Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:46:24

0001 /*=============================================================================
0002     Copyright (c) 2005-2012 Joel de Guzman
0003     Copyright (c) 2005-2006 Dan Marsden
0004 
0005     Distributed under the Boost Software License, Version 1.0. (See accompanying
0006     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 ==============================================================================*/
0008 #if !defined(BOOST_FUSION_DEQUE_26112006_1649)
0009 #define BOOST_FUSION_DEQUE_26112006_1649
0010 
0011 # include <boost/fusion/container/deque/deque_fwd.hpp>
0012 
0013 ///////////////////////////////////////////////////////////////////////////////
0014 // Without variadics, we will use the PP version
0015 ///////////////////////////////////////////////////////////////////////////////
0016 #if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
0017 # include <boost/fusion/container/deque/detail/cpp03/deque.hpp>
0018 #else
0019 
0020 ///////////////////////////////////////////////////////////////////////////////
0021 // C++11 interface
0022 ///////////////////////////////////////////////////////////////////////////////
0023 #include <boost/fusion/support/sequence_base.hpp>
0024 #include <boost/fusion/support/void.hpp>
0025 #include <boost/fusion/support/detail/enabler.hpp>
0026 #include <boost/fusion/support/detail/access.hpp>
0027 #include <boost/fusion/support/is_sequence.hpp>
0028 #include <boost/fusion/container/deque/detail/keyed_element.hpp>
0029 #include <boost/fusion/container/deque/detail/deque_keyed_values.hpp>
0030 #include <boost/fusion/container/deque/deque_fwd.hpp>
0031 #include <boost/fusion/container/deque/detail/value_at_impl.hpp>
0032 #include <boost/fusion/container/deque/detail/at_impl.hpp>
0033 #include <boost/fusion/container/deque/detail/begin_impl.hpp>
0034 #include <boost/fusion/container/deque/detail/end_impl.hpp>
0035 #include <boost/fusion/container/deque/detail/is_sequence_impl.hpp>
0036 #include <boost/fusion/sequence/intrinsic/begin.hpp>
0037 #include <boost/fusion/sequence/intrinsic/empty.hpp>
0038 
0039 #include <boost/mpl/int.hpp>
0040 #include <boost/mpl/and.hpp>
0041 #include <boost/utility/enable_if.hpp>
0042 #include <boost/type_traits/is_convertible.hpp>
0043 
0044 namespace boost { namespace fusion
0045 {
0046     struct deque_tag;
0047 
0048     template <typename ...Elements>
0049     struct deque : detail::nil_keyed_element
0050     {
0051         typedef deque_tag fusion_tag;
0052         typedef bidirectional_traversal_tag category;
0053         typedef mpl::int_<0> size;
0054         typedef mpl::int_<0> next_up;
0055         typedef mpl::int_<-1> next_down;
0056         typedef mpl::false_ is_view;
0057 
0058         template <typename Sequence>
0059         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0060         deque(Sequence const&,
0061             typename enable_if<
0062                 mpl::and_<
0063                     traits::is_sequence<Sequence>
0064                   , result_of::empty<Sequence>>, detail::enabler_>::type = detail::enabler) BOOST_NOEXCEPT
0065         {}
0066 
0067         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0068         deque() BOOST_NOEXCEPT {}
0069     };
0070 
0071     template <typename Head, typename ...Tail>
0072     struct deque<Head, Tail...>
0073       : detail::deque_keyed_values<Head, Tail...>::type
0074       , sequence_base<deque<Head, Tail...>>
0075     {
0076         typedef deque_tag fusion_tag;
0077         typedef bidirectional_traversal_tag category;
0078         typedef typename detail::deque_keyed_values<Head, Tail...>::type base;
0079         typedef mpl::int_<(sizeof ...(Tail) + 1)> size;
0080         typedef mpl::int_<size::value> next_up;
0081         typedef mpl::int_<-1> next_down;
0082         typedef mpl::false_ is_view;
0083 
0084         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0085         deque()
0086         {}
0087 
0088         template <typename Head_, typename ...Tail_, typename =
0089             typename enable_if<is_convertible<Head_, Head> >::type
0090         >
0091         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0092         deque(deque<Head_, Tail_...> const& seq)
0093           : base(seq)
0094         {}
0095 
0096         template <typename Head_, typename ...Tail_, typename =
0097             typename enable_if<is_convertible<Head_, Head> >::type
0098         >
0099         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0100         deque(deque<Head_, Tail_...>& seq)
0101           : base(seq)
0102         {}
0103 
0104 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0105         template <typename Head_, typename ...Tail_, typename =
0106             typename enable_if<is_convertible<Head_, Head> >::type
0107         >
0108         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0109         deque(deque<Head_, Tail_...>&& seq)
0110           : base(std::forward<deque<Head_, Tail_...>>(seq))
0111         {}
0112 #endif
0113 
0114         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0115         deque(deque const& seq)
0116           : base(seq)
0117         {}
0118 
0119 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0120         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0121         deque(deque&& seq)
0122           : base(std::forward<deque>(seq))
0123         {}
0124 #endif
0125 
0126         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0127         explicit deque(typename detail::call_param<Head>::type head
0128                      , typename detail::call_param<Tail>::type... tail)
0129           : base(detail::deque_keyed_values<Head, Tail...>::construct(head, tail...))
0130         {}
0131 
0132 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0133         template <typename Head_, typename ...Tail_, typename =
0134             typename enable_if<is_convertible<Head_, Head> >::type
0135         >
0136         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0137         explicit deque(Head_&& head, Tail_&&... tail)
0138           : base(detail::deque_keyed_values<Head, Tail...>
0139                 ::forward_(BOOST_FUSION_FWD_ELEM(Head_, head), BOOST_FUSION_FWD_ELEM(Tail_, tail)...))
0140         {}
0141 #else
0142         template <typename Head_, typename ...Tail_, typename =
0143             typename enable_if<is_convertible<Head_, Head> >::type
0144         >
0145         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0146         explicit deque(Head_ const& head, Tail_ const&... tail)
0147           : base(detail::deque_keyed_values<Head_, Tail_...>::construct(head, tail...))
0148         {}
0149 #endif
0150 
0151         template <typename Sequence>
0152         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0153         explicit deque(Sequence const& seq
0154           , typename disable_if<is_convertible<Sequence, Head>, detail::enabler_>::type = detail::enabler
0155           , typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler)
0156           : base(base::from_iterator(fusion::begin(seq)))
0157         {}
0158 
0159         template <typename ...Elements>
0160         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0161         deque& operator=(deque<Elements...> const& rhs)
0162         {
0163             base::operator=(rhs);
0164             return *this;
0165         }
0166 
0167         template <typename T>
0168         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0169         deque& operator=(T const& rhs)
0170         {
0171             base::operator=(rhs);
0172             return *this;
0173         }
0174 
0175 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0176         template <typename T>
0177         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0178         deque& operator=(T&& rhs)
0179         {
0180             base::operator=(BOOST_FUSION_FWD_ELEM(T, rhs));
0181             return *this;
0182         }
0183 #endif
0184 
0185     };
0186 }}
0187 
0188 #endif
0189 #endif