diff --git a/include/boost/multi_index/detail/ord_index_impl.hpp b/include/boost/multi_index/detail/ord_index_impl.hpp index f7e6ced..0af68f9 100644 --- a/include/boost/multi_index/detail/ord_index_impl.hpp +++ b/include/boost/multi_index/detail/ord_index_impl.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2022 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * 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) @@ -47,7 +47,6 @@ #include #include #include -#include #include #include #include @@ -1725,16 +1724,22 @@ void swap( /* Boost.Foreach compatibility */ +namespace boost{ +namespace foreach{ + +template +struct is_noncopyable; + template< typename KeyFromValue,typename Compare, typename SuperMeta,typename TagList,typename Category,typename AugmentPolicy > -inline boost::mpl::true_* boost_foreach_is_noncopyable( +struct is_noncopyable< boost::multi_index::detail::ordered_index< - KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>*&, - boost_foreach_argument_dependent_lookup_hack) -{ - return 0; + KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy> +>:boost::mpl::true_{}; + +} } #undef BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT diff --git a/include/boost/multi_index/hashed_index.hpp b/include/boost/multi_index/hashed_index.hpp index d4ba37a..5100d3c 100644 --- a/include/boost/multi_index/hashed_index.hpp +++ b/include/boost/multi_index/hashed_index.hpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -1890,16 +1889,21 @@ struct hashed_non_unique /* Boost.Foreach compatibility */ +namespace boost{ +namespace foreach{ + +template +struct is_noncopyable; + template< typename KeyFromValue,typename Hash,typename Pred, typename SuperMeta,typename TagList,typename Category > -inline boost::mpl::true_* boost_foreach_is_noncopyable( - boost::multi_index::detail::hashed_index< - KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>*&, - boost_foreach_argument_dependent_lookup_hack) -{ - return 0; +struct is_noncopyable +>:boost::mpl::true_{}; + +} } #undef BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT diff --git a/include/boost/multi_index/random_access_index.hpp b/include/boost/multi_index/random_access_index.hpp index c124746..96b4565 100644 --- a/include/boost/multi_index/random_access_index.hpp +++ b/include/boost/multi_index/random_access_index.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2021 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * 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) @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -1343,12 +1342,18 @@ struct random_access /* Boost.Foreach compatibility */ +namespace boost{ +namespace foreach{ + +template +struct is_noncopyable; + template -inline boost::mpl::true_* boost_foreach_is_noncopyable( - boost::multi_index::detail::random_access_index*&, - boost_foreach_argument_dependent_lookup_hack) -{ - return 0; +struct is_noncopyable< + boost::multi_index::detail::random_access_index +>:boost::mpl::true_{}; + +} } #undef BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT diff --git a/include/boost/multi_index/sequenced_index.hpp b/include/boost/multi_index/sequenced_index.hpp index f12213e..770a6ce 100644 --- a/include/boost/multi_index/sequenced_index.hpp +++ b/include/boost/multi_index/sequenced_index.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2021 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * 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) @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -1238,12 +1237,18 @@ struct sequenced /* Boost.Foreach compatibility */ +namespace boost{ +namespace foreach{ + +template +struct is_noncopyable; + template -inline boost::mpl::true_* boost_foreach_is_noncopyable( - boost::multi_index::detail::sequenced_index*&, - boost_foreach_argument_dependent_lookup_hack) -{ - return 0; +struct is_noncopyable< + boost::multi_index::detail::sequenced_index +>:boost::mpl::true_{}; + +} } #undef BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT diff --git a/test/test_iterators.cpp b/test/test_iterators.cpp index d9c7f7f..a36b638 100644 --- a/test/test_iterators.cpp +++ b/test/test_iterators.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex test for iterators. * - * Copyright 2003-2013 Joaquin M Lopez Munoz. + * Copyright 2003-2023 Joaquin M Lopez Munoz. * 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) @@ -15,6 +15,7 @@ #include "employee.hpp" #include #include +#include using namespace boost::multi_index; @@ -223,6 +224,24 @@ void test_const_rnd_iterators(const Index& i,int target) BOOST_TEST(n==target&&n==m&&n==p&&n==q); } +template +void test_boost_for_each(const Index& i,int) +{ + typedef typename Index::value_type value_type; + typedef typename Index::size_type size_type; + + size_type size=i.size(); + size_type count=0; + + BOOST_FOREACH(value_type const& x, i) + { + (void)x; + ++count; + } + + BOOST_TEST_EQ(count, size); +} + void test_iterators() { employee_set es; @@ -237,14 +256,20 @@ void test_iterators() test_non_const_iterators (es,target); test_const_iterators (es,target); + test_boost_for_each (es,target); test_non_const_hashed_iterators(get<1>(es),target); test_const_hashed_iterators (get<1>(es),target); + test_boost_for_each (get<1>(es),target); test_non_const_iterators (get<2>(es),target); test_const_iterators (get<2>(es),target); + test_boost_for_each (get<2>(es),target); test_non_const_iterators (get<3>(es),target); test_const_iterators (get<3>(es),target); + test_boost_for_each (get<3>(es),target); test_non_const_hashed_iterators(get<4>(es),target); test_const_hashed_iterators (get<4>(es),target); + test_boost_for_each (get<4>(es),target); test_non_const_rnd_iterators (get<5>(es),target); test_const_rnd_iterators (get<5>(es),target); + test_boost_for_each (get<5>(es),target); }