GCC-5 compatibility: remove the last remaining auto_ptrs

This commit is contained in:
Fischlurch 2017-05-01 21:43:10 +02:00
parent 9262af1346
commit 37cdfaba54
7 changed files with 18 additions and 32 deletions

View file

@ -86,13 +86,12 @@ namespace lib {
P (P const&& rr) : BASE(rr) {}
template<class Y> P (shared_ptr<Y> const& r) : BASE(r) {}
template<class Y> explicit P (weak_ptr<Y> const& wr) : BASE(wr) {}
template<class Y> explicit P (std::auto_ptr<Y> && ar) : BASE(std::move(ar)) {}
template<class Y> explicit P (std::unique_ptr<Y>&& u) : BASE(u.release()) {}
P& operator= (P const& r) { BASE::operator= (r); return *this; }
P& operator= (P const&& rr) { BASE::operator= (rr); return *this; }
template<class Y> P& operator=(shared_ptr<Y> const& sr) { BASE::operator= (sr); return *this; }
template<class Y> P& operator=(std::auto_ptr<Y> && ar) { BASE::operator= (std::move(ar)); return *this; }
TAR* get() const { return dynamic_cast<TAR*> (BASE::get()); }
TAR& operator*() const { return *get(); }

View file

@ -70,6 +70,7 @@ namespace lib {
* std::unique_ptr or even the behaviour of a plain
* old raw pointer, which is equivalent to \c true
* when the pointer isn'T \c NULL
* @deprecated obsoleted by C++11 rvalue references
*
*/
template<class TY, class PAR = std::allocator<TY>>

View file

@ -98,8 +98,8 @@ namespace lib {
{ }
template<class SU>
explicit ScopedPtrHolder (std::auto_ptr<SU> p) // never throws
: _Parent(p.release())
explicit ScopedPtrHolder (std::unique_ptr<SU> pu) // never throws
: _Parent(pu.release())
{ }
ScopedPtrHolder (ScopedPtrHolder const& ref)

View file

@ -38,7 +38,6 @@ namespace mobject {
namespace builder {
using util::isnil;
using std::auto_ptr;
using std::unique_ptr;
@ -46,7 +45,7 @@ namespace builder {
{
session::Fixture & fixedTimeline_;
auto_ptr<engine::RenderGraph> procSegment_;
unique_ptr<engine::RenderGraph> procSegment_;
unique_ptr<SegmentationTool> segmentation_;
unique_ptr<NodeCreatorTool> fabrication_;
@ -59,8 +58,8 @@ namespace builder {
};
ToolFactory::ToolFactory (session::Fixture& theTimeline)
: state_(new BuildProcessState (theTimeline))
ToolFactory::ToolFactory (session::Fixture& theFixture)
: state_(new BuildProcessState (theFixture))
{
ENSURE (state_->fixedTimeline_.isValid());
ENSURE (state_->procSegment_.get());
@ -89,13 +88,13 @@ namespace builder {
}
//////////////////////////////////////////TODO: a better idea than using auto_ptr?
auto_ptr<engine::RenderGraph>
engine::RenderGraph&
ToolFactory::getProduct ()
{
state_->segmentation_.reset(0);
state_->fabrication_.reset(0);
return state_->procSegment_;
UNIMPLEMENTED ("anything regarding the fixture and build process....");
return *state_->procSegment_;
}

View file

@ -73,9 +73,9 @@ namespace builder {
/** receive the finished product of the build process; effectively
* releases any other builder tool object
* //////////////////////////////////////////TODO a better idea than using auto_ptr?
* @todo unclear what to do and to return here
*/
std::auto_ptr<engine::RenderGraph> getProduct ();
engine::RenderGraph& getProduct ();
};

View file

@ -46,7 +46,7 @@ namespace proc {
using std::string;
using lumiera::Subsys;
using std::auto_ptr;
using std::unique_ptr;
using std::bind;
@ -263,7 +263,7 @@ namespace proc {
ProcessImpl*
DummyPlayerService::start (LumieraDisplaySlot viewerHandle)
{
auto_ptr<ProcessImpl> newProcess (new ProcessImpl (viewerHandle));
unique_ptr<ProcessImpl> newProcess (new ProcessImpl (viewerHandle));
REQUIRE (!newProcess->isActive());
newProcess->setRate(25);

View file

@ -170,27 +170,14 @@ namespace test{
void
check_ownership_transfer ()
{
std::auto_ptr<X> au (new X(23));
CHECK (au.get());
std::unique_ptr<X> up (new X(23));
CHECK (up.get());
P<X> pX (std::move(au));
CHECK (!au.get());
P<X> pX (std::move(up));
CHECK (!up.get());
CHECK (pX);
CHECK (1 == pX.use_count());
CHECK (23 == pX->x_);
au.reset (new X(21));
CHECK (au.get());
pX.reset();
CHECK (!pX);
CHECK (0 == pX.use_count());
pX = std::move(au);
CHECK (!au.get());
CHECK (pX);
CHECK (1 == pX.use_count());
CHECK (21 == pX->x_);
}