unique-ptr
Returning unique_ptr from functions
unique_ptr<T> does not allow copy construction, instead it supports move semantics. Yet, I can return a unique_ptr<T> from a function and assign the returned value to a variable.[详细]
2023-01-27 10:24 分类:问答Returning a unique_ptr from a class method C++0x
If my class SomeType has a method that returns a element from the map (using the key) say std::unique_ptr<OtherType> get_othertype(std::string name)[详细]
2023-01-17 02:19 分类:问答Why can I not push_back a unique_ptr into a vector?
What is wrong with this program? #include <memory> #include <vector> int main() { std::vector<std::unique_ptr<int>> vec;[详细]
2023-01-08 11:18 分类:问答Socket pointer transfer of ownership with tcp::acceptor::async_accept
I\'ve recently started using Boost.Asio in a project and would li开发者_如何学Cke to know whether anyone knows a clean solution to transfer ownership of a newly created socket to tcp::acceptor::async_[详细]
2023-01-04 10:03 分类:问答unique_ptr boost equivalent?
Is there some equivalent class for C++1x\'s std::unique_ptr in the boost libraries? The behavior I\'m looking for is being able to have an exception-safe factory function, like so...[详细]
2023-01-01 15:49 分类:问答So can unique_ptr be used safely in stl collections?
I am confused with unique_ptr and rvalue move philosophy. Let\'s say we have two collections: std::vector<std::auto_ptr<int>> autoCollection;[详细]
2023-01-01 00:17 分类:问答How can I get this code involving unique_ptr to compile?
#include <vector> #include <memory> using namespace std; class A { public: A(): i(new int) {} A(A const& a) = delete;[详细]
2022-12-28 05:37 分类:问答Is auto_ptr deprecated?
Will auto_ptr be deprecated in incoming C++ standard? Should unique_ptr be used for ownership transfer instead of shared_ptr?[详细]
2022-12-22 02:34 分类:问答Can't create map of MoveConstructibles
I have a class containing a std::unique_ptr<> and I want to put instances of this class inside of an std::map<>. I thought one of the things that motivated the introduction of move semanti[详细]
2022-12-20 07:44 分类:问答