Hello, My name is Cosmin Petrisor and I'm currently enrolled in the 3rd year of study (junior year) of the Computer Science program, at University Politehnica of Bucharest.I posted on boost g+ community, but no one replied. I am currently implementing the copy and move constructors. I managed to figure out how rehash is working and the copy constructor is almost done. On the other hand, is ok to use the copy constructor in the implementation of the move constructor? Something like: concurrent_unordered_map(concurrent_unordered_map &&old) BOOST_NOEXCEPT :concurrent_unordered_map((const concurrent_unordered_map &)old){ old.clear(); } or would be better to implement the copy and move assignment operators and define the copy and move constructors like: concurrent_unordered_map(const concurrent_unordered_map &old){ *this = old; } concurrent_unordered_map(concurrent_unordered_map &&old) BOOST_NOEXCEPT : { *this = std::move(old); } Best regards,Cosmin - Ioan Petrisor
On 16 Mar 2015 at 16:32, Petrisor Cosmin-ioan wrote:
I am currently implementing the copy and move constructors. I managed to figure out how rehash is working and the copy constructor is almost done. On the other hand, is ok to use the copy constructor in the implementation of the move constructor? Something like:
Search the archives of this list for lots and lots more hints regarding this test. Remember that correctness is more important than efficiency, and *proof* of correctness via high quality unit testing is the gold standard. You cannot use the copy constructor in a move constructor as that would violate noexcept on the move constructor. That would be a big violation of correctness, and a hidden cause of fatal process exit. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
participants (2)
-
Niall Douglas
-
Petrisor Cosmin-ioan