This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch]New feature to all kind of stl container.vector::data_move()returns vector::data() that can be moved,just as unique_ptr::release() to unique_ptr::get()


On 8 January 2015 at 13:54, éååå wrote:
> You are right.I'm not sure of the interface.I can now only be sure of the need.
> RAII is important too.
> My opinion's good part is:make it possible for resouce moving from vector to SomeHoldingArrayDataClass,not only now just vector to another vector.I suggest data_move() only because if data_move() is at hand,stl users can easily make that possible.
> Your example can't handle resouce moving:
>> extern "C" void some_function(const int*, size_t);
>> std::vector<int> get_values(size_t n);
>> ...
>> some_function(get_values(5).data(), 5);
> what if some_function save get_values(5).data() to somewhere out of the scope?

I'm not sure what your point is, but some_function doesn't do that.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]