diff --git a/doc/container.qbk b/doc/container.qbk index 8a29e29b..fccd2102 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -66,6 +66,11 @@ cases the most efficient. template struct vectorN; +[important Numbered forms will be deprecated in C++11 and it will be provided + via aliasing templates. It means that your partial specialization + might be compile error. You can detect whether it is aliasing + templates or not, using `BOOST_FUSION_HAS_VARIADIC_VECTOR`.] + [*Variadic form] template < @@ -81,9 +86,11 @@ The numbered form accepts the exact number of elements. Example: vector3 -The variadic form accepts `0` to `FUSION_MAX_VECTOR_SIZE` elements, where -`FUSION_MAX_VECTOR_SIZE` is a user definable predefined maximum that -defaults to `10`. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the The variadic form accepts `0` to +`FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a +user definable predefined maximum that defaults to `10`. Example: vector @@ -232,9 +239,11 @@ each element is peculiarly constant (see __recursive_inline__). > struct list; -The variadic class interface accepts `0` to `FUSION_MAX_LIST_SIZE` -elements, where `FUSION_MAX_LIST_SIZE` is a user definable predefined -maximum that defaults to `10`. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic class interface accepts `0` to +`FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user +definable predefined maximum that defaults to `10`. Example: list @@ -532,9 +541,11 @@ complexity (see __overloaded_functions__). > struct set; -The variadic class interface accepts `0` to `FUSION_MAX_SET_SIZE` elements, -where `FUSION_MAX_SET_SIZE` is a user definable predefined maximum that -defaults to `10`. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic class interface accepts `0` to +`FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user +definable predefined maximum that defaults to `10`. Example: set @@ -614,9 +625,11 @@ __overloaded_functions__). > struct map; -The variadic class interface accepts `0` to `FUSION_MAX_MAP_SIZE` elements, -where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum that -defaults to `10`. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic class interface accepts `0` to +`FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user +definable predefined maximum that defaults to `10`. Example: map<__pair__, __pair__, __pair__ > @@ -697,10 +710,13 @@ Create a __list__ from one or more values. typename __result_of_make_list__::type make_list(T0 const& x0, T1 const& x1... TN const& xN); -The variadic function accepts `0` to `FUSION_MAX_LIST_SIZE` elements, where -`FUSION_MAX_LIST_SIZE` is a user definable predefined maximum that defaults -to `10`. You may define the preprocessor constant `FUSION_MAX_LIST_SIZE` -before including any Fusion header to change the default. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic function accepts `0` to +`FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user +definable predefined maximum that defaults to `10`. You may define the +preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion +header to change the default. Example: #define FUSION_MAX_LIST_SIZE 20 @@ -794,11 +810,13 @@ Create a __vector__ from one or more values. typename __result_of_make_vector__::type make_vector(T0 const& x0, T1 const& x1... TN const& xN); -The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE` elements, -where `FUSION_MAX_VECTOR_SIZE` is a user definable predefined maximum that -defaults to `10`. You may define the preprocessor constant -`FUSION_MAX_VECTOR_SIZE` before including any Fusion header to change the -default. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic function accepts `0` to +`FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a +user definable predefined maximum that defaults to `10`. You may define +the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any +Fusion header to change the default. Example: #define FUSION_MAX_VECTOR_SIZE 20 @@ -896,11 +914,13 @@ Create a __set__ from one or more values. typename __result_of_make_set__::type make_set(T0 const& x0, T1 const& x1... TN const& xN); -The variadic function accepts `0` to `FUSION_MAX_SET_SIZE` elements, -where `FUSION_MAX_SET_SIZE` is a user definable predefined maximum that -defaults to `10`. You may define the preprocessor constant -`FUSION_MAX_SET_SIZE` before including any Fusion header to change the -default. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic function accepts `0` to +`FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user +definable predefined maximum that defaults to `10`. You may define the +preprocessor constant `FUSION_MAX_SET_SIZE` before including any Fusion +header to change the default. Example: #define FUSION_MAX_SET_SIZE 20 @@ -1049,10 +1069,13 @@ Constructs a tie using a __list__ sequence. __list__ list_tie(T0& x0, T1& x1... TN& xN); -The variadic function accepts `0` to `FUSION_MAX_LIST_SIZE` elements, where -`FUSION_MAX_LIST_SIZE` is a user definable predefined maximum that defaults -to `10`. You may define the preprocessor constant `FUSION_MAX_LIST_SIZE` -before including any Fusion header to change the default. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic function accepts `0` to +`FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user +definable predefined maximum that defaults to `10`. You may define the +preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion +header to change the default. Example: #define FUSION_MAX_LIST_SIZE 20 @@ -1096,11 +1119,13 @@ Constructs a tie using a __vector__ sequence. __vector__ vector_tie(T0& x0, T1& x1... TN& xN); -The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE` elements, -where `FUSION_MAX_VECTOR_SIZE` is a user definable predefined maximum that -defaults to `10`. You may define the preprocessor constant -`FUSION_MAX_VECTOR_SIZE` before including any Fusion header to change the -default. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic function accepts `0` to +`FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a +user definable predefined maximum that defaults to `10`. You may define +the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any +Fusion header to change the default. Example: #define FUSION_MAX_VECTOR_SIZE 20 @@ -1144,11 +1169,14 @@ Constructs a tie using a __map__ sequence. __map__<__pair__, __pair__,... __pair__ > map_tie(D0& d0, D1& d1... DN& dN); -The variadic function accepts `0` to `FUSION_MAX_MAP_SIZE` elements, -where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum that -defaults to `10`, and a corresponding number of key types. -You may define the preprocessor constant `FUSION_MAX_MAP_SIZE` before -including any Fusion header to change the default. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic function accepts `0` to +`FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user +definable predefined maximum that defaults to `10`, and a corresponding +number of key types. You may define the preprocessor constant +`FUSION_MAX_MAP_SIZE` before including any Fusion header to change the +default. Example: #define FUSION_MAX_MAP_SIZE 20 @@ -1249,10 +1277,13 @@ Returns the result type of __make_list__. template struct make_list; -The variadic function accepts `0` to `FUSION_MAX_LIST_SIZE` elements, where -`FUSION_MAX_LIST_SIZE` is a user definable predefined maximum that defaults -to `10`. You may define the preprocessor constant `FUSION_MAX_LIST_SIZE` -before including any Fusion header to change the default. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic function accepts `0` to +`FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user +definable predefined maximum that defaults to `10`. You may define the +preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion +header to change the default. Example: #define FUSION_MAX_LIST_SIZE 20 @@ -1333,11 +1364,13 @@ Returns the result type of __make_vector__. template struct make_vector; -The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE` elements, -where `FUSION_MAX_VECTOR_SIZE` is a user definable predefined maximum that -defaults to `10`. You may define the preprocessor constant -`FUSION_MAX_VECTOR_SIZE` before including any Fusion header to change the -default. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic function accepts `0` to +`FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a user +definable predefined maximum that defaults to `10`. You may define the +preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any Fusion +header to change the default. Example: #define FUSION_MAX_VECTOR_SIZE 20 @@ -1427,11 +1460,13 @@ Returns the result type of __make_set__. template struct make_set; -The variadic function accepts `0` to `FUSION_MAX_SET_SIZE` elements, -where `FUSION_MAX_SET_SIZE` is a user definable predefined maximum that -defaults to `10`. You may define the preprocessor constant -`FUSION_MAX_SET_SIZE` before including any Fusion header to change the -default. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic function accepts `0` to +`FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user definable +predefined maximum that defaults to `10`. You may define the preprocessor +constant `FUSION_MAX_SET_SIZE` before including any Fusion header to change +the default. Example: #define FUSION_MAX_SET_SIZE 20 @@ -1559,10 +1594,13 @@ Returns the result type of __list_tie__. template struct list_tie; -The variadic function accepts `0` to `FUSION_MAX_LIST_SIZE` elements, where -`FUSION_MAX_LIST_SIZE` is a user definable predefined maximum that defaults -to `10`. You may define the preprocessor constant `FUSION_MAX_LIST_SIZE` -before including any Fusion header to change the default. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic function accepts `0` to +`FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user +definable predefined maximum that defaults to `10`. You may define the +preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion +header to change the default. Example: #define FUSION_MAX_LIST_SIZE 20 @@ -1603,11 +1641,13 @@ Returns the result type of __vector_tie__. template struct vector_tie; -The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE` elements, -where `FUSION_MAX_VECTOR_SIZE` is a user definable predefined maximum that -defaults to `10`. You may define the preprocessor constant -`FUSION_MAX_VECTOR_SIZE` before including any Fusion header to change the -default. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic function accepts `0` to +`FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a user +definable predefined maximum that defaults to `10`. You may define the +preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any Fusion +header to change the default. Example: #define FUSION_MAX_VECTOR_SIZE 20 @@ -1695,11 +1735,13 @@ Returns the result type of __map_tie__. template struct map_tie; -The variadic function accepts `0` to `FUSION_MAX_MAP_SIZE` elements, -where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum that -defaults to `10`. You may define the preprocessor constant -`FUSION_MAX_MAP_SIZE` before including any Fusion header to change the -default. Example: +For C++11 compilers, the variadic function interface has no upper bound. + +For C++03 compilers, the variadic function accepts `0` to +`FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user definable +predefined maximum that defaults to `10`. You may define the preprocessor +constant `FUSION_MAX_MAP_SIZE` before including any Fusion header to change +the default. Example: #define FUSION_MAX_MAP_SIZE 20 diff --git a/include/boost/fusion/algorithm/transformation/erase.hpp b/include/boost/fusion/algorithm/transformation/erase.hpp index 0f3b8a15..8eebc357 100644 --- a/include/boost/fusion/algorithm/transformation/erase.hpp +++ b/include/boost/fusion/algorithm/transformation/erase.hpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include diff --git a/include/boost/fusion/algorithm/transformation/insert.hpp b/include/boost/fusion/algorithm/transformation/insert.hpp index 44e59653..c6d5219d 100644 --- a/include/boost/fusion/algorithm/transformation/insert.hpp +++ b/include/boost/fusion/algorithm/transformation/insert.hpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include diff --git a/include/boost/fusion/algorithm/transformation/insert_range.hpp b/include/boost/fusion/algorithm/transformation/insert_range.hpp index 40e64e1f..57878309 100644 --- a/include/boost/fusion/algorithm/transformation/insert_range.hpp +++ b/include/boost/fusion/algorithm/transformation/insert_range.hpp @@ -9,7 +9,6 @@ #include #include -#include #include #include #include diff --git a/include/boost/fusion/container/generation/make_set.hpp b/include/boost/fusion/container/generation/make_set.hpp index 705ec582..cd8519e5 100644 --- a/include/boost/fusion/container/generation/make_set.hpp +++ b/include/boost/fusion/container/generation/make_set.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) @@ -10,7 +10,46 @@ #include #include +#if !defined(BOOST_FUSION_HAS_VARIADIC_SET) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 variadic interface +/////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct make_set + { + typedef set< + typename detail::as_fusion_element< + typename remove_const< + typename remove_reference::type + >::type + >::type... + > type; + }; + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::make_set::type + make_set(T&&... arg) + { + return typename result_of::make_set::type(std::forward(arg)...); + } + }} + #endif +#endif diff --git a/include/boost/fusion/container/generation/make_vector.hpp b/include/boost/fusion/container/generation/make_vector.hpp index 8f067481..cd3b992b 100644 --- a/include/boost/fusion/container/generation/make_vector.hpp +++ b/include/boost/fusion/container/generation/make_vector.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) @@ -10,7 +10,66 @@ #include #include +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 variadic interface +/////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct make_vector + { + // make `make_vector' into `make_vector' + template struct trim_void; + + template + struct trim_void > + { + typedef vector type; + }; + + template + struct trim_void, void_, Tail...> + : trim_void > { }; + + template + struct trim_void, Head, Tail...> + : trim_void, Tail...> { }; + + typedef + typename trim_void< + vector<> + , typename detail::as_fusion_element< + typename remove_const< + typename remove_reference::type + >::type + >::type... + >::type + type; + }; + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::make_vector::type + make_vector(T&&... arg) + { + return typename result_of::make_vector::type(std::forward(arg)...); + } + }} + #endif +#endif diff --git a/include/boost/fusion/container/generation/vector_tie.hpp b/include/boost/fusion/container/generation/vector_tie.hpp index 5bb4face..5d7cb98b 100644 --- a/include/boost/fusion/container/generation/vector_tie.hpp +++ b/include/boost/fusion/container/generation/vector_tie.hpp @@ -8,8 +8,37 @@ #define FUSION_VECTOR_TIE_11112014_2302 #include +#include +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 variadic interface +/////////////////////////////////////////////////////////////////////////////// + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct vector_tie + { + typedef vector type; + }; + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline vector + vector_tie(T&... arg) + { + return vector(arg...); + } + }} + #endif +#endif diff --git a/include/boost/fusion/container/set/detail/as_set.hpp b/include/boost/fusion/container/set/detail/as_set.hpp index 1eb0d3fe..9d333258 100644 --- a/include/boost/fusion/container/set/detail/as_set.hpp +++ b/include/boost/fusion/container/set/detail/as_set.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,7 +13,55 @@ /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_SET) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ +BOOST_FUSION_BARRIER_BEGIN + + template ::type> + struct as_set; + + template + struct as_set > + { + template + struct apply + { + typedef set< + typename result_of::value_of< + typename result_of::advance_c::type + >::type... + > type; + }; + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static typename apply::type + call(Iterator const& i) + { + typedef apply gen; + typedef typename gen::type result; + return result(*advance_c(i)...); + } + }; + +BOOST_FUSION_BARRIER_END +}}} #endif +#endif diff --git a/include/boost/fusion/container/set/detail/convert_impl.hpp b/include/boost/fusion/container/set/detail/convert_impl.hpp index d9d5dcfc..0b4cb22f 100644 --- a/include/boost/fusion/container/set/detail/convert_impl.hpp +++ b/include/boost/fusion/container/set/detail/convert_impl.hpp @@ -29,7 +29,7 @@ namespace boost { namespace fusion template struct apply { - typedef typename detail::as_set::value> gen; + typedef detail::as_set::value> gen; typedef typename gen:: template apply::type>::type type; diff --git a/include/boost/fusion/container/set/set.hpp b/include/boost/fusion/container/set/set.hpp index 59f4eafc..12fd8115 100644 --- a/include/boost/fusion/container/set/set.hpp +++ b/include/boost/fusion/container/set/set.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,8 +13,126 @@ /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_SET) # include +#else +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct fusion_sequence_tag; + + template <> + struct set<> : sequence_base > + { + struct category : forward_traversal_tag, associative_tag {}; + + typedef set_tag fusion_tag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef mpl::false_ is_view; + + typedef vector<> storage_type; + + typedef storage_type::size size; + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + set() + : data() {} + + template + BOOST_FUSION_GPU_ENABLED + set(Sequence const& rhs, + typename enable_if >::type* = 0, + typename enable_if >::type* = 0) + : data(rhs) {} + + template + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + set& + operator=(T const& rhs) + { + data = rhs; + return *this; + } + + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + storage_type& get_data() { return data; } + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + storage_type const& get_data() const { return data; } + + private: + storage_type data; + }; + + template + struct set : sequence_base > + { + struct category : forward_traversal_tag, associative_tag {}; + + typedef set_tag fusion_tag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef mpl::false_ is_view; + + typedef vector storage_type; + + typedef typename storage_type::size size; + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + set() + : data() {} + + template + BOOST_FUSION_GPU_ENABLED + set(Sequence&& rhs, + typename enable_if >::type* = 0, + typename enable_if >::type* = 0) + : data(std::forward(rhs)) {} + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + explicit + set(U&& ...args) + : data(std::forward(args)...) {} + + template + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + set& + operator=(U&& rhs) + { + data = std::forward(rhs); + return *this; + } + + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + storage_type& get_data() { return data; } + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + storage_type const& get_data() const { return data; } + + private: + storage_type data; + }; + +}} + +#endif #endif diff --git a/include/boost/fusion/container/set/set_fwd.hpp b/include/boost/fusion/container/set/set_fwd.hpp index 50d8d1c8..7b5d6830 100644 --- a/include/boost/fusion/container/set/set_fwd.hpp +++ b/include/boost/fusion/container/set/set_fwd.hpp @@ -9,11 +9,38 @@ #include #include +#include + +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) \ + || (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)) +# if defined(BOOST_FUSION_HAS_VARIADIC_SET) +# undef BOOST_FUSION_HAS_VARIADIC_SET +# endif +#else +# if !defined(BOOST_FUSION_HAS_VARIADIC_SET) +# define BOOST_FUSION_HAS_VARIADIC_SET +# endif +#endif /////////////////////////////////////////////////////////////////////////////// // With no variadics, we will use the C++03 version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_SET) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace fusion +{ + struct set_tag; + struct set_iterator_tag; + + template + struct set; +}} #endif +#endif diff --git a/include/boost/fusion/container/vector.hpp b/include/boost/fusion/container/vector.hpp index a999c8b0..41c98033 100644 --- a/include/boost/fusion/container/vector.hpp +++ b/include/boost/fusion/container/vector.hpp @@ -8,25 +8,8 @@ #define FUSION_SEQUENCE_CLASS_VECTOR_10022005_0602 #include -#include - -#include -#if (FUSION_MAX_VECTOR_SIZE > 10) -#include -#endif -#if (FUSION_MAX_VECTOR_SIZE > 20) -#include -#endif -#if (FUSION_MAX_VECTOR_SIZE > 30) -#include -#endif -#if (FUSION_MAX_VECTOR_SIZE > 40) -#include -#endif - -#include #include -#include +#include #include #endif diff --git a/include/boost/fusion/container/vector/detail/as_vector.hpp b/include/boost/fusion/container/vector/detail/as_vector.hpp index eaaac896..e2f45b6a 100644 --- a/include/boost/fusion/container/vector/detail/as_vector.hpp +++ b/include/boost/fusion/container/vector/detail/as_vector.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) @@ -8,12 +8,63 @@ #define FUSION_AS_VECTOR_11052014_1801 #include +#include /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include +#else +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ +BOOST_FUSION_BARRIER_BEGIN + + template + struct as_vector_impl; + + template + struct as_vector_impl > + { + template + struct apply + { + typedef vector< + typename result_of::value_of< + typename result_of::advance_c::type + >::type... + > type; + }; + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static typename apply::type + call(Iterator i) + { + typedef typename apply::type result; + return result(*advance_c(i)...); + } + }; + + template + struct as_vector + : as_vector_impl::type> {}; + +BOOST_FUSION_BARRIER_END +}}} + +#endif #endif diff --git a/include/boost/fusion/container/vector/detail/at_impl.hpp b/include/boost/fusion/container/vector/detail/at_impl.hpp index cb98dd4a..a2900d79 100644 --- a/include/boost/fusion/container/vector/detail/at_impl.hpp +++ b/include/boost/fusion/container/vector/detail/at_impl.hpp @@ -9,9 +9,8 @@ #include #include -#include -#include -#include +#include +#include namespace boost { namespace fusion { @@ -28,7 +27,7 @@ namespace boost { namespace fusion template struct apply { - typedef typename mpl::at::type element; + typedef typename value_at_impl::template apply::type element; typedef typename detail::ref_result::type type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED @@ -43,7 +42,7 @@ namespace boost { namespace fusion template struct apply { - typedef typename mpl::at::type element; + typedef typename value_at_impl::template apply::type element; typedef typename detail::cref_result::type type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED diff --git a/include/boost/fusion/container/vector/detail/config.hpp b/include/boost/fusion/container/vector/detail/config.hpp new file mode 100644 index 00000000..84f4605d --- /dev/null +++ b/include/boost/fusion/container/vector/detail/config.hpp @@ -0,0 +1,36 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef FUSION_VECTOR_CONFIG_11052014_1720 +#define FUSION_VECTOR_CONFIG_11052014_1720 + +#include +#include +#include + +#if (defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) \ + || defined(BOOST_NO_CXX11_RVALUE_REFERENCES) \ + || defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) \ + || defined(BOOST_NO_CXX11_DECLTYPE)) \ + || (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)) +# if defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) +# undef BOOST_FUSION_HAS_VARIADIC_VECTOR +# endif +#else +# if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) +# define BOOST_FUSION_HAS_VARIADIC_VECTOR +# endif +#endif + +// Sometimes, MSVC 12 shows compile error with std::size_t of template parameter. +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1800)) +# if defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) +# undef BOOST_FUSION_HAS_VARIADIC_VECTOR +# endif +#endif + +#endif + diff --git a/include/boost/fusion/container/vector/detail/cpp03/limits.hpp b/include/boost/fusion/container/vector/detail/cpp03/limits.hpp index 6e106144..74a05102 100644 --- a/include/boost/fusion/container/vector/detail/cpp03/limits.hpp +++ b/include/boost/fusion/container/vector/detail/cpp03/limits.hpp @@ -9,6 +9,7 @@ #include #include +#include #if !defined(FUSION_MAX_VECTOR_SIZE) # define FUSION_MAX_VECTOR_SIZE 10 diff --git a/include/boost/fusion/container/vector/detail/deref_impl.hpp b/include/boost/fusion/container/vector/detail/deref_impl.hpp index 5186aa10..c85bb82b 100644 --- a/include/boost/fusion/container/vector/detail/deref_impl.hpp +++ b/include/boost/fusion/container/vector/detail/deref_impl.hpp @@ -8,8 +8,8 @@ #define FUSION_DEREF_IMPL_05042005_1037 #include -#include #include +#include #include #include @@ -30,9 +30,7 @@ namespace boost { namespace fusion { typedef typename Iterator::vector vector; typedef typename Iterator::index index; - typedef typename mpl::at< - typename vector::types, index>::type - element; + typedef typename value_at_impl::template apply::type element; typedef typename mpl::if_< diff --git a/include/boost/fusion/container/vector/detail/value_at_impl.hpp b/include/boost/fusion/container/vector/detail/value_at_impl.hpp index f71ca848..3d748afd 100644 --- a/include/boost/fusion/container/vector/detail/value_at_impl.hpp +++ b/include/boost/fusion/container/vector/detail/value_at_impl.hpp @@ -9,11 +9,50 @@ #include #include +#include /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include +#include + +namespace boost { namespace fusion +{ + struct vector_tag; + + namespace vector_detail + { + template + struct vector_data; + } + + namespace extension + { + template + struct value_at_impl; + + template <> + struct value_at_impl + { + template + struct apply + { + typedef typename boost::remove_cv::type seq; + typedef decltype(seq::template value_at_impl(boost::declval())) type; + }; + }; + } +}} #endif +#endif diff --git a/include/boost/fusion/container/vector/detail/value_of_impl.hpp b/include/boost/fusion/container/vector/detail/value_of_impl.hpp index 2a8acf91..d67ab3fc 100644 --- a/include/boost/fusion/container/vector/detail/value_of_impl.hpp +++ b/include/boost/fusion/container/vector/detail/value_of_impl.hpp @@ -8,7 +8,7 @@ #define FUSION_VALUE_OF_IMPL_05052005_1128 #include -#include +#include namespace boost { namespace fusion { @@ -27,9 +27,7 @@ namespace boost { namespace fusion { typedef typename Iterator::vector vector; typedef typename Iterator::index index; - typedef typename mpl::at< - typename vector::types, index>::type - type; + typedef typename value_at_impl::template apply::type type; }; }; } diff --git a/include/boost/fusion/container/vector/vector.hpp b/include/boost/fusion/container/vector/vector.hpp index 2b9f0ce5..4ca4b237 100644 --- a/include/boost/fusion/container/vector/vector.hpp +++ b/include/boost/fusion/container/vector/vector.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) @@ -9,12 +9,320 @@ #include #include +#include #include /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct vector_tag; + struct random_access_traversal_tag; + + namespace vector_detail + { + struct each_elem {}; + struct copy_or_move {}; + template struct from_sequence {}; + + template + struct make_indices_from_seq + : detail::make_index_sequence< + fusion::result_of::size::type>::value + > + {}; + + template + struct pure : remove_cv::type> {}; + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline each_elem + dispatch(T const&...) BOOST_NOEXCEPT { return each_elem(); } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline copy_or_move + dispatch(This const&) BOOST_NOEXCEPT { return copy_or_move(); } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline from_sequence< + typename lazy_enable_if_c< + (traits::is_sequence::value && + !is_same::value) + , make_indices_from_seq + >::type + > + dispatch(Sequence const&) BOOST_NOEXCEPT + { return from_sequence::type>(); } + + + // forward_at_c allows to access Nth element even if ForwardSequence + // since fusion::at_c requires RandomAccessSequence. + namespace result_of + { + template + struct forward_at_c + : fusion::result_of::deref< + typename fusion::result_of::advance_c< + typename fusion::result_of::begin< + typename remove_reference::type + >::type + , N + >::type + > + {}; + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::forward_at_c::type + forward_at_c(Sequence&& seq) + { + typedef typename + result_of::forward_at_c::type + result; + return std::forward(*advance_c(begin(seq))); + } + + // Object proxy since preserve object order + template + struct store + { + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + store() + : elem() // value-initialized explicitly + {} + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + store(store const& rhs) + : elem(rhs.get()) + {} + + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + store& + operator=(store const& rhs) + { + elem = rhs.get(); + return *this; + } + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + store(store&& rhs) + : elem(static_cast(rhs.get())) + {} + + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + store& + operator=(store&& rhs) + { + elem = static_cast(rhs.get()); + return *this; + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + store(U&& rhs + , typename disable_if::type, store> >::type* = 0) + : elem(std::forward(rhs)) + {} + + template + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + typename disable_if::type, store>, store&>::type + operator=(U&& rhs) + { + elem = std::forward(rhs); + return *this; + } + + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + T & get() { return elem; } + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + T const& get() const { return elem; } + + T elem; + }; + + template + struct vector_data; + + template + struct vector_data, T...> + : store... + , sequence_base, T...> > + { + typedef vector_tag fusion_tag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef mpl::false_ is_view; + typedef random_access_traversal_tag category; + typedef mpl::int_ size; + typedef vector type_sequence; + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + vector_data() + {} + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + vector_data(copy_or_move, vector_data const& rhs) + : store(static_cast const&>(rhs))... + {} + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + vector_data(copy_or_move, vector_data&& rhs) + : store(std::forward >(rhs))... + {} + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + explicit + vector_data(from_sequence >, Sequence&& rhs) + : store(forward_at_c(rhs))... + {} + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + explicit + vector_data(each_elem, U&&... var) + : store(std::forward(var))... + {} + + template + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + void + assign(Sequence&&, detail::index_sequence<>) {} + + template + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + void + assign(Sequence&& seq, detail::index_sequence) + { + at_impl(mpl::int_()) = vector_detail::forward_at_c(seq); + assign(std::forward(seq), detail::index_sequence()); + } + + template + static BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + auto at_detail(store* this_) -> decltype(this_->get()) + { + return this_->get(); + } + + template + static BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + auto at_detail(store const* this_) -> decltype(this_->get()) + { + return this_->get(); + } + + template + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + auto at_impl(J) -> decltype(at_detail(this)) + { + return at_detail(this); + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + auto at_impl(J) const -> decltype(at_detail(this)) + { + return at_detail(this); + } + + template + static BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + U value_at_impl(store*); + }; + + template + struct trim_void_; + + template + struct trim_void_ > + { + typedef vector_data< + typename detail::make_index_sequence::type + , T... + > type; + }; + + template + struct trim_void_, void_, Tail...> + : trim_void_ > {}; + + template + struct trim_void_, Head, Tail...> + : trim_void_, Tail...> {}; + + template + struct trim_void : trim_void_, T...> {}; + } // namespace boost::fusion::vector_detail + + // This class provides backward compatibility: vector. + template + struct vector + : vector_detail::trim_void::type + { + typedef typename vector_detail::trim_void::type base; + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + vector() + {} + + // rvalue-references is required here in order to forward any arguments to + // base: vector(T const&...) doesn't work with trailing void_ and + // vector(U const&...) cannot forward any arguments to base. + template + // XXX: constexpr become error due to pull-request #79, booooo!! + // In the (near) future release, should be fixed. + /* BOOST_CONSTEXPR */ BOOST_FUSION_GPU_ENABLED + vector(U&&... u) + : base(vector_detail::dispatch(u...), std::forward(u)...) + {} + + template + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + vector& + operator=(Sequence&& rhs) + { + typedef typename + vector_detail::make_indices_from_seq::type + indices; + base::assign(std::forward(rhs), indices()); + return *this; + } + }; +}} #endif +#endif diff --git a/include/boost/fusion/container/vector/vector10.hpp b/include/boost/fusion/container/vector/vector10.hpp index f152bfe1..65722fe6 100644 --- a/include/boost/fusion/container/vector/vector10.hpp +++ b/include/boost/fusion/container/vector/vector10.hpp @@ -9,11 +9,21 @@ #include #include +#include /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include #endif +#endif diff --git a/include/boost/fusion/container/vector/vector20.hpp b/include/boost/fusion/container/vector/vector20.hpp index c5be355d..c36e50c7 100644 --- a/include/boost/fusion/container/vector/vector20.hpp +++ b/include/boost/fusion/container/vector/vector20.hpp @@ -9,11 +9,21 @@ #include #include +#include /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include #endif +#endif diff --git a/include/boost/fusion/container/vector/vector30.hpp b/include/boost/fusion/container/vector/vector30.hpp index 1a528cb5..e9f891f2 100644 --- a/include/boost/fusion/container/vector/vector30.hpp +++ b/include/boost/fusion/container/vector/vector30.hpp @@ -9,11 +9,21 @@ #include #include +#include /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include #endif +#endif diff --git a/include/boost/fusion/container/vector/vector40.hpp b/include/boost/fusion/container/vector/vector40.hpp index 5faa7d59..4b753a08 100644 --- a/include/boost/fusion/container/vector/vector40.hpp +++ b/include/boost/fusion/container/vector/vector40.hpp @@ -9,11 +9,21 @@ #include #include +#include /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include #endif +#endif diff --git a/include/boost/fusion/container/vector/vector50.hpp b/include/boost/fusion/container/vector/vector50.hpp index 7b7e7a8a..5d8d3563 100644 --- a/include/boost/fusion/container/vector/vector50.hpp +++ b/include/boost/fusion/container/vector/vector50.hpp @@ -9,11 +9,21 @@ #include #include +#include /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include #endif +#endif diff --git a/include/boost/fusion/container/vector/vector_fwd.hpp b/include/boost/fusion/container/vector/vector_fwd.hpp index b63099ce..dcb0a0fc 100644 --- a/include/boost/fusion/container/vector/vector_fwd.hpp +++ b/include/boost/fusion/container/vector/vector_fwd.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) @@ -9,11 +9,35 @@ #include #include +#include /////////////////////////////////////////////////////////////////////////////// // With no variadics, we will use the C++03 version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include + +namespace boost { namespace fusion +{ + template + struct vector; + +#define FUSION_VECTOR_N_ALIASES(z, N, d) \ + template \ + using BOOST_PP_CAT(vector, N) = vector; + + BOOST_PP_REPEAT(51, FUSION_VECTOR_N_ALIASES, ~) + +#undef FUSION_VECTOR_N_ALIASES +}} #endif +#endif diff --git a/include/boost/fusion/functional/adapter/limits.hpp b/include/boost/fusion/functional/adapter/limits.hpp index cdcdf821..9fb5a2a2 100644 --- a/include/boost/fusion/functional/adapter/limits.hpp +++ b/include/boost/fusion/functional/adapter/limits.hpp @@ -9,16 +9,21 @@ #if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_LIMITS_HPP_INCLUDED) # define BOOST_FUSION_FUNCTIONAL_ADAPTER_LIMITS_HPP_INCLUDED -# include +# include +# if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) +# include +# endif # if !defined(BOOST_FUSION_UNFUSED_MAX_ARITY) # define BOOST_FUSION_UNFUSED_MAX_ARITY 6 -# elif BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE +# elif !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) && \ + (BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE) # error "BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE" # endif # if !defined(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY) # define BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY 6 -# elif BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE +# elif !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) && \ + (BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE) # error "BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE" # endif diff --git a/include/boost/fusion/support/detail/is_same_size.hpp b/include/boost/fusion/support/detail/is_same_size.hpp new file mode 100644 index 00000000..b1bf7cde --- /dev/null +++ b/include/boost/fusion/support/detail/is_same_size.hpp @@ -0,0 +1,29 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef FUSION_IS_SAME_SIZE_10082015_1156 +#define FUSION_IS_SAME_SIZE_10082015_1156 + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct is_same_size : mpl::false_ {}; + + template + struct is_same_size >::type, + typename enable_if >::type> + : mpl::equal_to, result_of::size > + {}; +}}} + +#endif diff --git a/include/boost/fusion/tuple/make_tuple.hpp b/include/boost/fusion/tuple/make_tuple.hpp index 0d127736..e5cbb3b2 100644 --- a/include/boost/fusion/tuple/make_tuple.hpp +++ b/include/boost/fusion/tuple/make_tuple.hpp @@ -13,7 +13,38 @@ /////////////////////////////////////////////////////////////////////////////// // With no variadics, we will use the C++03 version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline tuple::type + >::type + >::type...> + make_tuple(T&&... arg) + { + typedef tuple::type + >::type + >::type...> result_type; + return result_type(std::forward(arg)...); + } +}} #endif +#endif diff --git a/include/boost/fusion/tuple/tuple.hpp b/include/boost/fusion/tuple/tuple.hpp index 674c3691..6ee21f56 100644 --- a/include/boost/fusion/tuple/tuple.hpp +++ b/include/boost/fusion/tuple/tuple.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,7 +13,80 @@ /////////////////////////////////////////////////////////////////////////////// // With no variadics, we will use the C++03 version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + template + struct tuple : vector + { + typedef vector base_type; + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + tuple() + : base_type() {} + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + tuple(tuple const& other) + : base_type(other) {} + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + tuple(tuple&& other) + : base_type(std::move(other)) {} + + template + /*BOOST_CONSTEXPR*/ BOOST_FUSION_GPU_ENABLED + explicit + tuple(U&&... args) + : base_type(std::forward(args)...) {} + + template + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + tuple& operator=(U&& rhs) + { + base_type::operator=(std::forward(rhs)); + return *this; + } + }; + + template + struct tuple_size : result_of::size {}; + + template + struct tuple_element : result_of::value_at_c {}; + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::at_c::type + get(Tuple& tup) + { + return at_c(tup); + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::at_c::type + get(Tuple const& tup) + { + return at_c(tup); + } +}} #endif +#endif diff --git a/include/boost/fusion/tuple/tuple_fwd.hpp b/include/boost/fusion/tuple/tuple_fwd.hpp index 07420234..b763acd5 100644 --- a/include/boost/fusion/tuple/tuple_fwd.hpp +++ b/include/boost/fusion/tuple/tuple_fwd.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) @@ -9,11 +9,35 @@ #include #include +#include + +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) \ + || (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)) +# if defined(BOOST_FUSION_HAS_VARIADIC_TUPLE) +# undef BOOST_FUSION_HAS_VARIADIC_TUPLE +# endif +#else +# if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE) +# define BOOST_FUSION_HAS_VARIADIC_TUPLE +# endif +#endif /////////////////////////////////////////////////////////////////////////////// // With no variadics, we will use the C++03 version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace fusion +{ + template + struct tuple; +}} #endif +#endif diff --git a/include/boost/fusion/tuple/tuple_tie.hpp b/include/boost/fusion/tuple/tuple_tie.hpp index 92028070..a07dc0a4 100644 --- a/include/boost/fusion/tuple/tuple_tie.hpp +++ b/include/boost/fusion/tuple/tuple_tie.hpp @@ -13,7 +13,26 @@ /////////////////////////////////////////////////////////////////////////////// // With no variadics, we will use the C++03 version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include + +namespace boost { namespace fusion +{ + template + BOOST_FUSION_GPU_ENABLED + inline tuple + tie(T&... arg) + { + return tuple(arg...); + } +}} #endif +#endif diff --git a/include/boost/fusion/view/nview/detail/advance_impl.hpp b/include/boost/fusion/view/nview/detail/advance_impl.hpp index 7c74a386..c4641433 100644 --- a/include/boost/fusion/view/nview/detail/advance_impl.hpp +++ b/include/boost/fusion/view/nview/detail/advance_impl.hpp @@ -1,7 +1,7 @@ /*============================================================================= Copyright (c) 2009 Hartmut Kaiser - Distributed under the Boost Software License, Version 1.0. (See accompanying + 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) ==============================================================================*/ @@ -9,7 +9,6 @@ #define BOOST_FUSION_NVIEW_ADVANCE_IMPL_SEP_24_2009_0212PM #include -#include #include namespace boost { namespace fusion @@ -30,11 +29,11 @@ namespace boost { namespace fusion template struct apply { - typedef typename Iterator::first_type::iterator_type iterator_type; + typedef typename Iterator::first_type iterator_type; typedef typename Iterator::sequence_type sequence_type; - typedef nview_iterator::type> type; + typedef nview_iterator::type> type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type diff --git a/include/boost/fusion/view/nview/detail/at_impl.hpp b/include/boost/fusion/view/nview/detail/at_impl.hpp index b9f41def..9f8c1637 100644 --- a/include/boost/fusion/view/nview/detail/at_impl.hpp +++ b/include/boost/fusion/view/nview/detail/at_impl.hpp @@ -10,6 +10,7 @@ #include #include +#include namespace boost { namespace fusion { @@ -29,7 +30,7 @@ namespace boost { namespace fusion typedef typename Sequence::sequence_type sequence_type; typedef typename Sequence::index_type index_type; - typedef typename result_of::at::type index; + typedef typename result_of::value_at::type index; typedef typename result_of::at::type type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED diff --git a/include/boost/fusion/view/nview/detail/begin_impl.hpp b/include/boost/fusion/view/nview/detail/begin_impl.hpp index bab5e221..99e6319e 100644 --- a/include/boost/fusion/view/nview/detail/begin_impl.hpp +++ b/include/boost/fusion/view/nview/detail/begin_impl.hpp @@ -9,7 +9,6 @@ #define BOOST_FUSION_NVIEW_BEGIN_IMPL_SEP_23_2009_1036PM #include -#include #include namespace boost { namespace fusion @@ -32,8 +31,8 @@ namespace boost { namespace fusion { typedef typename Sequence::index_type index_type; - typedef nview_iterator::type> type; + typedef nview_iterator::type> type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence& s) diff --git a/include/boost/fusion/view/nview/detail/cpp03/nview_impl.hpp b/include/boost/fusion/view/nview/detail/cpp03/nview_impl.hpp index 08c6c9d7..0bcea9bb 100644 --- a/include/boost/fusion/view/nview/detail/cpp03/nview_impl.hpp +++ b/include/boost/fusion/view/nview/detail/cpp03/nview_impl.hpp @@ -17,10 +17,13 @@ #include #include #include +#include +#include +#include #define BOOST_PP_ITERATION_PARAMS_1 \ (3, (1, FUSION_MAX_VECTOR_SIZE, \ - "boost/fusion/view/nview/detail/cpp03/nview_impl.hpp")) \ + "boost/fusion/view/nview/detail/cpp03/nview_impl.hpp")) \ /**/ /////////////////////////////////////////////////////////////////////////////// diff --git a/include/boost/fusion/view/nview/detail/deref_impl.hpp b/include/boost/fusion/view/nview/detail/deref_impl.hpp index 85991021..57654aa0 100644 --- a/include/boost/fusion/view/nview/detail/deref_impl.hpp +++ b/include/boost/fusion/view/nview/detail/deref_impl.hpp @@ -9,8 +9,8 @@ #define BOOST_FUSION_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM #include -#include -#include +#include +#include namespace boost { namespace fusion { @@ -30,7 +30,7 @@ namespace boost { namespace fusion typedef typename Iterator::first_type first_type; typedef typename Iterator::sequence_type sequence_type; - typedef typename result_of::deref::type index; + typedef typename result_of::value_of::type index; typedef typename result_of::at< typename sequence_type::sequence_type, index>::type type; diff --git a/include/boost/fusion/view/nview/detail/end_impl.hpp b/include/boost/fusion/view/nview/detail/end_impl.hpp index 0a6efe56..810aea91 100644 --- a/include/boost/fusion/view/nview/detail/end_impl.hpp +++ b/include/boost/fusion/view/nview/detail/end_impl.hpp @@ -9,7 +9,6 @@ #define BOOST_FUSION_NVIEW_END_IMPL_SEP_24_2009_0140PM #include -#include #include namespace boost { namespace fusion @@ -33,8 +32,8 @@ namespace boost { namespace fusion { typedef typename Sequence::index_type index_type; - typedef nview_iterator::type> type; + typedef nview_iterator::type> type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence& s) diff --git a/include/boost/fusion/view/nview/detail/next_impl.hpp b/include/boost/fusion/view/nview/detail/next_impl.hpp index 3c304096..821d9c37 100644 --- a/include/boost/fusion/view/nview/detail/next_impl.hpp +++ b/include/boost/fusion/view/nview/detail/next_impl.hpp @@ -9,7 +9,7 @@ #define BOOST_FUSION_NVIEW_NEXT_IMPL_SEP_24_2009_0116PM #include -#include +#include namespace boost { namespace fusion { @@ -27,13 +27,13 @@ namespace boost { namespace fusion struct next_impl { template - struct apply + struct apply { - typedef typename Iterator::first_type::iterator_type first_type; + typedef typename Iterator::first_type first_type; typedef typename Iterator::sequence_type sequence_type; typedef nview_iterator::type> type; + typename result_of::next::type> type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type diff --git a/include/boost/fusion/view/nview/detail/nview_impl.hpp b/include/boost/fusion/view/nview/detail/nview_impl.hpp index 40674e35..0c75a66a 100644 --- a/include/boost/fusion/view/nview/detail/nview_impl.hpp +++ b/include/boost/fusion/view/nview/detail/nview_impl.hpp @@ -8,11 +8,43 @@ #define BOOST_FUSION_NVIEW_IMPL_17122014_1948 #include +#include /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include +#else + +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct as_nview + { + typedef vector...> index_type; + typedef nview type; + }; + } + + template + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline nview...> > + as_nview(Sequence& s) + { + typedef vector...> index_type; + return nview(s); + } +}} #endif +#endif diff --git a/include/boost/fusion/view/nview/detail/prior_impl.hpp b/include/boost/fusion/view/nview/detail/prior_impl.hpp index 470c5bd3..29b63f56 100644 --- a/include/boost/fusion/view/nview/detail/prior_impl.hpp +++ b/include/boost/fusion/view/nview/detail/prior_impl.hpp @@ -9,7 +9,7 @@ #define BOOST_FUSION_NVIEW_PRIOR_IMPL_SEP_24_2009_0142PM #include -#include +#include namespace boost { namespace fusion { @@ -27,13 +27,13 @@ namespace boost { namespace fusion struct prior_impl { template - struct apply + struct apply { - typedef typename Iterator::first_type::iterator_type first_type; + typedef typename Iterator::first_type first_type; typedef typename Iterator::sequence_type sequence_type; typedef nview_iterator::type> type; + typename result_of::prior::type> type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type diff --git a/include/boost/fusion/view/nview/nview.hpp b/include/boost/fusion/view/nview/nview.hpp index 2e257c81..e5a4be8a 100644 --- a/include/boost/fusion/view/nview/nview.hpp +++ b/include/boost/fusion/view/nview/nview.hpp @@ -9,19 +9,15 @@ #define BOOST_FUSION_NVIEW_SEP_23_2009_0948PM #include -#include #include -#include -#include -#include #include #include #include -#include #include #include +#include #include #include @@ -99,7 +95,7 @@ namespace boost { namespace fusion typedef mpl::true_ is_view; typedef Indicies index_type; - typedef typename mpl::size::type size; + typedef typename result_of::size::type size; typedef typename mpl::if_< is_const, detail::addconstref, detail::addref diff --git a/include/boost/fusion/view/nview/nview_iterator.hpp b/include/boost/fusion/view/nview/nview_iterator.hpp index aeaf4620..42e634e5 100644 --- a/include/boost/fusion/view/nview/nview_iterator.hpp +++ b/include/boost/fusion/view/nview/nview_iterator.hpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -40,7 +39,7 @@ namespace boost { namespace fusion typedef random_access_traversal_tag category; typedef Sequence sequence_type; - typedef mpl_iterator first_type; + typedef Pos first_type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED explicit nview_iterator(Sequence& in_seq)