¡@

Home 

c++ Programming Glossary: unique_ptr

What is a smart pointer and when should I use one?

http://stackoverflow.com/questions/106508/what-is-a-smart-pointer-and-when-should-i-use-one

object such as implemented by boost scoped_ptr or std unique_ptr . void f boost scoped_ptr MyObject ptr new MyObject ptr DoSomethingUseful..

Why is it wrong to use std::auto_ptr<> with standard containers?

http://stackoverflow.com/questions/111478/why-is-it-wrong-to-use-stdauto-ptr-with-standard-containers

NULL. To overcome this limitation you should use the std unique_ptr std shared_ptr or std weak_ptr smart pointers or the boost equivalents..

How do you reverse a string in place in C or C++?

http://stackoverflow.com/questions/198199/how-do-you-reverse-a-string-in-place-in-c-or-c

smart pointers (boost) explained

http://stackoverflow.com/questions/569775/smart-pointers-boost-explained

with such a transfer of ownership smart pointer called unique_ptr . Categorizing smart pointers scoped_ptr is a smart pointer.. pointer uses an existing reference counting mechanism. unique_ptr is a transfer of ownership pointer. You cannot copy it but you.. it but you can move it by using C 1x's move constructors unique_ptr type p new type unique_ptr type q p not legal unique_ptr type..

What is “rvalue reference for *this”?

http://stackoverflow.com/questions/8610571/what-is-rvalue-reference-for-this

the following code as a further example struct test2 std unique_ptr int heavy_resource test2 heavy_resource new int 500 operator.. test2 heavy_resource new int 500 operator std unique_ptr int const lvalue object deep copy std unique_ptr int p new int.. std unique_ptr int const lvalue object deep copy std unique_ptr int p new int 500 for int i 0 i 500 i p i heavy_resource i return..

Which kind of pointer do I use when?

http://stackoverflow.com/questions/8706192/which-kind-of-pointer-do-i-use-when

copyable and for which you can not specify a deleter. std unique_ptr is boost scoped_ptr on steroids and should be your default choice.. scoped_array which the standard unified by requiring std unique_ptr T partial specialization that will delete the pointer instead.. instead of delete ing it with the default_delete r . std unique_ptr T also offers operator instead of operator and operator . Note..

Why does the use of 'new' cause memory leaks?

http://stackoverflow.com/questions/8839943/why-does-the-use-of-new-cause-memory-leaks

similar class exists in the standard library called std unique_ptr . There's also an old one pre C 11 named auto_ptr but it's now..

Eclipse CDT C++11/C++0x support

http://stackoverflow.com/questions/9131763/eclipse-cdt-c11-c0x-support

This is an example of a piece of C 11 code auto text std unique_ptr char new char len The Eclipse editor complains about Function.. new char len The Eclipse editor complains about Function 'unique_ptr' could not be resolved The Makefile compilation works fine...