C++11 fixes for deque

[SVN r80392]
This commit is contained in:
Joel de Guzman
2012-09-04 05:04:26 +00:00
parent 35ec74edbc
commit 80799eed95
10 changed files with 42 additions and 25 deletions

View File

@ -11,24 +11,23 @@
#include <boost/config.hpp> #include <boost/config.hpp>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// With no decltype and variadics, we will use the C++03 version // With variadics, we will use the PP version version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if (defined(BOOST_NO_DECLTYPE) \ #if defined(BOOST_NO_VARIADIC_TEMPLATES)
|| defined(BOOST_NO_VARIADIC_TEMPLATES) \ # include <boost/fusion/container/deque/detail/pp_deque.hpp>
|| defined(BOOST_NO_RVALUE_REFERENCES))
# include <boost/fusion/container/deque/detail/cpp03_deque.hpp>
#else #else
# if !defined(BOOST_FUSION_HAS_CPP11_DEQUE) # if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
# define BOOST_FUSION_HAS_CPP11_DEQUE # define BOOST_FUSION_HAS_VARIADIC_DEQUE
# endif # endif
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// C++11 interface // C++11 variadic interface
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/support/sequence_base.hpp> #include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/container/deque/detail/keyed_element.hpp> #include <boost/fusion/container/deque/detail/keyed_element.hpp>
#include <boost/fusion/container/deque/detail/cpp11_deque_keyed_values.hpp> #include <boost/fusion/container/deque/detail/variadic_deque_keyed_values.hpp>
#include <boost/fusion/container/deque/deque_fwd.hpp> #include <boost/fusion/container/deque/deque_fwd.hpp>
#include <boost/fusion/container/deque/detail/value_at_impl.hpp> #include <boost/fusion/container/deque/detail/value_at_impl.hpp>
#include <boost/fusion/container/deque/detail/at_impl.hpp> #include <boost/fusion/container/deque/detail/at_impl.hpp>
@ -36,8 +35,10 @@
#include <boost/fusion/container/deque/detail/end_impl.hpp> #include <boost/fusion/container/deque/detail/end_impl.hpp>
#include <boost/fusion/container/deque/detail/is_sequence_impl.hpp> #include <boost/fusion/container/deque/detail/is_sequence_impl.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/mpl/int.hpp> #include <boost/mpl/int.hpp>
#include <boost/mpl/and.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_convertible.hpp>
@ -48,6 +49,22 @@ namespace boost { namespace fusion
template <typename ...Elements> template <typename ...Elements>
struct deque : detail::nil_keyed_element struct deque : detail::nil_keyed_element
{ {
typedef deque_tag fusion_tag;
typedef bidirectional_traversal_tag category;
typedef mpl::int_<0> size;
typedef mpl::int_<0> next_up;
typedef mpl::int_<0> next_down;
typedef mpl::false_ is_view;
template <typename Sequence>
deque(Sequence const&,
typename enable_if<
mpl::and_<
traits::is_sequence<Sequence>
, result_of::empty<Sequence>>>::type* /*dummy*/ = 0)
{}
deque() {}
}; };
template <typename Head, typename ...Tail> template <typename Head, typename ...Tail>
@ -60,7 +77,7 @@ namespace boost { namespace fusion
typedef typename detail::deque_keyed_values<Head, Tail...>::type base; typedef typename detail::deque_keyed_values<Head, Tail...>::type base;
typedef mpl::int_<(sizeof ...(Tail) + 1)> size; typedef mpl::int_<(sizeof ...(Tail) + 1)> size;
typedef mpl::int_<size::value> next_up; typedef mpl::int_<size::value> next_up;
typedef mpl::int_<mpl::int_<((size::value == 0) ? 0 : -1)>::type::value> next_down; typedef mpl::int_<((size::value == 0) ? 0 : -1)> next_down;
typedef mpl::false_ is_view; typedef mpl::false_ is_view;
deque() deque()

View File

@ -16,10 +16,10 @@
#if (defined(BOOST_NO_DECLTYPE) \ #if (defined(BOOST_NO_DECLTYPE) \
|| defined(BOOST_NO_VARIADIC_TEMPLATES) \ || defined(BOOST_NO_VARIADIC_TEMPLATES) \
|| defined(BOOST_NO_RVALUE_REFERENCES)) || defined(BOOST_NO_RVALUE_REFERENCES))
# include <boost/fusion/container/deque/detail/cpp03_deque_fwd.hpp> # include <boost/fusion/container/deque/detail/pp_deque_fwd.hpp>
#else #else
# if !defined(BOOST_FUSION_HAS_CPP11_DEQUE) # if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
# define BOOST_FUSION_HAS_CPP11_DEQUE # define BOOST_FUSION_HAS_VARIADIC_DEQUE
# endif # endif
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -9,7 +9,7 @@
#if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212) #if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212)
#define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212 #define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE) #if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
#error "C++03 only! This file should not have been included" #error "C++03 only! This file should not have been included"
#endif #endif

View File

@ -8,7 +8,7 @@
#if !defined(BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139) #if !defined(BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139)
#define BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139 #define BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE) #if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
#error "C++03 only! This file should not have been included" #error "C++03 only! This file should not have been included"
#endif #endif

View File

@ -9,7 +9,7 @@
#if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211) #if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211)
#define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211 #define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE) #if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
#error "C++03 only! This file should not have been included" #error "C++03 only! This file should not have been included"
#endif #endif

View File

@ -5,17 +5,17 @@
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#if !defined(BOOST_CPP03_FUSION_DEQUE_26112006_1649) #if !defined(BOOST_PP_FUSION_DEQUE_26112006_1649)
#define BOOST_CPP03_FUSION_DEQUE_26112006_1649 #define BOOST_PP_FUSION_DEQUE_26112006_1649
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE) #if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
#error "C++03 only! This file should not have been included" #error "C++03 only! This file should not have been included"
#endif #endif
#include <boost/fusion/container/deque/limits.hpp> #include <boost/fusion/container/deque/limits.hpp>
#include <boost/fusion/container/deque/front_extended_deque.hpp> #include <boost/fusion/container/deque/front_extended_deque.hpp>
#include <boost/fusion/container/deque/back_extended_deque.hpp> #include <boost/fusion/container/deque/back_extended_deque.hpp>
#include <boost/fusion/container/deque/detail/cpp03_deque_keyed_values.hpp> #include <boost/fusion/container/deque/detail/pp_deque_keyed_values.hpp>
#include <boost/fusion/container/deque/detail/deque_initial_size.hpp> #include <boost/fusion/container/deque/detail/deque_initial_size.hpp>
#include <boost/fusion/support/sequence_base.hpp> #include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/container/deque/detail/keyed_element.hpp> #include <boost/fusion/container/deque/detail/keyed_element.hpp>

View File

@ -5,10 +5,10 @@
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#if !defined(FUSION_CPP03_DEQUE_FORWARD_02092007_0749) #if !defined(FUSION_PP_DEQUE_FORWARD_02092007_0749)
#define FUSION_CPP03_DEQUE_FORWARD_02092007_0749 #define FUSION_PP_DEQUE_FORWARD_02092007_0749
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE) #if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
#error "C++03 only! This file should not have been included" #error "C++03 only! This file should not have been included"
#endif #endif

View File

@ -8,7 +8,7 @@
#if !defined(BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330) #if !defined(BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330)
#define BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330 #define BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE) #if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
#error "C++03 only! This file should not have been included" #error "C++03 only! This file should not have been included"
#endif #endif

View File

@ -8,7 +8,7 @@
#if !defined(BOOST_FUSION_DEQUE_LIMITS_26112006_1737) #if !defined(BOOST_FUSION_DEQUE_LIMITS_26112006_1737)
#define BOOST_FUSION_DEQUE_LIMITS_26112006_1737 #define BOOST_FUSION_DEQUE_LIMITS_26112006_1737
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE) #if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
#error "C++03 only! This file should not have been included" #error "C++03 only! This file should not have been included"
#endif #endif