diff options
Diffstat (limited to 'boost/fusion/container/vector')
-rw-r--r-- | boost/fusion/container/vector/detail/as_vector.hpp | 53 | ||||
-rw-r--r-- | boost/fusion/container/vector/detail/at_impl.hpp | 9 | ||||
-rw-r--r-- | boost/fusion/container/vector/detail/config.hpp | 36 | ||||
-rw-r--r-- | boost/fusion/container/vector/detail/cpp03/limits.hpp | 1 | ||||
-rw-r--r-- | boost/fusion/container/vector/detail/deref_impl.hpp | 6 | ||||
-rw-r--r-- | boost/fusion/container/vector/detail/value_at_impl.hpp | 39 | ||||
-rw-r--r-- | boost/fusion/container/vector/detail/value_of_impl.hpp | 6 | ||||
-rw-r--r-- | boost/fusion/container/vector/vector.hpp | 322 | ||||
-rw-r--r-- | boost/fusion/container/vector/vector10.hpp | 10 | ||||
-rw-r--r-- | boost/fusion/container/vector/vector20.hpp | 10 | ||||
-rw-r--r-- | boost/fusion/container/vector/vector30.hpp | 10 | ||||
-rw-r--r-- | boost/fusion/container/vector/vector40.hpp | 10 | ||||
-rw-r--r-- | boost/fusion/container/vector/vector50.hpp | 10 | ||||
-rw-r--r-- | boost/fusion/container/vector/vector_fwd.hpp | 26 |
14 files changed, 532 insertions, 16 deletions
diff --git a/boost/fusion/container/vector/detail/as_vector.hpp b/boost/fusion/container/vector/detail/as_vector.hpp index eaaac89638..e2f45b6a04 100644 --- a/boost/fusion/container/vector/detail/as_vector.hpp +++ b/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 <boost/fusion/support/config.hpp> +#include <boost/fusion/container/vector/detail/config.hpp> /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include <boost/fusion/container/vector/detail/cpp03/as_vector.hpp> +#else +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include <boost/fusion/support/detail/index_sequence.hpp> +#include <boost/fusion/container/vector/vector.hpp> +#include <boost/fusion/iterator/value_of.hpp> +#include <boost/fusion/iterator/deref.hpp> +#include <boost/fusion/iterator/advance.hpp> +#include <cstddef> + +namespace boost { namespace fusion { namespace detail +{ +BOOST_FUSION_BARRIER_BEGIN + + template <typename Indices> + struct as_vector_impl; + + template <std::size_t ...Indices> + struct as_vector_impl<index_sequence<Indices...> > + { + template <typename Iterator> + struct apply + { + typedef vector< + typename result_of::value_of< + typename result_of::advance_c<Iterator, Indices>::type + >::type... + > type; + }; + + template <typename Iterator> + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + static typename apply<Iterator>::type + call(Iterator i) + { + typedef typename apply<Iterator>::type result; + return result(*advance_c<Indices>(i)...); + } + }; + + template <int size> + struct as_vector + : as_vector_impl<typename make_index_sequence<size>::type> {}; + +BOOST_FUSION_BARRIER_END +}}} + +#endif #endif diff --git a/boost/fusion/container/vector/detail/at_impl.hpp b/boost/fusion/container/vector/detail/at_impl.hpp index cb98dd4a25..a2900d7943 100644 --- a/boost/fusion/container/vector/detail/at_impl.hpp +++ b/boost/fusion/container/vector/detail/at_impl.hpp @@ -9,9 +9,8 @@ #include <boost/fusion/support/config.hpp> #include <boost/fusion/support/detail/access.hpp> -#include <boost/type_traits/is_const.hpp> -#include <boost/mpl/at.hpp> -#include <boost/mpl/int.hpp> +#include <boost/fusion/container/vector/detail/value_at_impl.hpp> +#include <boost/static_assert.hpp> namespace boost { namespace fusion { @@ -28,7 +27,7 @@ namespace boost { namespace fusion template <typename Sequence, typename N> struct apply { - typedef typename mpl::at<typename Sequence::types, N>::type element; + typedef typename value_at_impl<vector_tag>::template apply<Sequence, N>::type element; typedef typename detail::ref_result<element>::type type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED @@ -43,7 +42,7 @@ namespace boost { namespace fusion template <typename Sequence, typename N> struct apply <Sequence const, N> { - typedef typename mpl::at<typename Sequence::types, N>::type element; + typedef typename value_at_impl<vector_tag>::template apply<Sequence, N>::type element; typedef typename detail::cref_result<element>::type type; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED diff --git a/boost/fusion/container/vector/detail/config.hpp b/boost/fusion/container/vector/detail/config.hpp new file mode 100644 index 0000000000..84f4605d2e --- /dev/null +++ b/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 <boost/config.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/fusion/support/config.hpp> + +#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/boost/fusion/container/vector/detail/cpp03/limits.hpp b/boost/fusion/container/vector/detail/cpp03/limits.hpp index 6e106144bb..74a05102d2 100644 --- a/boost/fusion/container/vector/detail/cpp03/limits.hpp +++ b/boost/fusion/container/vector/detail/cpp03/limits.hpp @@ -9,6 +9,7 @@ #include <boost/fusion/support/config.hpp> #include <boost/fusion/support/detail/pp_round.hpp> +#include <boost/preprocessor/stringize.hpp> #if !defined(FUSION_MAX_VECTOR_SIZE) # define FUSION_MAX_VECTOR_SIZE 10 diff --git a/boost/fusion/container/vector/detail/deref_impl.hpp b/boost/fusion/container/vector/detail/deref_impl.hpp index 5186aa1047..c85bb82b3b 100644 --- a/boost/fusion/container/vector/detail/deref_impl.hpp +++ b/boost/fusion/container/vector/detail/deref_impl.hpp @@ -8,8 +8,8 @@ #define FUSION_DEREF_IMPL_05042005_1037 #include <boost/fusion/support/config.hpp> -#include <boost/mpl/at.hpp> #include <boost/fusion/support/detail/access.hpp> +#include <boost/fusion/container/vector/detail/value_at_impl.hpp> #include <boost/type_traits/is_const.hpp> #include <boost/mpl/if.hpp> @@ -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<vector_tag>::template apply<vector, index>::type element; typedef typename mpl::if_< diff --git a/boost/fusion/container/vector/detail/value_at_impl.hpp b/boost/fusion/container/vector/detail/value_at_impl.hpp index f71ca8486d..6c8c41fb27 100644 --- a/boost/fusion/container/vector/detail/value_at_impl.hpp +++ b/boost/fusion/container/vector/detail/value_at_impl.hpp @@ -9,11 +9,50 @@ #include <boost/config.hpp> #include <boost/fusion/support/config.hpp> +#include <boost/fusion/container/vector/detail/config.hpp> /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include <boost/fusion/container/vector/detail/cpp03/value_at_impl.hpp> +#else +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include <boost/fusion/container/vector/vector_fwd.hpp> +#include <boost/type_traits/declval.hpp> +#include <boost/type_traits/remove_cv.hpp> + +namespace boost { namespace fusion +{ + struct vector_tag; + + namespace vector_detail + { + template <typename I, typename ...T> + struct vector_data; + } + + namespace extension + { + template <typename Tag> + struct value_at_impl; + + template <> + struct value_at_impl<vector_tag> + { + template <typename Sequence, typename N> + struct apply + { + typedef typename boost::remove_cv<Sequence>::type seq; + typedef typename mpl::identity<decltype(seq::template value_at_impl<N::value>(boost::declval<seq*>()))>::type::type type; + }; + }; + } +}} + +#endif #endif diff --git a/boost/fusion/container/vector/detail/value_of_impl.hpp b/boost/fusion/container/vector/detail/value_of_impl.hpp index 2a8acf912d..d67ab3fcc2 100644 --- a/boost/fusion/container/vector/detail/value_of_impl.hpp +++ b/boost/fusion/container/vector/detail/value_of_impl.hpp @@ -8,7 +8,7 @@ #define FUSION_VALUE_OF_IMPL_05052005_1128 #include <boost/fusion/support/config.hpp> -#include <boost/mpl/at.hpp> +#include <boost/fusion/container/vector/detail/value_at_impl.hpp> 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<vector_tag>::template apply<vector, index>::type type; }; }; } diff --git a/boost/fusion/container/vector/vector.hpp b/boost/fusion/container/vector/vector.hpp index 2b9f0ce5ca..845a019e6b 100644 --- a/boost/fusion/container/vector/vector.hpp +++ b/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,332 @@ #include <boost/config.hpp> #include <boost/fusion/support/config.hpp> +#include <boost/fusion/container/vector/detail/config.hpp> #include <boost/fusion/container/vector/vector_fwd.hpp> /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include <boost/fusion/container/vector/detail/cpp03/vector.hpp> +#else +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include <boost/fusion/support/sequence_base.hpp> +#include <boost/fusion/support/is_sequence.hpp> +#include <boost/fusion/support/detail/index_sequence.hpp> +#include <boost/fusion/container/vector/detail/at_impl.hpp> +#include <boost/fusion/container/vector/detail/value_at_impl.hpp> +#include <boost/fusion/container/vector/detail/begin_impl.hpp> +#include <boost/fusion/container/vector/detail/end_impl.hpp> +#include <boost/fusion/sequence/intrinsic/size.hpp> +#include <boost/fusion/sequence/intrinsic/begin.hpp> +#include <boost/fusion/iterator/advance.hpp> +#include <boost/fusion/iterator/deref.hpp> +#include <boost/core/enable_if.hpp> +#include <boost/mpl/int.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/remove_reference.hpp> +#include <cstddef> +#include <utility> + +namespace boost { namespace fusion +{ + struct vector_tag; + struct random_access_traversal_tag; + + namespace vector_detail + { + struct each_elem {}; + struct copy_or_move {}; + template <typename I> struct from_sequence {}; + + template <typename Sequence> + struct make_indices_from_seq + : detail::make_index_sequence< + fusion::result_of::size<typename remove_reference<Sequence>::type>::value + > + {}; + + template <typename T> + struct pure : remove_cv<typename remove_reference<T>::type> {}; + + template <typename Sequence, typename This, int = result_of::size<This>::value> + struct is_convertible_to_first + : boost::is_convertible<Sequence, typename result_of::value_at_c<This, 0>::type> + {}; + + template <typename Sequence, typename This> + struct is_convertible_to_first<Sequence, This, 0> + : mpl::false_ + {}; + + template <typename This, typename ...T> + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline each_elem + dispatch(T const&...) BOOST_NOEXCEPT { return each_elem(); } + + template <typename This> + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline copy_or_move + dispatch(This const&) BOOST_NOEXCEPT { return copy_or_move(); } + + template <typename This, typename Sequence> + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline from_sequence< + typename lazy_enable_if_c< + (traits::is_sequence<typename remove_reference<Sequence>::type>::value && + !is_same<This, typename pure<Sequence>::type>::value && + !is_convertible_to_first<Sequence, This>::value) + , make_indices_from_seq<Sequence> + >::type + > + dispatch(Sequence&&) BOOST_NOEXCEPT + { return from_sequence<typename make_indices_from_seq<Sequence>::type>(); } + + + // forward_at_c allows to access Nth element even if ForwardSequence + // since fusion::at_c requires RandomAccessSequence. + namespace result_of + { + template <typename Sequence, int N> + struct forward_at_c + : fusion::result_of::deref< + typename fusion::result_of::advance_c< + typename fusion::result_of::begin< + typename remove_reference<Sequence>::type + >::type + , N + >::type + > + {}; + } + + template <int N, typename Sequence> + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::forward_at_c<Sequence, N>::type + forward_at_c(Sequence&& seq) + { + typedef typename + result_of::forward_at_c<Sequence, N>::type + result; + return std::forward<result>(*advance_c<N>(begin(seq))); + } + + // Object proxy since preserve object order + template <std::size_t, typename T> + 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<T&&>(rhs.get())) + {} + + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + store& + operator=(store&& rhs) + { + elem = static_cast<T&&>(rhs.get()); + return *this; + } + + template <typename U> + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + store(U&& rhs + , typename disable_if<is_same<typename pure<U>::type, store> >::type* = 0) + : elem(std::forward<U>(rhs)) + {} + + template <typename U> + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + typename disable_if<is_same<typename pure<U>::type, store>, store&>::type + operator=(U&& rhs) + { + elem = std::forward<U>(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 <typename I, typename ...T> + struct vector_data; + + template <std::size_t ...I, typename ...T> + struct vector_data<detail::index_sequence<I...>, T...> + : store<I, T>... + , sequence_base<vector_data<detail::index_sequence<I...>, 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_<sizeof...(T)> size; + typedef vector<T...> 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<I, T>(static_cast<store<I, T> const&>(rhs))... + {} + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + vector_data(copy_or_move, vector_data&& rhs) + : store<I, T>(std::forward<store<I, T> >(rhs))... + {} + + template <typename Sequence> + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + explicit + vector_data(from_sequence<detail::index_sequence<I...> >, Sequence&& rhs) + : store<I, T>(forward_at_c<I>(rhs))... + {} + + template <typename ...U> + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + explicit + vector_data(each_elem, U&&... var) + : store<I, T>(std::forward<U>(var))... + {} + + template <typename Sequence> + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + void + assign(Sequence&&, detail::index_sequence<>) {} + + template <typename Sequence, std::size_t N, std::size_t ...M> + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + void + assign(Sequence&& seq, detail::index_sequence<N, M...>) + { + at_impl(mpl::int_<N>()) = vector_detail::forward_at_c<N>(seq); + assign(std::forward<Sequence>(seq), detail::index_sequence<M...>()); + } + + template <std::size_t N, typename U> + static BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + auto at_detail(store<N, U>* this_) -> decltype(this_->get()) + { + return this_->get(); + } + + template <std::size_t N, typename U> + static BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + auto at_detail(store<N, U> const* this_) -> decltype(this_->get()) + { + return this_->get(); + } + + template <typename J> + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + auto at_impl(J) -> decltype(at_detail<J::value>(this)) + { + return at_detail<J::value>(this); + } + + template <typename J> + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + auto at_impl(J) const -> decltype(at_detail<J::value>(this)) + { + return at_detail<J::value>(this); + } + + template <std::size_t N, typename U> + static BOOST_FUSION_GPU_ENABLED + mpl::identity<U> value_at_impl(store<N, U>*); + }; + + template <typename V, typename... T> + struct trim_void_; + + template <typename... T> + struct trim_void_<vector<T...> > + { + typedef vector_data< + typename detail::make_index_sequence<sizeof...(T)>::type + , T... + > type; + }; + + template <typename... T, typename... Tail> + struct trim_void_<vector<T...>, void_, Tail...> + : trim_void_<vector<T...> > {}; + + template <typename... T, typename Head, typename... Tail> + struct trim_void_<vector<T...>, Head, Tail...> + : trim_void_<vector<T..., Head>, Tail...> {}; + + template <typename... T> + struct trim_void : trim_void_<vector<>, T...> {}; + } // namespace boost::fusion::vector_detail + + // This class provides backward compatibility: vector<T, ..., void_, void_, ...>. + template <typename... T> + struct vector + : vector_detail::trim_void<T...>::type + { + typedef typename vector_detail::trim_void<T...>::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 <typename... U> + // 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<vector>(std::forward<U>(u)...), std::forward<U>(u)...) + {} + + template <typename Sequence> + BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED + vector& + operator=(Sequence&& rhs) + { + typedef typename + vector_detail::make_indices_from_seq<Sequence>::type + indices; + base::assign(std::forward<Sequence>(rhs), indices()); + return *this; + } + }; +}} + +#endif #endif diff --git a/boost/fusion/container/vector/vector10.hpp b/boost/fusion/container/vector/vector10.hpp index f152bfe161..65722fe64a 100644 --- a/boost/fusion/container/vector/vector10.hpp +++ b/boost/fusion/container/vector/vector10.hpp @@ -9,11 +9,21 @@ #include <boost/config.hpp> #include <boost/fusion/support/config.hpp> +#include <boost/fusion/container/vector/detail/config.hpp> /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include <boost/fusion/container/vector/detail/cpp03/vector10.hpp> +#else +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include <boost/fusion/container/vector/vector_fwd.hpp> +#include <boost/fusion/container/vector/vector.hpp> + +#endif #endif diff --git a/boost/fusion/container/vector/vector20.hpp b/boost/fusion/container/vector/vector20.hpp index c5be355df6..c36e50c7d2 100644 --- a/boost/fusion/container/vector/vector20.hpp +++ b/boost/fusion/container/vector/vector20.hpp @@ -9,11 +9,21 @@ #include <boost/config.hpp> #include <boost/fusion/support/config.hpp> +#include <boost/fusion/container/vector/detail/config.hpp> /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include <boost/fusion/container/vector/detail/cpp03/vector20.hpp> +#else +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include <boost/fusion/container/vector/vector_fwd.hpp> +#include <boost/fusion/container/vector/vector.hpp> + +#endif #endif diff --git a/boost/fusion/container/vector/vector30.hpp b/boost/fusion/container/vector/vector30.hpp index 1a528cb578..e9f891f28b 100644 --- a/boost/fusion/container/vector/vector30.hpp +++ b/boost/fusion/container/vector/vector30.hpp @@ -9,11 +9,21 @@ #include <boost/config.hpp> #include <boost/fusion/support/config.hpp> +#include <boost/fusion/container/vector/detail/config.hpp> /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include <boost/fusion/container/vector/detail/cpp03/vector30.hpp> +#else +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include <boost/fusion/container/vector/vector_fwd.hpp> +#include <boost/fusion/container/vector/vector.hpp> + +#endif #endif diff --git a/boost/fusion/container/vector/vector40.hpp b/boost/fusion/container/vector/vector40.hpp index 5faa7d595b..4b753a084e 100644 --- a/boost/fusion/container/vector/vector40.hpp +++ b/boost/fusion/container/vector/vector40.hpp @@ -9,11 +9,21 @@ #include <boost/config.hpp> #include <boost/fusion/support/config.hpp> +#include <boost/fusion/container/vector/detail/config.hpp> /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include <boost/fusion/container/vector/detail/cpp03/vector40.hpp> +#else +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include <boost/fusion/container/vector/vector_fwd.hpp> +#include <boost/fusion/container/vector/vector.hpp> + +#endif #endif diff --git a/boost/fusion/container/vector/vector50.hpp b/boost/fusion/container/vector/vector50.hpp index 7b7e7a8a18..5d8d356313 100644 --- a/boost/fusion/container/vector/vector50.hpp +++ b/boost/fusion/container/vector/vector50.hpp @@ -9,11 +9,21 @@ #include <boost/config.hpp> #include <boost/fusion/support/config.hpp> +#include <boost/fusion/container/vector/detail/config.hpp> /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include <boost/fusion/container/vector/detail/cpp03/vector50.hpp> +#else +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include <boost/fusion/container/vector/vector_fwd.hpp> +#include <boost/fusion/container/vector/vector.hpp> + +#endif #endif diff --git a/boost/fusion/container/vector/vector_fwd.hpp b/boost/fusion/container/vector/vector_fwd.hpp index b63099ce9d..dcb0a0fc0c 100644 --- a/boost/fusion/container/vector/vector_fwd.hpp +++ b/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 <boost/config.hpp> #include <boost/fusion/support/config.hpp> +#include <boost/fusion/container/vector/detail/config.hpp> /////////////////////////////////////////////////////////////////////////////// // With no variadics, we will use the C++03 version /////////////////////////////////////////////////////////////////////////////// +#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) # include <boost/fusion/container/vector/detail/cpp03/vector_fwd.hpp> +#else +/////////////////////////////////////////////////////////////////////////////// +// C++11 interface +/////////////////////////////////////////////////////////////////////////////// +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/repetition/repeat.hpp> + +namespace boost { namespace fusion +{ + template <typename ...T> + struct vector; + +#define FUSION_VECTOR_N_ALIASES(z, N, d) \ + template <typename ...T> \ + using BOOST_PP_CAT(vector, N) = vector<T...>; + + BOOST_PP_REPEAT(51, FUSION_VECTOR_N_ALIASES, ~) + +#undef FUSION_VECTOR_N_ALIASES +}} + +#endif #endif |