|
Boost-Commit : |
From: daniel_james_at_[hidden]
Date: 2008-05-11 09:12:27
Author: danieljames
Date: 2008-05-11 09:12:27 EDT (Sun, 11 May 2008)
New Revision: 45278
URL: http://svn.boost.org/trac/boost/changeset/45278
Log:
Add a quick explanation for an odd looking constructor.
Text files modified:
branches/unordered/trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
Modified: branches/unordered/trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp (original)
+++ branches/unordered/trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp 2008-05-11 09:12:27 EDT (Sun, 11 May 2008)
@@ -15,7 +15,19 @@
static int moves;
count_copies() : tag_(0) { ++copies; }
explicit count_copies(int tag) : tag_(tag) { ++copies; }
- count_copies(count_copies const&, count_copies const& x) : tag_(x.tag_) { ++copies; }
+
+ // This bizarre constructor is an attempt to confuse emplace.
+ //
+ // unordered_map<count_copies, count_copies> x:
+ // x.emplace(count_copies(1), count_copies(2));
+ // x.emplace(count_copies(1), count_copies(2), count_copies(3));
+ //
+ // The first emplace should use the single argument constructor twice.
+ // The second emplace should use the single argument contructor for
+ // the key, and this constructor for the value.
+ count_copies(count_copies const&, count_copies const& x)
+ : tag_(x.tag_) { ++copies; }
+
count_copies(count_copies const& x) : tag_(x.tag_) { ++copies; }
#if defined(BOOST_HAS_RVALUE_REFS)
count_copies(count_copies&& x) : tag_(x.tag_) {
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk