
WHAT: ===== The patch changes the internal pair concept, so STL pairs and Fusion pairs also work as MPL pairs. STL pair: first (value) second (value) first_type (type) second_type (type) Fusion pair: second (value) first_type (type) second_type (type) MPL pair (CVS): first (type) second (type) MPL pair (after applying this patch): first_type (type) second_type (type) FILES: ====== - mpl.patch changes in boost/mpl (note: preprocessed files for mpl::map are not included to not flood the list) - test.patch changes in libs/mpl/test (some tests access the type members directly) diffed against: CVS HEAD TESTED WITH: ============ - MSVC 8.0 - MSVC 7.1 - GCC 3.4.2 Index: boost/mpl/pair.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/mpl/pair.hpp,v retrieving revision 1.5 diff -u -r1.5 pair.hpp --- boost/mpl/pair.hpp 14 Dec 2004 14:05:31 -0000 1.5 +++ boost/mpl/pair.hpp 15 May 2006 23:31:20 -0000 @@ -28,8 +28,8 @@ struct pair { typedef pair type; - typedef T1 first; - typedef T2 second; + typedef T1 first_type; + typedef T2 second_type; BOOST_MPL_AUX_LAMBDA_SUPPORT(2,pair,(T1,T2)) }; @@ -40,9 +40,9 @@ struct first { #if !defined(BOOST_MPL_CFG_MSVC_70_ETI_BUG) - typedef typename P::first type; + typedef typename P::first_type type; #else - typedef typename aux::msvc_eti_base<P>::first type; + typedef typename aux::msvc_eti_base<P>::first_type type; #endif BOOST_MPL_AUX_LAMBDA_SUPPORT(1,first,(P)) }; @@ -53,9 +53,9 @@ struct second { #if !defined(BOOST_MPL_CFG_MSVC_70_ETI_BUG) - typedef typename P::second type; + typedef typename P::second_type type; #else - typedef typename aux::msvc_eti_base<P>::second type; + typedef typename aux::msvc_eti_base<P>::second_type type; #endif BOOST_MPL_AUX_LAMBDA_SUPPORT(1,second,(P)) }; Index: boost/mpl/unique.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/mpl/unique.hpp,v retrieving revision 1.7 diff -u -r1.7 unique.hpp --- boost/mpl/unique.hpp 2 Sep 2004 15:40:42 -0000 1.7 +++ boost/mpl/unique.hpp 15 May 2006 23:45:40 -0000 @@ -36,8 +36,8 @@ { template< typename Pair, typename T > struct apply { - typedef typename Pair::first seq_; - typedef typename Pair::second prior_; + typedef typename Pair::first_type seq_; + typedef typename Pair::second_type prior_; typedef typename eval_if< and_< is_not_na<prior_>, apply2<Predicate,prior_,T> > , identity<seq_> Index: boost/mpl/aux_/apply_1st.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/mpl/aux_/apply_1st.hpp,v retrieving revision 1.4 diff -u -r1.4 apply_1st.hpp --- boost/mpl/aux_/apply_1st.hpp 2 Sep 2004 15:40:43 -0000 1.4 +++ boost/mpl/aux_/apply_1st.hpp 15 May 2006 23:37:58 -0000 @@ -22,8 +22,8 @@ { template< typename Pair, typename T > struct apply : apply2< - typename Pair::first - , typename Pair::second + typename Pair::first_type + , typename Pair::second_type , T > { Index: boost/mpl/aux_/partition_op.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/mpl/aux_/partition_op.hpp,v retrieving revision 1.4 diff -u -r1.4 partition_op.hpp --- boost/mpl/aux_/partition_op.hpp 28 Nov 2004 01:46:37 -0000 1.4 +++ boost/mpl/aux_/partition_op.hpp 15 May 2006 23:38:44 -0000 @@ -31,8 +31,8 @@ template< typename State, typename T > struct apply { - typedef typename State::first first_; - typedef typename State::second second_; + typedef typename State::first_type first_; + typedef typename State::second_type second_; typedef typename apply1< Pred,T >::type pred_; typedef typename eval_if< Index: boost/mpl/aux_/sort_impl.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/mpl/aux_/sort_impl.hpp,v retrieving revision 1.5 diff -u -r1.5 sort_impl.hpp --- boost/mpl/aux_/sort_impl.hpp 28 Nov 2004 01:47:44 -0000 1.5 +++ boost/mpl/aux_/sort_impl.hpp 15 May 2006 23:39:47 -0000 @@ -63,8 +63,8 @@ , back_inserter< vector<> > >::type partitioned; - typedef typename quick_sort< typename partitioned::first, Pred >::type part1; - typedef typename quick_sort< typename partitioned::second, Pred >::type part2; + typedef typename quick_sort< typename partitioned::first_type, Pred >::type part1; + typedef typename quick_sort< typename partitioned::second_type, Pred >::type part2; typedef joint_view< joint_view< part1, single_view< typename deref<pivot>::type > > Index: boost/mpl/map/aux_/contains_impl.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/mpl/map/aux_/contains_impl.hpp,v retrieving revision 1.2 diff -u -r1.2 contains_impl.hpp --- boost/mpl/map/aux_/contains_impl.hpp 2 Sep 2004 15:41:00 -0000 1.2 +++ boost/mpl/map/aux_/contains_impl.hpp 15 May 2006 23:40:57 -0000 @@ -30,9 +30,9 @@ : is_same< typename at_impl<aux::map_tag>::apply< Map - , typename Pair::first + , typename Pair::first_type >::type - , typename Pair::second + , typename Pair::second_type > { }; Index: boost/mpl/map/aux_/erase_impl.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/mpl/map/aux_/erase_impl.hpp,v retrieving revision 1.3 diff -u -r1.3 erase_impl.hpp --- boost/mpl/map/aux_/erase_impl.hpp 5 Sep 2004 09:42:58 -0000 1.3 +++ boost/mpl/map/aux_/erase_impl.hpp 15 May 2006 23:41:34 -0000 @@ -31,7 +31,7 @@ > struct apply : erase_key_impl<aux::map_tag> - ::apply<Map,typename Pos::type::first> + ::apply<Map,typename Pos::type::first_type> { }; }; Index: boost/mpl/map/aux_/insert_impl.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/mpl/map/aux_/insert_impl.hpp,v retrieving revision 1.4 diff -u -r1.4 insert_impl.hpp --- boost/mpl/map/aux_/insert_impl.hpp 14 Dec 2004 14:05:31 -0000 1.4 +++ boost/mpl/map/aux_/insert_impl.hpp 15 May 2006 23:42:00 -0000 @@ -33,15 +33,15 @@ , Map #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES) , m_item< - typename Pair::first - , typename Pair::second + typename Pair::first_type + , typename Pair::second_type , Map > #else , m_item< next< typename Map::size >::type::value - , typename Pair::first - , typename Pair::second + , typename Pair::first_type + , typename Pair::second_type , Map > #endif Index: boost/mpl/map/aux_/numbered.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/mpl/map/aux_/numbered.hpp,v retrieving revision 1.4 diff -u -r1.4 numbered.hpp --- boost/mpl/map/aux_/numbered.hpp 14 Dec 2004 14:05:32 -0000 1.4 +++ boost/mpl/map/aux_/numbered.hpp 15 May 2006 23:42:50 -0000 @@ -39,8 +39,8 @@ > struct BOOST_PP_CAT(map,i_) : m_item< - typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::first - , typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::second + typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::first_type + , typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::second_type , AUX778076_MAP_TAIL(map,BOOST_PP_DEC(i_),P) > { @@ -93,8 +93,8 @@ struct BOOST_PP_CAT(map,i_) : m_item< i_ - , typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::first - , typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::second + , typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::first_type + , typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::second_type , AUX778076_MAP_TAIL(map,BOOST_PP_DEC(i_),P) > { ? libs/mpl/test/Jamfile_timestamp ? libs/mpl/test/results.7.1 ? libs/mpl/test/results.8.0 Index: libs/mpl/test/partition.cpp =================================================================== RCS file: /cvsroot/boost/boost/libs/mpl/test/partition.cpp,v retrieving revision 1.2 diff -u -r1.2 partition.cpp --- libs/mpl/test/partition.cpp 28 Nov 2004 03:35:12 -0000 1.2 +++ libs/mpl/test/partition.cpp 15 May 2006 23:56:24 -0000 @@ -37,6 +37,6 @@ , mpl::back_inserter< vector<> > >::type r; - MPL_ASSERT(( equal< r::first, vector_c<int,1,3,5,7,9> > )); - MPL_ASSERT(( equal< r::second, vector_c<int,0,2,4,6,8> > )); + MPL_ASSERT(( equal< r::first_type, vector_c<int,1,3,5,7,9> > )); + MPL_ASSERT(( equal< r::second_type, vector_c<int,0,2,4,6,8> > )); } Index: libs/mpl/test/stable_partition.cpp =================================================================== RCS file: /cvsroot/boost/boost/libs/mpl/test/stable_partition.cpp,v retrieving revision 1.3 diff -u -r1.3 stable_partition.cpp --- libs/mpl/test/stable_partition.cpp 2 Sep 2004 15:41:35 -0000 1.3 +++ libs/mpl/test/stable_partition.cpp 15 May 2006 23:56:54 -0000 @@ -31,8 +31,8 @@ , less< _, int_<3> > >::type result; - MPL_ASSERT(( equal< result::first,manual_first > )); - MPL_ASSERT(( equal< result::second,manual_second > )); + MPL_ASSERT(( equal< result::first_type,manual_first > )); + MPL_ASSERT(( equal< result::second_type,manual_second > )); } MPL_TEST_CASE() @@ -42,6 +42,6 @@ , greater_equal< _, int_<3> > >::type result; - MPL_ASSERT(( equal< result::first,manual_second > )); - MPL_ASSERT(( equal< result::second,manual_first > )); + MPL_ASSERT(( equal< result::first_type,manual_second > )); + MPL_ASSERT(( equal< result::second_type,manual_first > )); }

Tobias Schwinger wrote:
WHAT: =====
The patch changes the internal pair concept, so STL pairs and Fusion pairs also work as MPL pairs.
STL pair: first (value) second (value) first_type (type) second_type (type)
Fusion pair: second (value) first_type (type) second_type (type)
MPL pair (CVS): first (type) second (type)
MPL pair (after applying this patch): first_type (type) second_type (type)
Boost.Variant uses MPL implementation details directly, so here's a dependent patch. Verified with Variant test suite. Regards, Tobias Index: boost/variant/variant.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/variant/variant.hpp,v retrieving revision 1.96 diff -u -r1.96 variant.hpp --- boost/variant/variant.hpp 25 Aug 2005 16:27:26 -0000 1.96 +++ boost/variant/variant.hpp 16 May 2006 11:30:55 -0000 @@ -166,8 +166,8 @@ , mpl::protect< find_fallback_type_pred > >::type first_result_; - typedef typename first_result_::first first_result_index; - typedef typename first_result_::second first_result_it; + typedef typename first_result_::first_type first_result_index; + typedef typename first_result_::second_type first_result_it; // [...now search the rest of the sequence for boost::blank...] @@ -177,7 +177,7 @@ , mpl::protect< mpl::not_same_as<boost::blank> > >::type second_result_; - typedef typename second_result_::second second_result_it; + typedef typename second_result_::second_type second_result_it; public: // metafunction result @@ -1054,9 +1054,9 @@ internal_types >::type fallback_type_result_; - typedef typename fallback_type_result_::first + typedef typename fallback_type_result_::first_type fallback_type_index_; - typedef typename fallback_type_result_::second + typedef typename fallback_type_result_::second_type fallback_type_; struct has_fallback_type_ Index: boost/variant/detail/initializer.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/variant/detail/initializer.hpp,v retrieving revision 1.4 diff -u -r1.4 initializer.hpp --- boost/variant/detail/initializer.hpp 2 Sep 2004 15:41:28 -0000 1.4 +++ boost/variant/detail/initializer.hpp 16 May 2006 11:27:36 -0000 @@ -65,9 +65,9 @@ { private: // helpers, for metafunction result (below) - typedef typename BaseIndexPair::first + typedef typename BaseIndexPair::first_type base; - typedef typename BaseIndexPair::second + typedef typename BaseIndexPair::second_type index; class initializer_node @@ -224,7 +224,7 @@ , ::boost::mpl::protect< \ ::boost::detail::variant::make_initializer_node \ > \ - >::type::first \ + >::type::first_type \ /**/ #else // defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)

David Abrahams wrote:
Tobias Schwinger <tschwinger@neoscientists.org> writes:
WHAT: =====
The patch changes the internal pair concept, so STL pairs and Fusion pairs also work as MPL pairs.
Is a corresponding doc change needed?
Yes, here is the doc patch (I just noticed these type members are in fact *not* unspecified). I'm currently checking for further dependencies in other Boost libraries. Regards, Tobias Index: libs/mpl/doc/src/refmanual/TrivialMetafunction.rst =================================================================== RCS file: /cvsroot/boost/boost/libs/mpl/doc/src/refmanual/TrivialMetafunction.rst,v retrieving revision 1.1 diff -u -r1.1 TrivialMetafunction.rst --- libs/mpl/doc/src/refmanual/TrivialMetafunction.rst 29 Nov 2004 06:33:06 -0000 1.1 +++ libs/mpl/doc/src/refmanual/TrivialMetafunction.rst 16 May 2006 13:45:04 -0000 @@ -12,7 +12,7 @@ metafunction's instance. By convention, all `trivial metafunctions`__ in MPL are named after the members they provide assess to. For instance, a |Trivial Metafunction| named ``first`` reaches for the ``x``\ 's nested member -``::first``. +``::first_type``. __ `Trivial Metafunctions Summary`_ Index: libs/mpl/doc/src/refmanual/map.rst =================================================================== RCS file: /cvsroot/boost/boost/libs/mpl/doc/src/refmanual/map.rst,v retrieving revision 1.1 diff -u -r1.1 map.rst --- libs/mpl/doc/src/refmanual/map.rst 29 Nov 2004 06:33:06 -0000 1.1 +++ libs/mpl/doc/src/refmanual/map.rst 16 May 2006 13:50:17 -0000 @@ -80,9 +80,9 @@ | at<m,k>::type | | | at<m,k,default>::type | | +---------------------------------------+-----------------------------------------------------------+ -| ``key_type<m,x>::type`` | Identical to ``x::first``; see |Associative Sequence|. | +| ``key_type<m,x>::type`` | Identical to ``x::first_type``; see |Associative Sequence|. | +---------------------------------------+-----------------------------------------------------------+ -| ``value_type<m,x>::type`` | Identical to ``x::second``; see |Associative Sequence|. | +| ``value_type<m,x>::type`` | Identical to ``x::second_type``; see |Associative Sequence|. | +---------------------------------------+-----------------------------------------------------------+ | ``insert<m,x>::type`` | A new ``map`` equivalent to ``m`` except that | | | :: | Index: libs/mpl/doc/src/refmanual/pair.rst =================================================================== RCS file: /cvsroot/boost/boost/libs/mpl/doc/src/refmanual/pair.rst,v retrieving revision 1.1 diff -u -r1.1 pair.rst --- libs/mpl/doc/src/refmanual/pair.rst 29 Nov 2004 06:33:06 -0000 1.1 +++ libs/mpl/doc/src/refmanual/pair.rst 16 May 2006 13:49:48 -0000 @@ -15,8 +15,8 @@ struct pair { typedef pair type; - typedef T1 first; - typedef T2 second; + typedef T1 first_type; + typedef T2 second_type; }; @@ -55,8 +55,8 @@ > >::type p; - BOOST_MPL_ASSERT_RELATION( p::first::value, ==, 8 ); - BOOST_MPL_ASSERT_RELATION( p::second::value, ==, 3 ); + BOOST_MPL_ASSERT_RELATION( p::first_type::value, ==, 8 ); + BOOST_MPL_ASSERT_RELATION( p::second_type::value, ==, 3 ); See also Index: libs/mpl/doc/src/refmanual/partition.rst =================================================================== RCS file: /cvsroot/boost/boost/libs/mpl/doc/src/refmanual/partition.rst,v retrieving revision 1.1 diff -u -r1.1 partition.rst --- libs/mpl/doc/src/refmanual/partition.rst 29 Nov 2004 06:33:06 -0000 1.1 +++ libs/mpl/doc/src/refmanual/partition.rst 16 May 2006 13:48:48 -0000 @@ -103,8 +103,8 @@ , back_inserter< vector<> > >::type r; - BOOST_MPL_ASSERT(( equal< r::first, vector_c<int,1,3,5,7,9> > )); - BOOST_MPL_ASSERT(( equal< r::second, vector_c<int,0,2,4,6,8> > )); + BOOST_MPL_ASSERT(( equal< r::first_type, vector_c<int,1,3,5,7,9> > )); + BOOST_MPL_ASSERT(( equal< r::second_type, vector_c<int,0,2,4,6,8> > )); See also Index: libs/mpl/doc/src/refmanual/reverse_partition.rst =================================================================== RCS file: /cvsroot/boost/boost/libs/mpl/doc/src/refmanual/reverse_partition.rst,v retrieving revision 1.1 diff -u -r1.1 reverse_partition.rst --- libs/mpl/doc/src/refmanual/reverse_partition.rst 29 Nov 2004 06:33:06 -0000 1.1 +++ libs/mpl/doc/src/refmanual/reverse_partition.rst 16 May 2006 13:48:30 -0000 @@ -103,8 +103,8 @@ , back_inserter< vector<> > >::type r; - BOOST_MPL_ASSERT(( equal< r::first, vector_c<int,9,7,5,3,1> > )); - BOOST_MPL_ASSERT(( equal< r::second, vector_c<int,8,6,4,2,0> > )); + BOOST_MPL_ASSERT(( equal< r::first_type, vector_c<int,9,7,5,3,1> > )); + BOOST_MPL_ASSERT(( equal< r::second_type, vector_c<int,8,6,4,2,0> > )); See also Index: libs/mpl/doc/src/refmanual/reverse_stable_partition.rst =================================================================== RCS file: /cvsroot/boost/boost/libs/mpl/doc/src/refmanual/reverse_stable_partition.rst,v retrieving revision 1.1 diff -u -r1.1 reverse_stable_partition.rst --- libs/mpl/doc/src/refmanual/reverse_stable_partition.rst 29 Nov 2004 06:33:06 -0000 1.1 +++ libs/mpl/doc/src/refmanual/reverse_stable_partition.rst 16 May 2006 13:47:57 -0000 @@ -117,8 +117,8 @@ , back_inserter< vector<> > >::type r; - BOOST_MPL_ASSERT(( equal< r::first, vector_c<int,9,7,5,3,1> > )); - BOOST_MPL_ASSERT(( equal< r::second, vector_c<int,8,6,4,2,0> > )); + BOOST_MPL_ASSERT(( equal< r::first_type, vector_c<int,9,7,5,3,1> > )); + BOOST_MPL_ASSERT(( equal< r::second_type, vector_c<int,8,6,4,2,0> > )); See also Index: libs/mpl/doc/src/refmanual/reverse_unique.rst =================================================================== RCS file: /cvsroot/boost/boost/libs/mpl/doc/src/refmanual/reverse_unique.rst,v retrieving revision 1.1 diff -u -r1.1 reverse_unique.rst --- libs/mpl/doc/src/refmanual/reverse_unique.rst 29 Nov 2004 06:33:06 -0000 1.1 +++ libs/mpl/doc/src/refmanual/reverse_unique.rst 16 May 2006 13:46:50 -0000 @@ -98,7 +98,7 @@ , identity< first<_1> > , apply_wrap\ ``2``\<in_op, first<_1>, _2> > - >::type::first r; + >::type::first_type r; Complexity Index: libs/mpl/doc/src/refmanual/sort.rst =================================================================== RCS file: /cvsroot/boost/boost/libs/mpl/doc/src/refmanual/sort.rst,v retrieving revision 1.1 diff -u -r1.1 sort.rst --- libs/mpl/doc/src/refmanual/sort.rst 29 Nov 2004 06:33:06 -0000 1.1 +++ libs/mpl/doc/src/refmanual/sort.rst 16 May 2006 13:46:31 -0000 @@ -95,8 +95,8 @@ , aux_in >::type partitioned; - typedef sort<partitioned::first,p,aux_in >::type part1; - typedef sort<partitioned::second,p,aux_in >::type part2; + typedef sort<partitioned::first_type,p,aux_in >::type part1; + typedef sort<partitioned::second_type,p,aux_in >::type part2; typedef copy< joint_view< Index: libs/mpl/doc/src/refmanual/stable_partition.rst =================================================================== RCS file: /cvsroot/boost/boost/libs/mpl/doc/src/refmanual/stable_partition.rst,v retrieving revision 1.1 diff -u -r1.1 stable_partition.rst --- libs/mpl/doc/src/refmanual/stable_partition.rst 29 Nov 2004 06:33:06 -0000 1.1 +++ libs/mpl/doc/src/refmanual/stable_partition.rst 16 May 2006 13:45:42 -0000 @@ -117,8 +117,8 @@ , back_inserter< vector<> > >::type r; - BOOST_MPL_ASSERT(( equal< r::first, vector_c<int,1,3,5,7,9> > )); - BOOST_MPL_ASSERT(( equal< r::second, vector_c<int,0,2,4,6,8> > )); + BOOST_MPL_ASSERT(( equal< r::first_type, vector_c<int,1,3,5,7,9> > )); + BOOST_MPL_ASSERT(( equal< r::second_type, vector_c<int,0,2,4,6,8> > )); See also Index: libs/mpl/doc/src/refmanual/unique.rst =================================================================== RCS file: /cvsroot/boost/boost/libs/mpl/doc/src/refmanual/unique.rst,v retrieving revision 1.1 diff -u -r1.1 unique.rst --- libs/mpl/doc/src/refmanual/unique.rst 29 Nov 2004 06:33:06 -0000 1.1 +++ libs/mpl/doc/src/refmanual/unique.rst 16 May 2006 13:43:44 -0000 @@ -98,7 +98,7 @@ , identity< first<_1> > , apply_wrap\ ``2``\<in_op, first<_1>, _2> > - >::type::first r; + >::type::first_type r; Complexity

Tobias Schwinger <tschwinger@neoscientists.org> writes:
David Abrahams wrote:
Tobias Schwinger <tschwinger@neoscientists.org> writes:
WHAT: =====
The patch changes the internal pair concept, so STL pairs and Fusion pairs also work as MPL pairs. Is a corresponding doc change needed?
Yes, here is the doc patch (I just noticed these type members are in fact *not* unspecified). I'm currently checking for further dependencies in other Boost libraries.
When you've got the complete patch that you think we need, please post it to the tracker. Also, please consider if there's any way to provide backward compatibility (e.g. with redundant typedefs) so we don't break any 3rd-party code. Thanks. -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams
-
Tobias Schwinger