|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61611 - in trunk: boost/property_tree/detail libs/property_tree/test
From: sebastian.redl_at_[hidden]
Date: 2010-04-27 06:05:04
Author: cornedbee
Date: 2010-04-27 06:05:03 EDT (Tue, 27 Apr 2010)
New Revision: 61611
URL: http://svn.boost.org/trac/boost/changeset/61611
Log:
Explicitly convert some iterators. Fixes bug 4140.
Text files modified:
trunk/boost/property_tree/detail/ptree_implementation.hpp | 6 +++---
trunk/libs/property_tree/test/test_property_tree.cpp | 6 ++++++
trunk/libs/property_tree/test/test_property_tree.hpp | 15 +++++++++++++++
3 files changed, 24 insertions(+), 3 deletions(-)
Modified: trunk/boost/property_tree/detail/ptree_implementation.hpp
==============================================================================
--- trunk/boost/property_tree/detail/ptree_implementation.hpp (original)
+++ trunk/boost/property_tree/detail/ptree_implementation.hpp 2010-04-27 06:05:03 EDT (Tue, 27 Apr 2010)
@@ -467,8 +467,8 @@
std::pair<typename subs::by_name_index::iterator,
typename subs::by_name_index::iterator> r(
subs::assoc(this).equal_range(key));
- return std::pair<assoc_iterator, assoc_iterator>(r.first,
- r.second);
+ return std::pair<assoc_iterator, assoc_iterator>(
+ assoc_iterator(r.first), assoc_iterator(r.second));
}
template<class K, class D, class C> inline
@@ -481,7 +481,7 @@
typename subs::by_name_index::const_iterator> r(
subs::assoc(this).equal_range(key));
return std::pair<const_assoc_iterator, const_assoc_iterator>(
- r.first, r.second);
+ const_assoc_iterator(r.first), const_assoc_iterator(r.second));
}
template<class K, class D, class C> inline
Modified: trunk/libs/property_tree/test/test_property_tree.cpp
==============================================================================
--- trunk/libs/property_tree/test/test_property_tree.cpp (original)
+++ trunk/libs/property_tree/test/test_property_tree.cpp 2010-04-27 06:05:03 EDT (Tue, 27 Apr 2010)
@@ -9,8 +9,10 @@
// ----------------------------------------------------------------------------
#include "test_utils.hpp"
#include <boost/any.hpp>
+#include <boost/range.hpp>
#include <list>
#include <cmath>
+#include <iostream>
// If using VC, disable some warnings that trip in boost::serialization bowels
#ifdef BOOST_MSVC
@@ -152,6 +154,7 @@
test_front_back(pt);
test_get_put(pt);
test_get_child_put_child(pt);
+ test_equal_range(pt);
test_path_separator(pt);
test_path(pt);
test_precision(pt);
@@ -184,6 +187,7 @@
test_front_back(pt);
test_get_put(pt);
test_get_child_put_child(pt);
+ test_equal_range(pt);
test_path_separator(pt);
test_path(pt);
test_precision(pt);
@@ -216,6 +220,7 @@
test_front_back(pt);
test_get_put(pt);
test_get_child_put_child(pt);
+ test_equal_range(pt);
test_path_separator(pt);
test_path(pt);
test_precision(pt);
@@ -248,6 +253,7 @@
test_front_back(pt);
test_get_put(pt);
test_get_child_put_child(pt);
+ test_equal_range(pt);
test_path_separator(pt);
test_path(pt);
test_precision(pt);
Modified: trunk/libs/property_tree/test/test_property_tree.hpp
==============================================================================
--- trunk/libs/property_tree/test/test_property_tree.hpp (original)
+++ trunk/libs/property_tree/test/test_property_tree.hpp 2010-04-27 06:05:03 EDT (Tue, 27 Apr 2010)
@@ -914,6 +914,21 @@
}
+void test_equal_range(PTREE *)
+{
+ PTREE pt;
+ pt.add_child(T("k1"), PTREE());
+ pt.add_child(T("k2"), PTREE());
+ pt.add_child(T("k1"), PTREE());
+ pt.add_child(T("k3"), PTREE());
+ pt.add_child(T("k1"), PTREE());
+ pt.add_child(T("k2"), PTREE());
+
+ BOOST_CHECK(boost::distance(pt.equal_range(T("k1"))) == 3);
+ BOOST_CHECK(boost::distance(pt.equal_range(T("k2"))) == 2);
+ BOOST_CHECK(boost::distance(pt.equal_range(T("k3"))) == 1);
+}
+
void test_path_separator(PTREE *)
{
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