diff --git a/include/boost/mpl/aux_/push_back_impl.hpp b/include/boost/mpl/aux_/push_back_impl.hpp index 3d8d5fe..3ece711 100644 --- a/include/boost/mpl/aux_/push_back_impl.hpp +++ b/include/boost/mpl/aux_/push_back_impl.hpp @@ -25,8 +25,7 @@ namespace boost { namespace mpl { -template< typename Tag > -struct has_push_back_impl; +struct has_push_back_arg; // agurt 05/feb/04: no default implementation; the stub definition is needed // to enable the default 'has_push_back' implementation below @@ -39,7 +38,7 @@ struct push_back_impl // if you've got an assert here, you are requesting a 'push_back' // specialization that doesn't exist. BOOST_MPL_ASSERT_MSG( - ( boost::is_same< T, has_push_back_impl >::value ) + ( boost::is_same< T, has_push_back_arg >::value ) , REQUESTED_PUSH_BACK_SPECIALIZATION_FOR_SEQUENCE_DOES_NOT_EXIST , ( Sequence ) ); @@ -51,13 +50,13 @@ struct has_push_back_impl { template< typename Seq > struct apply #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) - : aux::has_type< push_back< Seq, has_push_back_impl > > + : aux::has_type< push_back< Seq, has_push_back_arg > > { #else { - typedef aux::has_type< push_back< Seq, has_push_back_impl > > type; + typedef aux::has_type< push_back< Seq, has_push_back_arg > > type; BOOST_STATIC_CONSTANT(bool, value = - (aux::has_type< push_back< Seq, has_push_back_impl > >::value) + (aux::has_type< push_back< Seq, has_push_back_arg > >::value) ); #endif }; diff --git a/include/boost/mpl/aux_/push_front_impl.hpp b/include/boost/mpl/aux_/push_front_impl.hpp index 2473a8b..4010532 100644 --- a/include/boost/mpl/aux_/push_front_impl.hpp +++ b/include/boost/mpl/aux_/push_front_impl.hpp @@ -25,8 +25,7 @@ namespace boost { namespace mpl { -template< typename Tag > -struct has_push_front_impl; +struct has_push_front_arg; // agurt 05/feb/04: no default implementation; the stub definition is needed // to enable the default 'has_push_front' implementation below @@ -40,7 +39,7 @@ struct push_front_impl // if you've got an assert here, you are requesting a 'push_front' // specialization that doesn't exist. BOOST_MPL_ASSERT_MSG( - ( boost::is_same< T, has_push_front_impl >::value ) + ( boost::is_same< T, has_push_front_arg >::value ) , REQUESTED_PUSH_FRONT_SPECIALIZATION_FOR_SEQUENCE_DOES_NOT_EXIST , ( Sequence ) ); @@ -52,13 +51,13 @@ struct has_push_front_impl { template< typename Seq > struct apply #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) - : aux::has_type< push_front< Seq, has_push_front_impl > > + : aux::has_type< push_front< Seq, has_push_front_arg > > { #else { - typedef aux::has_type< push_front< Seq, has_push_front_impl > > type; + typedef aux::has_type< push_front< Seq, has_push_front_arg > > type; BOOST_STATIC_CONSTANT(bool, value = - (aux::has_type< push_front< Seq, has_push_front_impl > >::value) + (aux::has_type< push_front< Seq, has_push_front_arg > >::value) ); #endif }; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index d8a14d3..0031a52 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -66,6 +66,7 @@ compile numeric_ops.cpp ; compile pair_view.cpp ; compile partition.cpp ; compile pop_front.cpp ; +compile push_back.cpp ; compile push_front.cpp ; compile quote.cpp ; compile range_c.cpp ; diff --git a/test/push_back.cpp b/test/push_back.cpp new file mode 100644 index 0000000..bdf7a92 --- /dev/null +++ b/test/push_back.cpp @@ -0,0 +1,52 @@ + +// Copyright Steven Watanabe 2009 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date: 2008-10-10 02:21:07 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49240 $ + +#include + +#include + +struct no_push_back_tag {}; + +struct no_push_back +{ + typedef no_push_back_tag tag; +}; + +struct has_push_back_tag {}; + +struct with_push_back +{ + typedef has_push_back_tag tag; +}; + +namespace boost { namespace mpl { + +template<> +struct push_back_impl< has_push_back_tag > +{ + template struct apply + { + typedef no_push_back type; + }; +}; + +}} + +MPL_TEST_CASE() +{ + MPL_ASSERT_NOT(( has_push_back< no_push_back > )); + MPL_ASSERT(( has_push_back< with_push_back > )); + + typedef push_back< with_push_back , int >::type test; + MPL_ASSERT(( is_same< test, no_push_back > )); +} diff --git a/test/push_front.cpp b/test/push_front.cpp index 980a6e5..f5edc2f 100644 --- a/test/push_front.cpp +++ b/test/push_front.cpp @@ -1,5 +1,6 @@ // Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Steven Watanabe 2009 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -19,6 +20,13 @@ #include +struct no_push_front_tag {}; + +struct no_push_front +{ + typedef no_push_front_tag tag; +}; + MPL_TEST_CASE() { typedef push_front,long>::type res1; @@ -37,4 +45,6 @@ MPL_TEST_CASE() MPL_ASSERT(( has_push_front< list1 > )); MPL_ASSERT_NOT(( has_push_back< list0<> > )); + + MPL_ASSERT_NOT(( has_push_front< no_push_front > )); }