|
Boost Users : |
Subject: [Boost-users] [ptr_container] usage of auto_type
From: Olaf Peter (ope-devel_at_[hidden])
Date: 2014-07-08 16:32:08
Hello,
I have the following code fragment:
typedef boost::ptr_vector<T> vector_t;
typedef message_vector_t::auto_type auto_t;
....
vector_t v;
{
auto_t x(new T)
// do something with x
v.push_back(x.release()); // here rise my question
}
according
http://www.boost.org/doc/libs/1_53_0/libs/ptr_container/doc/examples.html #6
Do I have to release x all the time?
E.g. I want to use it in the loop, where at the end I have to push_back
the value, where for my understanding x goes out of scope and hence is
released automatically. After studying the header, there is no push_back
for auto_type (which is static_move_ptr), but for std::auto_ptr (which
is imo deprecated in C++11) and T (which converts it into an auto_type
again). Is it correct or do I miss something?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net