From 20a5331cb32f66f3d367188d0ea32a83ca098f1a Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 15:20:41 +0300 Subject: [PATCH 01/56] Remove BOOST_STATIC_ASSERT & BOOST_NOEXCEPT --- CMakeLists.txt | 1 - include/boost/iterator/counting_iterator.hpp | 3 +- include/boost/iterator/detail/config_def.hpp | 2 +- .../detail/facade_iterator_category.hpp | 12 ++- include/boost/iterator/filter_iterator.hpp | 3 +- .../iterator/function_output_iterator.hpp | 4 +- include/boost/iterator/iterator_adaptor.hpp | 4 +- .../boost/iterator/iterator_archetypes.hpp | 5 +- .../boost/iterator/iterator_categories.hpp | 2 - include/boost/iterator/iterator_concepts.hpp | 6 +- include/boost/iterator/iterator_facade.hpp | 11 ++- include/boost/iterator/minimum_category.hpp | 3 +- include/boost/iterator/new_iterator_tests.hpp | 15 ++-- include/boost/iterator/transform_iterator.hpp | 6 +- include/boost/pending/iterator_tests.hpp | 3 +- test/indirect_iter_member_types.cpp | 2 - test/is_lvalue_iterator.cpp | 74 +++++++++---------- test/is_readable_iterator.cpp | 22 +++--- test/iterator_adaptor_cc.cpp | 2 +- test/iterator_adaptor_test.cpp | 10 +-- test/iterator_facade.cpp | 2 +- test/iterator_traits_test.cpp | 1 - test/permutation_iterator_test.cpp | 3 +- test/reverse_iterator_test.cpp | 2 +- test/static_assert_same.hpp | 3 +- test/transform_iterator_test.cpp | 12 +-- test/unit_tests.cpp | 1 - 27 files changed, 92 insertions(+), 122 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0dcf8477..bedf55ba3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,6 @@ target_link_libraries(boost_iterator Boost::mpl Boost::optional Boost::smart_ptr - Boost::static_assert Boost::type_traits Boost::utility ) diff --git a/include/boost/iterator/counting_iterator.hpp b/include/boost/iterator/counting_iterator.hpp index 65c11e94b..d4ddfa651 100644 --- a/include/boost/iterator/counting_iterator.hpp +++ b/include/boost/iterator/counting_iterator.hpp @@ -6,7 +6,6 @@ # define COUNTING_ITERATOR_DWA200348_HPP # include -# include # ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # include # elif !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) @@ -39,7 +38,7 @@ namespace detail struct is_numeric_impl { // For a while, this wasn't true, but we rely on it below. This is a regression assert. - BOOST_STATIC_ASSERT(::boost::is_integral::value); + static_assert(::boost::is_integral::value, ""); # ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS diff --git a/include/boost/iterator/detail/config_def.hpp b/include/boost/iterator/detail/config_def.hpp index bd04b75d8..277e0d5a2 100644 --- a/include/boost/iterator/detail/config_def.hpp +++ b/include/boost/iterator/detail/config_def.hpp @@ -46,7 +46,7 @@ #endif -#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x5A0)) \ +#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x5A0)) \ || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \ || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) diff --git a/include/boost/iterator/detail/facade_iterator_category.hpp b/include/boost/iterator/detail/facade_iterator_category.hpp index 9d41320f6..b74e115ce 100644 --- a/include/boost/iterator/detail/facade_iterator_category.hpp +++ b/include/boost/iterator/detail/facade_iterator_category.hpp @@ -14,8 +14,6 @@ # include # include -# include - # include # include # include @@ -144,11 +142,11 @@ struct iterator_category_with_traversal , Traversal >::value)); - BOOST_STATIC_ASSERT(is_iterator_category::value); - BOOST_STATIC_ASSERT(!is_iterator_category::value); - BOOST_STATIC_ASSERT(!is_iterator_traversal::value); + static_assert(is_iterator_category::value, ""); + static_assert(!is_iterator_category::value, ""); + static_assert(!is_iterator_traversal::value, ""); # if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) - BOOST_STATIC_ASSERT(is_iterator_traversal::value); + static_assert(is_iterator_traversal::value, ""); # endif }; @@ -157,7 +155,7 @@ struct iterator_category_with_traversal template struct facade_iterator_category_impl { - BOOST_STATIC_ASSERT(!is_iterator_category::value); + static_assert(!is_iterator_category::value, ""); typedef typename iterator_facade_default_category< Traversal,ValueParam,Reference diff --git a/include/boost/iterator/filter_iterator.hpp b/include/boost/iterator/filter_iterator.hpp index 18c6186aa..b3697c826 100644 --- a/include/boost/iterator/filter_iterator.hpp +++ b/include/boost/iterator/filter_iterator.hpp @@ -11,7 +11,6 @@ #include #include -#include #include #include @@ -75,7 +74,7 @@ namespace iterators { #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) // Don't allow use of this constructor if Predicate is a // function pointer type, since it will be 0. - BOOST_STATIC_ASSERT(is_class::value); + static_assert(is_class::value, ""); #endif satisfy_predicate(); } diff --git a/include/boost/iterator/function_output_iterator.hpp b/include/boost/iterator/function_output_iterator.hpp index ea2a668bb..18dfb17d3 100644 --- a/include/boost/iterator/function_output_iterator.hpp +++ b/include/boost/iterator/function_output_iterator.hpp @@ -31,7 +31,7 @@ namespace iterators { class output_proxy { public: - explicit output_proxy(UnaryFunction& f) BOOST_NOEXCEPT : m_f(f) { } + explicit output_proxy(UnaryFunction& f) noexcept : m_f(f) { } #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES template @@ -53,7 +53,7 @@ namespace iterators { } #endif - BOOST_DEFAULTED_FUNCTION(output_proxy(output_proxy const& that), BOOST_NOEXCEPT : m_f(that.m_f) {}) + BOOST_DEFAULTED_FUNCTION(output_proxy(output_proxy const& that), noexcept : m_f(that.m_f) {}) BOOST_DELETED_FUNCTION(output_proxy& operator=(output_proxy const&)) private: diff --git a/include/boost/iterator/iterator_adaptor.hpp b/include/boost/iterator/iterator_adaptor.hpp index db1c4daa3..2c5b2f45d 100644 --- a/include/boost/iterator/iterator_adaptor.hpp +++ b/include/boost/iterator/iterator_adaptor.hpp @@ -7,8 +7,6 @@ #ifndef BOOST_ITERATOR_ADAPTOR_23022003THW_HPP #define BOOST_ITERATOR_ADAPTOR_23022003THW_HPP -#include - #include #include @@ -209,7 +207,7 @@ namespace iterators { template inline void iterator_adaptor_assert_traversal () { - BOOST_STATIC_ASSERT((is_convertible::value)); + static_assert(is_convertible::value, ""); } } diff --git a/include/boost/iterator/iterator_archetypes.hpp b/include/boost/iterator/iterator_archetypes.hpp index 1d2591528..8737f2689 100644 --- a/include/boost/iterator/iterator_archetypes.hpp +++ b/include/boost/iterator/iterator_archetypes.hpp @@ -8,7 +8,6 @@ #include #include -#include #include @@ -330,7 +329,7 @@ struct iterator_access_archetype_impl< template struct archetype { - BOOST_STATIC_ASSERT(!is_const::value); + static_assert(!is_const::value, ""); typedef void value_type; typedef void reference; typedef void pointer; @@ -381,7 +380,7 @@ struct iterator_access_archetype_impl Value, archetypes::readable_lvalue_iterator_t > { - BOOST_STATIC_ASSERT((!is_const::value)); + static_assert(!is_const::value, ""); }; }; diff --git a/include/boost/iterator/iterator_categories.hpp b/include/boost/iterator/iterator_categories.hpp index baf805af6..910f871de 100644 --- a/include/boost/iterator/iterator_categories.hpp +++ b/include/boost/iterator/iterator_categories.hpp @@ -18,8 +18,6 @@ # include -# include - #include namespace boost { diff --git a/include/boost/iterator/iterator_concepts.hpp b/include/boost/iterator/iterator_concepts.hpp index 3c65553e8..c3514b164 100644 --- a/include/boost/iterator/iterator_concepts.hpp +++ b/include/boost/iterator/iterator_concepts.hpp @@ -17,8 +17,6 @@ #include #include -#include - // Use boost/limits to work around missing limits headers on some compilers #include #include @@ -144,8 +142,8 @@ namespace boost_concepts { typedef typename std::iterator_traits::difference_type difference_type; - BOOST_STATIC_ASSERT(boost::is_integral::value); - BOOST_STATIC_ASSERT(std::numeric_limits::is_signed); + static_assert(boost::is_integral::value, ""); + static_assert(std::numeric_limits::is_signed, ""); BOOST_CONCEPT_ASSERT(( boost::Convertible< diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index c4b5ae4c1..4dea63390 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -15,7 +15,6 @@ #include #include -#include #include #include @@ -973,7 +972,7 @@ namespace iterators { # define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \ BOOST_ITERATOR_FACADE_INTEROP( \ op \ - , boost::iterators::detail::always_bool2 \ + , boost::iterators::detail::always_bool2 \ , return_prefix \ , base_op \ ) @@ -1002,10 +1001,10 @@ namespace iterators { # define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op, return_prefix, base_op) \ BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS( \ - op \ - , boost::iterators::detail::always_bool2 \ - , return_prefix \ - , base_op \ + op \ + , boost::iterators::detail::always_bool2 \ + , return_prefix \ + , base_op \ ) BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<, return 0 >, distance_from) diff --git a/include/boost/iterator/minimum_category.hpp b/include/boost/iterator/minimum_category.hpp index 15679bc77..e73c6ac46 100644 --- a/include/boost/iterator/minimum_category.hpp +++ b/include/boost/iterator/minimum_category.hpp @@ -4,7 +4,6 @@ #ifndef BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_ # define BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_ -# include # include # include @@ -44,7 +43,7 @@ struct minimum_category_impl { template struct apply { - BOOST_STATIC_ASSERT((is_same::value)); + static_assert(is_same::value, ""); typedef T1 type; }; }; diff --git a/include/boost/iterator/new_iterator_tests.hpp b/include/boost/iterator/new_iterator_tests.hpp index 2091e5976..cdf02b6d7 100644 --- a/include/boost/iterator/new_iterator_tests.hpp +++ b/include/boost/iterator/new_iterator_tests.hpp @@ -29,7 +29,6 @@ // (David Abrahams) # include -# include # include // for detail::dummy_constructor # include # include @@ -90,7 +89,7 @@ void readable_iterator_test(const Iterator i1, T v) // I think we don't really need this as it checks the same things as // the above code. - BOOST_STATIC_ASSERT(is_readable_iterator::value); + static_assert(is_readable_iterator::value, ""); # endif } @@ -125,12 +124,12 @@ void constant_lvalue_iterator_test(Iterator i, T v1) Iterator i2(i); typedef typename std::iterator_traits::value_type value_type; typedef typename std::iterator_traits::reference reference; - BOOST_STATIC_ASSERT((is_same::value)); + static_assert(is_same::value, ""); const T& v2 = *i2; BOOST_TEST(v1 == v2); # ifndef BOOST_NO_LVALUE_RETURN_DETECTION - BOOST_STATIC_ASSERT(is_lvalue_iterator::value); - BOOST_STATIC_ASSERT(!is_non_const_lvalue_iterator::value); + static_assert(is_lvalue_iterator::value, ""); + static_assert(!is_non_const_lvalue_iterator::value, ""); # endif } @@ -140,7 +139,7 @@ void non_const_lvalue_iterator_test(Iterator i, T v1, T v2) Iterator i2(i); typedef typename std::iterator_traits::value_type value_type; typedef typename std::iterator_traits::reference reference; - BOOST_STATIC_ASSERT((is_same::value)); + static_assert(is_same::value, ""); T& v3 = *i2; BOOST_TEST(v1 == v3); @@ -151,8 +150,8 @@ void non_const_lvalue_iterator_test(Iterator i, T v1, T v2) T& v4 = *i2; BOOST_TEST(v2 == v4); # ifndef BOOST_NO_LVALUE_RETURN_DETECTION - BOOST_STATIC_ASSERT(is_lvalue_iterator::value); - BOOST_STATIC_ASSERT(is_non_const_lvalue_iterator::value); + static_assert(is_lvalue_iterator::value, ""); + static_assert(is_non_const_lvalue_iterator::value, ""); # endif } diff --git a/include/boost/iterator/transform_iterator.hpp b/include/boost/iterator/transform_iterator.hpp index 5b2b810e0..15eea8bad 100644 --- a/include/boost/iterator/transform_iterator.hpp +++ b/include/boost/iterator/transform_iterator.hpp @@ -27,10 +27,6 @@ #include #endif -#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) -#include -#endif - #include @@ -103,7 +99,7 @@ namespace iterators { #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) // don't provide this constructor if UnaryFunc is a // function pointer type, since it will be 0. Too dangerous. - BOOST_STATIC_ASSERT(is_class::value); + static_assert(is_class::value, ""); #endif } diff --git a/include/boost/pending/iterator_tests.hpp b/include/boost/pending/iterator_tests.hpp index a68368365..9d04cc8dc 100644 --- a/include/boost/pending/iterator_tests.hpp +++ b/include/boost/pending/iterator_tests.hpp @@ -20,7 +20,6 @@ // (David Abrahams) # include -# include # include // for detail::dummy_constructor # include # include @@ -143,7 +142,7 @@ template struct lvalue_test typedef typename Iterator::reference reference; typedef typename Iterator::value_type value_type; # endif - BOOST_STATIC_ASSERT(boost::is_reference::value); + static_assert(boost::is_reference::value, ""); BOOST_STATIC_ASSERT((boost::is_same::value || boost::is_same::value )); diff --git a/test/indirect_iter_member_types.cpp b/test/indirect_iter_member_types.cpp index 240e664fb..927fea344 100644 --- a/test/indirect_iter_member_types.cpp +++ b/test/indirect_iter_member_types.cpp @@ -9,10 +9,8 @@ #include -#include #include -#include #include "static_assert_same.hpp" #include diff --git a/test/is_lvalue_iterator.cpp b/test/is_lvalue_iterator.cpp index 16de01413..a0eea8263 100644 --- a/test/is_lvalue_iterator.cpp +++ b/test/is_lvalue_iterator.cpp @@ -4,9 +4,7 @@ #include #include -#include #include // std::ptrdiff_t -#include #include #include @@ -91,58 +89,58 @@ struct constant_lvalue_iterator int main() { - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator::value); - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator::value); - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator::iterator>::value); - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator::const_iterator>::value); - BOOST_STATIC_ASSERT(!boost::is_lvalue_iterator > >::value); - BOOST_STATIC_ASSERT(!boost::is_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(!boost::is_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(!boost::is_lvalue_iterator >::value); + static_assert(boost::is_lvalue_iterator::value, ""); + static_assert(boost::is_lvalue_iterator::value, ""); + static_assert(boost::is_lvalue_iterator::iterator>::value, ""); + static_assert(boost::is_lvalue_iterator::const_iterator>::value, ""); + static_assert(!boost::is_lvalue_iterator > >::value, ""); + static_assert(!boost::is_lvalue_iterator >::value, ""); + static_assert(!boost::is_lvalue_iterator >::value, ""); + static_assert(!boost::is_lvalue_iterator >::value, ""); #ifndef BOOST_NO_LVALUE_RETURN_DETECTION - BOOST_STATIC_ASSERT(!boost::is_lvalue_iterator::value); + static_assert(!boost::is_lvalue_iterator::value, ""); #endif // Make sure inaccessible copy constructor doesn't prevent // reference binding - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator::value); + static_assert(boost::is_lvalue_iterator::value, ""); - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); + static_assert(boost::is_lvalue_iterator >::value, ""); + static_assert(boost::is_lvalue_iterator >::value, ""); + static_assert(boost::is_lvalue_iterator >::value, ""); + static_assert(boost::is_lvalue_iterator >::value, ""); - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); + static_assert(boost::is_lvalue_iterator >::value, ""); + static_assert(boost::is_lvalue_iterator >::value, ""); + static_assert(boost::is_lvalue_iterator >::value, ""); + static_assert(boost::is_lvalue_iterator >::value, ""); - BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator::value); - BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator::value); - BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator::iterator>::value); - BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator::const_iterator>::value); - BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator > >::value); - BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator >::value); + static_assert(boost::is_non_const_lvalue_iterator::value, ""); + static_assert(!boost::is_non_const_lvalue_iterator::value, ""); + static_assert(boost::is_non_const_lvalue_iterator::iterator>::value, ""); + static_assert(!boost::is_non_const_lvalue_iterator::const_iterator>::value, ""); + static_assert(!boost::is_non_const_lvalue_iterator > >::value, ""); + static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); + static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); + static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); #ifndef BOOST_NO_LVALUE_RETURN_DETECTION - BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator::value); + static_assert(!boost::is_non_const_lvalue_iterator::value, ""); #endif - BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator::value); + static_assert(!boost::is_non_const_lvalue_iterator::value, ""); - BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); + static_assert(boost::is_non_const_lvalue_iterator >::value, ""); #if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) - BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); + static_assert(boost::is_non_const_lvalue_iterator >::value, ""); #endif - BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); + static_assert(boost::is_non_const_lvalue_iterator >::value, ""); + static_assert(boost::is_non_const_lvalue_iterator >::value, ""); - BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator >::value); - BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator >::value); + static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); + static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); + static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); + static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); return 0; } diff --git a/test/is_readable_iterator.cpp b/test/is_readable_iterator.cpp index 1d33a64ab..39c4d7539 100644 --- a/test/is_readable_iterator.cpp +++ b/test/is_readable_iterator.cpp @@ -4,9 +4,7 @@ #include #include -#include #include // std::ptrdiff_t -#include #include #include @@ -78,19 +76,19 @@ struct proxy_iterator2 int main() { - BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); - BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); - BOOST_STATIC_ASSERT(boost::is_readable_iterator::iterator>::value); - BOOST_STATIC_ASSERT(boost::is_readable_iterator::const_iterator>::value); - BOOST_STATIC_ASSERT(!boost::is_readable_iterator > >::value); - BOOST_STATIC_ASSERT(!boost::is_readable_iterator >::value); - BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); - BOOST_STATIC_ASSERT(!boost::is_readable_iterator::value); - BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); + static_assert(boost::is_readable_iterator::value, ""); + static_assert(boost::is_readable_iterator::value, ""); + static_assert(boost::is_readable_iterator::iterator>::value, ""); + static_assert(boost::is_readable_iterator::const_iterator>::value, ""); + static_assert(!boost::is_readable_iterator > >::value, ""); + static_assert(!boost::is_readable_iterator >::value, ""); + static_assert(boost::is_readable_iterator::value, ""); + static_assert(!boost::is_readable_iterator::value, ""); + static_assert(boost::is_readable_iterator::value, ""); // Make sure inaccessible copy constructor doesn't prevent // readability - BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); + static_assert(boost::is_readable_iterator::value, ""); return 0; } diff --git a/test/iterator_adaptor_cc.cpp b/test/iterator_adaptor_cc.cpp index 2ea758256..6b0b73ca4 100644 --- a/test/iterator_adaptor_cc.cpp +++ b/test/iterator_adaptor_cc.cpp @@ -27,7 +27,7 @@ int main() #if defined(__SGI_STL_PORT) \ || !BOOST_WORKAROUND(__GNUC__, <= 2) \ && !(BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 1)) \ - && !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) \ + && !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) \ && !BOOST_WORKAROUND(__LIBCOMO_VERSION__, BOOST_TESTED_AT(29)) \ && !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 1) { diff --git a/test/iterator_adaptor_test.cpp b/test/iterator_adaptor_test.cpp index 4b37c14b3..f64939daf 100644 --- a/test/iterator_adaptor_test.cpp +++ b/test/iterator_adaptor_test.cpp @@ -209,7 +209,7 @@ main() test = static_assert_same::value; test = static_assert_same::value; #if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) - BOOST_STATIC_ASSERT((boost::is_convertible::value)); + static_assert(boost::is_convertible::value, ""); #endif } @@ -220,9 +220,9 @@ main() test = static_assert_same::value; #if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) - BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); + static_assert(boost::is_readable_iterator::value, ""); # ifndef BOOST_NO_LVALUE_RETURN_DETECTION - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator::value); + static_assert(boost::is_lvalue_iterator::value, ""); # endif #endif @@ -243,8 +243,8 @@ main() #endif #ifndef BOOST_NO_LVALUE_RETURN_DETECTION - BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator::value); - BOOST_STATIC_ASSERT(boost::is_lvalue_iterator::value); + static_assert(boost::is_non_const_lvalue_iterator::value, ""); + static_assert(boost::is_lvalue_iterator::value, ""); #endif typedef modify_traversal IncrementableIter; diff --git a/test/iterator_facade.cpp b/test/iterator_facade.cpp index 7351dd3fc..0dcba1e0f 100644 --- a/test/iterator_facade.cpp +++ b/test/iterator_facade.cpp @@ -146,7 +146,7 @@ struct iterator_with_proxy_reference template void same_type(U const&) -{ BOOST_STATIC_ASSERT((boost::is_same::value)); } +{ static_assert(boost::is_same::value, ""); } template struct abstract_iterator diff --git a/test/iterator_traits_test.cpp b/test/iterator_traits_test.cpp index 40da04973..d59e4e0af 100644 --- a/test/iterator_traits_test.cpp +++ b/test/iterator_traits_test.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/test/permutation_iterator_test.cpp b/test/permutation_iterator_test.cpp index 81cdefedc..ac8270164 100644 --- a/test/permutation_iterator_test.cpp +++ b/test/permutation_iterator_test.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -44,7 +43,7 @@ void permutation_test() const int element_range_size = 10; const int index_size = 7; - BOOST_STATIC_ASSERT(index_size <= element_range_size); + static_assert(index_size <= element_range_size, ""); element_range_type elements( element_range_size ); for( element_range_type::iterator el_it = elements.begin(); el_it != elements.end(); ++el_it ) { *el_it = std::distance(elements.begin(), el_it); } diff --git a/test/reverse_iterator_test.cpp b/test/reverse_iterator_test.cpp index c2e4a4190..4be97343d 100644 --- a/test/reverse_iterator_test.cpp +++ b/test/reverse_iterator_test.cpp @@ -161,7 +161,7 @@ int main() #if defined(__SGI_STL_PORT) \ || !BOOST_WORKAROUND(__GNUC__, <= 2) \ && !(BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 1)) \ - && !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) \ + && !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) \ && !BOOST_WORKAROUND(__LIBCOMO_VERSION__, BOOST_TESTED_AT(29)) \ && !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 1) diff --git a/test/static_assert_same.hpp b/test/static_assert_same.hpp index 5d96da935..fb236324c 100644 --- a/test/static_assert_same.hpp +++ b/test/static_assert_same.hpp @@ -5,10 +5,9 @@ #ifndef STATIC_ASSERT_SAME_DWA2003530_HPP # define STATIC_ASSERT_SAME_DWA2003530_HPP -#include #include -#define STATIC_ASSERT_SAME( T1,T2 ) BOOST_STATIC_ASSERT((::boost::is_same< T1, T2 >::value)) +#define STATIC_ASSERT_SAME( T1,T2 ) static_assert(::boost::is_same< T1, T2 >::value, "") template struct static_assert_same diff --git a/test/transform_iterator_test.cpp b/test/transform_iterator_test.cpp index b22cb161f..3fd788e1c 100644 --- a/test/transform_iterator_test.cpp +++ b/test/transform_iterator_test.cpp @@ -172,20 +172,20 @@ main() { { typedef boost::transform_iterator iter_t; - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); + static_assert(boost::is_same::value, ""); + static_assert(boost::is_same::value, ""); } { typedef boost::transform_iterator iter_t; - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); + static_assert(boost::is_same::value, ""); + static_assert(boost::is_same::value, ""); } { typedef boost::transform_iterator iter_t; - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); + static_assert(boost::is_same::value, ""); + static_assert(boost::is_same::value, ""); } } diff --git a/test/unit_tests.cpp b/test/unit_tests.cpp index 656e72ffa..f91b7e877 100644 --- a/test/unit_tests.cpp +++ b/test/unit_tests.cpp @@ -3,7 +3,6 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include -#include #include "static_assert_same.hpp" From 50e118c8945083bf901bb138963333ed1231c78e Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 15:40:59 +0300 Subject: [PATCH 02/56] facade_iterator_category, type_traits, same_as --- include/boost/iterator/counting_iterator.hpp | 1 + .../boost/iterator/detail/facade_iterator_category.hpp | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/boost/iterator/counting_iterator.hpp b/include/boost/iterator/counting_iterator.hpp index d4ddfa651..ac4bfe182 100644 --- a/include/boost/iterator/counting_iterator.hpp +++ b/include/boost/iterator/counting_iterator.hpp @@ -8,6 +8,7 @@ # include # ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # include +# include # elif !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) # include # else diff --git a/include/boost/iterator/detail/facade_iterator_category.hpp b/include/boost/iterator/detail/facade_iterator_category.hpp index b74e115ce..bf7257a10 100644 --- a/include/boost/iterator/detail/facade_iterator_category.hpp +++ b/include/boost/iterator/detail/facade_iterator_category.hpp @@ -10,11 +10,10 @@ # include // used in iterator_tag inheritance logic # include -# include # include # include -# include +# include # include # include # include @@ -161,11 +160,11 @@ struct facade_iterator_category_impl Traversal,ValueParam,Reference >::type category; - typedef typename mpl::if_< - is_same< + typedef typename std::conditional< + std::is_same< Traversal , typename iterator_category_to_traversal::type - > + >::value , category , iterator_category_with_traversal >::type type; From fad6cd6dfe735fe784a8504de2af362810914aee Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 16:08:53 +0300 Subject: [PATCH 03/56] type_traits --- include/boost/iterator/iterator_adaptor.hpp | 54 ++++--------------- .../boost/iterator/iterator_archetypes.hpp | 33 +++++------- 2 files changed, 24 insertions(+), 63 deletions(-) diff --git a/include/boost/iterator/iterator_adaptor.hpp b/include/boost/iterator/iterator_adaptor.hpp index 2c5b2f45d..3cf553636 100644 --- a/include/boost/iterator/iterator_adaptor.hpp +++ b/include/boost/iterator/iterator_adaptor.hpp @@ -9,24 +9,12 @@ #include +#include + #include #include #include - -#include -#include -#include - -#include -#include - -#ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY -# include -#endif - -#include #include - #include namespace boost { @@ -39,13 +27,6 @@ namespace iterators { } // namespace iterators -// the incompleteness of use_default causes massive problems for -// is_convertible (naturally). This workaround is fortunately not -// needed for vc6/vc7. -template -struct is_convertible - : mpl::false_ {}; - namespace iterators { namespace detail @@ -108,27 +89,12 @@ namespace iterators { typedef boost::iterators::detail::enable_type type; }; -# elif BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) - - // For some reason vc7.1 needs us to "cut off" instantiation - // of is_convertible in a few cases. - template - struct enable_if_convertible - : iterators::enable_if< - mpl::or_< - is_same - , is_convertible - > - , boost::iterators::detail::enable_type - > - {}; - # else template struct enable_if_convertible : iterators::enable_if< - is_convertible + std::is_convertible , boost::iterators::detail::enable_type > {}; @@ -145,7 +111,7 @@ namespace iterators { template struct ia_dflt_help : mpl::eval_if< - is_same + std::is_same , DefaultNullaryFn , mpl::identity > @@ -171,9 +137,9 @@ namespace iterators { , typename boost::iterators::detail::ia_dflt_help< Value , mpl::eval_if< - is_same + std::is_same , iterator_value - , remove_reference + , std::remove_reference > >::type # else @@ -190,9 +156,9 @@ namespace iterators { , typename boost::iterators::detail::ia_dflt_help< Reference , mpl::eval_if< - is_same + std::is_same , iterator_reference - , add_reference + , std::add_lvalue_reference > >::type @@ -207,7 +173,7 @@ namespace iterators { template inline void iterator_adaptor_assert_traversal () { - static_assert(is_convertible::value, ""); + static_assert(std::is_convertible::value, ""); } } @@ -218,7 +184,7 @@ namespace iterators { // versions of iterator_adaptor The idea is that when the user needs // to fiddle with the reference type it is highly likely that the // iterator category has to be adjusted as well. Any of the - // following four template arguments may be ommitted or explicitly + // following four template arguments may be committed or explicitly // replaced by use_default. // // Value - if supplied, the value_type of the resulting iterator, unless diff --git a/include/boost/iterator/iterator_archetypes.hpp b/include/boost/iterator/iterator_archetypes.hpp index 8737f2689..e12a8b4ab 100644 --- a/include/boost/iterator/iterator_archetypes.hpp +++ b/include/boost/iterator/iterator_archetypes.hpp @@ -11,19 +11,14 @@ #include -#include -#include -#include -#include +#include #include #include #include #include -#include #include -#include #include #include @@ -125,11 +120,11 @@ namespace detail , archetypes::writable_iterator_t > , mpl::identity > - , mpl::if_< + , std::conditional< archetypes::has_access< AccessCategory , archetypes::readable_iterator_t - > + >::value , readable_operator_brackets , no_operator_brackets > @@ -279,9 +274,9 @@ namespace detail template struct convertible_type - : mpl::if_< is_const, - typename remove_const::type, - bogus_type > + : std::conditional< std::is_const::value, + typename std::remove_const::type, + bogus_type > {}; } // namespace detail @@ -311,9 +306,9 @@ struct iterator_access_archetype_impl< template struct archetype { - typedef typename remove_cv::type value_type; - typedef Value reference; - typedef Value* pointer; + typedef typename std::remove_cv::type value_type; + typedef Value reference; + typedef Value* pointer; value_type operator*() const { return static_object::get(); } @@ -329,7 +324,7 @@ struct iterator_access_archetype_impl< template struct archetype { - static_assert(!is_const::value, ""); + static_assert(!std::is_const::value, ""); typedef void value_type; typedef void reference; typedef void pointer; @@ -380,7 +375,7 @@ struct iterator_access_archetype_impl Value, archetypes::readable_lvalue_iterator_t > { - static_assert(!is_const::value, ""); + static_assert(!std::is_const::value, ""); }; }; @@ -391,7 +386,7 @@ struct iterator_archetype; template struct traversal_archetype_base : detail::operator_brackets< - typename remove_cv::type + typename std::remove_cv::type , AccessCategory , TraversalCategory > @@ -418,8 +413,8 @@ namespace detail archetypes::has_access< AccessCategory, archetypes::writable_iterator_t > - , remove_const - , add_const + , std::remove_const + , std::add_const >::type , typename access::reference >::type iterator_category; From 125b31573b9bc7b14c5acaec1790367c69b9c542 Mon Sep 17 00:00:00 2001 From: Georgy Guminov Date: Sun, 9 Jun 2024 16:25:45 +0300 Subject: [PATCH 04/56] function_output_iterator type_traits --- .../iterator/function_output_iterator.hpp | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/include/boost/iterator/function_output_iterator.hpp b/include/boost/iterator/function_output_iterator.hpp index 18dfb17d3..ad4adc390 100644 --- a/include/boost/iterator/function_output_iterator.hpp +++ b/include/boost/iterator/function_output_iterator.hpp @@ -13,13 +13,9 @@ #include #include +#include + #include -#include -#include -#include -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -#include -#endif namespace boost { namespace iterators { @@ -33,25 +29,15 @@ namespace iterators { public: explicit output_proxy(UnaryFunction& f) noexcept : m_f(f) { } -#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES - template - typename boost::disable_if_c< - boost::is_same< typename boost::remove_cv< T >::type, output_proxy >::value, - output_proxy const& - >::type operator=(const T& value) const { - m_f(value); - return *this; - } -#else template - typename boost::disable_if_c< - boost::is_same< typename boost::remove_cv< typename boost::remove_reference< T >::type >::type, output_proxy >::value, + + typename std::enable_if< + !std::is_same< typename std::remove_cv< typename std::remove_reference< T >::type >::type, output_proxy >::value, output_proxy const& >::type operator=(T&& value) const { m_f(static_cast< T&& >(value)); return *this; } -#endif BOOST_DEFAULTED_FUNCTION(output_proxy(output_proxy const& that), noexcept : m_f(that.m_f) {}) BOOST_DELETED_FUNCTION(output_proxy& operator=(output_proxy const&)) From 3b42b7246b55aca1148c07413392156d7fe090bf Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 16:31:32 +0300 Subject: [PATCH 05/56] indirect_iterator type_traits --- include/boost/iterator/indirect_iterator.hpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/include/boost/iterator/indirect_iterator.hpp b/include/boost/iterator/indirect_iterator.hpp index e15ac87e4..f67083957 100644 --- a/include/boost/iterator/indirect_iterator.hpp +++ b/include/boost/iterator/indirect_iterator.hpp @@ -14,16 +14,13 @@ #include -#include -#include - #include #include #include -#include #include #include +#include #ifdef BOOST_MPL_CFG_NO_HAS_XXX # include @@ -57,9 +54,9 @@ namespace iterators { , typename ia_dflt_help< Reference , mpl::eval_if< - is_same + std::is_same , indirect_reference - , add_reference + , std::add_lvalue_reference > >::type , Difference From ab8600f23c05b3ef8d1a92cf20cec077f939f291 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 17:05:37 +0300 Subject: [PATCH 06/56] indirect_reference --- include/boost/indirect_reference.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/include/boost/indirect_reference.hpp b/include/boost/indirect_reference.hpp index 3279cd052..21f090403 100644 --- a/include/boost/indirect_reference.hpp +++ b/include/boost/indirect_reference.hpp @@ -13,7 +13,6 @@ # include # include -# include # include # include From 9b20b2c7b834b7be9a3264ed72f825372d2af605 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 17:07:32 +0300 Subject: [PATCH 07/56] pointee --- include/boost/pointee.hpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/include/boost/pointee.hpp b/include/boost/pointee.hpp index 69efa940e..b177e735a 100644 --- a/include/boost/pointee.hpp +++ b/include/boost/pointee.hpp @@ -15,12 +15,10 @@ # include # include -# include -# include -# include # include #include +#include namespace boost { @@ -49,13 +47,13 @@ namespace detail BOOST_STATIC_CONSTANT(bool, is_constant = sizeof(impl::test(*impl::x)) == 1); - typedef typename mpl::if_c< + typedef typename std::conditional< # if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) ::boost::detail::iterator_pointee::is_constant # else is_constant # endif - , typename add_const::type + , typename std::add_const::type , value_type >::type type; }; From b0a67caeafdd93fdc77f02f2e5a2a3f976c0813d Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 17:09:57 +0300 Subject: [PATCH 08/56] counting_iterator --- include/boost/iterator/counting_iterator.hpp | 27 ++++++++------------ 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/include/boost/iterator/counting_iterator.hpp b/include/boost/iterator/counting_iterator.hpp index ac4bfe182..9af9e7752 100644 --- a/include/boost/iterator/counting_iterator.hpp +++ b/include/boost/iterator/counting_iterator.hpp @@ -5,19 +5,14 @@ #ifndef COUNTING_ITERATOR_DWA200348_HPP # define COUNTING_ITERATOR_DWA200348_HPP +# include + # include +# include # ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # include -# include -# elif !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) -# include -# else -# include # endif -# include # include -# include -# include # include # include @@ -39,7 +34,7 @@ namespace detail struct is_numeric_impl { // For a while, this wasn't true, but we rely on it below. This is a regression assert. - static_assert(::boost::is_integral::value, ""); + static_assert(std::is_integral::value, ""); # ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS @@ -50,11 +45,11 @@ namespace detail # if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) BOOST_STATIC_CONSTANT( bool, value = ( - boost::is_convertible::value - && boost::is_convertible::value + std::is_convertible::value + && std::is_convertible::value )); # else - BOOST_STATIC_CONSTANT(bool, value = ::boost::is_arithmetic::value); + BOOST_STATIC_CONSTANT(bool, value = std::is_arithmetic::value); # endif # endif @@ -62,7 +57,7 @@ namespace detail template struct is_numeric - : boost::integral_constant::value> + : std::integral_constant::value> {}; # if defined(BOOST_HAS_LONG_LONG) @@ -116,7 +111,7 @@ namespace detail { typedef typename detail::ia_dflt_help< CategoryOrTraversal - , typename boost::conditional< + , typename std::conditional< is_numeric::value , boost::type_identity , iterator_traversal @@ -125,7 +120,7 @@ namespace detail typedef typename detail::ia_dflt_help< Difference - , typename boost::conditional< + , typename std::conditional< is_numeric::value , numeric_difference , iterator_difference @@ -225,7 +220,7 @@ class counting_iterator difference_type distance_to(counting_iterator const& y) const { - typedef typename boost::conditional< + typedef typename std::conditional< detail::is_numeric::value , detail::number_distance , detail::iterator_distance From 0f976e830dc0cdced0179e7b865d2685bac4f912 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 17:14:50 +0300 Subject: [PATCH 09/56] filter_iterator --- include/boost/iterator/filter_iterator.hpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/include/boost/iterator/filter_iterator.hpp b/include/boost/iterator/filter_iterator.hpp index b3697c826..5540fe7fc 100644 --- a/include/boost/iterator/filter_iterator.hpp +++ b/include/boost/iterator/filter_iterator.hpp @@ -7,19 +7,14 @@ #ifndef BOOST_FILTER_ITERATOR_23022003THW_HPP #define BOOST_FILTER_ITERATOR_23022003THW_HPP +#include + #include #include -#include #include #include -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -#define BOOST_ITERATOR_DETAIL_MOVE(_type, _value) static_cast< _type&& >(_value) -#else -#define BOOST_ITERATOR_DETAIL_MOVE(_type, _value) _value -#endif - namespace boost { namespace iterators { @@ -61,20 +56,20 @@ namespace iterators { filter_iterator() { } filter_iterator(Predicate f, Iterator x, Iterator end_ = Iterator()) - : super_t(BOOST_ITERATOR_DETAIL_MOVE(Iterator, x)), m_predicate(BOOST_ITERATOR_DETAIL_MOVE(Predicate, f)), m_end(BOOST_ITERATOR_DETAIL_MOVE(Iterator, end_)) + : super_t(std::move(x)), m_predicate(std::move(f)), m_end(std::move(end_)) { satisfy_predicate(); } filter_iterator(Iterator x, Iterator end_ = Iterator()) - : super_t(BOOST_ITERATOR_DETAIL_MOVE(Iterator, x)), m_predicate(), m_end(BOOST_ITERATOR_DETAIL_MOVE(Iterator, end_)) + : super_t(std::move(x)), m_predicate(), m_end(std::move(end_)) { // Pro8 is a little too aggressive about instantiating the // body of this function. #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) // Don't allow use of this constructor if Predicate is a // function pointer type, since it will be 0. - static_assert(is_class::value, ""); + static_assert(std::is_class::value, ""); #endif satisfy_predicate(); } @@ -118,7 +113,7 @@ namespace iterators { inline filter_iterator make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator()) { - return filter_iterator(BOOST_ITERATOR_DETAIL_MOVE(Predicate, f), BOOST_ITERATOR_DETAIL_MOVE(Iterator, x), BOOST_ITERATOR_DETAIL_MOVE(Iterator, end)); + return filter_iterator(std::move(f), std::move(x), std::move(end)); } template @@ -130,7 +125,7 @@ namespace iterators { >::type x , Iterator end = Iterator()) { - return filter_iterator(BOOST_ITERATOR_DETAIL_MOVE(Iterator, x), BOOST_ITERATOR_DETAIL_MOVE(Iterator, end)); + return filter_iterator(std::move(x), std::move(end)); } } // namespace iterators From f299047daa9c525cc21a16cd419be1f077831d7d Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 17:35:42 +0300 Subject: [PATCH 10/56] minimum_category --- include/boost/iterator/minimum_category.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/boost/iterator/minimum_category.hpp b/include/boost/iterator/minimum_category.hpp index e73c6ac46..03720d972 100644 --- a/include/boost/iterator/minimum_category.hpp +++ b/include/boost/iterator/minimum_category.hpp @@ -4,8 +4,7 @@ #ifndef BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_ # define BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_ -# include -# include +# include # include # include @@ -43,7 +42,7 @@ struct minimum_category_impl { template struct apply { - static_assert(is_same::value, ""); + static_assert(std::is_same::value, ""); typedef T1 type; }; }; @@ -67,8 +66,8 @@ template struct minimum_category { typedef boost::iterators::detail::minimum_category_impl< - ::boost::is_convertible::value - , ::boost::is_convertible::value + std::is_convertible::value + , std::is_convertible::value > outer; typedef typename outer::template apply inner; From 6aad7256fc407e26a5de7895e75eaa44cee4f5fa Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 17:37:53 +0300 Subject: [PATCH 11/56] iterator_concepts --- include/boost/iterator/iterator_concepts.hpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/include/boost/iterator/iterator_concepts.hpp b/include/boost/iterator/iterator_concepts.hpp index c3514b164..ff039be73 100644 --- a/include/boost/iterator/iterator_concepts.hpp +++ b/include/boost/iterator/iterator_concepts.hpp @@ -9,13 +9,7 @@ #include #include -#include -#include - -#include -#include -#include -#include +#include // Use boost/limits to work around missing limits headers on some compilers #include @@ -142,7 +136,7 @@ namespace boost_concepts { typedef typename std::iterator_traits::difference_type difference_type; - static_assert(boost::is_integral::value, ""); + static_assert(std::is_integral::value, ""); static_assert(std::numeric_limits::is_signed, ""); BOOST_CONCEPT_ASSERT(( From 84885ea76a1636e36aef5d0cb571a25da0d81d9b Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 17:45:58 +0300 Subject: [PATCH 12/56] iterator_facade --- include/boost/iterator/iterator_facade.hpp | 52 +++++++++------------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 4dea63390..8b52be3e5 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -15,19 +15,7 @@ #include #include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - #include -#include #include #include #include @@ -36,6 +24,8 @@ #include #include +#include +#include #include // this goes last @@ -116,13 +106,13 @@ namespace iterators { CategoryOrTraversal, ValueParam, Reference >::type iterator_category; - typedef typename remove_const::type value_type; + typedef typename std::remove_const::type value_type; // Not the real associated pointer type typedef typename mpl::eval_if< boost::iterators::detail::iterator_writability_disabled - , add_pointer - , add_pointer + , std::add_pointer + , std::add_pointer >::type pointer; # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ @@ -179,7 +169,7 @@ namespace iterators { // Provides (r++)->foo() value_type* operator->() const { - return boost::addressof(stored_value); + return std::addressof(stored_value); } private: @@ -302,7 +292,7 @@ namespace iterators { // Provides (r++)->foo() value_type* operator->() const { - return boost::addressof(dereference_proxy.stored_value); + return std::addressof(dereference_proxy.stored_value); } private: @@ -317,11 +307,11 @@ namespace iterators { static Reference r; template - static typename mpl::if_< - is_convertible< + static typename std::conditional< + std::is_convertible< R const volatile* , Value const volatile* - > + >::value , char[1] , char[2] >::type& helper(R const&); @@ -338,8 +328,8 @@ namespace iterators { # else template struct is_non_proxy_reference - : is_convertible< - typename remove_reference::type + : std::is_convertible< + typename std::remove_reference::type const volatile* , Value const volatile* > @@ -373,7 +363,7 @@ namespace iterators { // 'reference-to-reference' in the template which described in CWG // DR106. // http://www.open-std.org/Jtc1/sc22/wg21/docs/cwg_defects.html#106 - , typename add_lvalue_reference::type + , typename std::add_lvalue_reference::type > // No multipass iterator can have values that disappear @@ -385,8 +375,8 @@ namespace iterators { > > > - , mpl::if_< - is_non_proxy_reference + , std::conditional< + is_non_proxy_reference::value , postfix_increment_proxy , writable_postfix_increment_proxy > @@ -404,10 +394,10 @@ namespace iterators { struct proxy { explicit proxy(Reference const & x) : m_ref(x) {} - Reference* operator->() { return boost::addressof(m_ref); } + Reference* operator->() { return std::addressof(m_ref); } // This function is needed for MWCW and BCC, which won't call // operator-> again automatically per 13.3.1.2 para 8 - operator Reference*() { return boost::addressof(m_ref); } + operator Reference*() { return std::addressof(m_ref); } Reference m_ref; }; typedef proxy result_type; @@ -423,7 +413,7 @@ namespace iterators { typedef Pointer result_type; static result_type apply(T& x) { - return boost::addressof(x); + return std::addressof(x); } }; @@ -466,7 +456,7 @@ namespace iterators { mpl::and_< // Really we want an is_copy_constructible trait here, // but is_POD will have to suffice in the meantime. - boost::is_POD + std::is_pod , iterator_writability_disabled > > @@ -475,8 +465,8 @@ namespace iterators { template struct operator_brackets_result { - typedef typename mpl::if_< - use_operator_brackets_proxy + typedef typename std::conditional< + use_operator_brackets_proxy::value , operator_brackets_proxy , Value >::type type; From cab8440ca1800b16a5bc6900da5c30e5a7f21b1e Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 17:48:04 +0300 Subject: [PATCH 13/56] function_input_iterator --- .../boost/iterator/function_input_iterator.hpp | 18 +++++++----------- include/boost/iterator/iterator_facade.hpp | 8 +++++--- test/detail/zip_iterator_test.ipp | 1 + test/range_distance_compat_test.cpp | 1 + 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/boost/iterator/function_input_iterator.hpp b/include/boost/iterator/function_input_iterator.hpp index 610c1338f..15175b245 100644 --- a/include/boost/iterator/function_input_iterator.hpp +++ b/include/boost/iterator/function_input_iterator.hpp @@ -9,10 +9,10 @@ #ifndef BOOST_FUNCTION_INPUT_ITERATOR #define BOOST_FUNCTION_INPUT_ITERATOR +#include +#include + #include -#include -#include -#include #include #include #include @@ -20,10 +20,6 @@ #include #include -#ifdef BOOST_RESULT_OF_USE_TR1 -#include -#endif - namespace boost { namespace iterators { @@ -41,7 +37,7 @@ namespace iterators { { typedef typename result_of< #ifdef BOOST_RESULT_OF_USE_TR1 - typename boost::conditional::value, F&, F>::type() + typename std::conditional::value, F&, F>::type() #else F&() #endif @@ -60,7 +56,7 @@ namespace iterators { public: function_object_input_iterator() {} function_object_input_iterator(Function & f_, Input state_ = Input()) - : f(boost::addressof(f_)), state(state_) {} + : f(std::addressof(f_)), state(state_) {} void increment() { if (value) @@ -130,13 +126,13 @@ namespace iterators { template class function_input_iterator : - public boost::conditional< + public std::conditional< function_types::is_function_pointer::value, impl::function_pointer_input_iterator, impl::function_object_input_iterator >::type { - typedef typename boost::conditional< + typedef typename std::conditional< function_types::is_function_pointer::value, impl::function_pointer_input_iterator, impl::function_object_input_iterator diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 8b52be3e5..b511071d5 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -375,8 +376,8 @@ namespace iterators { > > > - , std::conditional< - is_non_proxy_reference::value + , mpl::if_< + is_non_proxy_reference , postfix_increment_proxy , writable_postfix_increment_proxy > @@ -456,7 +457,8 @@ namespace iterators { mpl::and_< // Really we want an is_copy_constructible trait here, // but is_POD will have to suffice in the meantime. - std::is_pod + std::is_standard_layout + , std::is_trivial , iterator_writability_disabled > > diff --git a/test/detail/zip_iterator_test.ipp b/test/detail/zip_iterator_test.ipp index 7e0d2f7b0..39c223c0d 100644 --- a/test/detail/zip_iterator_test.ipp +++ b/test/detail/zip_iterator_test.ipp @@ -8,6 +8,7 @@ #include +#include #include #include #include diff --git a/test/range_distance_compat_test.cpp b/test/range_distance_compat_test.cpp index ef7e301da..5501810a8 100644 --- a/test/range_distance_compat_test.cpp +++ b/test/range_distance_compat_test.cpp @@ -5,6 +5,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #include +#include #include #include From b889bd4cef84609ab0752671d7fa99a13bfa6c66 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 19:07:21 +0300 Subject: [PATCH 14/56] More std. --- include/boost/iterator/iterator_facade.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index b511071d5..298961f9c 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -54,7 +54,7 @@ namespace iterators { // The type trait checks if the category or traversal is at least as advanced as the specified required traversal template< typename CategoryOrTraversal, typename Required > struct is_traversal_at_least : - public boost::is_convertible< typename iterator_category_to_traversal< CategoryOrTraversal >::type, Required > + public std::is_convertible< typename iterator_category_to_traversal< CategoryOrTraversal >::type, Required > {}; // @@ -357,7 +357,7 @@ namespace iterators { : mpl::eval_if< mpl::and_< // A proxy is only needed for readable iterators - is_convertible< + std::is_convertible< Reference // Use add_lvalue_reference to form `reference to Value` due to // some (strict) C++03 compilers (e.g. `gcc -std=c++03`) reject @@ -370,7 +370,7 @@ namespace iterators { // No multipass iterator can have values that disappear // before positions can be re-visited , mpl::not_< - is_convertible< + std::is_convertible< typename iterator_category_to_traversal::type , forward_traversal_tag > @@ -495,7 +495,7 @@ namespace iterators { iterator_difference # else mpl::eval_if< - is_convertible + std::is_convertible , iterator_difference , iterator_difference > @@ -944,7 +944,7 @@ namespace iterators { # ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP # define BOOST_ITERATOR_CONVERTIBLE(a,b) mpl::true_() # else -# define BOOST_ITERATOR_CONVERTIBLE(a,b) is_convertible() +# define BOOST_ITERATOR_CONVERTIBLE(a,b) std::is_convertible() # endif # define BOOST_ITERATOR_FACADE_INTEROP(op, result_type, return_prefix, base_op) \ From ae97f33ae7868b76dc75fa2a1ac0a994ab8b57e7 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 19:08:55 +0300 Subject: [PATCH 15/56] Example --- example/node_iterator2.hpp | 10 ++-------- example/node_iterator3.hpp | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/example/node_iterator2.hpp b/example/node_iterator2.hpp index 1f5d834ab..0c209151e 100644 --- a/example/node_iterator2.hpp +++ b/example/node_iterator2.hpp @@ -6,9 +6,9 @@ # include "node.hpp" # include +# include # ifndef BOOST_NO_SFINAE -# include # include # endif @@ -35,19 +35,13 @@ class node_iter node_iter const& other # ifndef BOOST_NO_SFINAE , typename boost::enable_if< - boost::is_convertible + std::is_convertible , enabler >::type = enabler() # endif ) : m_node(other.m_node) {} - -# if !BOOST_WORKAROUND(__GNUC__, == 2) - private: // GCC2 can't grant friendship to template member functions - friend class boost::iterator_core_access; -# endif - template bool equal(node_iter const& other) const { diff --git a/example/node_iterator3.hpp b/example/node_iterator3.hpp index 3ae7bec5a..16e5752e7 100644 --- a/example/node_iterator3.hpp +++ b/example/node_iterator3.hpp @@ -6,9 +6,9 @@ # include "node.hpp" # include +# include # ifndef BOOST_NO_SFINAE -# include # include # endif @@ -40,7 +40,7 @@ class node_iter node_iter const& other # ifndef BOOST_NO_SFINAE , typename boost::enable_if< - boost::is_convertible + std::is_convertible , enabler >::type = enabler() # endif From 76def8685ce0fff4e497fa1e78b5cb9159a17dc3 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 19:10:32 +0300 Subject: [PATCH 16/56] new_iterator_tests --- include/boost/iterator/new_iterator_tests.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/boost/iterator/new_iterator_tests.hpp b/include/boost/iterator/new_iterator_tests.hpp index cdf02b6d7..eb87573ea 100644 --- a/include/boost/iterator/new_iterator_tests.hpp +++ b/include/boost/iterator/new_iterator_tests.hpp @@ -29,12 +29,11 @@ // (David Abrahams) # include +# include # include // for detail::dummy_constructor # include # include # include -# include -# include # include # include @@ -124,7 +123,7 @@ void constant_lvalue_iterator_test(Iterator i, T v1) Iterator i2(i); typedef typename std::iterator_traits::value_type value_type; typedef typename std::iterator_traits::reference reference; - static_assert(is_same::value, ""); + static_assert(std::is_same::value, ""); const T& v2 = *i2; BOOST_TEST(v1 == v2); # ifndef BOOST_NO_LVALUE_RETURN_DETECTION @@ -139,11 +138,11 @@ void non_const_lvalue_iterator_test(Iterator i, T v1, T v2) Iterator i2(i); typedef typename std::iterator_traits::value_type value_type; typedef typename std::iterator_traits::reference reference; - static_assert(is_same::value, ""); + static_assert(std::is_same::value, ""); T& v3 = *i2; BOOST_TEST(v1 == v3); - // A non-const lvalue iterator is not neccessarily writable, but we + // A non-const lvalue iterator is not necessarily writable, but we // are assuming the value_type is assignable here *i = v2; From 03609290fcff647fd788efc7f4e9fd83ebe64590 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 19:11:08 +0300 Subject: [PATCH 17/56] iterator_tests --- include/boost/iterator/iterator_facade.hpp | 10 +++++----- include/boost/pending/iterator_tests.hpp | 13 +++++-------- test/iterator_facade.cpp | 6 +++--- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 298961f9c..12383309d 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -635,13 +635,13 @@ namespace iterators { } template - static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::true_) + static bool equal(Facade1 const& f1, Facade2 const& f2, std::true_type) { return f1.equal(f2); } template - static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::false_) + static bool equal(Facade1 const& f1, Facade2 const& f2, std::false_type) { return f2.equal(f1); } @@ -654,14 +654,14 @@ namespace iterators { template static typename Facade1::difference_type distance_from( - Facade1 const& f1, Facade2 const& f2, mpl::true_) + Facade1 const& f1, Facade2 const& f2, std::true_type) { return -f1.distance_to(f2); } template static typename Facade2::difference_type distance_from( - Facade1 const& f1, Facade2 const& f2, mpl::false_) + Facade1 const& f1, Facade2 const& f2, std::false_type) { return f2.distance_to(f1); } @@ -942,7 +942,7 @@ namespace iterators { // # ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP -# define BOOST_ITERATOR_CONVERTIBLE(a,b) mpl::true_() +# define BOOST_ITERATOR_CONVERTIBLE(a,b) std::true_type() # else # define BOOST_ITERATOR_CONVERTIBLE(a,b) std::is_convertible() # endif diff --git a/include/boost/pending/iterator_tests.hpp b/include/boost/pending/iterator_tests.hpp index 9d04cc8dc..4105553ac 100644 --- a/include/boost/pending/iterator_tests.hpp +++ b/include/boost/pending/iterator_tests.hpp @@ -20,12 +20,10 @@ // (David Abrahams) # include +# include # include // for detail::dummy_constructor # include # include -# include -# include -# include namespace boost { @@ -142,10 +140,9 @@ template struct lvalue_test typedef typename Iterator::reference reference; typedef typename Iterator::value_type value_type; # endif - static_assert(boost::is_reference::value, ""); - BOOST_STATIC_ASSERT((boost::is_same::value - || boost::is_same::value - )); + static_assert(std::is_reference::value, ""); + static_assert(std::is_same::value + || std::is_same::value); } }; @@ -179,7 +176,7 @@ void forward_iterator_test(Iterator i, T v1, T v2) // borland doesn't allow non-type template parameters # if !defined(BOOST_BORLANDC) || (BOOST_BORLANDC > 0x551) - lvalue_test<(boost::is_pointer::value)>::check(i); + lvalue_test::value>::check(i); #endif } diff --git a/test/iterator_facade.cpp b/test/iterator_facade.cpp index 0dcba1e0f..fcf73b64b 100644 --- a/test/iterator_facade.cpp +++ b/test/iterator_facade.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include // This is a really, really limited test so far. All we're doing @@ -120,7 +120,7 @@ struct wrapper { } template wrapper(const wrapper& other, - typename boost::enable_if< boost::is_convertible >::type* = 0) + typename boost::enable_if< std::is_convertible >::type* = 0) : m_x(other.m_x) { } }; @@ -146,7 +146,7 @@ struct iterator_with_proxy_reference template void same_type(U const&) -{ static_assert(boost::is_same::value, ""); } +{ static_assert(std::is_same::value, ""); } template struct abstract_iterator From 5076b544b7d3221d9ad28e573276f75aba595354 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 23:13:58 +0300 Subject: [PATCH 18/56] test/pointee --- include/boost/pending/iterator_tests.hpp | 2 +- test/pointee.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/pending/iterator_tests.hpp b/include/boost/pending/iterator_tests.hpp index 4105553ac..a810a3b3d 100644 --- a/include/boost/pending/iterator_tests.hpp +++ b/include/boost/pending/iterator_tests.hpp @@ -142,7 +142,7 @@ template struct lvalue_test # endif static_assert(std::is_reference::value, ""); static_assert(std::is_same::value - || std::is_same::value); + || std::is_same::value, ""); } }; diff --git a/test/pointee.cpp b/test/pointee.cpp index 32e34962f..4e545990e 100644 --- a/test/pointee.cpp +++ b/test/pointee.cpp @@ -3,10 +3,10 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include -#include #include "static_assert_same.hpp" #include #include +#include template struct proxy_ptr @@ -27,7 +27,7 @@ struct proxy_ref_ptr : proxy_ptr template struct proxy_value_ptr : proxy_ptr { - typedef typename boost::add_const::type element_type; + typedef typename std::add_const::type element_type; }; struct X { From e927fe777f135a714975c318ca32cbdb0ca8061a Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 23:31:13 +0300 Subject: [PATCH 19/56] is_* --- include/boost/iterator/is_iterator.hpp | 12 +++++------- include/boost/iterator/is_lvalue_iterator.hpp | 9 ++++----- include/boost/iterator/is_readable_iterator.hpp | 7 +++---- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/include/boost/iterator/is_iterator.hpp b/include/boost/iterator/is_iterator.hpp index 5740b19eb..65fabeb11 100644 --- a/include/boost/iterator/is_iterator.hpp +++ b/include/boost/iterator/is_iterator.hpp @@ -16,15 +16,13 @@ #include #include -#include -#include -#include #include -#include #if !defined(BOOST_NO_CXX17_ITERATOR_TRAITS) #include #endif +#include + #ifdef BOOST_HAS_PRAGMA_ONCE #pragma once #endif @@ -68,9 +66,9 @@ struct is_iterator_impl : template< typename T > struct is_iterator_impl< T* > : - public boost::conjunction< - boost::is_complete< T >, - boost::negation< boost::is_function< T > > + public std::conjunction< + boost::is_complete + , std::negation> >::type { }; diff --git a/include/boost/iterator/is_lvalue_iterator.hpp b/include/boost/iterator/is_lvalue_iterator.hpp index 46f0483e2..99038e7a5 100644 --- a/include/boost/iterator/is_lvalue_iterator.hpp +++ b/include/boost/iterator/is_lvalue_iterator.hpp @@ -6,15 +6,14 @@ #include -#include #include #include #include #include +#include // should be the last #includes -#include #include #ifndef BOOST_NO_IS_CONVERTIBLE @@ -54,7 +53,7 @@ namespace detail // convertible to Value const& struct conversion_eater { - conversion_eater(typename add_lvalue_reference::type); + conversion_eater(typename std::add_lvalue_reference::type); }; static char tester(conversion_eater, int); @@ -137,14 +136,14 @@ namespace detail } // namespace detail template< typename T > struct is_lvalue_iterator -: public ::boost::integral_constant::value> +: public std::integral_constant::value> { public: BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_lvalue_iterator,(T)) }; template< typename T > struct is_non_const_lvalue_iterator -: public ::boost::integral_constant::value> +: public std::integral_constant::value> { public: BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_non_const_lvalue_iterator,(T)) diff --git a/include/boost/iterator/is_readable_iterator.hpp b/include/boost/iterator/is_readable_iterator.hpp index 26827c4c5..f94b79ba8 100644 --- a/include/boost/iterator/is_readable_iterator.hpp +++ b/include/boost/iterator/is_readable_iterator.hpp @@ -6,14 +6,13 @@ #include #include -#include #include #include +#include // should be the last #include -#include #include #ifndef BOOST_NO_IS_CONVERTIBLE @@ -29,7 +28,7 @@ namespace detail template struct is_readable_iterator_impl { - static char tester(typename add_lvalue_reference::type, int); + static char tester(typename std::add_lvalue_reference::type, int); static char (& tester(any_conversion_eater, ...) )[2]; template @@ -100,7 +99,7 @@ namespace detail } // namespace detail template< typename T > struct is_readable_iterator -: public ::boost::integral_constant::value> +: public std::integral_constant::value> { public: BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_readable_iterator,(T)) From b644d2cd71a60a9951e6dd8b8a79d23ffdb39e42 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 23:36:21 +0300 Subject: [PATCH 20/56] test --- include/boost/iterator/is_iterator.hpp | 8 ++++---- test/counting_iterator_test.cpp | 5 ++--- test/indirect_iter_member_types.cpp | 18 +++++++++--------- test/iterator_traits_test.cpp | 5 ++--- test/minimum_category.cpp | 4 ++-- test/static_assert_same.hpp | 4 ++-- 6 files changed, 21 insertions(+), 23 deletions(-) diff --git a/include/boost/iterator/is_iterator.hpp b/include/boost/iterator/is_iterator.hpp index 65fabeb11..37cf19711 100644 --- a/include/boost/iterator/is_iterator.hpp +++ b/include/boost/iterator/is_iterator.hpp @@ -66,10 +66,10 @@ struct is_iterator_impl : template< typename T > struct is_iterator_impl< T* > : - public std::conjunction< - boost::is_complete - , std::negation> - >::type + std::integral_constant< + bool + , boost::is_complete::value && !std::is_function::value + > { }; diff --git a/test/counting_iterator_test.cpp b/test/counting_iterator_test.cpp index 09d4295b5..d26938a78 100644 --- a/test/counting_iterator_test.cpp +++ b/test/counting_iterator_test.cpp @@ -30,13 +30,12 @@ #include #include -#include #include #include #include -#include #include +#include #include #ifndef BOOST_BORLANDC # include @@ -68,7 +67,7 @@ struct unsigned_assert_nonnegative template struct assert_nonnegative - : boost::conditional< + : std::conditional< std::numeric_limits::is_signed , signed_assert_nonnegative , unsigned_assert_nonnegative diff --git a/test/indirect_iter_member_types.cpp b/test/indirect_iter_member_types.cpp index 927fea344..246399eb2 100644 --- a/test/indirect_iter_member_types.cpp +++ b/test/indirect_iter_member_types.cpp @@ -12,7 +12,7 @@ #include #include "static_assert_same.hpp" -#include +#include struct zow { }; @@ -38,10 +38,10 @@ int main() STATIC_ASSERT_SAME(Iter::pointer, int*); STATIC_ASSERT_SAME(Iter::difference_type, std::ptrdiff_t); - BOOST_STATIC_ASSERT((boost::is_convertible::value)); - BOOST_STATIC_ASSERT((boost::is_convertible::type, - boost::random_access_traversal_tag>::value)); + static_assert(std::is_convertible::value); + static_assert(std::is_convertible::type, + boost::random_access_traversal_tag>::value); } { typedef boost::indirect_iterator Iter; @@ -69,10 +69,10 @@ int main() STATIC_ASSERT_SAME(Iter::difference_type, std::ptrdiff_t); - BOOST_STATIC_ASSERT((boost::is_convertible::value)); - BOOST_STATIC_ASSERT((boost::is_convertible::type, - boost::random_access_traversal_tag>::value)); + static_assert(std::is_convertible::value); + static_assert(std::is_convertible::type, + boost::random_access_traversal_tag>::value); } { typedef boost::indirect_iterator Iter; diff --git a/test/iterator_traits_test.cpp b/test/iterator_traits_test.cpp index d59e4e0af..d2b84c38f 100644 --- a/test/iterator_traits_test.cpp +++ b/test/iterator_traits_test.cpp @@ -20,14 +20,13 @@ // reference type from operator* (David Abrahams) // 19 Jan 2001 Initial version with iterator operators (David Abrahams) -#include #include #include #include #include #include #include -#include +#include // A UDT for which we can specialize std::iterator_traits on // compilers which don't support partial specialization. There's no @@ -97,7 +96,7 @@ template <> struct assertion template struct assert_same - : assertion<(::boost::is_same::value)> + : assertion<(std::is_same::value)> { }; diff --git a/test/minimum_category.cpp b/test/minimum_category.cpp index 3f89d6c6a..54f7e7a87 100644 --- a/test/minimum_category.cpp +++ b/test/minimum_category.cpp @@ -6,10 +6,10 @@ #include #include -#include #include +#include -using boost::is_same; +using std::is_same; using boost::iterators::minimum_category; int main(int, char*[]) diff --git a/test/static_assert_same.hpp b/test/static_assert_same.hpp index fb236324c..2911845c5 100644 --- a/test/static_assert_same.hpp +++ b/test/static_assert_same.hpp @@ -5,9 +5,9 @@ #ifndef STATIC_ASSERT_SAME_DWA2003530_HPP # define STATIC_ASSERT_SAME_DWA2003530_HPP -#include +#include -#define STATIC_ASSERT_SAME( T1,T2 ) static_assert(::boost::is_same< T1, T2 >::value, "") +#define STATIC_ASSERT_SAME( T1,T2 ) static_assert(std::is_same::value, "") template struct static_assert_same From 5ad5d511d94283532e780aa02ec67583061064c5 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 23:47:32 +0300 Subject: [PATCH 21/56] zip_iterator --- include/boost/iterator/zip_iterator.hpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/boost/iterator/zip_iterator.hpp b/include/boost/iterator/zip_iterator.hpp index f5780aeb8..f97fb29a2 100644 --- a/include/boost/iterator/zip_iterator.hpp +++ b/include/boost/iterator/zip_iterator.hpp @@ -8,7 +8,6 @@ #ifndef BOOST_ZIP_ITERATOR_TMB_07_13_2003_HPP_ # define BOOST_ZIP_ITERATOR_TMB_07_13_2003_HPP_ -#include #include #include #include // for enable_if_convertible @@ -19,9 +18,6 @@ #include // for std::pair #include // for backward compatibility -#include -#include - #include #include #include @@ -83,7 +79,7 @@ namespace iterators { struct result { typedef typename - remove_cv::type>::type + std::remove_cv::type>::type iterator; typedef typename iterator_reference::type type; From ed96afb533beddc94cd1db1d55cd48bc9d5c6072 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Sun, 9 Jun 2024 23:48:36 +0300 Subject: [PATCH 22/56] config_def --- include/boost/iterator/detail/config_def.hpp | 4 ++-- test/indirect_iter_member_types.cpp | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/boost/iterator/detail/config_def.hpp b/include/boost/iterator/detail/config_def.hpp index 277e0d5a2..d9f4742c0 100644 --- a/include/boost/iterator/detail/config_def.hpp +++ b/include/boost/iterator/detail/config_def.hpp @@ -92,7 +92,7 @@ # define BOOST_NO_IS_CONVERTIBLE_TEMPLATE // The following program fails to compile: # if 0 // test code - #include + #include template struct foo { @@ -104,7 +104,7 @@ T p; }; - bool x = boost::is_convertible, foo >::value; + bool x = std::is_convertible, foo >::value; # endif #endif diff --git a/test/indirect_iter_member_types.cpp b/test/indirect_iter_member_types.cpp index 246399eb2..261a51054 100644 --- a/test/indirect_iter_member_types.cpp +++ b/test/indirect_iter_member_types.cpp @@ -39,9 +39,11 @@ int main() STATIC_ASSERT_SAME(Iter::difference_type, std::ptrdiff_t); static_assert(std::is_convertible::value); + std::random_access_iterator_tag>::value, + ""); static_assert(std::is_convertible::type, - boost::random_access_traversal_tag>::value); + boost::random_access_traversal_tag>::value, + ""); } { typedef boost::indirect_iterator Iter; @@ -70,9 +72,11 @@ int main() STATIC_ASSERT_SAME(Iter::difference_type, std::ptrdiff_t); static_assert(std::is_convertible::value); + std::random_access_iterator_tag>::value, + ""); static_assert(std::is_convertible::type, - boost::random_access_traversal_tag>::value); + boost::random_access_traversal_tag>::value, + ""); } { typedef boost::indirect_iterator Iter; From fafb68bbc245ce663c49aa099302891c6fbba093 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Mon, 10 Jun 2024 00:09:05 +0300 Subject: [PATCH 23/56] transform_iterator --- include/boost/iterator/transform_iterator.hpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/include/boost/iterator/transform_iterator.hpp b/include/boost/iterator/transform_iterator.hpp index 15eea8bad..797b897b3 100644 --- a/include/boost/iterator/transform_iterator.hpp +++ b/include/boost/iterator/transform_iterator.hpp @@ -12,21 +12,11 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include #include +#include #include -#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) -#include -#endif - #include @@ -99,7 +89,7 @@ namespace iterators { #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) // don't provide this constructor if UnaryFunc is a // function pointer type, since it will be 0. Too dangerous. - static_assert(is_class::value, ""); + static_assert(std::is_class::value, ""); #endif } @@ -146,7 +136,7 @@ namespace iterators { // crash. template inline typename iterators::enable_if< - is_class // We should probably find a cheaper test than is_class<> + std::is_class // We should probably find a cheaper test than is_class<> , transform_iterator >::type make_transform_iterator(Iterator it) From 80d5883601ddba05e74be22b51ddd7fd6433c25e Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Mon, 10 Jun 2024 00:10:51 +0300 Subject: [PATCH 24/56] iterator_facade --- include/boost/iterator/iterator_facade.hpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 12383309d..104d5f401 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -951,9 +951,7 @@ namespace iterators { BOOST_ITERATOR_FACADE_INTEROP_HEAD(inline, op, result_type) \ { \ /* For those compilers that do not support enable_if */ \ - BOOST_STATIC_ASSERT(( \ - is_interoperable< Derived1, Derived2 >::value \ - )); \ + static_assert(is_interoperable::value, ""); \ return_prefix iterator_core_access::base_op( \ *static_cast(&lhs) \ , *static_cast(&rhs) \ @@ -979,11 +977,12 @@ namespace iterators { BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(inline, op, result_type) \ { \ /* For those compilers that do not support enable_if */ \ - BOOST_STATIC_ASSERT(( \ + static_assert( \ is_interoperable< Derived1, Derived2 >::value && \ boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived1 >::type, random_access_traversal_tag >::value && \ - boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived2 >::type, random_access_traversal_tag >::value \ - )); \ + boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived2 >::type, random_access_traversal_tag >::value, \ + "" \ + ); \ return_prefix iterator_core_access::base_op( \ *static_cast(&lhs) \ , *static_cast(&rhs) \ From 315001916388145cfadc0fb7b8f0b63884401a82 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Mon, 10 Jun 2024 00:20:56 +0300 Subject: [PATCH 25/56] interoperable --- include/boost/iterator/interoperable.hpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/include/boost/iterator/interoperable.hpp b/include/boost/iterator/interoperable.hpp index 6f3c872a2..4bb8c8967 100644 --- a/include/boost/iterator/interoperable.hpp +++ b/include/boost/iterator/interoperable.hpp @@ -7,11 +7,11 @@ #ifndef BOOST_INTEROPERABLE_23022003THW_HPP # define BOOST_INTEROPERABLE_23022003THW_HPP +# include + # include # include -# include - # include // must appear last namespace boost { @@ -33,13 +33,10 @@ namespace iterators { // template struct is_interoperable -# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY - : mpl::true_ -# else - : mpl::or_< - is_convertible< A, B > - , is_convertible< B, A > > -# endif + : std::integral_constant< + bool + , std::is_convertible< A, B >::value || std::is_convertible< B, A >::value + > { }; From 26d7f7cbdbbc86723a736a912676faea788c60a5 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Mon, 10 Jun 2024 00:21:47 +0300 Subject: [PATCH 26/56] facade_iterator_category --- .../detail/facade_iterator_category.hpp | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/include/boost/iterator/detail/facade_iterator_category.hpp b/include/boost/iterator/detail/facade_iterator_category.hpp index bf7257a10..5e7cef106 100644 --- a/include/boost/iterator/detail/facade_iterator_category.hpp +++ b/include/boost/iterator/detail/facade_iterator_category.hpp @@ -14,9 +14,6 @@ # include # include -# include -# include -# include # include // try to keep this last @@ -81,24 +78,24 @@ template struct iterator_facade_default_category : mpl::eval_if< mpl::and_< - is_reference - , is_convertible + std::is_reference + , std::is_convertible > , mpl::eval_if< - is_convertible + std::is_convertible , mpl::identity , mpl::if_< - is_convertible + std::is_convertible , std::bidirectional_iterator_tag , std::forward_iterator_tag > > , typename mpl::eval_if< mpl::and_< - is_convertible + std::is_convertible // check for readability - , is_convertible + , std::is_convertible > , mpl::identity , mpl::identity @@ -111,15 +108,15 @@ struct iterator_facade_default_category template struct is_iterator_category : mpl::or_< - is_convertible - , is_convertible + std::is_convertible + , std::is_convertible > { }; template struct is_iterator_traversal - : is_convertible + : std::is_convertible {}; // @@ -135,11 +132,11 @@ struct iterator_category_with_traversal // Make sure this isn't used to build any categories where // convertibility to Traversal is redundant. Should just use the // Category element in that case. - BOOST_STATIC_ASSERT(( - !is_convertible< + static_assert( + !std::is_convertible< typename iterator_category_to_traversal::type , Traversal - >::value)); + >::value, ""); static_assert(is_iterator_category::value, ""); static_assert(!is_iterator_category::value, ""); From 11c6da55d4c2f3d10a5962c32485d05220a3d996 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Mon, 10 Jun 2024 00:22:22 +0300 Subject: [PATCH 27/56] iterator_categories --- include/boost/iterator/filter_iterator.hpp | 2 +- .../boost/iterator/iterator_categories.hpp | 25 +++++++++---------- test/iterator_adaptor_test.cpp | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/include/boost/iterator/filter_iterator.hpp b/include/boost/iterator/filter_iterator.hpp index 5540fe7fc..db81fce03 100644 --- a/include/boost/iterator/filter_iterator.hpp +++ b/include/boost/iterator/filter_iterator.hpp @@ -31,7 +31,7 @@ namespace iterators { , Iterator , use_default , typename mpl::if_< - is_convertible< + std::is_convertible< typename iterator_traversal::type , random_access_traversal_tag > diff --git a/include/boost/iterator/iterator_categories.hpp b/include/boost/iterator/iterator_categories.hpp index 910f871de..1fc53e626 100644 --- a/include/boost/iterator/iterator_categories.hpp +++ b/include/boost/iterator/iterator_categories.hpp @@ -16,8 +16,7 @@ # include # include -# include - +#include #include namespace boost { @@ -75,19 +74,19 @@ namespace detail template struct old_category_to_traversal : mpl::eval_if< - is_convertible + std::is_convertible , mpl::identity , mpl::eval_if< - is_convertible + std::is_convertible , mpl::identity , mpl::eval_if< - is_convertible + std::is_convertible , mpl::identity , mpl::eval_if< - is_convertible + std::is_convertible , mpl::identity , mpl::eval_if< - is_convertible + std::is_convertible , mpl::identity , void > @@ -105,7 +104,7 @@ namespace detail template struct iterator_category_to_traversal : mpl::eval_if< // if already convertible to a traversal tag, we're done. - is_convertible + std::is_convertible , mpl::identity , boost::iterators::detail::old_category_to_traversal > @@ -144,19 +143,19 @@ struct iterator_traversal template struct pure_traversal_tag : mpl::eval_if< - is_convertible + std::is_convertible , mpl::identity , mpl::eval_if< - is_convertible + std::is_convertible , mpl::identity , mpl::eval_if< - is_convertible + std::is_convertible , mpl::identity , mpl::eval_if< - is_convertible + std::is_convertible , mpl::identity , mpl::eval_if< - is_convertible + std::is_convertible , mpl::identity , void > diff --git a/test/iterator_adaptor_test.cpp b/test/iterator_adaptor_test.cpp index f64939daf..ef5b9a482 100644 --- a/test/iterator_adaptor_test.cpp +++ b/test/iterator_adaptor_test.cpp @@ -209,7 +209,7 @@ main() test = static_assert_same::value; test = static_assert_same::value; #if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) - static_assert(boost::is_convertible::value, ""); + static_assert(std::is_convertible::value, ""); #endif } From 85a6cadce03cd49f2f3e2de0073b72b90e25fc16 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Mon, 10 Jun 2024 00:38:48 +0300 Subject: [PATCH 28/56] iterator_facade --- .../boost/iterator/iterator_archetypes.hpp | 2 +- include/boost/iterator/iterator_facade.hpp | 23 ----------- test/filter_iterator_test.cpp | 9 ++--- test/is_convertible_fail.cpp | 3 +- test/unit_tests.cpp | 38 ++++++++++++------- 5 files changed, 31 insertions(+), 44 deletions(-) diff --git a/include/boost/iterator/iterator_archetypes.hpp b/include/boost/iterator/iterator_archetypes.hpp index e12a8b4ab..d46f2771d 100644 --- a/include/boost/iterator/iterator_archetypes.hpp +++ b/include/boost/iterator/iterator_archetypes.hpp @@ -113,7 +113,7 @@ namespace detail template struct operator_brackets : mpl::eval_if< - is_convertible + std::is_convertible , mpl::eval_if< archetypes::has_access< AccessCategory diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 104d5f401..e1f6d815e 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -230,7 +230,6 @@ namespace iterators { } // Provides writability of *r++ -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template typename iterators::enable_if< is_not_writable_postfix_increment_dereference_proxy< T >, @@ -240,28 +239,6 @@ namespace iterators { *this->stored_iterator = static_cast< T&& >(x); return *this; } -#else - template - typename iterators::enable_if< - is_not_writable_postfix_increment_dereference_proxy< T >, - writable_postfix_increment_dereference_proxy const& - >::type operator=(T const& x) const - { - *this->stored_iterator = x; - return *this; - } - - // This overload just in case only non-const objects are writable - template - typename iterators::enable_if< - is_not_writable_postfix_increment_dereference_proxy< T >, - writable_postfix_increment_dereference_proxy const& - >::type operator=(T& x) const - { - *this->stored_iterator = x; - return *this; - } -#endif private: Iterator stored_iterator; diff --git a/test/filter_iterator_test.cpp b/test/filter_iterator_test.cpp index cf850bcf7..e6e537eeb 100644 --- a/test/filter_iterator_test.cpp +++ b/test/filter_iterator_test.cpp @@ -15,7 +15,6 @@ #include #include -#include using boost::dummyT; @@ -229,12 +228,12 @@ int main() filter_iter(one_or_four(), array, array+N) , dummyT(1), dummyT(4)); - BOOST_STATIC_ASSERT( - (!boost::is_convertible< + static_assert( + !std::is_convertible< boost::iterator_traversal::type , boost::random_access_traversal_tag - >::value - )); + >::value, + ""); //# endif diff --git a/test/is_convertible_fail.cpp b/test/is_convertible_fail.cpp index 757b5c6ac..89255fc84 100644 --- a/test/is_convertible_fail.cpp +++ b/test/is_convertible_fail.cpp @@ -8,12 +8,13 @@ // #include #include +#include int main() { typedef boost::reverse_iterator rev_iter1; typedef boost::reverse_iterator rev_iter2; - return boost::is_convertible::value + return std::is_convertible::value ? boost::exit_failure : boost::exit_success; } diff --git a/test/unit_tests.cpp b/test/unit_tests.cpp index f91b7e877..bbb4bb8ef 100644 --- a/test/unit_tests.cpp +++ b/test/unit_tests.cpp @@ -6,6 +6,7 @@ #include "static_assert_same.hpp" +#include #include struct X { int a; }; @@ -37,32 +38,41 @@ void category_test() using namespace boost::iterators; using namespace boost::iterators::detail; - BOOST_STATIC_ASSERT(( - !boost::is_convertible< + static_assert( + !std::is_convertible< std::input_iterator_tag - , input_output_iterator_tag>::value)); + , input_output_iterator_tag>::value, + ""); - BOOST_STATIC_ASSERT(( - !boost::is_convertible< + static_assert( + !std::is_convertible< std::output_iterator_tag - , input_output_iterator_tag>::value)); + , input_output_iterator_tag + >::value, + ""); - BOOST_STATIC_ASSERT(( - boost::is_convertible< + static_assert( + std::is_convertible< input_output_iterator_tag - , std::input_iterator_tag>::value)); + , std::input_iterator_tag + >::value, + ""); - BOOST_STATIC_ASSERT(( - boost::is_convertible< + static_assert( + std::is_convertible< input_output_iterator_tag - , std::output_iterator_tag>::value)); + , std::output_iterator_tag + >::value, + ""); #if 0 // This seems wrong; we're not advertising // input_output_iterator_tag are we? - BOOST_STATIC_ASSERT(( + static_assert( boost::is_convertible< std::forward_iterator_tag - , input_output_iterator_tag>::value)); + , input_output_iterator_tag + >::value, + ""); #endif int test = static_assert_min_cat< From c2cee6faf7bd188575be910eb33fdd8146e96f01 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Mon, 10 Jun 2024 01:21:07 +0300 Subject: [PATCH 29/56] enable_if --- example/node_iterator2.hpp | 8 +- example/node_iterator3.hpp | 8 +- include/boost/iterator/detail/enable_if.hpp | 83 ------------------- include/boost/iterator/filter_iterator.hpp | 4 +- include/boost/iterator/iterator_adaptor.hpp | 7 +- include/boost/iterator/iterator_facade.hpp | 22 ++--- include/boost/iterator/transform_iterator.hpp | 5 +- test/filter_iterator_test.cpp | 2 +- test/iterator_facade.cpp | 3 +- 9 files changed, 25 insertions(+), 117 deletions(-) delete mode 100644 include/boost/iterator/detail/enable_if.hpp diff --git a/example/node_iterator2.hpp b/example/node_iterator2.hpp index 0c209151e..998fdba6a 100644 --- a/example/node_iterator2.hpp +++ b/example/node_iterator2.hpp @@ -8,10 +8,6 @@ # include # include -# ifndef BOOST_NO_SFINAE -# include -# endif - template class node_iter : public boost::iterator_facade< @@ -34,8 +30,8 @@ class node_iter node_iter( node_iter const& other # ifndef BOOST_NO_SFINAE - , typename boost::enable_if< - std::is_convertible + , typename std::enable_if< + std::is_convertible::value , enabler >::type = enabler() # endif diff --git a/example/node_iterator3.hpp b/example/node_iterator3.hpp index 16e5752e7..a0b5d2f11 100644 --- a/example/node_iterator3.hpp +++ b/example/node_iterator3.hpp @@ -8,10 +8,6 @@ # include # include -# ifndef BOOST_NO_SFINAE -# include -# endif - template class node_iter : public boost::iterator_adaptor< @@ -39,8 +35,8 @@ class node_iter node_iter( node_iter const& other # ifndef BOOST_NO_SFINAE - , typename boost::enable_if< - std::is_convertible + , typename std::enable_if< + std::is_convertible::value , enabler >::type = enabler() # endif diff --git a/include/boost/iterator/detail/enable_if.hpp b/include/boost/iterator/detail/enable_if.hpp deleted file mode 100644 index dcc9adb73..000000000 --- a/include/boost/iterator/detail/enable_if.hpp +++ /dev/null @@ -1,83 +0,0 @@ -// (C) Copyright David Abrahams 2002. -// (C) Copyright Jeremy Siek 2002. -// (C) Copyright Thomas Witt 2002. -// 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) -#ifndef BOOST_ENABLE_IF_23022003THW_HPP -#define BOOST_ENABLE_IF_23022003THW_HPP - -#include -#include -#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) -#include -#endif - -// -// Boost iterators uses its own enable_if cause we need -// special semantics for deficient compilers. -// 23/02/03 thw -// - -namespace boost -{ - - namespace iterators - { - // - // Base machinery for all kinds of enable if - // - template - struct enabled - { - template - struct base - { - typedef T type; - }; - }; - - // - // For compilers that don't support "Substitution Failure Is Not An Error" - // enable_if falls back to always enabled. See comments - // on operator implementation for consequences. - // - template<> - struct enabled - { - template - struct base - { -#ifdef BOOST_NO_SFINAE - typedef T type; - - // This way to do it would give a nice error message containing - // invalid overload, but has the big disadvantage that - // there is no reference to user code in the error message. - // - // struct invalid_overload; - // typedef invalid_overload type; - // -#endif - }; - }; - - - template - struct enable_if -# if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE) - : enabled<(Cond::value)>::template base -# else - : boost::type_identity -# endif - { - }; - - } // namespace iterators - -} // namespace boost - -#include - -#endif // BOOST_ENABLE_IF_23022003THW_HPP diff --git a/include/boost/iterator/filter_iterator.hpp b/include/boost/iterator/filter_iterator.hpp index db81fce03..44ac1e7d9 100644 --- a/include/boost/iterator/filter_iterator.hpp +++ b/include/boost/iterator/filter_iterator.hpp @@ -119,8 +119,8 @@ namespace iterators { template inline filter_iterator make_filter_iterator( - typename iterators::enable_if< - is_class + typename std::enable_if< + is_class::value , Iterator >::type x , Iterator end = Iterator()) diff --git a/include/boost/iterator/iterator_adaptor.hpp b/include/boost/iterator/iterator_adaptor.hpp index 3cf553636..65d37b3dd 100644 --- a/include/boost/iterator/iterator_adaptor.hpp +++ b/include/boost/iterator/iterator_adaptor.hpp @@ -13,7 +13,6 @@ #include #include -#include #include #include @@ -81,7 +80,7 @@ namespace iterators { // false positives for user/library defined iterator types. See comments // on operator implementation for consequences. // -# if defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE) +# if defined(BOOST_NO_SFINAE) template struct enable_if_convertible @@ -93,8 +92,8 @@ namespace iterators { template struct enable_if_convertible - : iterators::enable_if< - std::is_convertible + : std::enable_if< + std::is_convertible::value , boost::iterators::detail::enable_type > {}; diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index e1f6d815e..1f3a220e2 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -13,7 +13,6 @@ #include #include -#include #include #include @@ -66,8 +65,8 @@ namespace iterators { , class Return > struct enable_if_interoperable : - public boost::iterators::enable_if< - is_interoperable< Facade1, Facade2 > + public std::enable_if< + is_interoperable::value , Return > {}; @@ -81,12 +80,12 @@ namespace iterators { , class Return > struct enable_if_interoperable_and_random_access_traversal : - public boost::iterators::enable_if< + public std::enable_if< mpl::and_< is_interoperable< Facade1, Facade2 > , is_traversal_at_least< typename iterator_category< Facade1 >::type, random_access_traversal_tag > , is_traversal_at_least< typename iterator_category< Facade2 >::type, random_access_traversal_tag > - > + >::value , Return > {}; @@ -231,8 +230,8 @@ namespace iterators { // Provides writability of *r++ template - typename iterators::enable_if< - is_not_writable_postfix_increment_dereference_proxy< T >, + typename std::enable_if< + is_not_writable_postfix_increment_dereference_proxy::value, writable_postfix_increment_dereference_proxy const& >::type operator=(T&& x) const { @@ -529,9 +528,12 @@ namespace iterators { # define BOOST_ITERATOR_FACADE_PLUS_HEAD(prefix,args) \ template \ - prefix typename boost::iterators::enable_if< \ - boost::iterators::detail::is_traversal_at_least< TC, boost::iterators::random_access_traversal_tag >, \ - Derived \ + prefix typename std::enable_if< \ + boost::iterators::detail::is_traversal_at_least< \ + TC \ + , boost::iterators::random_access_traversal_tag \ + >::value \ + , Derived \ >::type operator+ args // diff --git a/include/boost/iterator/transform_iterator.hpp b/include/boost/iterator/transform_iterator.hpp index 797b897b3..cab87bc8c 100644 --- a/include/boost/iterator/transform_iterator.hpp +++ b/include/boost/iterator/transform_iterator.hpp @@ -9,7 +9,6 @@ #include #include -#include #include #include #include @@ -135,8 +134,8 @@ namespace iterators { // function pointer in the iterator be 0, leading to a runtime // crash. template - inline typename iterators::enable_if< - std::is_class // We should probably find a cheaper test than is_class<> + inline typename std::enable_if< + std::is_class::value // We should probably find a cheaper test than is_class<> , transform_iterator >::type make_transform_iterator(Iterator it) diff --git a/test/filter_iterator_test.cpp b/test/filter_iterator_test.cpp index e6e537eeb..b0b1caf09 100644 --- a/test/filter_iterator_test.cpp +++ b/test/filter_iterator_test.cpp @@ -7,13 +7,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include using boost::dummyT; diff --git a/test/iterator_facade.cpp b/test/iterator_facade.cpp index fcf73b64b..09fd88e9e 100644 --- a/test/iterator_facade.cpp +++ b/test/iterator_facade.cpp @@ -9,7 +9,6 @@ #include #include -#include // This is a really, really limited test so far. All we're doing // right now is checking that the postfix++ proxy for single-pass @@ -120,7 +119,7 @@ struct wrapper { } template wrapper(const wrapper& other, - typename boost::enable_if< std::is_convertible >::type* = 0) + typename std::enable_if< std::is_convertible::value >::type* = 0) : m_x(other.m_x) { } }; From 67060a0a46cb218a3dc1526a79a9b85652336b39 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Mon, 10 Jun 2024 13:24:04 +0300 Subject: [PATCH 30/56] Require SFINAE & decltype. --- example/node_iterator2.hpp | 2 -- example/node_iterator3.hpp | 2 -- include/boost/iterator/detail/config_def.hpp | 2 +- include/boost/iterator/iterator_adaptor.hpp | 12 ------------ 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/example/node_iterator2.hpp b/example/node_iterator2.hpp index 998fdba6a..86bfc9e35 100644 --- a/example/node_iterator2.hpp +++ b/example/node_iterator2.hpp @@ -29,12 +29,10 @@ class node_iter template node_iter( node_iter const& other -# ifndef BOOST_NO_SFINAE , typename std::enable_if< std::is_convertible::value , enabler >::type = enabler() -# endif ) : m_node(other.m_node) {} diff --git a/example/node_iterator3.hpp b/example/node_iterator3.hpp index a0b5d2f11..9d224b43c 100644 --- a/example/node_iterator3.hpp +++ b/example/node_iterator3.hpp @@ -34,12 +34,10 @@ class node_iter template node_iter( node_iter const& other -# ifndef BOOST_NO_SFINAE , typename std::enable_if< std::is_convertible::value , enabler >::type = enabler() -# endif ) : super_t(other.base()) {} diff --git a/include/boost/iterator/detail/config_def.hpp b/include/boost/iterator/detail/config_def.hpp index d9f4742c0..e9861ef76 100644 --- a/include/boost/iterator/detail/config_def.hpp +++ b/include/boost/iterator/detail/config_def.hpp @@ -110,7 +110,7 @@ #endif -#if !defined(BOOST_MSVC) && (defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE)) +#if !defined(BOOST_MSVC) && (defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE)) # define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY #endif diff --git a/include/boost/iterator/iterator_adaptor.hpp b/include/boost/iterator/iterator_adaptor.hpp index 65d37b3dd..2fcecb329 100644 --- a/include/boost/iterator/iterator_adaptor.hpp +++ b/include/boost/iterator/iterator_adaptor.hpp @@ -80,16 +80,6 @@ namespace iterators { // false positives for user/library defined iterator types. See comments // on operator implementation for consequences. // -# if defined(BOOST_NO_SFINAE) - - template - struct enable_if_convertible - { - typedef boost::iterators::detail::enable_type type; - }; - -# else - template struct enable_if_convertible : std::enable_if< @@ -98,8 +88,6 @@ namespace iterators { > {}; -# endif - // // Default template argument handling for iterator_adaptor // From 49d76ac72796ff3bb0e79ab23d9674240391a395 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Mon, 10 Jun 2024 18:09:50 +0300 Subject: [PATCH 31/56] CXX11 --- test/function_input_iterator_test.cpp | 5 ----- test/function_output_iterator_test.cpp | 2 -- 2 files changed, 7 deletions(-) diff --git a/test/function_input_iterator_test.cpp b/test/function_input_iterator_test.cpp index f64e9f59d..6668d8332 100644 --- a/test/function_input_iterator_test.cpp +++ b/test/function_input_iterator_test.cpp @@ -11,14 +11,12 @@ #include -#if !defined(BOOST_NO_CXX11_DECLTYPE) // Force boost::result_of use decltype, even on compilers that don't support N3276. // This enables this test to also verify if the iterator works with lambdas // on such compilers with this config macro. Note that without the macro result_of // (and consequently the iterator) is guaranteed to _not_ work, so this case is not // worth testing anyway. #define BOOST_RESULT_OF_USE_DECLTYPE -#endif #include #include @@ -108,8 +106,6 @@ int main() BOOST_TEST_EQ(*it3, 54); } -#if !defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \ - && defined(BOOST_RESULT_OF_USE_DECLTYPE) // test the iterator with lambda expressions int num = 42; auto lambda_generator = [&num] { return num++; }; @@ -123,7 +119,6 @@ int main() BOOST_TEST_EQ(generated.size(), 10u); for(std::size_t i = 0; i != 10; ++i) BOOST_TEST_EQ(generated[i], static_cast(42 + i)); -#endif // BOOST_NO_CXX11_LAMBDAS return boost::report_errors(); } diff --git a/test/function_output_iterator_test.cpp b/test/function_output_iterator_test.cpp index c18592d63..c55c16080 100644 --- a/test/function_output_iterator_test.cpp +++ b/test/function_output_iterator_test.cpp @@ -44,7 +44,6 @@ int main() BOOST_TEST_EQ(n, 6); } -#if !defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) { int n = 0; auto it = boost::iterators::make_function_output_iterator([&n](int x) { n -= x; }); @@ -57,7 +56,6 @@ int main() BOOST_TEST_EQ(n, -6); } -#endif #if defined(__cpp_lib_concepts) && ( __cpp_lib_concepts >= 202002L ) { From 829a20d3340cb68ea27819f397f138007f459706 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Mon, 10 Jun 2024 21:38:53 +0300 Subject: [PATCH 32/56] Return BOOST_NOEXCEPT --- include/boost/iterator/function_output_iterator.hpp | 4 ++-- test/is_iterator.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/boost/iterator/function_output_iterator.hpp b/include/boost/iterator/function_output_iterator.hpp index ad4adc390..d562475ce 100644 --- a/include/boost/iterator/function_output_iterator.hpp +++ b/include/boost/iterator/function_output_iterator.hpp @@ -27,7 +27,7 @@ namespace iterators { class output_proxy { public: - explicit output_proxy(UnaryFunction& f) noexcept : m_f(f) { } + explicit output_proxy(UnaryFunction& f) BOOST_NOEXCEPT : m_f(f) { } template @@ -39,7 +39,7 @@ namespace iterators { return *this; } - BOOST_DEFAULTED_FUNCTION(output_proxy(output_proxy const& that), noexcept : m_f(that.m_f) {}) + BOOST_DEFAULTED_FUNCTION(output_proxy(output_proxy const& that), BOOST_NOEXCEPT : m_f(that.m_f) {}) BOOST_DELETED_FUNCTION(output_proxy& operator=(output_proxy const&)) private: diff --git a/test/is_iterator.cpp b/test/is_iterator.cpp index 7d67dda13..a5aba3254 100644 --- a/test/is_iterator.cpp +++ b/test/is_iterator.cpp @@ -145,11 +145,11 @@ int main() BOOST_TEST(!boost::iterators::is_iterator< int complete::* >::value); BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) >::value); BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) const >::value); -#if defined(__cpp_noexcept_function_type) && (__cpp_noexcept_function_type >= 201510L) - BOOST_TEST(!boost::iterators::is_iterator< int (*)(int) noexcept >::value); - BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) noexcept >::value); - BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) const noexcept >::value); -#endif + + BOOST_TEST(!boost::iterators::is_iterator< int (*)(int) BOOST_NOEXCEPT >::value); + BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) BOOST_NOEXCEPT >::value); + BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) const BOOST_NOEXCEPT >::value); + BOOST_TEST(!boost::iterators::is_iterator< int[] >::value); BOOST_TEST(!boost::iterators::is_iterator< int[10] >::value); BOOST_TEST(!boost::iterators::is_iterator< int*[] >::value); From d2672c7b2fab9efc46abf5463771840edc95d72f Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Tue, 11 Jun 2024 14:00:35 +0300 Subject: [PATCH 33/56] Replace move with static_cast --- include/boost/iterator/filter_iterator.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/iterator/filter_iterator.hpp b/include/boost/iterator/filter_iterator.hpp index 44ac1e7d9..47e9fe9ec 100644 --- a/include/boost/iterator/filter_iterator.hpp +++ b/include/boost/iterator/filter_iterator.hpp @@ -56,13 +56,13 @@ namespace iterators { filter_iterator() { } filter_iterator(Predicate f, Iterator x, Iterator end_ = Iterator()) - : super_t(std::move(x)), m_predicate(std::move(f)), m_end(std::move(end_)) + : super_t(static_cast(x)), m_predicate(static_cast(f)), m_end(static_cast(end_)) { satisfy_predicate(); } filter_iterator(Iterator x, Iterator end_ = Iterator()) - : super_t(std::move(x)), m_predicate(), m_end(std::move(end_)) + : super_t(static_cast(x)), m_predicate(), m_end(static_cast(end_)) { // Pro8 is a little too aggressive about instantiating the // body of this function. @@ -113,7 +113,7 @@ namespace iterators { inline filter_iterator make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator()) { - return filter_iterator(std::move(f), std::move(x), std::move(end)); + return filter_iterator(static_cast(f), static_cast(x), static_cast(end)); } template @@ -125,7 +125,7 @@ namespace iterators { >::type x , Iterator end = Iterator()) { - return filter_iterator(std::move(x), std::move(end)); + return filter_iterator(static_cast(x), static_cast(end)); } } // namespace iterators From 6178ab33ac96a119d701b13344d8b95f1acab570 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Tue, 11 Jun 2024 14:02:30 +0300 Subject: [PATCH 34/56] Return boost::addressof. --- include/boost/iterator/function_input_iterator.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/iterator/function_input_iterator.hpp b/include/boost/iterator/function_input_iterator.hpp index 15175b245..dcda07cd1 100644 --- a/include/boost/iterator/function_input_iterator.hpp +++ b/include/boost/iterator/function_input_iterator.hpp @@ -10,9 +10,9 @@ #define BOOST_FUNCTION_INPUT_ITERATOR #include -#include #include +#include #include #include #include @@ -56,7 +56,7 @@ namespace iterators { public: function_object_input_iterator() {} function_object_input_iterator(Function & f_, Input state_ = Input()) - : f(std::addressof(f_)), state(state_) {} + : f(addressof(f_)), state(state_) {} void increment() { if (value) From c69c46fbf20c074b272d2591687908a99027bf3d Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Tue, 11 Jun 2024 14:04:17 +0300 Subject: [PATCH 35/56] Omitted. --- include/boost/iterator/iterator_adaptor.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/iterator/iterator_adaptor.hpp b/include/boost/iterator/iterator_adaptor.hpp index 2fcecb329..113ac6c30 100644 --- a/include/boost/iterator/iterator_adaptor.hpp +++ b/include/boost/iterator/iterator_adaptor.hpp @@ -171,7 +171,7 @@ namespace iterators { // versions of iterator_adaptor The idea is that when the user needs // to fiddle with the reference type it is highly likely that the // iterator category has to be adjusted as well. Any of the - // following four template arguments may be committed or explicitly + // following four template arguments may be omitted or explicitly // replaced by use_default. // // Value - if supplied, the value_type of the resulting iterator, unless From 49c9f0f7937f5944b8fdba23544a3f6c24065c7e Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Wed, 12 Jun 2024 14:12:10 +0300 Subject: [PATCH 36/56] Return is iterator CXX17 test. --- test/is_iterator.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/is_iterator.cpp b/test/is_iterator.cpp index a5aba3254..7d67dda13 100644 --- a/test/is_iterator.cpp +++ b/test/is_iterator.cpp @@ -145,11 +145,11 @@ int main() BOOST_TEST(!boost::iterators::is_iterator< int complete::* >::value); BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) >::value); BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) const >::value); - - BOOST_TEST(!boost::iterators::is_iterator< int (*)(int) BOOST_NOEXCEPT >::value); - BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) BOOST_NOEXCEPT >::value); - BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) const BOOST_NOEXCEPT >::value); - +#if defined(__cpp_noexcept_function_type) && (__cpp_noexcept_function_type >= 201510L) + BOOST_TEST(!boost::iterators::is_iterator< int (*)(int) noexcept >::value); + BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) noexcept >::value); + BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) const noexcept >::value); +#endif BOOST_TEST(!boost::iterators::is_iterator< int[] >::value); BOOST_TEST(!boost::iterators::is_iterator< int[10] >::value); BOOST_TEST(!boost::iterators::is_iterator< int*[] >::value); From 8e8ca3641b47818f4d371c604d3c0676c70af141 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Wed, 12 Jun 2024 15:56:49 +0300 Subject: [PATCH 37/56] Partially add static_assert messages. --- include/boost/iterator/counting_iterator.hpp | 2 +- .../detail/facade_iterator_category.hpp | 14 +- include/boost/iterator/filter_iterator.hpp | 2 +- include/boost/iterator/iterator_adaptor.hpp | 27 ++-- .../boost/iterator/iterator_archetypes.hpp | 4 +- .../boost/iterator/iterator_categories.hpp | 2 +- include/boost/iterator/iterator_concepts.hpp | 4 +- include/boost/iterator/iterator_facade.hpp | 13 +- include/boost/iterator/minimum_category.hpp | 5 +- include/boost/iterator/new_iterator_tests.hpp | 20 ++- include/boost/iterator/transform_iterator.hpp | 2 +- include/boost/pending/iterator_tests.hpp | 8 +- test/filter_iterator_test.cpp | 2 +- test/indirect_iter_member_types.cpp | 8 +- test/is_lvalue_iterator.cpp | 123 +++++++++++------- test/is_readable_iterator.cpp | 30 +++-- test/iterator_adaptor_test.cpp | 19 ++- test/iterator_facade.cpp | 2 +- 18 files changed, 177 insertions(+), 110 deletions(-) diff --git a/include/boost/iterator/counting_iterator.hpp b/include/boost/iterator/counting_iterator.hpp index 9af9e7752..3e5a594f0 100644 --- a/include/boost/iterator/counting_iterator.hpp +++ b/include/boost/iterator/counting_iterator.hpp @@ -34,7 +34,7 @@ namespace detail struct is_numeric_impl { // For a while, this wasn't true, but we rely on it below. This is a regression assert. - static_assert(std::is_integral::value, ""); + static_assert(std::is_integral::value, "std::is_integral is expected to be true"); # ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS diff --git a/include/boost/iterator/detail/facade_iterator_category.hpp b/include/boost/iterator/detail/facade_iterator_category.hpp index 5e7cef106..c6f48a896 100644 --- a/include/boost/iterator/detail/facade_iterator_category.hpp +++ b/include/boost/iterator/detail/facade_iterator_category.hpp @@ -136,13 +136,15 @@ struct iterator_category_with_traversal !std::is_convertible< typename iterator_category_to_traversal::type , Traversal - >::value, ""); + >::value, + "Category transformed to corresponding traversal must be convertible to Traversal." + ); - static_assert(is_iterator_category::value, ""); - static_assert(!is_iterator_category::value, ""); - static_assert(!is_iterator_traversal::value, ""); + static_assert(is_iterator_category::value, "Category must be an STL iterator category."); + static_assert(!is_iterator_category::value, "Traversal must not be an STL iterator category."); + static_assert(!is_iterator_traversal::value, "Category must not be a traversal tag."); # if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) - static_assert(is_iterator_traversal::value, ""); + static_assert(is_iterator_traversal::value, "Traversal must be a traversal tag."); # endif }; @@ -151,7 +153,7 @@ struct iterator_category_with_traversal template struct facade_iterator_category_impl { - static_assert(!is_iterator_category::value, ""); + static_assert(!is_iterator_category::value, "Traversal must not be an STL iterator category."); typedef typename iterator_facade_default_category< Traversal,ValueParam,Reference diff --git a/include/boost/iterator/filter_iterator.hpp b/include/boost/iterator/filter_iterator.hpp index 47e9fe9ec..187a92e39 100644 --- a/include/boost/iterator/filter_iterator.hpp +++ b/include/boost/iterator/filter_iterator.hpp @@ -69,7 +69,7 @@ namespace iterators { #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) // Don't allow use of this constructor if Predicate is a // function pointer type, since it will be 0. - static_assert(std::is_class::value, ""); + static_assert(std::is_class::value, "Predicate must be a class."); #endif satisfy_predicate(); } diff --git a/include/boost/iterator/iterator_adaptor.hpp b/include/boost/iterator/iterator_adaptor.hpp index 113ac6c30..c72efbf51 100644 --- a/include/boost/iterator/iterator_adaptor.hpp +++ b/include/boost/iterator/iterator_adaptor.hpp @@ -155,13 +155,6 @@ namespace iterators { > type; }; - - // workaround for aC++ CR JAGaf33512 - template - inline void iterator_adaptor_assert_traversal () - { - static_assert(std::is_convertible::value, ""); - } } // @@ -260,12 +253,12 @@ namespace iterators { typename super_t::iterator_category >::type my_traversal; -# define BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(cat) \ - boost::iterators::detail::iterator_adaptor_assert_traversal(); - void advance(typename super_t::difference_type n) { - BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(random_access_traversal_tag) + static_assert( + std::is_convertible::value, + "Super iterator must have a random_access_traversal_tag." + ); m_iterator += n; } @@ -273,7 +266,10 @@ namespace iterators { void decrement() { - BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(bidirectional_traversal_tag) + static_assert( + std::is_convertible::value, + "Super iterator must have a bidirectional_traversal_tag." + ); --m_iterator; } @@ -283,7 +279,10 @@ namespace iterators { typename super_t::difference_type distance_to( iterator_adaptor const& y) const { - BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(random_access_traversal_tag) + static_assert( + std::is_convertible::value, + "Super iterator must have a random_access_traversal_tag." + ); // Maybe readd with same_distance // BOOST_STATIC_ASSERT( // (detail::same_category_and_difference::value) @@ -291,8 +290,6 @@ namespace iterators { return y.base() - m_iterator; } -# undef BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL - private: // data members Base m_iterator; }; diff --git a/include/boost/iterator/iterator_archetypes.hpp b/include/boost/iterator/iterator_archetypes.hpp index d46f2771d..7c8e7067a 100644 --- a/include/boost/iterator/iterator_archetypes.hpp +++ b/include/boost/iterator/iterator_archetypes.hpp @@ -324,7 +324,7 @@ struct iterator_access_archetype_impl< template struct archetype { - static_assert(!std::is_const::value, ""); + static_assert(!std::is_const::value, "Value type must be const."); typedef void value_type; typedef void reference; typedef void pointer; @@ -375,7 +375,7 @@ struct iterator_access_archetype_impl Value, archetypes::readable_lvalue_iterator_t > { - static_assert(!std::is_const::value, ""); + static_assert(!std::is_const::value, "Value type must be const."); }; }; diff --git a/include/boost/iterator/iterator_categories.hpp b/include/boost/iterator/iterator_categories.hpp index 1fc53e626..d201083cd 100644 --- a/include/boost/iterator/iterator_categories.hpp +++ b/include/boost/iterator/iterator_categories.hpp @@ -104,7 +104,7 @@ namespace detail template struct iterator_category_to_traversal : mpl::eval_if< // if already convertible to a traversal tag, we're done. - std::is_convertible + std::is_convertible , mpl::identity , boost::iterators::detail::old_category_to_traversal > diff --git a/include/boost/iterator/iterator_concepts.hpp b/include/boost/iterator/iterator_concepts.hpp index ff039be73..0fca16368 100644 --- a/include/boost/iterator/iterator_concepts.hpp +++ b/include/boost/iterator/iterator_concepts.hpp @@ -136,8 +136,8 @@ namespace boost_concepts { typedef typename std::iterator_traits::difference_type difference_type; - static_assert(std::is_integral::value, ""); - static_assert(std::numeric_limits::is_signed, ""); + static_assert(std::is_integral::value, "difference_type must be integral."); + static_assert(std::numeric_limits::is_signed, "difference_type must be signed."); BOOST_CONCEPT_ASSERT(( boost::Convertible< diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 1f3a220e2..2d2569182 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -930,7 +930,10 @@ namespace iterators { BOOST_ITERATOR_FACADE_INTEROP_HEAD(inline, op, result_type) \ { \ /* For those compilers that do not support enable_if */ \ - static_assert(is_interoperable::value, ""); \ + static_assert( \ + is_interoperable::value, \ + "Derived1 & Derived2 types must be interoperable." \ + ); \ return_prefix iterator_core_access::base_op( \ *static_cast(&lhs) \ , *static_cast(&rhs) \ @@ -957,10 +960,10 @@ namespace iterators { { \ /* For those compilers that do not support enable_if */ \ static_assert( \ - is_interoperable< Derived1, Derived2 >::value && \ - boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived1 >::type, random_access_traversal_tag >::value && \ - boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived2 >::type, random_access_traversal_tag >::value, \ - "" \ + is_interoperable::value && \ + boost::iterators::detail::is_traversal_at_least::type, random_access_traversal_tag>::value && \ + boost::iterators::detail::is_traversal_at_least::type, random_access_traversal_tag>::value, \ + "Derived1 & Derived2 types must be interoperable and must both have random_access_traversal_tag." \ ); \ return_prefix iterator_core_access::base_op( \ *static_cast(&lhs) \ diff --git a/include/boost/iterator/minimum_category.hpp b/include/boost/iterator/minimum_category.hpp index 03720d972..58fa2759e 100644 --- a/include/boost/iterator/minimum_category.hpp +++ b/include/boost/iterator/minimum_category.hpp @@ -42,7 +42,10 @@ struct minimum_category_impl { template struct apply { - static_assert(std::is_same::value, ""); + static_assert( + std::is_same::value, + "Types must be same when they are convertible to each other." + ); typedef T1 type; }; }; diff --git a/include/boost/iterator/new_iterator_tests.hpp b/include/boost/iterator/new_iterator_tests.hpp index eb87573ea..6a6bf571d 100644 --- a/include/boost/iterator/new_iterator_tests.hpp +++ b/include/boost/iterator/new_iterator_tests.hpp @@ -88,7 +88,7 @@ void readable_iterator_test(const Iterator i1, T v) // I think we don't really need this as it checks the same things as // the above code. - static_assert(is_readable_iterator::value, ""); + static_assert(is_readable_iterator::value, "Iterator must be readable."); # endif } @@ -123,12 +123,15 @@ void constant_lvalue_iterator_test(Iterator i, T v1) Iterator i2(i); typedef typename std::iterator_traits::value_type value_type; typedef typename std::iterator_traits::reference reference; - static_assert(std::is_same::value, ""); + static_assert( + std::is_same::value, + "reference type must be the same as const value_type& for constant lvalue iterator." + ); const T& v2 = *i2; BOOST_TEST(v1 == v2); # ifndef BOOST_NO_LVALUE_RETURN_DETECTION - static_assert(is_lvalue_iterator::value, ""); - static_assert(!is_non_const_lvalue_iterator::value, ""); + static_assert(is_lvalue_iterator::value, "Iterator must be lvalue."); + static_assert(!is_non_const_lvalue_iterator::value, "Iterator must be const."); # endif } @@ -138,7 +141,10 @@ void non_const_lvalue_iterator_test(Iterator i, T v1, T v2) Iterator i2(i); typedef typename std::iterator_traits::value_type value_type; typedef typename std::iterator_traits::reference reference; - static_assert(std::is_same::value, ""); + static_assert( + std::is_same::value, + "reference type must be the same as value_type& for non-constant lvalue iterator." + ); T& v3 = *i2; BOOST_TEST(v1 == v3); @@ -149,8 +155,8 @@ void non_const_lvalue_iterator_test(Iterator i, T v1, T v2) T& v4 = *i2; BOOST_TEST(v2 == v4); # ifndef BOOST_NO_LVALUE_RETURN_DETECTION - static_assert(is_lvalue_iterator::value, ""); - static_assert(is_non_const_lvalue_iterator::value, ""); + static_assert(is_lvalue_iterator::value, "Iterator must be lvalue."); + static_assert(is_non_const_lvalue_iterator::value, "Iterator must be non-const."); # endif } diff --git a/include/boost/iterator/transform_iterator.hpp b/include/boost/iterator/transform_iterator.hpp index cab87bc8c..512b0d0ce 100644 --- a/include/boost/iterator/transform_iterator.hpp +++ b/include/boost/iterator/transform_iterator.hpp @@ -88,7 +88,7 @@ namespace iterators { #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) // don't provide this constructor if UnaryFunc is a // function pointer type, since it will be 0. Too dangerous. - static_assert(std::is_class::value, ""); + static_assert(std::is_class::value, "Transform function must not be a function pointer."); #endif } diff --git a/include/boost/pending/iterator_tests.hpp b/include/boost/pending/iterator_tests.hpp index a810a3b3d..1fbb10e09 100644 --- a/include/boost/pending/iterator_tests.hpp +++ b/include/boost/pending/iterator_tests.hpp @@ -140,9 +140,11 @@ template struct lvalue_test typedef typename Iterator::reference reference; typedef typename Iterator::value_type value_type; # endif - static_assert(std::is_reference::value, ""); - static_assert(std::is_same::value - || std::is_same::value, ""); + static_assert(std::is_reference::value, "reference must be a reference type."); + static_assert( + std::is_same::value || std::is_same::value, + "reference must either be a reference to value_type or constant reference to value_type." + ); } }; diff --git a/test/filter_iterator_test.cpp b/test/filter_iterator_test.cpp index b0b1caf09..be34c3bb0 100644 --- a/test/filter_iterator_test.cpp +++ b/test/filter_iterator_test.cpp @@ -233,7 +233,7 @@ int main() boost::iterator_traversal::type , boost::random_access_traversal_tag >::value, - ""); + "Filter interator must have a random_access_traversal_tag."); //# endif diff --git a/test/indirect_iter_member_types.cpp b/test/indirect_iter_member_types.cpp index 261a51054..dffe68c07 100644 --- a/test/indirect_iter_member_types.cpp +++ b/test/indirect_iter_member_types.cpp @@ -40,10 +40,10 @@ int main() static_assert(std::is_convertible::value, - ""); + "Iter must have an STL random_access_iterator_tag."); static_assert(std::is_convertible::type, boost::random_access_traversal_tag>::value, - ""); + "Iter must have a random_access_traversal_tag."); } { typedef boost::indirect_iterator Iter; @@ -73,10 +73,10 @@ int main() static_assert(std::is_convertible::value, - ""); + "Iter must have an STL random_access_iterator_tag."); static_assert(std::is_convertible::type, boost::random_access_traversal_tag>::value, - ""); + "Iter must have a random_access_traversal_tag."); } { typedef boost::indirect_iterator Iter; diff --git a/test/is_lvalue_iterator.cpp b/test/is_lvalue_iterator.cpp index a0eea8263..e52356836 100644 --- a/test/is_lvalue_iterator.cpp +++ b/test/is_lvalue_iterator.cpp @@ -86,61 +86,96 @@ struct constant_lvalue_iterator constant_lvalue_iterator operator++(int); }; - int main() { - static_assert(boost::is_lvalue_iterator::value, ""); - static_assert(boost::is_lvalue_iterator::value, ""); - static_assert(boost::is_lvalue_iterator::iterator>::value, ""); - static_assert(boost::is_lvalue_iterator::const_iterator>::value, ""); - static_assert(!boost::is_lvalue_iterator > >::value, ""); - static_assert(!boost::is_lvalue_iterator >::value, ""); - static_assert(!boost::is_lvalue_iterator >::value, ""); - static_assert(!boost::is_lvalue_iterator >::value, ""); + static_assert(boost::is_lvalue_iterator::value, + "boost::is_lvalue_iterator::value is expected to be true."); + static_assert(boost::is_lvalue_iterator::value, + "boost::is_lvalue_iterator::value is expected to be true."); + static_assert(boost::is_lvalue_iterator::iterator>::value, + "boost::is_lvalue_iterator::iterator>::value."); + static_assert(boost::is_lvalue_iterator::const_iterator>::value, + "boost::is_lvalue_iterator::const_iterator>::value is expected to be true."); + static_assert(!boost::is_lvalue_iterator>>::value, + "boost::is_lvalue_iterator>>::value is expected to be false."); + static_assert(!boost::is_lvalue_iterator>::value, + "boost::is_lvalue_iterator>::value is expected to be false."); + static_assert(!boost::is_lvalue_iterator>::value, + "boost::is_lvalue_iterator>::value is expected to be false."); + static_assert(!boost::is_lvalue_iterator>::value, + "boost::is_lvalue_iterator>::value is expected to be false."); #ifndef BOOST_NO_LVALUE_RETURN_DETECTION - static_assert(!boost::is_lvalue_iterator::value, ""); + static_assert(!boost::is_lvalue_iterator::value, + "boost::is_lvalue_iterator::value is expected to be false."); #endif // Make sure inaccessible copy constructor doesn't prevent // reference binding - static_assert(boost::is_lvalue_iterator::value, ""); - - static_assert(boost::is_lvalue_iterator >::value, ""); - static_assert(boost::is_lvalue_iterator >::value, ""); - static_assert(boost::is_lvalue_iterator >::value, ""); - static_assert(boost::is_lvalue_iterator >::value, ""); - - - static_assert(boost::is_lvalue_iterator >::value, ""); - static_assert(boost::is_lvalue_iterator >::value, ""); - static_assert(boost::is_lvalue_iterator >::value, ""); - static_assert(boost::is_lvalue_iterator >::value, ""); - - - - static_assert(boost::is_non_const_lvalue_iterator::value, ""); - static_assert(!boost::is_non_const_lvalue_iterator::value, ""); - static_assert(boost::is_non_const_lvalue_iterator::iterator>::value, ""); - static_assert(!boost::is_non_const_lvalue_iterator::const_iterator>::value, ""); - static_assert(!boost::is_non_const_lvalue_iterator > >::value, ""); - static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); - static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); - static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); + static_assert(boost::is_lvalue_iterator::value, + "boost::is_lvalue_iterator::value is expected to be true."); + + static_assert(boost::is_lvalue_iterator>::value, + "boost::is_lvalue_iterator>::value is expected to be true."); + static_assert(boost::is_lvalue_iterator>::value, + "boost::is_lvalue_iterator>::value is expected to be true."); + static_assert(boost::is_lvalue_iterator>::value, + "boost::is_lvalue_iterator>::value is expected to be true."); + static_assert(boost::is_lvalue_iterator>::value, + "boost::is_lvalue_iterator>::value is expected to be true."); + + + static_assert(boost::is_lvalue_iterator>::value, + "boost::is_lvalue_iterator>::value is expected to be true."); + static_assert(boost::is_lvalue_iterator>::value, + "boost::is_lvalue_iterator>::value is expected to be true."); + static_assert(boost::is_lvalue_iterator>::value, + "boost::is_lvalue_iterator>::value is expected to be true."); + static_assert(boost::is_lvalue_iterator>::value, + "boost::is_lvalue_iterator>::value is expected to be true."); + + + + static_assert(boost::is_non_const_lvalue_iterator::value, + "boost::is_non_const_lvalue_iterator::value is expected to be true."); + static_assert(!boost::is_non_const_lvalue_iterator::value, + "boost::is_non_const_lvalue_iterator::value is expected to be false."); + static_assert(boost::is_non_const_lvalue_iterator::iterator>::value, + "boost::is_non_const_lvalue_iterator::iterator>::value is expected to be true."); + static_assert(!boost::is_non_const_lvalue_iterator::const_iterator>::value, + "boost::is_non_const_lvalue_iterator::const_iterator>::value is expected to be false."); + static_assert(!boost::is_non_const_lvalue_iterator>>::value, + "boost::is_non_const_lvalue_iterator>>::value is expected to be false."); + static_assert(!boost::is_non_const_lvalue_iterator>::value, + "boost::is_non_const_lvalue_iterator>::value is expected to be false."); + static_assert(!boost::is_non_const_lvalue_iterator>::value, + "boost::is_non_const_lvalue_iterator>::value is expected to be false."); + static_assert(!boost::is_non_const_lvalue_iterator>::value, + "boost::is_non_const_lvalue_iterator>::value is expected to be false."); #ifndef BOOST_NO_LVALUE_RETURN_DETECTION - static_assert(!boost::is_non_const_lvalue_iterator::value, ""); + static_assert(!boost::is_non_const_lvalue_iterator::value, + "boost::is_non_const_lvalue_iterator::value is expected to be false."); #endif - static_assert(!boost::is_non_const_lvalue_iterator::value, ""); + static_assert(!boost::is_non_const_lvalue_iterator::value, + "boost::is_non_const_lvalue_iterator::value is expected to be false."); - static_assert(boost::is_non_const_lvalue_iterator >::value, ""); + static_assert(boost::is_non_const_lvalue_iterator>::value, + "boost::is_non_const_lvalue_iterator>::value is expected to be true."); #if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) - static_assert(boost::is_non_const_lvalue_iterator >::value, ""); + static_assert(boost::is_non_const_lvalue_iterator>::value, + "boost::is_non_const_lvalue_iterator>::value is expected to be true."); #endif - static_assert(boost::is_non_const_lvalue_iterator >::value, ""); - static_assert(boost::is_non_const_lvalue_iterator >::value, ""); - - static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); - static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); - static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); - static_assert(!boost::is_non_const_lvalue_iterator >::value, ""); + static_assert(boost::is_non_const_lvalue_iterator>::value, + "boost::is_non_const_lvalue_iterator>::value is expected to be true."); + static_assert(boost::is_non_const_lvalue_iterator>::value, + "boost::is_non_const_lvalue_iterator>::value is expected to be true."); + + static_assert(!boost::is_non_const_lvalue_iterator>::value, + "boost::is_non_const_lvalue_iterator>::value is expected to be false."); + static_assert(!boost::is_non_const_lvalue_iterator>::value, + "boost::is_non_const_lvalue_iterator>::value is expected to be false."); + static_assert(!boost::is_non_const_lvalue_iterator>::value, + "boost::is_non_const_lvalue_iterator>::value is expected to be false."); + static_assert(!boost::is_non_const_lvalue_iterator>::value, + "boost::is_non_const_lvalue_iterator>::value is expected to be false."); return 0; } diff --git a/test/is_readable_iterator.cpp b/test/is_readable_iterator.cpp index 39c4d7539..5e929ee9b 100644 --- a/test/is_readable_iterator.cpp +++ b/test/is_readable_iterator.cpp @@ -76,19 +76,29 @@ struct proxy_iterator2 int main() { - static_assert(boost::is_readable_iterator::value, ""); - static_assert(boost::is_readable_iterator::value, ""); - static_assert(boost::is_readable_iterator::iterator>::value, ""); - static_assert(boost::is_readable_iterator::const_iterator>::value, ""); - static_assert(!boost::is_readable_iterator > >::value, ""); - static_assert(!boost::is_readable_iterator >::value, ""); - static_assert(boost::is_readable_iterator::value, ""); - static_assert(!boost::is_readable_iterator::value, ""); - static_assert(boost::is_readable_iterator::value, ""); + static_assert(boost::is_readable_iterator::value, + "boost::is_readable_iterator::value is expected to be true."); + static_assert(boost::is_readable_iterator::value, + "boost::is_readable_iterator::value is expected to be true."); + static_assert(boost::is_readable_iterator::iterator>::value, + "boost::is_readable_iterator::iterator>::value is expected to be true."); + static_assert(boost::is_readable_iterator::const_iterator>::value, + "boost::is_readable_iterator::const_iterator>::value is expected to be true."); + static_assert(!boost::is_readable_iterator>>::value, + "boost::is_readable_iterator>>::value is expected to be false."); + static_assert(!boost::is_readable_iterator>::value, + "boost::is_readable_iterator>::value is expected to be false."); + static_assert(boost::is_readable_iterator::value, + "boost::is_readable_iterator::value is expected to be true."); + static_assert(!boost::is_readable_iterator::value, + "boost::is_readable_iterator::value is expected to be false."); + static_assert(boost::is_readable_iterator::value, + "boost::is_readable_iterator::value is expected to be true."); // Make sure inaccessible copy constructor doesn't prevent // readability - static_assert(boost::is_readable_iterator::value, ""); + static_assert(boost::is_readable_iterator::value, + "boost::is_readable_iterator::value is expected to be true."); return 0; } diff --git a/test/iterator_adaptor_test.cpp b/test/iterator_adaptor_test.cpp index ef5b9a482..81f2e35f8 100644 --- a/test/iterator_adaptor_test.cpp +++ b/test/iterator_adaptor_test.cpp @@ -209,7 +209,10 @@ main() test = static_assert_same::value; test = static_assert_same::value; #if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) - static_assert(std::is_convertible::value, ""); + static_assert( + std::is_convertible::value, + "Iter1::iterator_category must be convertible to std::random_access_iterator_tag." + ); #endif } @@ -220,9 +223,9 @@ main() test = static_assert_same::value; #if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) - static_assert(boost::is_readable_iterator::value, ""); + static_assert(boost::is_readable_iterator::value, "Iter1 is expected to be readable."); # ifndef BOOST_NO_LVALUE_RETURN_DETECTION - static_assert(boost::is_lvalue_iterator::value, ""); + static_assert(boost::is_lvalue_iterator::value, "Iter1 is expected to be lvalue."); # endif #endif @@ -243,8 +246,14 @@ main() #endif #ifndef BOOST_NO_LVALUE_RETURN_DETECTION - static_assert(boost::is_non_const_lvalue_iterator::value, ""); - static_assert(boost::is_lvalue_iterator::value, ""); + static_assert( + boost::is_non_const_lvalue_iterator::value, + "boost::is_non_const_lvalue_iterator::value is expected to be true." + ); + static_assert( + boost::is_lvalue_iterator::value, + "boost::is_lvalue_iterator::value is expected to be true." + ); #endif typedef modify_traversal IncrementableIter; diff --git a/test/iterator_facade.cpp b/test/iterator_facade.cpp index 09fd88e9e..3ae0716cf 100644 --- a/test/iterator_facade.cpp +++ b/test/iterator_facade.cpp @@ -225,7 +225,7 @@ int main() BOOST_TEST_EQ(val.private_mutator_count, 0); // mutator() should be invoked on an object returned by value BOOST_TEST_EQ(shared_mutator_count, 2); - same_type(p.operator->()); + same_type(p.operator->()); // possibly replace with static_assert(std::is_same())>>::value, "") } { From f102fb16c38bc3d603db7f63553d7123cbe49d15 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Wed, 12 Jun 2024 16:25:40 +0300 Subject: [PATCH 38/56] Finish with static_assert messages. --- include/boost/iterator/iterator_facade.hpp | 2 +- include/boost/pending/iterator_tests.hpp | 2 +- test/iterator_facade.cpp | 8 +++---- test/permutation_iterator_test.cpp | 1 - test/static_assert_same.hpp | 2 +- test/transform_iterator_test.cpp | 14 ++++++----- test/unit_tests.cpp | 28 +++++++--------------- 7 files changed, 22 insertions(+), 35 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 2d2569182..9af802cff 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -960,7 +960,7 @@ namespace iterators { { \ /* For those compilers that do not support enable_if */ \ static_assert( \ - is_interoperable::value && \ + is_interoperable::value && \ boost::iterators::detail::is_traversal_at_least::type, random_access_traversal_tag>::value && \ boost::iterators::detail::is_traversal_at_least::type, random_access_traversal_tag>::value, \ "Derived1 & Derived2 types must be interoperable and must both have random_access_traversal_tag." \ diff --git a/include/boost/pending/iterator_tests.hpp b/include/boost/pending/iterator_tests.hpp index 1fbb10e09..1b1c50bf4 100644 --- a/include/boost/pending/iterator_tests.hpp +++ b/include/boost/pending/iterator_tests.hpp @@ -142,7 +142,7 @@ template struct lvalue_test # endif static_assert(std::is_reference::value, "reference must be a reference type."); static_assert( - std::is_same::value || std::is_same::value, + std::is_same::value || std::is_same::value, "reference must either be a reference to value_type or constant reference to value_type." ); } diff --git a/test/iterator_facade.cpp b/test/iterator_facade.cpp index 3ae0716cf..a44325a53 100644 --- a/test/iterator_facade.cpp +++ b/test/iterator_facade.cpp @@ -10,6 +10,8 @@ #include #include +#include "static_assert_same.hpp" + // This is a really, really limited test so far. All we're doing // right now is checking that the postfix++ proxy for single-pass // iterators works properly. @@ -143,10 +145,6 @@ struct iterator_with_proxy_reference { return wrapper(m_x); } }; -template -void same_type(U const&) -{ static_assert(std::is_same::value, ""); } - template struct abstract_iterator : boost::iterator_facade< @@ -225,7 +223,7 @@ int main() BOOST_TEST_EQ(val.private_mutator_count, 0); // mutator() should be invoked on an object returned by value BOOST_TEST_EQ(shared_mutator_count, 2); - same_type(p.operator->()); // possibly replace with static_assert(std::is_same())>>::value, "") + STATIC_ASSERT_SAME(input_iter::pointer, std::remove_cv())>::type>::type); } { diff --git a/test/permutation_iterator_test.cpp b/test/permutation_iterator_test.cpp index ac8270164..619605f41 100644 --- a/test/permutation_iterator_test.cpp +++ b/test/permutation_iterator_test.cpp @@ -43,7 +43,6 @@ void permutation_test() const int element_range_size = 10; const int index_size = 7; - static_assert(index_size <= element_range_size, ""); element_range_type elements( element_range_size ); for( element_range_type::iterator el_it = elements.begin(); el_it != elements.end(); ++el_it ) { *el_it = std::distance(elements.begin(), el_it); } diff --git a/test/static_assert_same.hpp b/test/static_assert_same.hpp index 2911845c5..fb1c84783 100644 --- a/test/static_assert_same.hpp +++ b/test/static_assert_same.hpp @@ -7,7 +7,7 @@ #include -#define STATIC_ASSERT_SAME( T1,T2 ) static_assert(std::is_same::value, "") +#define STATIC_ASSERT_SAME( T1,T2 ) static_assert(std::is_same::value, "T1 ans T2 are expected to be the same types.") template struct static_assert_same diff --git a/test/transform_iterator_test.cpp b/test/transform_iterator_test.cpp index 3fd788e1c..5b15f4fe8 100644 --- a/test/transform_iterator_test.cpp +++ b/test/transform_iterator_test.cpp @@ -21,6 +21,8 @@ #include #include +#include "static_assert_same.hpp" + #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION namespace boost { namespace detail { @@ -172,20 +174,20 @@ main() { { typedef boost::transform_iterator iter_t; - static_assert(boost::is_same::value, ""); - static_assert(boost::is_same::value, ""); + STATIC_ASSERT_SAME(iter_t::reference, float); + STATIC_ASSERT_SAME(iter_t::value_type, float); } { typedef boost::transform_iterator iter_t; - static_assert(boost::is_same::value, ""); - static_assert(boost::is_same::value, ""); + STATIC_ASSERT_SAME(iter_t::reference, int); + STATIC_ASSERT_SAME(iter_t::value_type, float); } { typedef boost::transform_iterator iter_t; - static_assert(boost::is_same::value, ""); - static_assert(boost::is_same::value, ""); + STATIC_ASSERT_SAME(iter_t::reference, float); + STATIC_ASSERT_SAME(iter_t::value_type, double); } } diff --git a/test/unit_tests.cpp b/test/unit_tests.cpp index bbb4bb8ef..76bbffb35 100644 --- a/test/unit_tests.cpp +++ b/test/unit_tests.cpp @@ -39,31 +39,20 @@ void category_test() using namespace boost::iterators::detail; static_assert( - !std::is_convertible< - std::input_iterator_tag - , input_output_iterator_tag>::value, - ""); + !std::is_convertible::value, + "std::input_iterator_tag is not expected to be convertible to input_output_iterator_tag."); static_assert( - !std::is_convertible< - std::output_iterator_tag - , input_output_iterator_tag - >::value, - ""); + !std::is_convertible::value, + "std::output_iterator_tag is not expected to be convertible to input_output_iterator_tag."); static_assert( - std::is_convertible< - input_output_iterator_tag - , std::input_iterator_tag - >::value, - ""); + std::is_convertible::value, + "input_output_iterator_tag is expected to be convertible to std::input_iterator_tag."); static_assert( - std::is_convertible< - input_output_iterator_tag - , std::output_iterator_tag - >::value, - ""); + std::is_convertible::value, + "input_output_iterator_tag is expected to be convertible to std::output_iterator_tag."); #if 0 // This seems wrong; we're not advertising // input_output_iterator_tag are we? @@ -113,4 +102,3 @@ int main() operator_arrow_test(); return 0; } - From 5e919ebabb3b1d98405de210f35e068acfb37290 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Wed, 12 Jun 2024 16:30:44 +0300 Subject: [PATCH 39/56] Make macro more readable. --- include/boost/iterator/iterator_facade.hpp | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 9af802cff..652210b88 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -957,19 +957,23 @@ namespace iterators { # define BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS(op, result_type, return_prefix, base_op) \ BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(inline, op, result_type) \ - { \ - /* For those compilers that do not support enable_if */ \ - static_assert( \ - is_interoperable::value && \ - boost::iterators::detail::is_traversal_at_least::type, random_access_traversal_tag>::value && \ - boost::iterators::detail::is_traversal_at_least::type, random_access_traversal_tag>::value, \ - "Derived1 & Derived2 types must be interoperable and must both have random_access_traversal_tag." \ - ); \ - return_prefix iterator_core_access::base_op( \ - *static_cast(&lhs) \ - , *static_cast(&rhs) \ - , BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \ - ); \ + { \ + using boost::iterators::detail::is_traversal_at_least; \ + using Derived1IterCat = typename iterator_category::type; \ + using Derived2IterCat = typename iterator_category::type; \ + /* For those compilers that do not support enable_if */ \ + static_assert( \ + is_interoperable::value && \ + is_traversal_at_least::value && \ + is_traversal_at_least::value, \ + "Derived1 & Derived2 types must be interoperable and must both have " \ + "random_access_traversal_tag." \ + ); \ + return_prefix iterator_core_access::base_op( \ + *static_cast(&lhs) \ + , *static_cast(&rhs) \ + , BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \ + ); \ } # define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op, return_prefix, base_op) \ From c329a9b11d78035543b868eb96c34f897f6e81ea Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Wed, 12 Jun 2024 16:35:43 +0300 Subject: [PATCH 40/56] return addressof. --- include/boost/iterator/iterator_facade.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 652210b88..47a5b2b43 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -8,10 +8,11 @@ #define BOOST_ITERATOR_FACADE_23022003THW_HPP #include +#include + #include #include #include - #include #include @@ -169,7 +170,7 @@ namespace iterators { // Provides (r++)->foo() value_type* operator->() const { - return std::addressof(stored_value); + return boost::addressof(stored_value); } private: @@ -269,7 +270,7 @@ namespace iterators { // Provides (r++)->foo() value_type* operator->() const { - return std::addressof(dereference_proxy.stored_value); + return boost::addressof(dereference_proxy.stored_value); } private: @@ -371,10 +372,10 @@ namespace iterators { struct proxy { explicit proxy(Reference const & x) : m_ref(x) {} - Reference* operator->() { return std::addressof(m_ref); } + Reference* operator->() { return boost::addressof(m_ref); } // This function is needed for MWCW and BCC, which won't call // operator-> again automatically per 13.3.1.2 para 8 - operator Reference*() { return std::addressof(m_ref); } + operator Reference*() { return boost::addressof(m_ref); } Reference m_ref; }; typedef proxy result_type; @@ -390,7 +391,7 @@ namespace iterators { typedef Pointer result_type; static result_type apply(T& x) { - return std::addressof(x); + return boost::addressof(x); } }; From 2af7a36a55cefd7ea6b68bf932dd4d354a1c849d Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Wed, 12 Jun 2024 16:53:02 +0300 Subject: [PATCH 41/56] return conjuction. --- include/boost/iterator/is_iterator.hpp | 27 +++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/include/boost/iterator/is_iterator.hpp b/include/boost/iterator/is_iterator.hpp index 37cf19711..0c3718adc 100644 --- a/include/boost/iterator/is_iterator.hpp +++ b/include/boost/iterator/is_iterator.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #if !defined(BOOST_NO_CXX17_ITERATOR_TRAITS) #include #endif @@ -57,56 +58,56 @@ no_type check(...); template< typename T > struct is_iterator_impl : - public boost::integral_constant< + public std::integral_constant< bool, - sizeof(has_iterator_category_detail::check< T >(0)) == sizeof(has_iterator_category_detail::yes_type) + sizeof(has_iterator_category_detail::check(0)) == sizeof(has_iterator_category_detail::yes_type) > { }; template< typename T > struct is_iterator_impl< T* > : - std::integral_constant< - bool - , boost::is_complete::value && !std::is_function::value - > + public boost::conjunction< + boost::is_complete, + std::integral_constant::value> + >::type { }; template< typename T, typename U > struct is_iterator_impl< T U::* > : - public boost::false_type + public std::false_type { }; template< typename T > -struct is_iterator_impl< T& > : - public boost::false_type +struct is_iterator_impl : + public std::false_type { }; template< typename T, std::size_t N > struct is_iterator_impl< T[N] > : - public boost::false_type + public std::false_type { }; #if !defined(BOOST_TT_HAS_WORKING_IS_COMPLETE) template< typename T > struct is_iterator_impl< T[] > : - public boost::false_type + public std::false_type { }; template< > struct is_iterator_impl< void > : - public boost::false_type + public std::false_type { }; template< > struct is_iterator_impl< void* > : - public boost::false_type + public std::false_type { }; #endif // !defined(BOOST_TT_HAS_WORKING_IS_COMPLETE) From e4cc900f9a4d2eb0eb3bb1d40148cf580d3adf8d Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Wed, 12 Jun 2024 17:14:21 +0300 Subject: [PATCH 42/56] abstract conjunction. --- .../detail/type_traits/conjunction.hpp | 53 +++++++++++++++++++ include/boost/iterator/is_iterator.hpp | 4 +- 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 include/boost/iterator/detail/type_traits/conjunction.hpp diff --git a/include/boost/iterator/detail/type_traits/conjunction.hpp b/include/boost/iterator/detail/type_traits/conjunction.hpp new file mode 100644 index 000000000..bad757b8e --- /dev/null +++ b/include/boost/iterator/detail/type_traits/conjunction.hpp @@ -0,0 +1,53 @@ +/* + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * https://www.boost.org/LICENSE_1_0.txt) + * + * Copyright (c) 2024 Georgiy Guminov + */ +/*! + * \file iterator/detail/type_traits/conjunction.hpp + * + * This header contains definition of \c conjunction type trait. + */ + +#ifndef BOOST_ITERATOR_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_ +#define BOOST_ITERATOR_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_ + +#include +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +#if (defined(__cpp_lib_logical_traits) && (__cpp_lib_logical_traits >= 201510l)) || \ + (defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190023918) && (BOOST_CXX_VERSION >= 201703l)) + +namespace boost { +namespace iterators { +namespace detail { + +using std::conjunction; + +} // namespace detail +} // namespace iterator +} // namespace boost + +#else + +#include + +namespace boost { +namespace iterators { +namespace detail { + +using boost::conjunction; + +} // namespace detail +} // namespace iterator +} // namespace boost + +#endif + +#endif // BOOST_ITERATOR_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_ \ No newline at end of file diff --git a/include/boost/iterator/is_iterator.hpp b/include/boost/iterator/is_iterator.hpp index 0c3718adc..2beba2254 100644 --- a/include/boost/iterator/is_iterator.hpp +++ b/include/boost/iterator/is_iterator.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #if !defined(BOOST_NO_CXX17_ITERATOR_TRAITS) #include #endif @@ -67,7 +67,7 @@ struct is_iterator_impl : template< typename T > struct is_iterator_impl< T* > : - public boost::conjunction< + public conjunction< boost::is_complete, std::integral_constant::value> >::type From 165440d357cb2f46a08ac8bf98479b91d8a5a522 Mon Sep 17 00:00:00 2001 From: Georgiy Guminov Date: Wed, 12 Jun 2024 18:07:49 +0300 Subject: [PATCH 43/56] Fix gcc 4.6 build. --- include/boost/iterator/iterator_facade.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 47a5b2b43..f4debe04d 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -960,8 +960,8 @@ namespace iterators { BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(inline, op, result_type) \ { \ using boost::iterators::detail::is_traversal_at_least; \ - using Derived1IterCat = typename iterator_category::type; \ - using Derived2IterCat = typename iterator_category::type; \ + typedef typename iterator_category::type Derived1IterCat; \ + typedef typename iterator_category::type Derived2IterCat; \ /* For those compilers that do not support enable_if */ \ static_assert( \ is_interoperable::value && \ From e49506b9b978cacd4d4d4cbd97b3a8be48fb2dbe Mon Sep 17 00:00:00 2001 From: Georqy Guminov Date: Sun, 23 Jun 2024 16:12:29 +0300 Subject: [PATCH 44/56] Remove workaround include. --- test/range_distance_compat_test.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/test/range_distance_compat_test.cpp b/test/range_distance_compat_test.cpp index 5501810a8..ef7e301da 100644 --- a/test/range_distance_compat_test.cpp +++ b/test/range_distance_compat_test.cpp @@ -5,7 +5,6 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include #include #include From 8f73f2a9882f9c479b7313e2a8bd6e2c4fc6ec03 Mon Sep 17 00:00:00 2001 From: Georgy Guminov Date: Sat, 19 Oct 2024 17:20:52 +0300 Subject: [PATCH 45/56] Fixes. Remove some Boost.MPL usages. --- build.jam | 1 - include/boost/iterator/counting_iterator.hpp | 2 - .../detail/facade_iterator_category.hpp | 16 +++--- .../detail/type_traits/conjunction.hpp | 2 +- .../detail/type_traits/disjunction.hpp | 53 +++++++++++++++++++ .../iterator/detail/type_traits/negation.hpp | 53 +++++++++++++++++++ include/boost/iterator/filter_iterator.hpp | 4 +- include/boost/iterator/indirect_iterator.hpp | 2 - include/boost/iterator/interoperable.hpp | 9 +--- include/boost/iterator/is_iterator.hpp | 3 +- include/boost/iterator/is_lvalue_iterator.hpp | 9 ++-- .../boost/iterator/is_readable_iterator.hpp | 9 ++-- include/boost/iterator/iterator_facade.hpp | 23 ++++---- include/boost/iterator/new_iterator_tests.hpp | 4 +- include/boost/pending/iterator_tests.hpp | 4 +- test/iterator_adaptor_test.cpp | 6 +-- test/permutation_iterator_test.cpp | 2 + 17 files changed, 151 insertions(+), 51 deletions(-) create mode 100644 include/boost/iterator/detail/type_traits/disjunction.hpp create mode 100644 include/boost/iterator/detail/type_traits/negation.hpp diff --git a/build.jam b/build.jam index 88bf37ff6..9f47fcba1 100644 --- a/build.jam +++ b/build.jam @@ -16,7 +16,6 @@ constant boost_dependencies : /boost/mpl//boost_mpl /boost/optional//boost_optional /boost/smart_ptr//boost_smart_ptr - /boost/static_assert//boost_static_assert /boost/type_traits//boost_type_traits /boost/utility//boost_utility ; diff --git a/include/boost/iterator/counting_iterator.hpp b/include/boost/iterator/counting_iterator.hpp index 3e5a594f0..a05ca2c52 100644 --- a/include/boost/iterator/counting_iterator.hpp +++ b/include/boost/iterator/counting_iterator.hpp @@ -33,8 +33,6 @@ namespace detail template struct is_numeric_impl { - // For a while, this wasn't true, but we rely on it below. This is a regression assert. - static_assert(std::is_integral::value, "std::is_integral is expected to be true"); # ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS diff --git a/include/boost/iterator/detail/facade_iterator_category.hpp b/include/boost/iterator/detail/facade_iterator_category.hpp index c6f48a896..eb932400e 100644 --- a/include/boost/iterator/detail/facade_iterator_category.hpp +++ b/include/boost/iterator/detail/facade_iterator_category.hpp @@ -8,13 +8,13 @@ # include -# include // used in iterator_tag inheritance logic -# include # include # include # include +# include +# include # include // try to keep this last # ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY @@ -55,7 +55,7 @@ struct input_output_iterator_tag template struct iterator_writability_disabled # ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY // Adding Thomas' logic? - : mpl::or_< + : disjunction< is_const , boost::detail::indirect_traits::is_reference_to_const , is_const @@ -77,21 +77,21 @@ struct iterator_writability_disabled template struct iterator_facade_default_category : mpl::eval_if< - mpl::and_< + conjunction< std::is_reference , std::is_convertible > , mpl::eval_if< std::is_convertible , mpl::identity - , mpl::if_< - std::is_convertible + , std::conditional< + std::is_convertible::value , std::bidirectional_iterator_tag , std::forward_iterator_tag > > , typename mpl::eval_if< - mpl::and_< + conjunction< std::is_convertible // check for readability @@ -107,7 +107,7 @@ struct iterator_facade_default_category // True iff T is convertible to an old-style iterator category. template struct is_iterator_category - : mpl::or_< + : disjunction< std::is_convertible , std::is_convertible > diff --git a/include/boost/iterator/detail/type_traits/conjunction.hpp b/include/boost/iterator/detail/type_traits/conjunction.hpp index bad757b8e..9f61f4fee 100644 --- a/include/boost/iterator/detail/type_traits/conjunction.hpp +++ b/include/boost/iterator/detail/type_traits/conjunction.hpp @@ -50,4 +50,4 @@ using boost::conjunction; #endif -#endif // BOOST_ITERATOR_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_ \ No newline at end of file +#endif // BOOST_ITERATOR_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_ diff --git a/include/boost/iterator/detail/type_traits/disjunction.hpp b/include/boost/iterator/detail/type_traits/disjunction.hpp new file mode 100644 index 000000000..e0d2ad333 --- /dev/null +++ b/include/boost/iterator/detail/type_traits/disjunction.hpp @@ -0,0 +1,53 @@ +/* + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * https://www.boost.org/LICENSE_1_0.txt) + * + * Copyright (c) 2024 Georgiy Guminov + */ +/*! + * \file iterator/detail/type_traits/disjunction.hpp + * + * This header contains definition of \c disjunction type trait. + */ + +#ifndef BOOST_ITERATOR_DETAIL_TYPE_TRAITS_DISJUNCTION_HPP_INCLUDED_ +#define BOOST_ITERATOR_DETAIL_TYPE_TRAITS_DISJUNCTION_HPP_INCLUDED_ + +#include +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +#if (defined(__cpp_lib_logical_traits) && (__cpp_lib_logical_traits >= 201510l)) || \ + (defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190023918) && (BOOST_CXX_VERSION >= 201703l)) + +namespace boost { +namespace iterators { +namespace detail { + +using std::disjunction; + +} // namespace detail +} // namespace iterator +} // namespace boost + +#else + +#include + +namespace boost { +namespace iterators { +namespace detail { + +using boost::disjunction; + +} // namespace detail +} // namespace iterator +} // namespace boost + +#endif + +#endif // BOOST_ITERATOR_DETAIL_TYPE_TRAITS_DISJUNCTION_HPP_INCLUDED_ diff --git a/include/boost/iterator/detail/type_traits/negation.hpp b/include/boost/iterator/detail/type_traits/negation.hpp new file mode 100644 index 000000000..9be4b6e91 --- /dev/null +++ b/include/boost/iterator/detail/type_traits/negation.hpp @@ -0,0 +1,53 @@ +/* + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * https://www.boost.org/LICENSE_1_0.txt) + * + * Copyright (c) 2024 Georgiy Guminov + */ +/*! + * \file iterator/detail/type_traits/negation.hpp + * + * This header contains definition of \c negation type trait. + */ + +#ifndef BOOST_ITERATOR_DETAIL_TYPE_TRAITS_NEGATION_HPP_INCLUDED_ +#define BOOST_ITERATOR_DETAIL_TYPE_TRAITS_NEGATION_HPP_INCLUDED_ + +#include +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +#if (defined(__cpp_lib_logical_traits) && (__cpp_lib_logical_traits >= 201510l)) || \ + (defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190023918) && (BOOST_CXX_VERSION >= 201703l)) + +namespace boost { +namespace iterators { +namespace detail { + +using std::negation; + +} // namespace detail +} // namespace iterator +} // namespace boost + +#else + +#include + +namespace boost { +namespace iterators { +namespace detail { + +using boost::negation; + +} // namespace detail +} // namespace iterator +} // namespace boost + +#endif + +#endif // BOOST_ITERATOR_DETAIL_TYPE_TRAITS_NEGATION_HPP_INCLUDED_ diff --git a/include/boost/iterator/filter_iterator.hpp b/include/boost/iterator/filter_iterator.hpp index 187a92e39..34549a813 100644 --- a/include/boost/iterator/filter_iterator.hpp +++ b/include/boost/iterator/filter_iterator.hpp @@ -30,11 +30,11 @@ namespace iterators { filter_iterator , Iterator , use_default - , typename mpl::if_< + , typename std::conditional< std::is_convertible< typename iterator_traversal::type , random_access_traversal_tag - > + >::value , bidirectional_traversal_tag , use_default >::type diff --git a/include/boost/iterator/indirect_iterator.hpp b/include/boost/iterator/indirect_iterator.hpp index f67083957..ff02c4206 100644 --- a/include/boost/iterator/indirect_iterator.hpp +++ b/include/boost/iterator/indirect_iterator.hpp @@ -14,7 +14,6 @@ #include -#include #include #include #include @@ -25,7 +24,6 @@ #ifdef BOOST_MPL_CFG_NO_HAS_XXX # include # include -# include # include #endif diff --git a/include/boost/iterator/interoperable.hpp b/include/boost/iterator/interoperable.hpp index 4bb8c8967..b278eebb4 100644 --- a/include/boost/iterator/interoperable.hpp +++ b/include/boost/iterator/interoperable.hpp @@ -9,9 +9,7 @@ # include -# include -# include - +# include # include // must appear last namespace boost { @@ -33,10 +31,7 @@ namespace iterators { // template struct is_interoperable - : std::integral_constant< - bool - , std::is_convertible< A, B >::value || std::is_convertible< B, A >::value - > + : detail::disjunction, std::is_convertible> { }; diff --git a/include/boost/iterator/is_iterator.hpp b/include/boost/iterator/is_iterator.hpp index 2beba2254..d9830a077 100644 --- a/include/boost/iterator/is_iterator.hpp +++ b/include/boost/iterator/is_iterator.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #if !defined(BOOST_NO_CXX17_ITERATOR_TRAITS) #include #endif @@ -69,7 +70,7 @@ template< typename T > struct is_iterator_impl< T* > : public conjunction< boost::is_complete, - std::integral_constant::value> + negation< std::is_function< T > > >::type { }; diff --git a/include/boost/iterator/is_lvalue_iterator.hpp b/include/boost/iterator/is_lvalue_iterator.hpp index 99038e7a5..f64661b96 100644 --- a/include/boost/iterator/is_lvalue_iterator.hpp +++ b/include/boost/iterator/is_lvalue_iterator.hpp @@ -7,7 +7,6 @@ #include #include -#include #include #include @@ -86,7 +85,7 @@ namespace detail struct is_lvalue_iterator_impl { template - struct rebind : boost::mpl::false_ + struct rebind : std::integral_constant {}; }; @@ -95,7 +94,7 @@ namespace detail struct is_lvalue_iterator_impl { template - struct rebind : boost::mpl::false_ + struct rebind : std::integral_constant {}; }; @@ -103,7 +102,7 @@ namespace detail struct is_lvalue_iterator_impl { template - struct rebind : boost::mpl::false_ + struct rebind : std::integral_constant {}; }; @@ -111,7 +110,7 @@ namespace detail struct is_lvalue_iterator_impl { template - struct rebind : boost::mpl::false_ + struct rebind : std::integral_constant {}; }; #endif diff --git a/include/boost/iterator/is_readable_iterator.hpp b/include/boost/iterator/is_readable_iterator.hpp index f94b79ba8..960516740 100644 --- a/include/boost/iterator/is_readable_iterator.hpp +++ b/include/boost/iterator/is_readable_iterator.hpp @@ -4,7 +4,6 @@ #ifndef IS_READABLE_ITERATOR_DWA2003112_HPP # define IS_READABLE_ITERATOR_DWA2003112_HPP -#include #include #include @@ -56,7 +55,7 @@ namespace detail struct is_readable_iterator_impl { template - struct rebind : boost::mpl::false_ + struct rebind : std::integral_constant {}; }; @@ -65,7 +64,7 @@ namespace detail struct is_readable_iterator_impl { template - struct rebind : boost::mpl::false_ + struct rebind : std::integral_constant {}; }; @@ -73,7 +72,7 @@ namespace detail struct is_readable_iterator_impl { template - struct rebind : boost::mpl::false_ + struct rebind : std::integral_constant {}; }; @@ -81,7 +80,7 @@ namespace detail struct is_readable_iterator_impl { template - struct rebind : boost::mpl::false_ + struct rebind : std::integral_constant {}; }; #endif diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index f4debe04d..7cc2ca26d 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -14,11 +14,11 @@ #include #include #include +#include +#include #include -#include -#include -#include + #include #include #include @@ -82,7 +82,7 @@ namespace iterators { > struct enable_if_interoperable_and_random_access_traversal : public std::enable_if< - mpl::and_< + detail::conjunction< is_interoperable< Facade1, Facade2 > , is_traversal_at_least< typename iterator_category< Facade1 >::type, random_access_traversal_tag > , is_traversal_at_least< typename iterator_category< Facade2 >::type, random_access_traversal_tag > @@ -277,7 +277,9 @@ namespace iterators { writable_postfix_increment_dereference_proxy dereference_proxy; }; -# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +//# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#if 1 template struct is_non_proxy_reference_impl @@ -299,8 +301,9 @@ namespace iterators { template struct is_non_proxy_reference - : mpl::bool_< - is_non_proxy_reference_impl::value + : std::integral_constant< + bool + , is_non_proxy_reference_impl::value > {}; # else @@ -332,7 +335,7 @@ namespace iterators { template struct postfix_increment_result : mpl::eval_if< - mpl::and_< + detail::conjunction< // A proxy is only needed for readable iterators std::is_convertible< Reference @@ -346,7 +349,7 @@ namespace iterators { // No multipass iterator can have values that disappear // before positions can be re-visited - , mpl::not_< + , detail::negation< std::is_convertible< typename iterator_category_to_traversal::type , forward_traversal_tag @@ -431,7 +434,7 @@ namespace iterators { template struct use_operator_brackets_proxy : mpl::not_< - mpl::and_< + detail::conjunction< // Really we want an is_copy_constructible trait here, // but is_POD will have to suffice in the meantime. std::is_standard_layout diff --git a/include/boost/iterator/new_iterator_tests.hpp b/include/boost/iterator/new_iterator_tests.hpp index 6a6bf571d..a1964dd58 100644 --- a/include/boost/iterator/new_iterator_tests.hpp +++ b/include/boost/iterator/new_iterator_tests.hpp @@ -34,9 +34,9 @@ # include # include # include -# include # include +# include # include # include @@ -100,7 +100,7 @@ void writable_iterator_test(Iterator i, T v, T v2) # if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) writable_iterator_traversal_test( - i, v2, mpl::and_< + i, v2, iterators::detail::conjunction< detail::is_incrementable , detail::is_postfix_incrementable >()); diff --git a/include/boost/pending/iterator_tests.hpp b/include/boost/pending/iterator_tests.hpp index 1b1c50bf4..6c50b9d74 100644 --- a/include/boost/pending/iterator_tests.hpp +++ b/include/boost/pending/iterator_tests.hpp @@ -142,8 +142,8 @@ template struct lvalue_test # endif static_assert(std::is_reference::value, "reference must be a reference type."); static_assert( - std::is_same::value || std::is_same::value, - "reference must either be a reference to value_type or constant reference to value_type." + std::is_same::value || std::is_same::value, + "reference must either be a reference to value_type or constant reference to value_type." ); } }; diff --git a/test/iterator_adaptor_test.cpp b/test/iterator_adaptor_test.cpp index 81f2e35f8..4305d1867 100644 --- a/test/iterator_adaptor_test.cpp +++ b/test/iterator_adaptor_test.cpp @@ -210,8 +210,8 @@ main() test = static_assert_same::value; #if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) static_assert( - std::is_convertible::value, - "Iter1::iterator_category must be convertible to std::random_access_iterator_tag." + std::is_convertible::value, + "Iterator must have a random access category." ); #endif } @@ -225,7 +225,7 @@ main() #if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) static_assert(boost::is_readable_iterator::value, "Iter1 is expected to be readable."); # ifndef BOOST_NO_LVALUE_RETURN_DETECTION - static_assert(boost::is_lvalue_iterator::value, "Iter1 is expected to be lvalue."); + static_assert(boost::is_lvalue_iterator::value, "Iter1 is expected to be lvalue iterator."); # endif #endif diff --git a/test/permutation_iterator_test.cpp b/test/permutation_iterator_test.cpp index 619605f41..db601e871 100644 --- a/test/permutation_iterator_test.cpp +++ b/test/permutation_iterator_test.cpp @@ -43,6 +43,8 @@ void permutation_test() const int element_range_size = 10; const int index_size = 7; + static_assert(index_size < element_range_size, "The permutation of some elements is checked."); + element_range_type elements( element_range_size ); for( element_range_type::iterator el_it = elements.begin(); el_it != elements.end(); ++el_it ) { *el_it = std::distance(elements.begin(), el_it); } From 79081314584b92c108eeedc391dd9d53e972e21a Mon Sep 17 00:00:00 2001 From: Georgy Guminov Date: Sat, 19 Oct 2024 17:55:22 +0300 Subject: [PATCH 46/56] Fix compilation. --- include/boost/iterator/iterator_facade.hpp | 7 +- include/boost/iterator/new_iterator_tests.hpp | 151 +++++++++--------- 2 files changed, 76 insertions(+), 82 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 7cc2ca26d..a46141924 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -28,6 +28,7 @@ #include #include +#include #include // this goes last namespace boost { @@ -433,7 +434,7 @@ namespace iterators { // proxy, or whether it can simply return a copy of the value_type. template struct use_operator_brackets_proxy - : mpl::not_< + : detail::negation< detail::conjunction< // Really we want an is_copy_constructible trait here, // but is_POD will have to suffice in the meantime. @@ -455,13 +456,13 @@ namespace iterators { }; template - operator_brackets_proxy make_operator_brackets_result(Iterator const& iter, mpl::true_) + operator_brackets_proxy make_operator_brackets_result(Iterator const& iter, std::integral_constant) { return operator_brackets_proxy(iter); } template - typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, mpl::false_) + typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, std::integral_constant) { return *iter; } diff --git a/include/boost/iterator/new_iterator_tests.hpp b/include/boost/iterator/new_iterator_tests.hpp index a1964dd58..eb36ecc34 100644 --- a/include/boost/iterator/new_iterator_tests.hpp +++ b/include/boost/iterator/new_iterator_tests.hpp @@ -1,5 +1,5 @@ #ifndef BOOST_NEW_ITERATOR_TESTS_HPP -# define BOOST_NEW_ITERATOR_TESTS_HPP +#define BOOST_NEW_ITERATOR_TESTS_HPP // // Copyright (c) David Abrahams 2001. @@ -28,52 +28,49 @@ // 04 Feb 2001 Added lvalue test, corrected preconditions // (David Abrahams) -# include -# include -# include // for detail::dummy_constructor -# include -# include -# include +#include // for detail::dummy_constructor +#include +#include +#include +#include +#include -# include -# include -# include -# include +#include +#include +#include +#include namespace boost { - // Do separate tests for *i++ so we can treat, e.g., smart pointers, // as readable and/or writable iterators. template -void readable_iterator_traversal_test(Iterator i1, T v, mpl::true_) -{ - T v2(*i1++); - BOOST_TEST(v == v2); +void readable_iterator_traversal_test(Iterator i1, T v, + std::integral_constant) { + T v2(*i1++); + BOOST_TEST(v == v2); } template -void readable_iterator_traversal_test(const Iterator i1, T v, mpl::false_) -{} +void readable_iterator_traversal_test(const Iterator i1, T v, + std::integral_constant) {} template -void writable_iterator_traversal_test(Iterator i1, T v, mpl::true_) -{ - ++i1; // we just wrote into that position - *i1++ = v; - Iterator x(i1++); - (void)x; +void writable_iterator_traversal_test(Iterator i1, T v, + std::integral_constant) { + ++i1; // we just wrote into that position + *i1++ = v; + Iterator x(i1++); + (void)x; } template -void writable_iterator_traversal_test(const Iterator i1, T v, mpl::false_) -{} - +void writable_iterator_traversal_test(const Iterator i1, T v, + std::integral_constant) {} // Preconditions: *i == v template -void readable_iterator_test(const Iterator i1, T v) -{ +void readable_iterator_test(const Iterator i1, T v) { Iterator i2(i1); // Copy Constructible typedef typename std::iterator_traits::reference ref_t; ref_t r1 = *i1; @@ -83,33 +80,35 @@ void readable_iterator_test(const Iterator i1, T v) BOOST_TEST(v1 == v); BOOST_TEST(v2 == v); -# if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) - readable_iterator_traversal_test(i1, v, detail::is_postfix_incrementable()); +#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) + readable_iterator_traversal_test( + i1, v, + std::integral_constant< + bool, detail::is_postfix_incrementable::value>{}); // I think we don't really need this as it checks the same things as // the above code. - static_assert(is_readable_iterator::value, "Iterator must be readable."); -# endif + static_assert(is_readable_iterator::value, + "Iterator must be readable."); +#endif } template -void writable_iterator_test(Iterator i, T v, T v2) -{ +void writable_iterator_test(Iterator i, T v, T v2) { Iterator i2(i); // Copy Constructible *i2 = v; -# if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) +#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) writable_iterator_traversal_test( - i, v2, iterators::detail::conjunction< - detail::is_incrementable - , detail::is_postfix_incrementable + i, v2, + iterators::detail::conjunction< + std::integral_constant::value>, + std::integral_constant::value> >()); -# endif +#endif } -template -void swappable_iterator_test(Iterator i, Iterator j) -{ +template void swappable_iterator_test(Iterator i, Iterator j) { Iterator i2(i), j2(j); typename std::iterator_traits::value_type bi = *i, bj = *j; iter_swap(i2, j2); @@ -118,51 +117,50 @@ void swappable_iterator_test(Iterator i, Iterator j) } template -void constant_lvalue_iterator_test(Iterator i, T v1) -{ +void constant_lvalue_iterator_test(Iterator i, T v1) { Iterator i2(i); typedef typename std::iterator_traits::value_type value_type; typedef typename std::iterator_traits::reference reference; - static_assert( - std::is_same::value, - "reference type must be the same as const value_type& for constant lvalue iterator." - ); - const T& v2 = *i2; + static_assert(std::is_same::value, + "reference type must be the same as const value_type& for " + "constant lvalue iterator."); + const T &v2 = *i2; BOOST_TEST(v1 == v2); -# ifndef BOOST_NO_LVALUE_RETURN_DETECTION - static_assert(is_lvalue_iterator::value, "Iterator must be lvalue."); - static_assert(!is_non_const_lvalue_iterator::value, "Iterator must be const."); -# endif +#ifndef BOOST_NO_LVALUE_RETURN_DETECTION + static_assert(is_lvalue_iterator::value, + "Iterator must be lvalue."); + static_assert(!is_non_const_lvalue_iterator::value, + "Iterator must be const."); +#endif } template -void non_const_lvalue_iterator_test(Iterator i, T v1, T v2) -{ +void non_const_lvalue_iterator_test(Iterator i, T v1, T v2) { Iterator i2(i); typedef typename std::iterator_traits::value_type value_type; typedef typename std::iterator_traits::reference reference; - static_assert( - std::is_same::value, - "reference type must be the same as value_type& for non-constant lvalue iterator." - ); - T& v3 = *i2; + static_assert(std::is_same::value, + "reference type must be the same as value_type& for " + "non-constant lvalue iterator."); + T &v3 = *i2; BOOST_TEST(v1 == v3); // A non-const lvalue iterator is not necessarily writable, but we // are assuming the value_type is assignable here *i = v2; - T& v4 = *i2; + T &v4 = *i2; BOOST_TEST(v2 == v4); -# ifndef BOOST_NO_LVALUE_RETURN_DETECTION - static_assert(is_lvalue_iterator::value, "Iterator must be lvalue."); - static_assert(is_non_const_lvalue_iterator::value, "Iterator must be non-const."); -# endif +#ifndef BOOST_NO_LVALUE_RETURN_DETECTION + static_assert(is_lvalue_iterator::value, + "Iterator must be lvalue."); + static_assert(is_non_const_lvalue_iterator::value, + "Iterator must be non-const."); +#endif } template -void forward_readable_iterator_test(Iterator i, Iterator j, T val1, T val2) -{ +void forward_readable_iterator_test(Iterator i, Iterator j, T val1, T val2) { Iterator i2; Iterator i3(i); i2 = i; @@ -183,8 +181,7 @@ void forward_readable_iterator_test(Iterator i, Iterator j, T val1, T val2) } template -void forward_swappable_iterator_test(Iterator i, Iterator j, T val1, T val2) -{ +void forward_swappable_iterator_test(Iterator i, Iterator j, T val1, T val2) { forward_readable_iterator_test(i, j, val1, val2); Iterator i2 = i; ++i2; @@ -194,8 +191,7 @@ void forward_swappable_iterator_test(Iterator i, Iterator j, T val1, T val2) // bidirectional // Preconditions: *i == v1, *++i == v2 template -void bidirectional_readable_iterator_test(Iterator i, T v1, T v2) -{ +void bidirectional_readable_iterator_test(Iterator i, T v1, T v2) { Iterator j(i); ++j; forward_readable_iterator_test(i, j, v1, v2); @@ -224,14 +220,12 @@ void bidirectional_readable_iterator_test(Iterator i, T v1, T v2) // random access // Preconditions: [i,i+N) is a valid range template -void random_access_readable_iterator_test(Iterator i, int N, TrueVals vals) -{ +void random_access_readable_iterator_test(Iterator i, int N, TrueVals vals) { bidirectional_readable_iterator_test(i, vals[0], vals[1]); const Iterator j = i; int c; - for (c = 0; c < N-1; ++c) - { + for (c = 0; c < N - 1; ++c) { BOOST_TEST(i == j + c); BOOST_TEST(*i == vals[c]); typename std::iterator_traits::value_type x = j[c]; @@ -246,8 +240,7 @@ void random_access_readable_iterator_test(Iterator i, int N, TrueVals vals) } Iterator k = j + N - 1; - for (c = 0; c < N-1; ++c) - { + for (c = 0; c < N - 1; ++c) { BOOST_TEST(i == k - c); BOOST_TEST(*i == vals[N - 1 - c]); typename std::iterator_traits::value_type x = j[N - 1 - c]; @@ -264,6 +257,6 @@ void random_access_readable_iterator_test(Iterator i, int N, TrueVals vals) } // namespace boost -# include +#include #endif // BOOST_NEW_ITERATOR_TESTS_HPP From 4f040a9d8613f6be73ecba7c717cc51a68519679 Mon Sep 17 00:00:00 2001 From: Georgy Guminov Date: Sat, 19 Oct 2024 18:04:59 +0300 Subject: [PATCH 47/56] Fix compilation. [2] --- .../boost/iterator/detail/facade_iterator_category.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/iterator/detail/facade_iterator_category.hpp b/include/boost/iterator/detail/facade_iterator_category.hpp index eb932400e..7bac8d6c8 100644 --- a/include/boost/iterator/detail/facade_iterator_category.hpp +++ b/include/boost/iterator/detail/facade_iterator_category.hpp @@ -56,12 +56,12 @@ template struct iterator_writability_disabled # ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY // Adding Thomas' logic? : disjunction< - is_const - , boost::detail::indirect_traits::is_reference_to_const - , is_const + std::is_const + , std::integral_constant::value> + , std::is_const > # else - : is_const + : std::is_const # endif {}; From 6184e618f7772864b79ced725c21613b285e0a20 Mon Sep 17 00:00:00 2001 From: Georgy Guminov Date: Sat, 19 Oct 2024 18:15:01 +0300 Subject: [PATCH 48/56] Fix compilation. [3] (+ std::true_type & std::false_type) --- include/boost/iterator/is_lvalue_iterator.hpp | 8 ++++---- include/boost/iterator/is_readable_iterator.hpp | 8 ++++---- include/boost/iterator/iterator_facade.hpp | 4 ++-- include/boost/iterator/new_iterator_tests.hpp | 12 ++++-------- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/include/boost/iterator/is_lvalue_iterator.hpp b/include/boost/iterator/is_lvalue_iterator.hpp index f64661b96..66cdd191a 100644 --- a/include/boost/iterator/is_lvalue_iterator.hpp +++ b/include/boost/iterator/is_lvalue_iterator.hpp @@ -85,7 +85,7 @@ namespace detail struct is_lvalue_iterator_impl { template - struct rebind : std::integral_constant + struct rebind : std::false_type {}; }; @@ -94,7 +94,7 @@ namespace detail struct is_lvalue_iterator_impl { template - struct rebind : std::integral_constant + struct rebind : std::false_type {}; }; @@ -102,7 +102,7 @@ namespace detail struct is_lvalue_iterator_impl { template - struct rebind : std::integral_constant + struct rebind : std::false_type {}; }; @@ -110,7 +110,7 @@ namespace detail struct is_lvalue_iterator_impl { template - struct rebind : std::integral_constant + struct rebind : std::false_type {}; }; #endif diff --git a/include/boost/iterator/is_readable_iterator.hpp b/include/boost/iterator/is_readable_iterator.hpp index 960516740..5cfce27a4 100644 --- a/include/boost/iterator/is_readable_iterator.hpp +++ b/include/boost/iterator/is_readable_iterator.hpp @@ -55,7 +55,7 @@ namespace detail struct is_readable_iterator_impl { template - struct rebind : std::integral_constant + struct rebind : std::false_type {}; }; @@ -64,7 +64,7 @@ namespace detail struct is_readable_iterator_impl { template - struct rebind : std::integral_constant + struct rebind : std::false_type {}; }; @@ -72,7 +72,7 @@ namespace detail struct is_readable_iterator_impl { template - struct rebind : std::integral_constant + struct rebind : std::false_type {}; }; @@ -80,7 +80,7 @@ namespace detail struct is_readable_iterator_impl { template - struct rebind : std::integral_constant + struct rebind : std::false_type {}; }; #endif diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index a46141924..4dbbecaac 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -456,13 +456,13 @@ namespace iterators { }; template - operator_brackets_proxy make_operator_brackets_result(Iterator const& iter, std::integral_constant) + operator_brackets_proxy make_operator_brackets_result(Iterator const& iter, std::true_type) { return operator_brackets_proxy(iter); } template - typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, std::integral_constant) + typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, std::false_type) { return *iter; } diff --git a/include/boost/iterator/new_iterator_tests.hpp b/include/boost/iterator/new_iterator_tests.hpp index eb36ecc34..90fde100c 100644 --- a/include/boost/iterator/new_iterator_tests.hpp +++ b/include/boost/iterator/new_iterator_tests.hpp @@ -45,19 +45,16 @@ namespace boost { // Do separate tests for *i++ so we can treat, e.g., smart pointers, // as readable and/or writable iterators. template -void readable_iterator_traversal_test(Iterator i1, T v, - std::integral_constant) { +void readable_iterator_traversal_test(Iterator i1, T v, std::true_type) { T v2(*i1++); BOOST_TEST(v == v2); } template -void readable_iterator_traversal_test(const Iterator i1, T v, - std::integral_constant) {} +void readable_iterator_traversal_test(const Iterator i1, T v, std::false_type) {} template -void writable_iterator_traversal_test(Iterator i1, T v, - std::integral_constant) { +void writable_iterator_traversal_test(Iterator i1, T v, std::true_type) { ++i1; // we just wrote into that position *i1++ = v; Iterator x(i1++); @@ -65,8 +62,7 @@ void writable_iterator_traversal_test(Iterator i1, T v, } template -void writable_iterator_traversal_test(const Iterator i1, T v, - std::integral_constant) {} +void writable_iterator_traversal_test(const Iterator i1, T v, std::false_type) {} // Preconditions: *i == v template From bef9f98df05b263c86391e1fb7f10a108e5d5e71 Mon Sep 17 00:00:00 2001 From: Georgy Guminov Date: Sat, 19 Oct 2024 18:20:11 +0300 Subject: [PATCH 49/56] Fix compilation. [4] --- include/boost/iterator/iterator_facade.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 4dbbecaac..870e4bfda 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -786,11 +786,11 @@ namespace iterators { typename boost::iterators::detail::operator_brackets_result::type operator[](difference_type n) const { - typedef boost::iterators::detail::use_operator_brackets_proxy use_proxy; + const auto use_proxy = boost::iterators::detail::use_operator_brackets_proxy::value; return boost::iterators::detail::make_operator_brackets_result( this->derived() + n - , use_proxy() + , std::integral_constant{} ); } From 8f31c27558b6b36ca4c532647808208b72d33ea0 Mon Sep 17 00:00:00 2001 From: Georgy Guminov Date: Sun, 20 Oct 2024 03:43:03 +0300 Subject: [PATCH 50/56] Return macro. --- include/boost/iterator/iterator_facade.hpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 870e4bfda..8a0853642 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -278,10 +278,7 @@ namespace iterators { writable_postfix_increment_dereference_proxy dereference_proxy; }; -//# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -#if 1 - +# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template struct is_non_proxy_reference_impl { From 0e892b29cdc21a62e4dd1d57119d1af5ca2f47cd Mon Sep 17 00:00:00 2001 From: Georgy Guminov Date: Sat, 26 Oct 2024 14:41:35 +0300 Subject: [PATCH 51/56] Removed unused include. --- test/detail/zip_iterator_test.ipp | 1 - 1 file changed, 1 deletion(-) diff --git a/test/detail/zip_iterator_test.ipp b/test/detail/zip_iterator_test.ipp index 39c223c0d..7e0d2f7b0 100644 --- a/test/detail/zip_iterator_test.ipp +++ b/test/detail/zip_iterator_test.ipp @@ -8,7 +8,6 @@ #include -#include #include #include #include From 33b33b1bb4eeadab1a85d35bdfaaf8d295ccae39 Mon Sep 17 00:00:00 2001 From: Georgy Guminov Date: Sat, 26 Oct 2024 14:48:51 +0300 Subject: [PATCH 52/56] Correct static_assert messages. --- include/boost/iterator/iterator_adaptor.hpp | 6 +++--- include/boost/iterator/iterator_archetypes.hpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/boost/iterator/iterator_adaptor.hpp b/include/boost/iterator/iterator_adaptor.hpp index c72efbf51..9c6cbfafb 100644 --- a/include/boost/iterator/iterator_adaptor.hpp +++ b/include/boost/iterator/iterator_adaptor.hpp @@ -257,7 +257,7 @@ namespace iterators { { static_assert( std::is_convertible::value, - "Super iterator must have a random_access_traversal_tag." + "Iterator must support random access traversal." ); m_iterator += n; } @@ -268,7 +268,7 @@ namespace iterators { { static_assert( std::is_convertible::value, - "Super iterator must have a bidirectional_traversal_tag." + "Iterator must support bidirectional traversal." ); --m_iterator; } @@ -281,7 +281,7 @@ namespace iterators { { static_assert( std::is_convertible::value, - "Super iterator must have a random_access_traversal_tag." + "Super iterator must support random access traversal." ); // Maybe readd with same_distance // BOOST_STATIC_ASSERT( diff --git a/include/boost/iterator/iterator_archetypes.hpp b/include/boost/iterator/iterator_archetypes.hpp index 7c8e7067a..6696445cf 100644 --- a/include/boost/iterator/iterator_archetypes.hpp +++ b/include/boost/iterator/iterator_archetypes.hpp @@ -324,7 +324,7 @@ struct iterator_access_archetype_impl< template struct archetype { - static_assert(!std::is_const::value, "Value type must be const."); + static_assert(!std::is_const::value, "Value type must not be const."); typedef void value_type; typedef void reference; typedef void pointer; @@ -375,7 +375,7 @@ struct iterator_access_archetype_impl Value, archetypes::readable_lvalue_iterator_t > { - static_assert(!std::is_const::value, "Value type must be const."); + static_assert(!std::is_const::value, "Value type must not be const."); }; }; From df5df6ac234f4b8b71a388b8966f41f91d750711 Mon Sep 17 00:00:00 2001 From: Georgy Guminov Date: Sat, 26 Oct 2024 15:06:43 +0300 Subject: [PATCH 53/56] Remove BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY --- include/boost/iterator/detail/config_def.hpp | 5 ----- include/boost/iterator/detail/config_undef.hpp | 1 - include/boost/iterator/iterator_facade.hpp | 12 ------------ 3 files changed, 18 deletions(-) diff --git a/include/boost/iterator/detail/config_def.hpp b/include/boost/iterator/detail/config_def.hpp index e9861ef76..dd0c96d09 100644 --- a/include/boost/iterator/detail/config_def.hpp +++ b/include/boost/iterator/detail/config_def.hpp @@ -109,11 +109,6 @@ #endif - -#if !defined(BOOST_MSVC) && (defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE)) -# define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY -#endif - # if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) // GCC-2.95 (obsolete) eagerly instantiates templated constructors and conversion diff --git a/include/boost/iterator/detail/config_undef.hpp b/include/boost/iterator/detail/config_undef.hpp index a32529c02..b1ebc658b 100644 --- a/include/boost/iterator/detail/config_undef.hpp +++ b/include/boost/iterator/detail/config_undef.hpp @@ -13,7 +13,6 @@ #undef BOOST_NO_IS_CONVERTIBLE #undef BOOST_NO_IS_CONVERTIBLE_TEMPLATE -#undef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY #undef BOOST_NO_LVALUE_RETURN_DETECTION #undef BOOST_NO_ONE_WAY_ITERATOR_INTEROP diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 8a0853642..e7571b7f3 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -497,17 +497,6 @@ namespace iterators { // Macros which describe the declarations of binary operators -# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY -# define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \ - template < \ - class Derived1, class V1, class TC1, class Reference1, class Difference1 \ - , class Derived2, class V2, class TC2, class Reference2, class Difference2 \ - > \ - prefix typename mpl::apply2::type \ - operator op( \ - iterator_facade const& lhs \ - , iterator_facade const& rhs) -# else # define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \ template < \ class Derived1, class V1, class TC1, class Reference1, class Difference1 \ @@ -520,7 +509,6 @@ namespace iterators { operator op( \ iterator_facade const& lhs \ , iterator_facade const& rhs) -# endif # define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable) From 7937fb9a6607adc97466ee1d6f31990bd1e48994 Mon Sep 17 00:00:00 2001 From: Georgy Guminov Date: Sat, 26 Oct 2024 15:17:11 +0300 Subject: [PATCH 54/56] Remove useless static asserts. --- include/boost/iterator/iterator_facade.hpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index e7571b7f3..37e66c0da 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -919,11 +919,6 @@ namespace iterators { # define BOOST_ITERATOR_FACADE_INTEROP(op, result_type, return_prefix, base_op) \ BOOST_ITERATOR_FACADE_INTEROP_HEAD(inline, op, result_type) \ { \ - /* For those compilers that do not support enable_if */ \ - static_assert( \ - is_interoperable::value, \ - "Derived1 & Derived2 types must be interoperable." \ - ); \ return_prefix iterator_core_access::base_op( \ *static_cast(&lhs) \ , *static_cast(&rhs) \ @@ -951,14 +946,6 @@ namespace iterators { using boost::iterators::detail::is_traversal_at_least; \ typedef typename iterator_category::type Derived1IterCat; \ typedef typename iterator_category::type Derived2IterCat; \ - /* For those compilers that do not support enable_if */ \ - static_assert( \ - is_interoperable::value && \ - is_traversal_at_least::value && \ - is_traversal_at_least::value, \ - "Derived1 & Derived2 types must be interoperable and must both have " \ - "random_access_traversal_tag." \ - ); \ return_prefix iterator_core_access::base_op( \ *static_cast(&lhs) \ , *static_cast(&rhs) \ From 7b231fed49e6d677b2ef7acadd96df029cd7d308 Mon Sep 17 00:00:00 2001 From: Georgy Guminov Date: Sat, 26 Oct 2024 15:29:57 +0300 Subject: [PATCH 55/56] Correct static_assert messages. --- include/boost/iterator/new_iterator_tests.hpp | 4 ++-- test/indirect_iter_member_types.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/iterator/new_iterator_tests.hpp b/include/boost/iterator/new_iterator_tests.hpp index 90fde100c..d29b7b708 100644 --- a/include/boost/iterator/new_iterator_tests.hpp +++ b/include/boost/iterator/new_iterator_tests.hpp @@ -124,7 +124,7 @@ void constant_lvalue_iterator_test(Iterator i, T v1) { BOOST_TEST(v1 == v2); #ifndef BOOST_NO_LVALUE_RETURN_DETECTION static_assert(is_lvalue_iterator::value, - "Iterator must be lvalue."); + "Iterator must be an lvalue iterator."); static_assert(!is_non_const_lvalue_iterator::value, "Iterator must be const."); #endif @@ -149,7 +149,7 @@ void non_const_lvalue_iterator_test(Iterator i, T v1, T v2) { BOOST_TEST(v2 == v4); #ifndef BOOST_NO_LVALUE_RETURN_DETECTION static_assert(is_lvalue_iterator::value, - "Iterator must be lvalue."); + "Iterator must be an lvalue iterator."); static_assert(is_non_const_lvalue_iterator::value, "Iterator must be non-const."); #endif diff --git a/test/indirect_iter_member_types.cpp b/test/indirect_iter_member_types.cpp index dffe68c07..86b893fa3 100644 --- a/test/indirect_iter_member_types.cpp +++ b/test/indirect_iter_member_types.cpp @@ -40,7 +40,7 @@ int main() static_assert(std::is_convertible::value, - "Iter must have an STL random_access_iterator_tag."); + "Iter must have a random access category."); static_assert(std::is_convertible::type, boost::random_access_traversal_tag>::value, "Iter must have a random_access_traversal_tag."); @@ -73,7 +73,7 @@ int main() static_assert(std::is_convertible::value, - "Iter must have an STL random_access_iterator_tag."); + "Iter must have a random access category."); static_assert(std::is_convertible::type, boost::random_access_traversal_tag>::value, "Iter must have a random_access_traversal_tag."); From e05b5e20657fe620ece60e289b3dd2e0ec3d30b1 Mon Sep 17 00:00:00 2001 From: Georgy Guminov Date: Sun, 15 Dec 2024 13:00:05 +0300 Subject: [PATCH 56/56] Fix messages & replace is_standard_layout with is_copy_constructible. --- include/boost/iterator/iterator_facade.hpp | 6 +----- include/boost/iterator/minimum_category.hpp | 2 +- include/boost/iterator/new_iterator_tests.hpp | 7 +++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 37e66c0da..292fcb9d9 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -433,9 +433,7 @@ namespace iterators { struct use_operator_brackets_proxy : detail::negation< detail::conjunction< - // Really we want an is_copy_constructible trait here, - // but is_POD will have to suffice in the meantime. - std::is_standard_layout + std::is_copy_constructible , std::is_trivial , iterator_writability_disabled > @@ -944,8 +942,6 @@ namespace iterators { BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(inline, op, result_type) \ { \ using boost::iterators::detail::is_traversal_at_least; \ - typedef typename iterator_category::type Derived1IterCat; \ - typedef typename iterator_category::type Derived2IterCat; \ return_prefix iterator_core_access::base_op( \ *static_cast(&lhs) \ , *static_cast(&rhs) \ diff --git a/include/boost/iterator/minimum_category.hpp b/include/boost/iterator/minimum_category.hpp index 58fa2759e..913cec43e 100644 --- a/include/boost/iterator/minimum_category.hpp +++ b/include/boost/iterator/minimum_category.hpp @@ -44,7 +44,7 @@ struct minimum_category_impl { static_assert( std::is_same::value, - "Types must be same when they are convertible to each other." + "Iterator category types must be the same when they are equivalent." ); typedef T1 type; }; diff --git a/include/boost/iterator/new_iterator_tests.hpp b/include/boost/iterator/new_iterator_tests.hpp index d29b7b708..a8a833517 100644 --- a/include/boost/iterator/new_iterator_tests.hpp +++ b/include/boost/iterator/new_iterator_tests.hpp @@ -123,10 +123,9 @@ void constant_lvalue_iterator_test(Iterator i, T v1) { const T &v2 = *i2; BOOST_TEST(v1 == v2); #ifndef BOOST_NO_LVALUE_RETURN_DETECTION - static_assert(is_lvalue_iterator::value, - "Iterator must be an lvalue iterator."); - static_assert(!is_non_const_lvalue_iterator::value, - "Iterator must be const."); + static_assert(is_lvalue_iterator::value + && !is_non_const_lvalue_iterator::value, + "Iterator must be a const lvalue iterator."); #endif }