1 2 // Copyright Steven Watanabe 2009 3 // 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt or copy at 6 // http://www.boost.org/LICENSE_1_0.txt) 7 // 8 // See http://www.boost.org/libs/mpl for documentation. 9 10 // $Id$ 11 // $Date: 2008-10-10 02:21:07 -0700 (Fri, 10 Oct 2008) $ 12 // $Revision: 49240 $ 13 14 #include <boost/mpl/push_back.hpp> 15 16 #include <boost/mpl/aux_/test.hpp> 17 18 struct no_push_back_tag {}; 19 20 struct no_push_back 21 { 22 typedef no_push_back_tag tag; 23 }; 24 25 struct has_push_back_tag {}; 26 27 struct with_push_back 28 { 29 typedef has_push_back_tag tag; 30 }; 31 32 namespace boost { namespace mpl { 33 34 template<> 35 struct push_back_impl< has_push_back_tag > 36 { 37 template<class Seq, class T> struct apply 38 { 39 typedef no_push_back type; 40 }; 41 }; 42 43 }} 44 MPL_TEST_CASE()45MPL_TEST_CASE() 46 { 47 MPL_ASSERT_NOT(( has_push_back< no_push_back > )); 48 MPL_ASSERT(( has_push_back< with_push_back > )); 49 50 typedef push_back< with_push_back , int >::type test; 51 MPL_ASSERT(( is_same< test, no_push_back > )); 52 } 53