diff --git a/include/boost/fusion/container/generation/detail/pp_list_tie.hpp b/include/boost/fusion/container/generation/detail/pp_list_tie.hpp index 561677f9..be25627a 100644 --- a/include/boost/fusion/container/generation/detail/pp_list_tie.hpp +++ b/include/boost/fusion/container/generation/detail/pp_list_tie.hpp @@ -53,7 +53,7 @@ namespace boost { namespace fusion // $$$ shouldn't we remove_reference first to allow references? $$$ #define BOOST_FUSION_REF(z, n, data) BOOST_PP_CAT(T, n)& -#define BOOST_PP_FILENAME_1 +#define BOOST_PP_FILENAME_1 #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_LIST_SIZE) #include BOOST_PP_ITERATE() diff --git a/include/boost/fusion/container/generation/list_tie.hpp b/include/boost/fusion/container/generation/list_tie.hpp index afc0ab2f..91907167 100644 --- a/include/boost/fusion/container/generation/list_tie.hpp +++ b/include/boost/fusion/container/generation/list_tie.hpp @@ -10,7 +10,35 @@ #include #include +#if !defined(BOOST_FUSION_HAS_VARIADIC_LIST) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 variadic interface +/////////////////////////////////////////////////////////////////////////////// + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct list_tie + { + typedef list type; + }; + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline list + list_tie(T&... arg) + { + return list(arg...); + } +}} + +#endif #endif diff --git a/include/boost/fusion/container/generation/make_list.hpp b/include/boost/fusion/container/generation/make_list.hpp index 0aafb272..e88f553a 100644 --- a/include/boost/fusion/container/generation/make_list.hpp +++ b/include/boost/fusion/container/generation/make_list.hpp @@ -10,7 +10,37 @@ #include #include +#if !defined(BOOST_FUSION_HAS_VARIADIC_LIST) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 variadic interface +/////////////////////////////////////////////////////////////////////////////// + +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct make_list + { + typedef list::type...> type; + }; + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::make_list::type + make_list(T const&... arg) + { + return typename result_of::make_list::type(arg...); + } + }} + #endif +#endif diff --git a/include/boost/fusion/container/list/detail/cpp03/list.hpp b/include/boost/fusion/container/list/detail/cpp03/list.hpp index 41b3caff..b39489b0 100644 --- a/include/boost/fusion/container/list/detail/cpp03/list.hpp +++ b/include/boost/fusion/container/list/detail/cpp03/list.hpp @@ -46,10 +46,9 @@ namespace boost { namespace fusion typedef detail::list_to_cons list_to_cons; - - public: typedef typename list_to_cons::type inherited_type; + public: BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED list() : inherited_type() {} diff --git a/include/boost/fusion/container/list/detail/cpp03/preprocessed/list10.hpp b/include/boost/fusion/container/list/detail/cpp03/preprocessed/list10.hpp index 9a289365..69ffc9c2 100644 --- a/include/boost/fusion/container/list/detail/cpp03/preprocessed/list10.hpp +++ b/include/boost/fusion/container/list/detail/cpp03/preprocessed/list10.hpp @@ -18,8 +18,8 @@ namespace boost { namespace fusion typedef detail::list_to_cons list_to_cons; - public: typedef typename list_to_cons::type inherited_type; + public: BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED list() : inherited_type() {} diff --git a/include/boost/fusion/container/list/detail/cpp03/preprocessed/list20.hpp b/include/boost/fusion/container/list/detail/cpp03/preprocessed/list20.hpp index a201cb44..0d6ea768 100644 --- a/include/boost/fusion/container/list/detail/cpp03/preprocessed/list20.hpp +++ b/include/boost/fusion/container/list/detail/cpp03/preprocessed/list20.hpp @@ -18,8 +18,8 @@ namespace boost { namespace fusion typedef detail::list_to_cons list_to_cons; - public: typedef typename list_to_cons::type inherited_type; + public: BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED list() : inherited_type() {} diff --git a/include/boost/fusion/container/list/detail/cpp03/preprocessed/list30.hpp b/include/boost/fusion/container/list/detail/cpp03/preprocessed/list30.hpp index ef9e65fc..9087c119 100644 --- a/include/boost/fusion/container/list/detail/cpp03/preprocessed/list30.hpp +++ b/include/boost/fusion/container/list/detail/cpp03/preprocessed/list30.hpp @@ -18,8 +18,8 @@ namespace boost { namespace fusion typedef detail::list_to_cons list_to_cons; - public: typedef typename list_to_cons::type inherited_type; + public: BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED list() : inherited_type() {} diff --git a/include/boost/fusion/container/list/detail/cpp03/preprocessed/list40.hpp b/include/boost/fusion/container/list/detail/cpp03/preprocessed/list40.hpp index 570b2ccd..24a474fe 100644 --- a/include/boost/fusion/container/list/detail/cpp03/preprocessed/list40.hpp +++ b/include/boost/fusion/container/list/detail/cpp03/preprocessed/list40.hpp @@ -18,8 +18,8 @@ namespace boost { namespace fusion typedef detail::list_to_cons list_to_cons; - public: typedef typename list_to_cons::type inherited_type; + public: BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED list() : inherited_type() {} diff --git a/include/boost/fusion/container/list/detail/cpp03/preprocessed/list50.hpp b/include/boost/fusion/container/list/detail/cpp03/preprocessed/list50.hpp index d237cdf9..b810bea1 100644 --- a/include/boost/fusion/container/list/detail/cpp03/preprocessed/list50.hpp +++ b/include/boost/fusion/container/list/detail/cpp03/preprocessed/list50.hpp @@ -18,8 +18,8 @@ namespace boost { namespace fusion typedef detail::list_to_cons list_to_cons; - public: typedef typename list_to_cons::type inherited_type; + public: BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED list() : inherited_type() {} diff --git a/include/boost/fusion/container/list/detail/list_to_cons.hpp b/include/boost/fusion/container/list/detail/list_to_cons.hpp index e967c892..1ce1cfba 100644 --- a/include/boost/fusion/container/list/detail/list_to_cons.hpp +++ b/include/boost/fusion/container/list/detail/list_to_cons.hpp @@ -1,5 +1,5 @@ /*============================================================================= - Copyright (c) 2014 Kohei Takahashi + Copyright (c) 2014-2015 Kohei Takahashi 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) @@ -7,12 +7,55 @@ #ifndef FUSION_LIST_MAIN_10262014_0447 #define FUSION_LIST_MAIN_10262014_0447 +#include #include #include /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_LIST) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct list_to_cons; + + template <> + struct list_to_cons<> + { + typedef nil_ type; + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static type call() { return type(); } + }; + + template + struct list_to_cons + { + typedef Head head_type; + typedef list_to_cons tail_list_to_cons; + typedef typename tail_list_to_cons::type tail_type; + + typedef cons type; + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static type + call(typename detail::call_param::type _h, + typename detail::call_param::type ..._t) + { + return type(_h, tail_list_to_cons::call(_t...)); + } + }; +}}} #endif +#endif diff --git a/include/boost/fusion/container/list/list.hpp b/include/boost/fusion/container/list/list.hpp index b07f0fc9..865a6d7d 100644 --- a/include/boost/fusion/container/list/list.hpp +++ b/include/boost/fusion/container/list/list.hpp @@ -1,5 +1,5 @@ /*============================================================================= - Copyright (c) 2014 Kohei Takahashi + Copyright (c) 2014-2015 Kohei Takahashi 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) @@ -13,6 +13,115 @@ /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_LIST) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include + +namespace boost { namespace fusion +{ + struct nil_; + + template <> + struct list<> + : detail::list_to_cons<>::type + { + private: + typedef detail::list_to_cons<> list_to_cons; + typedef list_to_cons::type inherited_type; + + public: + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + list() + : inherited_type() {} + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template + BOOST_FUSION_GPU_ENABLED + list(Sequence const& rhs) + : inherited_type(rhs) {} + + template + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + list& + operator=(Sequence const& rhs) + { + inherited_type::operator=(rhs); + return *this; + } +#else + template + BOOST_FUSION_GPU_ENABLED + list(Sequence&& rhs) + : inherited_type(std::forward(rhs)) {} + + template + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + list& + operator=(Sequence&& rhs) + { + inherited_type::operator=(std::forward(rhs)); + return *this; + } +#endif + }; + + template + struct list + : detail::list_to_cons::type + { + private: + typedef detail::list_to_cons list_to_cons; + typedef typename list_to_cons::type inherited_type; + + public: + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + list() + : inherited_type() {} + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template + BOOST_FUSION_GPU_ENABLED + list(Sequence const& rhs) + : inherited_type(rhs) {} +#else + template + BOOST_FUSION_GPU_ENABLED + list(Sequence&& rhs) + : inherited_type(std::forward(rhs)) {} +#endif + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + explicit + list(typename detail::call_param::type ...args) + : inherited_type(list_to_cons::call(args...)) {} + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + list& + operator=(Sequence const& rhs) + { + inherited_type::operator=(rhs); + return *this; + } +#else + template + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + list& + operator=(Sequence&& rhs) + { + inherited_type::operator=(std::forward(rhs)); + return *this; + } +#endif + }; +}} #endif +#endif diff --git a/include/boost/fusion/container/list/list_fwd.hpp b/include/boost/fusion/container/list/list_fwd.hpp index d7ea0dcd..c5f26192 100644 --- a/include/boost/fusion/container/list/list_fwd.hpp +++ b/include/boost/fusion/container/list/list_fwd.hpp @@ -10,9 +10,34 @@ #include #include +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) \ + || (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)) +# if defined(BOOST_FUSION_HAS_VARIADIC_LIST) +# undef BOOST_FUSION_HAS_VARIADIC_LIST +# endif +#else +# if !defined(BOOST_FUSION_HAS_VARIADIC_LIST) +# define BOOST_FUSION_HAS_VARIADIC_LIST +# endif +#endif + /////////////////////////////////////////////////////////////////////////////// // With no variadics, we will use the C++03 version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_LIST) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace fusion +{ + struct void_; + + template + struct list; +}} #endif +#endif