From c33857273550251284f20623b51b6ae0a119fe81 Mon Sep 17 00:00:00 2001 From: morinmorin Date: Sat, 16 Sep 2017 11:51:12 +0900 Subject: [PATCH 1/9] Fix usage of decltype-based result_of in transform_iterator. Regardless of value categories of a transform_iterator object, its dereference operator calls m_f as an lvalue. Thus, correct usage of decltype-based result_of is result_of. --- include/boost/iterator/transform_iterator.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/boost/iterator/transform_iterator.hpp b/include/boost/iterator/transform_iterator.hpp index 67356ff..2281df8 100644 --- a/include/boost/iterator/transform_iterator.hpp +++ b/include/boost/iterator/transform_iterator.hpp @@ -47,7 +47,11 @@ namespace iterators { // the function. typedef typename ia_dflt_help< Reference +#ifdef BOOST_RESULT_OF_USE_TR1 , result_of::reference)> +#else + , result_of::reference)> +#endif >::type reference; // To get the default for Value: remove any reference on the From 685b3fe85554f5ec5e3fbc8f7ad915110d1f3ac6 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 18 Sep 2017 00:30:45 +0300 Subject: [PATCH 2/9] Re-added executable permissions for scripts. The executable bit was removed previously because the files have no extension and were not considered as scripts by the search command. --- doc/rst2html | 0 doc/rst2latex | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 doc/rst2html mode change 100644 => 100755 doc/rst2latex diff --git a/doc/rst2html b/doc/rst2html old mode 100644 new mode 100755 diff --git a/doc/rst2latex b/doc/rst2latex old mode 100644 new mode 100755 From 8577675c854ae2915eabff075aad8c170d7abe45 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 18 Sep 2017 01:09:42 +0300 Subject: [PATCH 3/9] Renamed scripts to have a meaningful extension. --- doc/{rst2html => rst2html.sh} | 0 doc/{rst2latex => rst2latex.sh} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename doc/{rst2html => rst2html.sh} (100%) rename doc/{rst2latex => rst2latex.sh} (100%) diff --git a/doc/rst2html b/doc/rst2html.sh similarity index 100% rename from doc/rst2html rename to doc/rst2html.sh diff --git a/doc/rst2latex b/doc/rst2latex.sh similarity index 100% rename from doc/rst2latex rename to doc/rst2latex.sh From 2af60e066d321a12f0d0cbfe910ba3ec6b95bf0f Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 18 Sep 2017 01:39:00 +0300 Subject: [PATCH 4/9] Move function_output_iterator.hpp into the iterator directory. --- include/boost/{ => iterator}/function_output_iterator.hpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename include/boost/{ => iterator}/function_output_iterator.hpp (100%) diff --git a/include/boost/function_output_iterator.hpp b/include/boost/iterator/function_output_iterator.hpp similarity index 100% rename from include/boost/function_output_iterator.hpp rename to include/boost/iterator/function_output_iterator.hpp From a85dfaa7f2888e24769682c097341c73b56a8693 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 18 Sep 2017 01:43:24 +0300 Subject: [PATCH 5/9] Added a forwarding header for function_output_iterator.hpp --- include/boost/function_output_iterator.hpp | 13 +++++++++++++ include/boost/iterator/function_output_iterator.hpp | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 include/boost/function_output_iterator.hpp diff --git a/include/boost/function_output_iterator.hpp b/include/boost/function_output_iterator.hpp new file mode 100644 index 0000000..091e4ea --- /dev/null +++ b/include/boost/function_output_iterator.hpp @@ -0,0 +1,13 @@ +// (C) Copyright Andrey Semashev 2017. +// 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) + +// This is a deprecated header left for backward compatibility + +#ifndef BOOST_FUNCTION_OUTPUT_ITERATOR_HPP +#define BOOST_FUNCTION_OUTPUT_ITERATOR_HPP + +#include + +#endif // BOOST_FUNCTION_OUTPUT_ITERATOR_HPP diff --git a/include/boost/iterator/function_output_iterator.hpp b/include/boost/iterator/function_output_iterator.hpp index dd8c44d..51fe835 100644 --- a/include/boost/iterator/function_output_iterator.hpp +++ b/include/boost/iterator/function_output_iterator.hpp @@ -8,8 +8,8 @@ // 27 Feb 2001 Jeremy Siek // Initial checkin. -#ifndef BOOST_FUNCTION_OUTPUT_ITERATOR_HPP -#define BOOST_FUNCTION_OUTPUT_ITERATOR_HPP +#ifndef BOOST_ITERATOR_FUNCTION_OUTPUT_ITERATOR_HPP +#define BOOST_ITERATOR_FUNCTION_OUTPUT_ITERATOR_HPP #include @@ -59,4 +59,4 @@ using iterators::make_function_output_iterator; } // namespace boost -#endif // BOOST_FUNCTION_OUTPUT_ITERATOR_HPP +#endif // BOOST_ITERATOR_FUNCTION_OUTPUT_ITERATOR_HPP From 38ef55220943ce30e66b4f150f3cff99f6d8b63c Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 18 Sep 2017 01:50:55 +0300 Subject: [PATCH 6/9] Add the new path to the header to the comment. --- include/boost/function_output_iterator.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/boost/function_output_iterator.hpp b/include/boost/function_output_iterator.hpp index 091e4ea..15dbcb9 100644 --- a/include/boost/function_output_iterator.hpp +++ b/include/boost/function_output_iterator.hpp @@ -3,11 +3,12 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// This is a deprecated header left for backward compatibility - #ifndef BOOST_FUNCTION_OUTPUT_ITERATOR_HPP #define BOOST_FUNCTION_OUTPUT_ITERATOR_HPP +// This is a deprecated header left for backward compatibility. +// Use boost/iterator/function_output_iterator.hpp instead. + #include #endif // BOOST_FUNCTION_OUTPUT_ITERATOR_HPP From 0a08203107bf9a7fdd0d353ff818d6b2971bd17b Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 30 Sep 2017 15:56:53 +0300 Subject: [PATCH 7/9] Replaced type_traits.hpp with more fine grained includes. This should work around compilation failures on gcc 4.6, which apparently cannot handle all headers in Boost.TypeTraits. --- include/boost/iterator/new_iterator_tests.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/boost/iterator/new_iterator_tests.hpp b/include/boost/iterator/new_iterator_tests.hpp index cb9b107..9ebd5e7 100644 --- a/include/boost/iterator/new_iterator_tests.hpp +++ b/include/boost/iterator/new_iterator_tests.hpp @@ -29,12 +29,14 @@ // (David Abrahams) # include -# include # include # include // for detail::dummy_constructor # include # include # include +# include +# include +# include # include # include From a36ed0f35dcfc055acfbc4d1598ab1ed7e9dd55f Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 2 Oct 2017 01:18:17 +0300 Subject: [PATCH 8/9] Replaced type_traits.hpp with more fine-grained includes. Replaced assert with BOOST_ASSERT. --- include/boost/pending/iterator_tests.hpp | 108 ++++++++++++----------- 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/include/boost/pending/iterator_tests.hpp b/include/boost/pending/iterator_tests.hpp index 1640310..ae59309 100644 --- a/include/boost/pending/iterator_tests.hpp +++ b/include/boost/pending/iterator_tests.hpp @@ -20,12 +20,14 @@ // (David Abrahams) # include -# include -# include +# include # include # include // for detail::dummy_constructor # include # include +# include +# include +# include namespace boost { @@ -51,28 +53,28 @@ template void trivial_iterator_test(const Iterator i, const Iterator j, T val) { Iterator k; - assert(i == i); - assert(j == j); - assert(i != j); + BOOST_ASSERT(i == i); + BOOST_ASSERT(j == j); + BOOST_ASSERT(i != j); #ifdef BOOST_NO_STD_ITERATOR_TRAITS T v = *i; #else typename std::iterator_traits::value_type v = *i; #endif - assert(v == val); + BOOST_ASSERT(v == val); boost::ignore_unused(v); #if 0 // hmm, this will give a warning for transform_iterator... perhaps // this should be separated out into a stand-alone test since there // are several situations where it can't be used, like for // integer_range::iterator. - assert(v == i->foo()); + BOOST_ASSERT(v == i->foo()); #endif k = i; - assert(k == k); - assert(k == i); - assert(k != j); - assert(*k == val); + BOOST_ASSERT(k == k); + BOOST_ASSERT(k == i); + BOOST_ASSERT(k != j); + BOOST_ASSERT(*k == val); boost::ignore_unused(k); } @@ -92,8 +94,8 @@ void input_iterator_test(Iterator i, T v1, T v2) { Iterator i1(i); - assert(i == i1); - assert(!(i != i1)); + BOOST_ASSERT(i == i1); + BOOST_ASSERT(!(i != i1)); // I can see no generic way to create an input iterator // that is in the domain of== of i and != i. @@ -102,24 +104,24 @@ void input_iterator_test(Iterator i, T v1, T v2) // // Iterator i2; // - // assert(i != i2); - // assert(!(i == i2)); + // BOOST_ASSERT(i != i2); + // BOOST_ASSERT(!(i == i2)); - assert(*i1 == v1); - assert(*i == v1); + BOOST_ASSERT(*i1 == v1); + BOOST_ASSERT(*i == v1); // we cannot test for equivalence of (void)++i & (void)i++ // as i is only guaranteed to be single pass. - assert(*i++ == v1); + BOOST_ASSERT(*i++ == v1); boost::ignore_unused(i1); i1 = i; - assert(i == i1); - assert(!(i != i1)); + BOOST_ASSERT(i == i1); + BOOST_ASSERT(!(i != i1)); - assert(*i1 == v2); - assert(*i == v2); + BOOST_ASSERT(*i1 == v2); + BOOST_ASSERT(*i == v2); boost::ignore_unused(i1); // i is dereferencable, so it must be incrementable. @@ -162,15 +164,15 @@ void forward_iterator_test(Iterator i, T v1, T v2) Iterator i1 = i, i2 = i; - assert(i == i1++); - assert(i != ++i2); + BOOST_ASSERT(i == i1++); + BOOST_ASSERT(i != ++i2); trivial_iterator_test(i, i1, v1); trivial_iterator_test(i, i2, v1); ++i; - assert(i == i1); - assert(i == i2); + BOOST_ASSERT(i == i1); + BOOST_ASSERT(i == i2); ++i1; ++i2; @@ -192,15 +194,15 @@ void bidirectional_iterator_test(Iterator i, T v1, T v2) Iterator i1 = i, i2 = i; - assert(i == i1--); - assert(i != --i2); + BOOST_ASSERT(i == i1--); + BOOST_ASSERT(i != --i2); trivial_iterator_test(i, i1, v2); trivial_iterator_test(i, i2, v2); --i; - assert(i == i1); - assert(i == i2); + BOOST_ASSERT(i == i1); + BOOST_ASSERT(i == i2); ++i1; ++i2; @@ -224,30 +226,30 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals) boost::ignore_unused(); for (c = 0; c < N-1; ++c) { - assert(i == j + c); - assert(*i == vals[c]); - assert(*i == boost::implicit_cast(j[c])); - assert(*i == *(j + c)); - assert(*i == *(c + j)); + BOOST_ASSERT(i == j + c); + BOOST_ASSERT(*i == vals[c]); + BOOST_ASSERT(*i == boost::implicit_cast(j[c])); + BOOST_ASSERT(*i == *(j + c)); + BOOST_ASSERT(*i == *(c + j)); ++i; - assert(i > j); - assert(i >= j); - assert(j <= i); - assert(j < i); + BOOST_ASSERT(i > j); + BOOST_ASSERT(i >= j); + BOOST_ASSERT(j <= i); + BOOST_ASSERT(j < i); } Iterator k = j + N - 1; for (c = 0; c < N-1; ++c) { - assert(i == k - c); - assert(*i == vals[N - 1 - c]); - assert(*i == boost::implicit_cast(j[N - 1 - c])); + BOOST_ASSERT(i == k - c); + BOOST_ASSERT(*i == vals[N - 1 - c]); + BOOST_ASSERT(*i == boost::implicit_cast(j[N - 1 - c])); Iterator q = k - c; boost::ignore_unused(q); - assert(*i == *q); - assert(i > j); - assert(i >= j); - assert(j <= i); - assert(j < i); + BOOST_ASSERT(*i == *q); + BOOST_ASSERT(i > j); + BOOST_ASSERT(i >= j); + BOOST_ASSERT(j <= i); + BOOST_ASSERT(j < i); --i; } } @@ -256,16 +258,16 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals) template void const_nonconst_iterator_test(Iterator i, ConstIterator j) { - assert(i != j); - assert(j != i); + BOOST_ASSERT(i != j); + BOOST_ASSERT(j != i); ConstIterator k(i); - assert(k == i); - assert(i == k); + BOOST_ASSERT(k == i); + BOOST_ASSERT(i == k); k = i; - assert(k == i); - assert(i == k); + BOOST_ASSERT(k == i); + BOOST_ASSERT(i == k); boost::ignore_unused(k); } From 8b5e92a0c4417bb0dfdaa1594e47fcded64f988c Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 2 Oct 2017 01:26:39 +0300 Subject: [PATCH 9/9] Converted asserts in tests to tests using lightweight_test.hpp. --- include/boost/iterator/new_iterator_tests.hpp | 2 +- include/boost/pending/iterator_tests.hpp | 104 +++++++++--------- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/include/boost/iterator/new_iterator_tests.hpp b/include/boost/iterator/new_iterator_tests.hpp index 9ebd5e7..a1d3b2f 100644 --- a/include/boost/iterator/new_iterator_tests.hpp +++ b/include/boost/iterator/new_iterator_tests.hpp @@ -40,7 +40,7 @@ # include # include -# include +# include namespace boost { diff --git a/include/boost/pending/iterator_tests.hpp b/include/boost/pending/iterator_tests.hpp index ae59309..b4d2efa 100644 --- a/include/boost/pending/iterator_tests.hpp +++ b/include/boost/pending/iterator_tests.hpp @@ -20,11 +20,11 @@ // (David Abrahams) # include -# include # include # include // for detail::dummy_constructor # include # include +# include # include # include # include @@ -53,28 +53,28 @@ template void trivial_iterator_test(const Iterator i, const Iterator j, T val) { Iterator k; - BOOST_ASSERT(i == i); - BOOST_ASSERT(j == j); - BOOST_ASSERT(i != j); + BOOST_TEST(i == i); + BOOST_TEST(j == j); + BOOST_TEST(i != j); #ifdef BOOST_NO_STD_ITERATOR_TRAITS T v = *i; #else typename std::iterator_traits::value_type v = *i; #endif - BOOST_ASSERT(v == val); + BOOST_TEST(v == val); boost::ignore_unused(v); #if 0 // hmm, this will give a warning for transform_iterator... perhaps // this should be separated out into a stand-alone test since there // are several situations where it can't be used, like for // integer_range::iterator. - BOOST_ASSERT(v == i->foo()); + BOOST_TEST(v == i->foo()); #endif k = i; - BOOST_ASSERT(k == k); - BOOST_ASSERT(k == i); - BOOST_ASSERT(k != j); - BOOST_ASSERT(*k == val); + BOOST_TEST(k == k); + BOOST_TEST(k == i); + BOOST_TEST(k != j); + BOOST_TEST(*k == val); boost::ignore_unused(k); } @@ -94,8 +94,8 @@ void input_iterator_test(Iterator i, T v1, T v2) { Iterator i1(i); - BOOST_ASSERT(i == i1); - BOOST_ASSERT(!(i != i1)); + BOOST_TEST(i == i1); + BOOST_TEST(!(i != i1)); // I can see no generic way to create an input iterator // that is in the domain of== of i and != i. @@ -104,24 +104,24 @@ void input_iterator_test(Iterator i, T v1, T v2) // // Iterator i2; // - // BOOST_ASSERT(i != i2); - // BOOST_ASSERT(!(i == i2)); + // BOOST_TEST(i != i2); + // BOOST_TEST(!(i == i2)); - BOOST_ASSERT(*i1 == v1); - BOOST_ASSERT(*i == v1); + BOOST_TEST(*i1 == v1); + BOOST_TEST(*i == v1); // we cannot test for equivalence of (void)++i & (void)i++ // as i is only guaranteed to be single pass. - BOOST_ASSERT(*i++ == v1); + BOOST_TEST(*i++ == v1); boost::ignore_unused(i1); i1 = i; - BOOST_ASSERT(i == i1); - BOOST_ASSERT(!(i != i1)); + BOOST_TEST(i == i1); + BOOST_TEST(!(i != i1)); - BOOST_ASSERT(*i1 == v2); - BOOST_ASSERT(*i == v2); + BOOST_TEST(*i1 == v2); + BOOST_TEST(*i == v2); boost::ignore_unused(i1); // i is dereferencable, so it must be incrementable. @@ -164,15 +164,15 @@ void forward_iterator_test(Iterator i, T v1, T v2) Iterator i1 = i, i2 = i; - BOOST_ASSERT(i == i1++); - BOOST_ASSERT(i != ++i2); + BOOST_TEST(i == i1++); + BOOST_TEST(i != ++i2); trivial_iterator_test(i, i1, v1); trivial_iterator_test(i, i2, v1); ++i; - BOOST_ASSERT(i == i1); - BOOST_ASSERT(i == i2); + BOOST_TEST(i == i1); + BOOST_TEST(i == i2); ++i1; ++i2; @@ -194,15 +194,15 @@ void bidirectional_iterator_test(Iterator i, T v1, T v2) Iterator i1 = i, i2 = i; - BOOST_ASSERT(i == i1--); - BOOST_ASSERT(i != --i2); + BOOST_TEST(i == i1--); + BOOST_TEST(i != --i2); trivial_iterator_test(i, i1, v2); trivial_iterator_test(i, i2, v2); --i; - BOOST_ASSERT(i == i1); - BOOST_ASSERT(i == i2); + BOOST_TEST(i == i1); + BOOST_TEST(i == i2); ++i1; ++i2; @@ -226,30 +226,30 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals) boost::ignore_unused(); for (c = 0; c < N-1; ++c) { - BOOST_ASSERT(i == j + c); - BOOST_ASSERT(*i == vals[c]); - BOOST_ASSERT(*i == boost::implicit_cast(j[c])); - BOOST_ASSERT(*i == *(j + c)); - BOOST_ASSERT(*i == *(c + j)); + BOOST_TEST(i == j + c); + BOOST_TEST(*i == vals[c]); + BOOST_TEST(*i == boost::implicit_cast(j[c])); + BOOST_TEST(*i == *(j + c)); + BOOST_TEST(*i == *(c + j)); ++i; - BOOST_ASSERT(i > j); - BOOST_ASSERT(i >= j); - BOOST_ASSERT(j <= i); - BOOST_ASSERT(j < i); + BOOST_TEST(i > j); + BOOST_TEST(i >= j); + BOOST_TEST(j <= i); + BOOST_TEST(j < i); } Iterator k = j + N - 1; for (c = 0; c < N-1; ++c) { - BOOST_ASSERT(i == k - c); - BOOST_ASSERT(*i == vals[N - 1 - c]); - BOOST_ASSERT(*i == boost::implicit_cast(j[N - 1 - c])); + BOOST_TEST(i == k - c); + BOOST_TEST(*i == vals[N - 1 - c]); + BOOST_TEST(*i == boost::implicit_cast(j[N - 1 - c])); Iterator q = k - c; boost::ignore_unused(q); - BOOST_ASSERT(*i == *q); - BOOST_ASSERT(i > j); - BOOST_ASSERT(i >= j); - BOOST_ASSERT(j <= i); - BOOST_ASSERT(j < i); + BOOST_TEST(*i == *q); + BOOST_TEST(i > j); + BOOST_TEST(i >= j); + BOOST_TEST(j <= i); + BOOST_TEST(j < i); --i; } } @@ -258,16 +258,16 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals) template void const_nonconst_iterator_test(Iterator i, ConstIterator j) { - BOOST_ASSERT(i != j); - BOOST_ASSERT(j != i); + BOOST_TEST(i != j); + BOOST_TEST(j != i); ConstIterator k(i); - BOOST_ASSERT(k == i); - BOOST_ASSERT(i == k); + BOOST_TEST(k == i); + BOOST_TEST(i == k); k = i; - BOOST_ASSERT(k == i); - BOOST_ASSERT(i == k); + BOOST_TEST(k == i); + BOOST_TEST(i == k); boost::ignore_unused(k); }