Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56441 - in trunk: boost/unordered/detail libs/unordered/test/objects libs/unordered/test/unordered tools/boostbook/test/doxygen/boost
From: daniel_james_at_[hidden]
Date: 2009-09-27 15:12:05


Author: danieljames
Date: 2009-09-27 15:12:04 EDT (Sun, 27 Sep 2009)
New Revision: 56441
URL: http://svn.boost.org/trac/boost/changeset/56441

Log:
Try supporting reference parameters in pairs. Probably not required.
Added:
   trunk/libs/unordered/test/unordered/insert_range_tests.cpp (contents, props changed)
Text files modified:
   trunk/boost/unordered/detail/extract_key.hpp | 3 +--
   trunk/libs/unordered/test/objects/test.hpp | 4 ++++
   trunk/libs/unordered/test/unordered/Jamfile.v2 | 1 +
   trunk/tools/boostbook/test/doxygen/boost/example.hpp | 5 +++++
   4 files changed, 11 insertions(+), 2 deletions(-)

Modified: trunk/boost/unordered/detail/extract_key.hpp
==============================================================================
--- trunk/boost/unordered/detail/extract_key.hpp (original)
+++ trunk/boost/unordered/detail/extract_key.hpp 2009-09-27 15:12:04 EDT (Sun, 27 Sep 2009)
@@ -106,7 +106,7 @@
             {
                 return v.first;
             }
-/*
+
             template <class Second>
             static key_type const& extract(
                 std::pair<key_type&, Second> const& v)
@@ -120,7 +120,6 @@
             {
                 return v.first;
             }
-*/
 
 #if defined(BOOST_UNORDERED_STD_FORWARD)
             template <class Arg1, class... Args>

Modified: trunk/libs/unordered/test/objects/test.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/test.hpp (original)
+++ trunk/libs/unordered/test/objects/test.hpp 2009-09-27 15:12:04 EDT (Sun, 27 Sep 2009)
@@ -93,6 +93,10 @@
             return x1.type_ != x2.type_;
         }
     };
+
+ std::size_t hash_value(test::object const& x) {
+ return hash()(x);
+ }
 
     class less
     {

Modified: trunk/libs/unordered/test/unordered/Jamfile.v2
==============================================================================
--- trunk/libs/unordered/test/unordered/Jamfile.v2 (original)
+++ trunk/libs/unordered/test/unordered/Jamfile.v2 2009-09-27 15:12:04 EDT (Sun, 27 Sep 2009)
@@ -27,6 +27,7 @@
         [ run move_tests.cpp : : : <test-info>always_show_run_output ]
         [ run assign_tests.cpp ]
         [ run insert_tests.cpp ]
+ [ run insert_range_tests.cpp ]
         [ run insert_stable_tests.cpp ]
         [ run unnecessary_copy_tests.cpp ]
         [ run erase_tests.cpp ]

Added: trunk/libs/unordered/test/unordered/insert_range_tests.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/unordered/test/unordered/insert_range_tests.cpp 2009-09-27 15:12:04 EDT (Sun, 27 Sep 2009)
@@ -0,0 +1,40 @@
+
+// Copyright 2006-2009 Daniel James.
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/unordered_set.hpp>
+#include <boost/unordered_map.hpp>
+#include <vector>
+#include "../helpers/test.hpp"
+#include "../objects/test.hpp"
+
+UNORDERED_AUTO_TEST(needless_copies_1) {
+ std::vector<std::pair<test::object, int> > src;
+ src.push_back(std::pair<test::object, int>(test::object(1, 2), 0));
+
+ boost::unordered_map<test::object, double> dst;
+ dst[test::object(1, 2)] = 0;
+
+ test::object_count count = test::global_object_count;
+ dst.insert(src.begin(), src.end());
+ BOOST_TEST(count == test::global_object_count);
+}
+
+UNORDERED_AUTO_TEST(needless_copies_2) {
+ test::object x(1, 2);
+ std::pair<test::object&, int> src(x, 0);
+
+ boost::unordered_map<test::object, double> dst;
+
+ test::object_count count = test::global_object_count;
+ dst.emplace(src);
+ BOOST_TEST(test::global_object_count.instances == count.instances + 1);
+ BOOST_TEST_EQ(test::global_object_count.constructions, count.constructions + 1);
+
+ count = test::global_object_count;
+ dst.emplace(src);
+ BOOST_TEST_EQ(test::global_object_count, count);
+}
+
+RUN_TESTS()

Modified: trunk/tools/boostbook/test/doxygen/boost/example.hpp
==============================================================================
--- trunk/tools/boostbook/test/doxygen/boost/example.hpp (original)
+++ trunk/tools/boostbook/test/doxygen/boost/example.hpp 2009-09-27 15:12:04 EDT (Sun, 27 Sep 2009)
@@ -32,6 +32,11 @@
         mutable int mutable_integer;
         const int const_integer;
         static const int static_const_integer;
+
+ class inner_class {
+ public:
+ int x;
+ }
 
         enum class_enum { enumerator };
         


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