1 /*============================================================================= 2 Copyright (c) 2005 Joel de Guzman 3 4 Distributed under the Boost Software License, Version 1.0. (See accompanying 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 ==============================================================================*/ 7 #if !defined(FUSION_LIST_07172005_1153) 8 #define FUSION_LIST_07172005_1153 9 10 #include <boost/fusion/container/list/list_fwd.hpp> 11 #include <boost/fusion/container/list/detail/list_to_cons.hpp> 12 13 namespace boost { namespace fusion 14 { 15 struct nil; 16 struct void_; 17 18 template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, typename T)> 19 struct list 20 : detail::list_to_cons<BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, T)>::type 21 { 22 private: 23 typedef 24 detail::list_to_cons<BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, T)> 25 list_to_cons; 26 27 public: 28 typedef typename list_to_cons::type inherited_type; 29 listboost::fusion::list30 list() 31 : inherited_type() {} 32 33 template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, typename U)> listboost::fusion::list34 list(list<BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, U)> const& rhs) 35 : inherited_type(rhs) {} 36 37 template <typename Sequence> listboost::fusion::list38 list(Sequence const& rhs) 39 : inherited_type(rhs) {} 40 41 // Expand a couple of forwarding constructors for arguments 42 // of type (T0), (T0, T1), (T0, T1, T2) etc. Exanple: 43 // 44 // list( 45 // typename detail::call_param<T0>::type _0 46 // , typename detail::call_param<T1>::type _1) 47 // : inherited_type(list_to_cons::call(_0, _1)) {} 48 #include <boost/fusion/container/list/detail/list_forward_ctor.hpp> 49 50 template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, typename U)> 51 list& operator =boost::fusion::list52 operator=(list<BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, U)> const& rhs) 53 { 54 inherited_type::operator=(rhs); 55 return *this; 56 } 57 58 template <typename T> 59 list& operator =boost::fusion::list60 operator=(T const& rhs) 61 { 62 inherited_type::operator=(rhs); 63 return *this; 64 } 65 }; 66 }} 67 68 #endif 69