diff --git a/.travis.yml b/.travis.yml index 0528f49db..cdeef82b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -184,9 +184,11 @@ install: - git submodule init libs/array - git submodule init libs/assert + - git submodule init libs/bimap - git submodule init libs/bind - git submodule init libs/concept_check - git submodule init libs/config + - git submodule init libs/container - git submodule init libs/container_hash - git submodule init libs/conversion - git submodule init libs/core @@ -195,6 +197,7 @@ install: - git submodule init libs/function_types - git submodule init libs/functional - git submodule init libs/integer + - git submodule init libs/intrusive - git submodule init libs/iterator - git submodule init libs/lambda - git submodule init libs/move diff --git a/appveyor.yml b/appveyor.yml index 4613ff61a..3c0087999 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -46,9 +46,11 @@ install: - git submodule init libs/array - git submodule init libs/assert + - git submodule init libs/bimap - git submodule init libs/bind - git submodule init libs/concept_check - git submodule init libs/config + - git submodule init libs/container - git submodule init libs/container_hash - git submodule init libs/conversion - git submodule init libs/core @@ -57,6 +59,7 @@ install: - git submodule init libs/function_types - git submodule init libs/functional - git submodule init libs/integer + - git submodule init libs/intrusive - git submodule init libs/iterator - git submodule init libs/lambda - git submodule init libs/move diff --git a/doc/adapted.qbk b/doc/adapted.qbk index d14086196..507cd7759 100644 --- a/doc/adapted.qbk +++ b/doc/adapted.qbk @@ -183,6 +183,110 @@ __boost_array_library__ [endsect] +[section:structured_pair boost::bimaps::relation::structured_pair] + +This module provides adapters for +`boost::bimaps::relation::structured_pair`. Including the module header +makes `boost::bimaps::relation::structured_pair` a fully conforming +__random_access_sequence__. + +[heading Header] + + #include + #include + +[heading Model of] + +* __random_access_sequence__ + +[heading Example] + + boost::bimaps::relation::structured_pair< + int + , std::string + > p(123, "Hola!!!"); + std::cout << __at_c__<0>(p) << std::endl; + std::cout << __at_c__<1>(p) << std::endl; + std::cout << p << std::endl; + +[endsect] + +[section:compressed_pair boost::compressed_pair] + +This module provides adapters for __boost_compressed_pair__. Including the +module header makes __boost_compressed_pair__ a fully conforming +__random_access_sequence__. + +[heading Header] + + #include + #include + +[heading Model of] + +* __random_access_sequence__ + +[heading Example] + + boost::compressed_pair p(123, "Hola!!!"); + std::cout << __at_c__<0>(p) << std::endl; + std::cout << __at_c__<1>(p) << std::endl; + std::cout << p << std::endl; + +[endsect] + +[section:container_pair boost::container::map/multimap<>::movable_value_type] + +This module provides adapters for the `mutable_value_type` definition nested +within __boost_container_map__ and __boost_container_multimap__. Including +the module header makes `mutable_value_type` a fully conforming +__random_access_sequence__. + +[heading Header] + + #include + #include + +[heading Model of] + +* __random_access_sequence__ + +[heading Example] + + boost::container::map< + int + , std::string + >::movable_value_type p(123, "Hola!!!"); + std::cout << __at_c__<0>(p) << std::endl; + std::cout << __at_c__<1>(p) << std::endl; + std::cout << p << std::endl; + +[endsect] + +[section:compressed_pair boost::compressed_pair] + +This module provides adapters for __boost_compressed_pair__. Including the +module header makes __boost_compressed_pair__ a fully conforming +__random_access_sequence__. + +[heading Header] + + #include + #include + +[heading Model of] + +* __random_access_sequence__ + +[heading Example] + + boost::compressed_pair p(123, "Hola!!!"); + std::cout << __at_c__<0>(p) << std::endl; + std::cout << __at_c__<1>(p) << std::endl; + std::cout << p << std::endl; + +[endsect] + [section boost::tuple] This module provides adapters for `boost::tuple`. Including the module header makes `boost::tuple` a fully conforming __forward_sequence__. diff --git a/doc/fusion.qbk b/doc/fusion.qbk index 6d6987d5c..9c1905ff3 100644 --- a/doc/fusion.qbk +++ b/doc/fusion.qbk @@ -37,6 +37,9 @@ [def __boost_any__ [@http://www.boost.org/libs/any Boost.Any Library]] [def __new_iterator_concepts__ [@http://www.boost.org/libs/iterator/doc/new-iter-concepts.html New Iterator Concepts]] [def __boost_array_library__ [@http://www.boost.org/libs/array Boost.Array Library]] +[def __boost_container_map__ [@http://www.boost.org/doc/html/boost/container/map.html `boost::container::map`]] +[def __boost_container_multimap__ [@http://www.boost.org/doc/html/boost/container/multimap.html `boost::container::multimap`]] +[def __boost_compressed_pair__ [@http://www.boost.org/libs/utility/doc/html/compressed_pair.html `boost::compressed_pair`]] [def __boost_variant_library__ [@http://www.boost.org/libs/variant Boost.Variant Library]] [def __boost_tuple_library__ [@http://www.boost.org/libs/tuple Boost.Tuple Library]] [def __boost_ref__ [@http://www.boost.org/libs/core/ref.html Ref utility]] @@ -134,6 +137,9 @@ [def __array__ [link fusion.adapted.array array]] [def __std_pair__ [link fusion.adapted.std__pair `std::pair`]] [def __boost_array__ [link fusion.adapted.boost__array `boost::array`]] +[def __structured_pair__ [link fusion.adapted.structured_pair `boost::bimaps::relation::structured_pair`]] +[def __container_pair__ [link fusion.adapted.container_pair `boost::container::map/multimap<>::movable_value_type`]] +[def __compressed_pair__ [link fusion.adapted.compressed_pair `boost::compressed_pair`]] [def __mpl_sequence__ [link fusion.adapted.mpl_sequence mpl sequence]] [def __adapt_tpl_struct__ [link fusion.adapted.adapt_tpl_struct `BOOST_FUSION_ADAPT_TPL_STRUCT`]] [def __adapt_struct_named__ [link fusion.adapted.adapt_struct_named `BOOST_FUSION_ADAPT_STRUCT_NAMED`]] diff --git a/doc/sequence.qbk b/doc/sequence.qbk index 4625f8a5a..946230ab7 100644 --- a/doc/sequence.qbk +++ b/doc/sequence.qbk @@ -120,6 +120,9 @@ For any Forward Sequence s the following invariants always hold: [heading Models] * __std_pair__ +* __structured_pair__ +* __container_pair__ +* __compressed_pair__ * __boost_array__ * __vector__ * __cons__ @@ -193,6 +196,9 @@ are not defined in __forward_sequence__. [heading Models] * __std_pair__ +* __structured_pair__ +* __container_pair__ +* __compressed_pair__ * __boost_array__ * __vector__ * __map__ @@ -281,6 +287,9 @@ are not defined in __bidirectional_sequence__. [heading Models] * __std_pair__ +* __structured_pair__ +* __container_pair__ +* __compressed_pair__ * __boost_array__ * __vector__ * __map__ diff --git a/include/boost/fusion/adapted.hpp b/include/boost/fusion/adapted.hpp index 5bc33899c..47193e4ba 100644 --- a/include/boost/fusion/adapted.hpp +++ b/include/boost/fusion/adapted.hpp @@ -1,21 +1,25 @@ -/*============================================================================= +/*============================================================================ Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2005-2006 Dan Marsden - 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) -==============================================================================*/ + 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) +============================================================================*/ #if !defined(BOOST_FUSION_ADAPTED_30122005_1420) #define BOOST_FUSION_ADAPTED_30122005_1420 -#include #include #include #include #include #include #include +#include +#include +#include #include +#include // The std_tuple_iterator adaptor only supports implementations // using variadic templates @@ -23,4 +27,5 @@ #include #endif -#endif +#endif // include guard + diff --git a/include/boost/fusion/adapted/boost_bimap_pair.hpp b/include/boost/fusion/adapted/boost_bimap_pair.hpp new file mode 100755 index 000000000..8c089be36 --- /dev/null +++ b/include/boost/fusion/adapted/boost_bimap_pair.hpp @@ -0,0 +1,71 @@ +/*============================================================================ + Copyright (c) 2013-2018 Cromwell D. Enage + + 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) +============================================================================*/ +#if !defined(BOOST_FUSION_ADAPTED_BOOST_BIMAP_PAIR_HPP) +#define BOOST_FUSION_ADAPTED_BOOST_BIMAP_PAIR_HPP + +#include +#include + +namespace boost { namespace fusion { namespace detail { namespace bimap_pair +{ + template + struct first_type + { + typedef typename ::boost::bimaps::tags::support::default_tagged< + T + , ::boost::bimaps::relation::member_at::left + >::type::value_type type; + }; + + template + struct second_type + { + typedef typename ::boost::bimaps::tags::support::default_tagged< + T + , ::boost::bimaps::relation::member_at::right + >::type::value_type type; + }; +}}}} + +#include +#include + +BOOST_FUSION_ADAPT_TPL_STRUCT( + (T1)(T2) + , (::boost::bimaps::relation::structured_pair) + (T1) + (T2) + (boost::bimaps::relation::normal_layout) + , ( + typename ::boost::fusion::detail::bimap_pair::first_type::type + , first + ) + ( + typename ::boost::fusion::detail::bimap_pair::second_type::type + , second + ) +) + +BOOST_FUSION_ADAPT_TPL_STRUCT( + (T1)(T2) + , (::boost::bimaps::relation::structured_pair) + (T1) + (T2) + (boost::bimaps::relation::mirror_layout) + , ( + typename ::boost::fusion::detail::bimap_pair::second_type::type + , second + ) + ( + typename ::boost::fusion::detail::bimap_pair::first_type::type + , first + ) +) + +#endif // include guard + diff --git a/include/boost/fusion/adapted/boost_compressed_pair.hpp b/include/boost/fusion/adapted/boost_compressed_pair.hpp new file mode 100755 index 000000000..462d5dc3f --- /dev/null +++ b/include/boost/fusion/adapted/boost_compressed_pair.hpp @@ -0,0 +1,33 @@ +/*============================================================================ + Copyright (c) 2013-2018 Cromwell D. Enage + + 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) +============================================================================*/ +#if !defined(BOOST_FUSION_ADAPTED_BOOST_COMPRESSED_PAIR_HPP) +#define BOOST_FUSION_ADAPTED_BOOST_COMPRESSED_PAIR_HPP + +#include +#include +#include + +BOOST_FUSION_ADAPT_TPL_ADT( + (T1)(T2) + , (::boost::compressed_pair)(T1)(T2) + , ( + typename ::boost::call_traits::reference + , typename ::boost::call_traits::const_reference + , obj.first() + , obj.first() = val + ) + ( + typename ::boost::call_traits::reference + , typename ::boost::call_traits::const_reference + , obj.second() + , obj.second() = val + ) +) + +#endif // include guard + diff --git a/include/boost/fusion/adapted/boost_container_pair.hpp b/include/boost/fusion/adapted/boost_container_pair.hpp new file mode 100755 index 000000000..398ab4297 --- /dev/null +++ b/include/boost/fusion/adapted/boost_container_pair.hpp @@ -0,0 +1,19 @@ +/*============================================================================ + Copyright (c) 2013-2018 Cromwell D. Enage + + 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) +============================================================================*/ +#if !defined(BOOST_FUSION_ADAPTED_BOOST_CONTAINER_PAIR_HPP) +#define BOOST_FUSION_ADAPTED_BOOST_CONTAINER_PAIR_HPP + +#include +#include + +BOOST_FUSION_ADAPT_TPL_STRUCT( + (T1)(T2), (::boost::container::dtl::pair)(T1)(T2), (T1, first)(T2, second) +) + +#endif // include guard + diff --git a/include/boost/fusion/include/boost_bimap_pair.hpp b/include/boost/fusion/include/boost_bimap_pair.hpp new file mode 100755 index 000000000..a8db7654e --- /dev/null +++ b/include/boost/fusion/include/boost_bimap_pair.hpp @@ -0,0 +1,14 @@ +/*============================================================================ + Copyright (c) 2013-2018 Cromwell D. Enage + + 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) +============================================================================*/ +#if !defined(BOOST_FUSION_INCLUDE_BOOST_BIMAP_PAIR_HPP) +#define BOOST_FUSION_INCLUDE_BOOST_BIMAP_PAIR_HPP + +#include + +#endif // include guard + diff --git a/include/boost/fusion/include/boost_compressed_pair.hpp b/include/boost/fusion/include/boost_compressed_pair.hpp new file mode 100755 index 000000000..31196819f --- /dev/null +++ b/include/boost/fusion/include/boost_compressed_pair.hpp @@ -0,0 +1,14 @@ +/*============================================================================ + Copyright (c) 2013-2018 Cromwell D. Enage + + 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) +============================================================================*/ +#if !defined(BOOST_FUSION_INCLUDE_BOOST_COMPRESSED_PAIR_HPP) +#define BOOST_FUSION_INCLUDE_BOOST_COMPRESSED_PAIR_HPP + +#include + +#endif // include guard + diff --git a/include/boost/fusion/include/boost_container_pair.hpp b/include/boost/fusion/include/boost_container_pair.hpp new file mode 100755 index 000000000..c901c9a94 --- /dev/null +++ b/include/boost/fusion/include/boost_container_pair.hpp @@ -0,0 +1,14 @@ +/*============================================================================ + Copyright (c) 2013-2018 Cromwell D. Enage + + 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) +============================================================================*/ +#if !defined(BOOST_FUSION_INCLUDE_BOOST_CONTAINER_PAIR_HPP) +#define BOOST_FUSION_INCLUDE_BOOST_CONTAINER_PAIR_HPP + +#include + +#endif // include guard + diff --git a/test/Jamfile b/test/Jamfile index e55b15ad2..2f51ada10 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -134,6 +134,9 @@ project [ run sequence/set.cpp ] [ run sequence/single_view.cpp ] [ run sequence/std_pair.cpp ] + [ run sequence/boost_bimap_pair.cpp ] + [ run sequence/boost_compressed_pair.cpp ] + [ run sequence/boost_container_pair.cpp ] [ run sequence/boost_array.cpp ] [ run sequence/array.cpp ] [ run sequence/std_array.cpp : : diff --git a/test/sequence/adapted_pair.hpp b/test/sequence/adapted_pair.hpp new file mode 100644 index 000000000..29b056ce5 --- /dev/null +++ b/test/sequence/adapted_pair.hpp @@ -0,0 +1,106 @@ +/*============================================================================ + Copyright (c) 2001-2011 Joel de Guzman + + 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) +============================================================================*/ +#include +#include +#include +#include +#include +#include + +namespace test +{ + template + void pair_compare(PairType& p) + { + boost::fusion::vector v1(4, 3.3f); + boost::fusion::vector v2(5, 4.4); + BOOST_TEST(v1 < p); + BOOST_TEST(v1 <= p); + BOOST_TEST(p > v1); + BOOST_TEST(p >= v1); + BOOST_TEST(p < v2); + BOOST_TEST(p <= v2); + BOOST_TEST(v2 > p); + BOOST_TEST(v2 >= p); + } +} + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace test +{ + template + void pair_access_and_modify(PairType& p) + { + BOOST_MPL_ASSERT((boost::mpl::is_sequence)); + BOOST_MPL_ASSERT(( + boost::is_same::type> + )); + BOOST_MPL_ASSERT(( + boost::is_same< + std::string + , typename boost::mpl::back::type + > + )); + BOOST_MPL_ASSERT(( + boost::is_same::type> + )); + BOOST_MPL_ASSERT(( + boost::is_same< + std::string + , typename boost::mpl::at_c::type + > + )); + BOOST_MPL_ASSERT(( + boost::mpl::equal_to< + boost::fusion::result_of::size + , boost::mpl::int_<2> + > + )); + BOOST_MPL_ASSERT_NOT((boost::fusion::traits::is_view)); + BOOST_MPL_ASSERT_NOT((boost::fusion::result_of::empty)); + + BOOST_TEST(p == boost::fusion::make_vector(123, "Hola!!!")); + + boost::fusion::vector v(p); + BOOST_TEST(v == p); + v = p; + BOOST_TEST(v == p); + + boost::fusion::list l(p); + BOOST_TEST(l == p); + l = p; + BOOST_TEST(l == p); + + boost::fusion::at_c<0>(p) = 6; + boost::fusion::at_c<1>(p) = "mama mia"; + BOOST_TEST(p == boost::fusion::make_vector(6, "mama mia")); + BOOST_TEST(boost::fusion::front(p) == 6); +#if 0 + BOOST_TEST(boost::fusion::back(p) == "mama mia"); +#endif + } +} + diff --git a/test/sequence/boost_bimap_pair.cpp b/test/sequence/boost_bimap_pair.cpp new file mode 100755 index 000000000..2f9254e7a --- /dev/null +++ b/test/sequence/boost_bimap_pair.cpp @@ -0,0 +1,54 @@ +/*============================================================================ + Copyright (c) 2013-2018 Cromwell D. Enage + + 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) +============================================================================*/ +#include +#include +#include "adapted_pair.hpp" + +int main() +{ + { + boost::bimaps::relation::structured_pair< + int + , std::string + , boost::bimaps::relation::normal_layout + > p(123, "Hola!!!"); + test::pair_access_and_modify(p); + BOOST_TEST(boost::fusion::back(p) == "mama mia"); + } + + { + boost::bimaps::relation::structured_pair< + std::string + , int + , boost::bimaps::relation::mirror_layout + > p("Hola!!!", 123); + test::pair_access_and_modify(p); + BOOST_TEST(boost::fusion::back(p) == "mama mia"); + } + + { + boost::bimaps::relation::structured_pair< + short + , float + , boost::bimaps::relation::normal_layout + > p(5, 3.3f); + test::pair_compare(p); + } + + { + boost::bimaps::relation::structured_pair< + float + , short + , boost::bimaps::relation::mirror_layout + > p(3.3f, 5); + test::pair_compare(p); + } + + return boost::report_errors(); +} + diff --git a/test/sequence/boost_compressed_pair.cpp b/test/sequence/boost_compressed_pair.cpp new file mode 100755 index 000000000..7d7733106 --- /dev/null +++ b/test/sequence/boost_compressed_pair.cpp @@ -0,0 +1,170 @@ +/*============================================================================ + Copyright (c) 2013-2018 Cromwell D. Enage + + 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) +============================================================================*/ +#include +#include +#include "adapted_pair.hpp" + +namespace test +{ + struct empty_base + { + }; + + bool operator==(empty_base const&, empty_base const&) + { + return true; + } + + bool operator!=(empty_base const&, empty_base const&) + { + return false; + } +} + +int main() +{ + { + boost::compressed_pair p(123, "Hola!!!"); + test::pair_access_and_modify(p); + } + + { + boost::compressed_pair p(5, 3.3f); + test::pair_compare(p); + } + + { + typedef boost::compressed_pair pair_type; + BOOST_MPL_ASSERT((boost::mpl::is_sequence)); + BOOST_MPL_ASSERT(( + boost::is_same::type> + )); + BOOST_MPL_ASSERT(( + boost::is_same< + test::empty_base + , boost::mpl::back::type + > + )); + BOOST_MPL_ASSERT(( + boost::is_same::type> + )); + BOOST_MPL_ASSERT(( + boost::is_same< + test::empty_base + , boost::mpl::at_c::type + > + )); + BOOST_MPL_ASSERT(( + boost::mpl::equal_to< + boost::fusion::result_of::size + , boost::mpl::int_<2> + > + )); + BOOST_MPL_ASSERT_NOT((boost::fusion::traits::is_view)); + BOOST_MPL_ASSERT_NOT((boost::fusion::result_of::empty)); + + pair_type p(123); + BOOST_TEST(boost::fusion::front(p) == 123); + + boost::fusion::at_c<0>(p) = 6; + BOOST_TEST(boost::fusion::front(p) == 6); + } + + { + typedef boost::compressed_pair< + test::empty_base + , std::string + > pair_type; + BOOST_MPL_ASSERT((boost::mpl::is_sequence)); + BOOST_MPL_ASSERT(( + boost::is_same< + test::empty_base + , boost::mpl::front::type + > + )); + BOOST_MPL_ASSERT(( + boost::is_same::type> + )); + BOOST_MPL_ASSERT(( + boost::is_same< + test::empty_base + , boost::mpl::at_c::type + > + )); + BOOST_MPL_ASSERT(( + boost::is_same::type> + )); + BOOST_MPL_ASSERT(( + boost::mpl::equal_to< + boost::fusion::result_of::size + , boost::mpl::int_<2> + > + )); + BOOST_MPL_ASSERT_NOT((boost::fusion::traits::is_view)); + BOOST_MPL_ASSERT_NOT((boost::fusion::result_of::empty)); + + pair_type p("Hola!!!"); + BOOST_TEST( + p == boost::fusion::make_vector(test::empty_base(), "Hola!!!") + ); + + boost::fusion::at_c<1>(p) = "mama mia"; + BOOST_TEST( + p == boost::fusion::make_vector(test::empty_base(), "mama mia") + ); + } + + { + typedef boost::compressed_pair pair_type; + BOOST_MPL_ASSERT((boost::mpl::is_sequence)); + BOOST_MPL_ASSERT(( + boost::is_same::type> + )); + BOOST_MPL_ASSERT(( + boost::is_same::type> + )); + BOOST_MPL_ASSERT(( + boost::is_same::type> + )); + BOOST_MPL_ASSERT(( + boost::is_same::type> + )); + BOOST_MPL_ASSERT(( + boost::mpl::equal_to< + boost::fusion::result_of::size + , boost::mpl::int_<2> + > + )); + BOOST_MPL_ASSERT_NOT((boost::fusion::traits::is_view)); + BOOST_MPL_ASSERT_NOT((boost::fusion::result_of::empty)); + + pair_type p(456); + BOOST_TEST(p == boost::fusion::make_vector(456, 456)); + + boost::fusion::vector v(p); + BOOST_TEST(v == p); + v = p; + BOOST_TEST(v == p); + + boost::fusion::list l(p); + BOOST_TEST(l == p); + l = p; + BOOST_TEST(l == p); + + boost::fusion::at_c<0>(p) = 7; + boost::fusion::at_c<1>(p) = 8; + BOOST_TEST(p == boost::fusion::make_vector(7, 8)); + BOOST_TEST(boost::fusion::front(p) == 7); +#if 0 + BOOST_TEST(boost::fusion::back(p) == 8); +#endif + } + + return boost::report_errors(); +} + diff --git a/test/sequence/boost_container_pair.cpp b/test/sequence/boost_container_pair.cpp new file mode 100755 index 000000000..b03ebb70f --- /dev/null +++ b/test/sequence/boost_container_pair.cpp @@ -0,0 +1,30 @@ +/*============================================================================ + Copyright (c) 2013-2018 Cromwell D. Enage + + 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) +============================================================================*/ +#include +#include +#include +#include "adapted_pair.hpp" + +int main() +{ + { + boost::container::map + ::movable_value_type p(123, "Hola!!!"); + test::pair_access_and_modify(p); + BOOST_TEST(boost::fusion::back(p) == "mama mia"); + } + + { + boost::container::map + ::movable_value_type p(5, 3.3f); + test::pair_compare(p); + } + + return boost::report_errors(); +} + diff --git a/test/sequence/std_pair.cpp b/test/sequence/std_pair.cpp index 647e9b00c..09526a13d 100644 --- a/test/sequence/std_pair.cpp +++ b/test/sequence/std_pair.cpp @@ -1,98 +1,25 @@ -/*============================================================================= +/*============================================================================ Copyright (c) 2001-2011 Joel de Guzman - 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) -==============================================================================*/ -#include + 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) +============================================================================*/ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include +#include "adapted_pair.hpp" -int -main() +int main() { - using namespace boost::fusion; - using namespace boost; - - std::cout << tuple_open('['); - std::cout << tuple_close(']'); - std::cout << tuple_delimiter(", "); - - { - typedef std::pair pair_type; - BOOST_MPL_ASSERT_NOT((traits::is_view)); - BOOST_STATIC_ASSERT(!traits::is_view::value); - pair_type p(123, "Hola!!!"); - - std::cout << at_c<0>(p) << std::endl; - std::cout << at_c<1>(p) << std::endl; - std::cout << p << std::endl; - BOOST_TEST(p == make_vector(123, "Hola!!!")); - - at_c<0>(p) = 6; - at_c<1>(p) = "mama mia"; - BOOST_TEST(p == make_vector(6, "mama mia")); - - BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 2); - BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty::value); - - BOOST_TEST(front(p) == 6); - BOOST_TEST(back(p) == "mama mia"); - } - - { - fusion::vector v1(4, 3.3f); - std::pair v2(5, 3.3f); - fusion::vector v3(5, 4.4); - BOOST_TEST(v1 < v2); - BOOST_TEST(v1 <= v2); - BOOST_TEST(v2 > v1); - BOOST_TEST(v2 >= v1); - BOOST_TEST(v2 < v3); - BOOST_TEST(v2 <= v3); - BOOST_TEST(v3 > v2); - BOOST_TEST(v3 >= v2); - } - - { - // conversion from pair to vector - fusion::vector v(std::make_pair(123, "Hola!!!")); - v = std::make_pair(123, "Hola!!!"); - } - { - // conversion from pair to list - fusion::list l(std::make_pair(123, "Hola!!!")); - l = std::make_pair(123, "Hola!!!"); + std::pair p(123, "Hola!!!"); + test::pair_access_and_modify(p); + BOOST_TEST(boost::fusion::back(p) == "mama mia"); } { - typedef std::pair pair_type; - BOOST_MPL_ASSERT((mpl::is_sequence)); - BOOST_MPL_ASSERT((boost::is_same::type>)); + std::pair p(5, 3.3f); + test::pair_compare(p); } return boost::report_errors();