copy-and-swap
Is it OK to have a throwing swap member-implementation?
The general guideline when writing classes (using the copy-and-swap idiom) is to provide a non throwing swap member function. (Effective C++, 3rd edition, Item 25 and other resources)[详细]
2023-04-11 02:36 分类:问答How do I swap an MFC CString?
OK, so I\'m all sold on the copy-and-swap idiom and I think I mostly know how to implement it. However, or codebase uses MFC\'s CString class as string and this ain\'t gonna change.[详细]
2023-04-11 02:23 分类:问答Does it make sense to use the move-and-swap idiom on a movable and non-copyable class
If I have a class such as class Foo{ public: Foo(){...} Foo(Foo && rhs){...} operator=(Foo rhs){ swap(*this, rhs);}[详细]
2023-03-22 17:06 分类:问答Why do some people use swap for move assignments?
For example, stdlibc++ has the following: unique_lock& operator=(unique_lock&& __u) { if(_M_owns)[详细]
2023-03-20 08:20 分类:问答Safe assignment and copy-and-swap idiom [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question开发者_如何转开发? Update the question so it focuses on one problem only[详细]
2023-03-03 13:07 分类:问答public friend swap member function
In the beautiful answer to the copy-and-swap-idiom there is a piece of code I need a bit of help: class dumb_array[详细]
2023-02-27 03:06 分类:问答What is the copy-and-swap idiom?
What is the copy-and-swap idiom and when should it be used? What problems does it solve? Does it change for C++11?[详细]
2023-01-07 16:31 分类:问答