summaryrefslogtreecommitdiff
path: root/libs/range
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2016-10-06 10:30:07 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2016-10-06 10:32:57 +0900
commit71d216b90256936a9638f325af9bc69d720e75de (patch)
tree9c5f682d341c7c88ad0c8e3d4b262e00b6fb691a /libs/range
parent733b5d5ae2c5d625211e2985ac25728ac3f54883 (diff)
downloadboost-71d216b90256936a9638f325af9bc69d720e75de.tar.gz
boost-71d216b90256936a9638f325af9bc69d720e75de.tar.bz2
boost-71d216b90256936a9638f325af9bc69d720e75de.zip
Imported Upstream version 1.59.0
Change-Id: I2dde00f4eca71df3eea9d251dcaecde18a6c90a5 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'libs/range')
-rw-r--r--libs/range/doc/html/index.html2
-rw-r--r--libs/range/doc/html/range/reference/adaptors/reference/filtered.html7
-rw-r--r--libs/range/doc/reference/adaptors/filtered.qbk4
-rw-r--r--libs/range/test/Jamfile.v25
-rw-r--r--libs/range/test/adaptor_test/filtered.cpp24
-rw-r--r--libs/range/test/compile_fail/adaptor/filtered_concept.cpp38
-rw-r--r--libs/range/test/compile_fail/adaptor/filtered_concept2.cpp38
-rw-r--r--libs/range/test/compile_fail/adaptor/filtered_concept3.cpp38
-rw-r--r--libs/range/test/compile_fail/adaptor/filtered_concept4.cpp38
-rw-r--r--libs/range/test/sub_range.cpp18
-rw-r--r--libs/range/test/ticket_10336.cpp43
11 files changed, 92 insertions, 163 deletions
diff --git a/libs/range/doc/html/index.html b/libs/range/doc/html/index.html
index 9f673a0812..644208384f 100644
--- a/libs/range/doc/html/index.html
+++ b/libs/range/doc/html/index.html
@@ -150,7 +150,7 @@
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: April 07, 2015 at 22:46:26 GMT</small></p></td>
+<td align="left"><p><small>Last revised: August 04, 2015 at 09:01:27 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
diff --git a/libs/range/doc/html/range/reference/adaptors/reference/filtered.html b/libs/range/doc/html/range/reference/adaptors/reference/filtered.html
index 5e76f8ee3a..613b6cfd03 100644
--- a/libs/range/doc/html/range/reference/adaptors/reference/filtered.html
+++ b/libs/range/doc/html/range/reference/adaptors/reference/filtered.html
@@ -80,8 +80,8 @@
to the argument type of <code class="computeroutput"><span class="identifier">pred</span></code>.
</li>
<li class="listitem">
- <span class="bold"><strong>Postcondition:</strong></span> For all adjacent
- elements <code class="computeroutput"><span class="special">[</span><span class="identifier">x</span><span class="special">]</span></code> in the returned range, <code class="computeroutput"><span class="identifier">pred</span><span class="special">(</span><span class="identifier">x</span><span class="special">)</span></code>
+ <span class="bold"><strong>Postcondition:</strong></span> For all elements
+ <code class="computeroutput"><span class="special">[</span><span class="identifier">x</span><span class="special">]</span></code> in the returned range, <code class="computeroutput"><span class="identifier">pred</span><span class="special">(</span><span class="identifier">x</span><span class="special">)</span></code>
is <code class="computeroutput"><span class="keyword">true</span></code>.
</li>
<li class="listitem">
@@ -89,8 +89,7 @@
of <code class="computeroutput"><span class="identifier">pred</span></code> might throw.
</li>
<li class="listitem">
- <span class="bold"><strong>Range Category:</strong></span> <a class="link" href="../../../concepts/forward_range.html" title="Forward Range">Forward
- Range</a>
+ <span class="bold"><strong>Range Category:</strong></span> __singlepass_range__
</li>
<li class="listitem">
<span class="bold"><strong>Range Return Type:</strong></span> <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">filtered_range</span><span class="special">&lt;</span><span class="keyword">decltype</span><span class="special">(</span><span class="identifier">rng</span><span class="special">)&gt;</span></code>
diff --git a/libs/range/doc/reference/adaptors/filtered.qbk b/libs/range/doc/reference/adaptors/filtered.qbk
index 0340ed1502..4ca3f9163e 100644
--- a/libs/range/doc/reference/adaptors/filtered.qbk
+++ b/libs/range/doc/reference/adaptors/filtered.qbk
@@ -12,9 +12,9 @@
]
* [*Precondition:] The `value_type` of the range is convertible to the argument type of `pred`.
-* [*Postcondition:] For all adjacent elements `[x]` in the returned range, `pred(x)` is `true`.
+* [*Postcondition:] For all elements `[x]` in the returned range, `pred(x)` is `true`.
* [*Throws:] Whatever the copy constructor of `pred` might throw.
-* [*Range Category:] __forward_range__
+* [*Range Category:] __singlepass_range__
* [*Range Return Type:] `boost::filtered_range<decltype(rng)>`
* [*Returned Range Category:] The minimum of the range category of `rng` and __bidirectional_range__
diff --git a/libs/range/test/Jamfile.v2 b/libs/range/test/Jamfile.v2
index dcc20c6d30..05937c7d48 100644
--- a/libs/range/test/Jamfile.v2
+++ b/libs/range/test/Jamfile.v2
@@ -40,10 +40,6 @@ test-suite range :
[ compile-fail compile_fail/adaptor/copied_concept2.cpp ]
[ compile-fail compile_fail/adaptor/copied_concept3.cpp ]
[ compile-fail compile_fail/adaptor/copied_concept4.cpp ]
- [ compile-fail compile_fail/adaptor/filtered_concept.cpp ]
- [ compile-fail compile_fail/adaptor/filtered_concept2.cpp ]
- [ compile-fail compile_fail/adaptor/filtered_concept3.cpp ]
- [ compile-fail compile_fail/adaptor/filtered_concept4.cpp ]
[ compile-fail compile_fail/adaptor/reversed_concept.cpp ]
[ compile-fail compile_fail/adaptor/reversed_concept2.cpp ]
[ compile-fail compile_fail/adaptor/reversed_concept3.cpp ]
@@ -219,6 +215,7 @@ test-suite range :
[ range-test ticket_5811_indirected_optional ]
[ range-test ticket_6715_iterator_range_equality ]
[ range-test ticket_6944 ]
+ [ range-test ticket_10336 ]
[ range-test value_type ]
;
diff --git a/libs/range/test/adaptor_test/filtered.cpp b/libs/range/test/adaptor_test/filtered.cpp
index 8e7b958b19..17a457fb97 100644
--- a/libs/range/test/adaptor_test/filtered.cpp
+++ b/libs/range/test/adaptor_test/filtered.cpp
@@ -21,6 +21,7 @@
#include <set>
#include <string>
#include <vector>
+#include <sstream>
namespace boost
{
@@ -113,12 +114,35 @@ namespace boost
filtered_test_impl< Container, is_even >();
}
+ void ticket_10988_single_pass()
+ {
+ std::vector<int> v;
+ std::string str("0 1 2 3 4 5");
+ std::istringstream in(str);
+
+ boost::push_back(v,
+ boost::make_iterator_range(
+ std::istream_iterator<int>(in),
+ std::istream_iterator<int>())
+ | boost::adaptors::filtered(is_even()));
+
+ std::vector<int> reference;
+ for (int i = 0; i < 6; i += 2)
+ {
+ reference.push_back(i);
+ }
+ BOOST_CHECK_EQUAL_COLLECTIONS(
+ reference.begin(), reference.end(),
+ v.begin(), v.end());
+ }
+
void filtered_test()
{
filtered_test_all_predicates< std::vector< int > >();
filtered_test_all_predicates< std::list< int > >();
filtered_test_all_predicates< std::set< int > >();
filtered_test_all_predicates< std::multiset< int > >();
+ ticket_10988_single_pass();
}
}
}
diff --git a/libs/range/test/compile_fail/adaptor/filtered_concept.cpp b/libs/range/test/compile_fail/adaptor/filtered_concept.cpp
deleted file mode 100644
index 4242d3c42d..0000000000
--- a/libs/range/test/compile_fail/adaptor/filtered_concept.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Boost.Range library
-//
-// Copyright Neil Groves 2014. Use, modification and distribution is subject
-// to 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)
-//
-// For more information, see http://www.boost.org/libs/range
-//
-
-#include "mock_range.hpp"
-#include <boost/range/adaptor/filtered.hpp>
-
-namespace
-{
-
-struct always_true
-{
- typedef bool result_type;
-
- bool operator()(int) const
- {
- return true;
- }
-};
-
-} // anonymous namespace
-
-int main(int, const char**)
-{
- using boost::range::unit_test::mock_range;
- using boost::adaptors::filtered;
-
- // This next line should fail when Boost.Range concept checking is
- // enabled since the filtered adaptor takes at least a ForwardRange.
- return (mock_range<boost::single_pass_traversal_tag>() |
- filtered(always_true())).front();
-}
diff --git a/libs/range/test/compile_fail/adaptor/filtered_concept2.cpp b/libs/range/test/compile_fail/adaptor/filtered_concept2.cpp
deleted file mode 100644
index d184eb0d78..0000000000
--- a/libs/range/test/compile_fail/adaptor/filtered_concept2.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Boost.Range library
-//
-// Copyright Neil Groves 2014. Use, modification and distribution is subject
-// to 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)
-//
-// For more information, see http://www.boost.org/libs/range
-//
-
-#include "mock_range.hpp"
-#include <boost/range/adaptor/filtered.hpp>
-
-namespace
-{
-
-struct always_true
-{
- typedef bool result_type;
-
- bool operator()(int) const
- {
- return true;
- }
-};
-
-} // anonymous namespace
-
-int main(int, const char**)
-{
- using boost::range::unit_test::mock_const_range;
- using boost::adaptors::filtered;
-
- // This next line should fail when Boost.Range concept checking is
- // enabled since the filtered adaptor takes at least a ForwardRange.
- return (mock_const_range<boost::single_pass_traversal_tag>() |
- filtered(always_true())).front();
-}
diff --git a/libs/range/test/compile_fail/adaptor/filtered_concept3.cpp b/libs/range/test/compile_fail/adaptor/filtered_concept3.cpp
deleted file mode 100644
index 6a30185faa..0000000000
--- a/libs/range/test/compile_fail/adaptor/filtered_concept3.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Boost.Range library
-//
-// Copyright Neil Groves 2014. Use, modification and distribution is subject
-// to 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)
-//
-// For more information, see http://www.boost.org/libs/range
-//
-
-#include "mock_range.hpp"
-#include <boost/range/adaptor/filtered.hpp>
-
-namespace
-{
-
-struct always_true
-{
- typedef bool result_type;
-
- bool operator()(int) const
- {
- return true;
- }
-};
-
-} // anonymous namespace
-
-int main(int, const char**)
-{
- using boost::range::unit_test::mock_range;
-
- // This next line should fail when Boost.Range concept checking is
- // enabled since the filtered adaptor takes at least a ForwardRange.
- return boost::adaptors::filter(
- mock_range<boost::single_pass_traversal_tag>(),
- always_true()).front();
-}
diff --git a/libs/range/test/compile_fail/adaptor/filtered_concept4.cpp b/libs/range/test/compile_fail/adaptor/filtered_concept4.cpp
deleted file mode 100644
index 8d21bbae13..0000000000
--- a/libs/range/test/compile_fail/adaptor/filtered_concept4.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Boost.Range library
-//
-// Copyright Neil Groves 2014. Use, modification and distribution is subject
-// to 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)
-//
-// For more information, see http://www.boost.org/libs/range
-//
-
-#include "mock_range.hpp"
-#include <boost/range/adaptor/filtered.hpp>
-
-namespace
-{
-
-struct always_true
-{
- typedef bool result_type;
-
- bool operator()(int) const
- {
- return true;
- }
-};
-
-} // anonymous namespace
-
-int main(int, const char**)
-{
- using boost::range::unit_test::mock_const_range;
-
- // This next line should fail when Boost.Range concept checking is
- // enabled since the filtered adaptor takes at least a ForwardRange.
- return boost::adaptors::filter(
- mock_const_range<boost::single_pass_traversal_tag>(),
- always_true()).front();
-}
diff --git a/libs/range/test/sub_range.cpp b/libs/range/test/sub_range.cpp
index be488115d3..a6dbb36b7f 100644
--- a/libs/range/test/sub_range.cpp
+++ b/libs/range/test/sub_range.cpp
@@ -244,6 +244,22 @@ inline void test_advance()
BOOST_CHECK_EQUAL(r3.advance_end(-1).size(), 1u);
}
+void ticket_10514()
+{
+ typedef std::vector<int> vec_t;
+ typedef boost::sub_range<vec_t> range_t;
+ vec_t v(10);
+ range_t r(v.begin(), v.end());
+ const range_t& cr = r;
+ range_t copy_r = cr;
+
+ BOOST_CHECK(r.begin() == copy_r.begin());
+ BOOST_CHECK(r.end() == copy_r.end());
+
+ BOOST_CHECK(cr.begin() == copy_r.begin());
+ BOOST_CHECK(cr.end() == copy_r.end());
+}
+
} // anonymous namespace
} // namespace boost_range_test
@@ -262,6 +278,8 @@ boost::unit_test::test_suite* init_unit_test_suite(int, char*[])
test->add(BOOST_TEST_CASE(&boost_range_test::test_advance));
+ test->add(BOOST_TEST_CASE(&boost_range_test::ticket_10514));
+
return test;
}
diff --git a/libs/range/test/ticket_10336.cpp b/libs/range/test/ticket_10336.cpp
new file mode 100644
index 0000000000..541e037a6c
--- /dev/null
+++ b/libs/range/test/ticket_10336.cpp
@@ -0,0 +1,43 @@
+// Boost.Range library
+//
+// Copyright Neil Groves 2011. Use, modification and
+// distribution is subject to 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)
+//
+//
+// For more information, see http://www.boost.org/libs/range/
+//
+#include <boost/range/iterator_range.hpp>
+#include <boost/unordered_map.hpp>
+
+#include <boost/test/test_tools.hpp>
+#include <boost/test/unit_test.hpp>
+
+namespace boost
+{
+ namespace
+ {
+ // Ticket 10336 - compilation error in iterator_range and unordered_map
+ void test_ticket_10336()
+ {
+ typedef boost::unordered_map<int,int> container_t;
+ typedef container_t::const_iterator citer_t;
+ typedef boost::iterator_range<citer_t> rng_t;
+
+ const container_t c;
+ rng_t rng(c.begin(), c.end());
+ }
+ }
+}
+
+boost::unit_test::test_suite*
+init_unit_test_suite(int argc, char* argv[])
+{
+ boost::unit_test::test_suite* test
+ = BOOST_TEST_SUITE( "RangeTestSuite.ticket_10336" );
+
+ test->add( BOOST_TEST_CASE( &boost::test_ticket_10336 ) );
+
+ return test;
+}