summaryrefslogtreecommitdiff
path: root/boost/fusion/container/deque/detail
diff options
context:
space:
mode:
Diffstat (limited to 'boost/fusion/container/deque/detail')
-rw-r--r--boost/fusion/container/deque/detail/as_deque.hpp2
-rw-r--r--boost/fusion/container/deque/detail/at_impl.hpp36
-rw-r--r--boost/fusion/container/deque/detail/begin_impl.hpp26
-rw-r--r--boost/fusion/container/deque/detail/convert_impl.hpp4
-rw-r--r--boost/fusion/container/deque/detail/cpp03_deque.hpp125
-rw-r--r--boost/fusion/container/deque/detail/cpp03_deque_fwd.hpp54
-rw-r--r--boost/fusion/container/deque/detail/cpp03_deque_keyed_values.hpp (renamed from boost/fusion/container/deque/detail/deque_keyed_values.hpp)6
-rw-r--r--boost/fusion/container/deque/detail/cpp11_deque_keyed_values.hpp56
-rw-r--r--boost/fusion/container/deque/detail/deque_forward_ctor.hpp8
-rw-r--r--boost/fusion/container/deque/detail/deque_initial_size.hpp6
-rw-r--r--boost/fusion/container/deque/detail/deque_keyed_values_call.hpp6
-rw-r--r--boost/fusion/container/deque/detail/end_impl.hpp26
-rw-r--r--boost/fusion/container/deque/detail/is_sequence_impl.hpp10
-rw-r--r--boost/fusion/container/deque/detail/keyed_element.hpp39
-rw-r--r--boost/fusion/container/deque/detail/value_at_impl.hpp22
15 files changed, 342 insertions, 84 deletions
diff --git a/boost/fusion/container/deque/detail/as_deque.hpp b/boost/fusion/container/deque/detail/as_deque.hpp
index bc9ae8461f..906f4fb657 100644
--- a/boost/fusion/container/deque/detail/as_deque.hpp
+++ b/boost/fusion/container/deque/detail/as_deque.hpp
@@ -1,5 +1,5 @@
/*=============================================================================
- Copyright (c) 2005-2011 Joel de Guzman
+ Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
diff --git a/boost/fusion/container/deque/detail/at_impl.hpp b/boost/fusion/container/deque/detail/at_impl.hpp
index dc09d31b7c..0684dcf19e 100644
--- a/boost/fusion/container/deque/detail/at_impl.hpp
+++ b/boost/fusion/container/deque/detail/at_impl.hpp
@@ -1,8 +1,8 @@
/*=============================================================================
- Copyright (c) 2005-2011 Joel de Guzman
+ Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
- 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)
==============================================================================*/
#if !defined(BOOST_FUSION_DEQUE_AT_IMPL_09122006_2017)
@@ -19,15 +19,15 @@
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
-namespace boost { namespace fusion {
-
+namespace boost { namespace fusion
+{
struct deque_tag;
- namespace extension
+ namespace extension
{
template<typename T>
struct at_impl;
-
+
template<>
struct at_impl<deque_tag>
{
@@ -37,15 +37,21 @@ namespace boost { namespace fusion {
typedef typename Sequence::next_up next_up;
typedef typename Sequence::next_down next_down;
BOOST_MPL_ASSERT_RELATION(next_down::value, !=, next_up::value);
-
- typedef mpl::plus<next_down, mpl::int_<1> > offset;
- typedef mpl::int_<mpl::plus<N, offset>::value> adjusted_index;
- typedef typename detail::keyed_element_value_at<Sequence, adjusted_index>::type element_type;
- typedef typename add_reference<
- typename mpl::eval_if<
- is_const<Sequence>,
- add_const<element_type>,
- mpl::identity<element_type> >::type>::type type;
+
+ static int const offset = next_down::value + 1;
+ typedef mpl::int_<(N::value + offset)> adjusted_index;
+ typedef typename
+ detail::keyed_element_value_at<Sequence, adjusted_index>::type
+ element_type;
+
+ typedef typename
+ add_reference<
+ typename mpl::eval_if<
+ is_const<Sequence>,
+ add_const<element_type>,
+ mpl::identity<element_type> >::type
+ >::type
+ type;
static type call(Sequence& seq)
{
diff --git a/boost/fusion/container/deque/detail/begin_impl.hpp b/boost/fusion/container/deque/detail/begin_impl.hpp
index 8c02b9ac8f..1447868a33 100644
--- a/boost/fusion/container/deque/detail/begin_impl.hpp
+++ b/boost/fusion/container/deque/detail/begin_impl.hpp
@@ -1,8 +1,8 @@
/*=============================================================================
- Copyright (c) 2005-2011 Joel de Guzman
+ Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
- 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)
==============================================================================*/
#if !defined(BOOST_FUSION_DEQUE_BEGIN_IMPL_09122006_2034)
@@ -13,27 +13,29 @@
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/if.hpp>
-namespace boost { namespace fusion {
-
+namespace boost { namespace fusion
+{
struct deque_tag;
- namespace extension
+ namespace extension
{
template<typename T>
struct begin_impl;
-
+
template<>
struct begin_impl<deque_tag>
{
template<typename Sequence>
struct apply
{
- typedef typename mpl::if_<
- mpl::equal_to<typename Sequence::next_down, typename Sequence::next_up>,
- deque_iterator<Sequence, 0>,
- deque_iterator<
- Sequence, mpl::plus<typename Sequence::next_down, mpl::int_<1> >::value> >::type type;
-
+ typedef typename
+ mpl::if_c<
+ (Sequence::next_down::value == Sequence::next_up::value)
+ , deque_iterator<Sequence, 0>
+ , deque_iterator<Sequence, (Sequence::next_down::value + 1)>
+ >::type
+ type;
+
static type call(Sequence& seq)
{
return type(seq);
diff --git a/boost/fusion/container/deque/detail/convert_impl.hpp b/boost/fusion/container/deque/detail/convert_impl.hpp
index 9693d95d12..1401ef1ac8 100644
--- a/boost/fusion/container/deque/detail/convert_impl.hpp
+++ b/boost/fusion/container/deque/detail/convert_impl.hpp
@@ -1,5 +1,5 @@
/*=============================================================================
- Copyright (c) 2005-2011 Joel de Guzman
+ Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -28,7 +28,7 @@ namespace boost { namespace fusion
template <typename Sequence>
struct apply
{
- typedef typename detail::as_deque<result_of::size<Sequence>::value> gen;
+ typedef detail::as_deque<result_of::size<Sequence>::value> gen;
typedef typename gen::
template apply<typename result_of::begin<Sequence>::type>::type
type;
diff --git a/boost/fusion/container/deque/detail/cpp03_deque.hpp b/boost/fusion/container/deque/detail/cpp03_deque.hpp
new file mode 100644
index 0000000000..5804d89006
--- /dev/null
+++ b/boost/fusion/container/deque/detail/cpp03_deque.hpp
@@ -0,0 +1,125 @@
+/*=============================================================================
+ Copyright (c) 2005-2012 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_CPP03_FUSION_DEQUE_26112006_1649)
+#define BOOST_CPP03_FUSION_DEQUE_26112006_1649
+
+#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
+#include <boost/fusion/container/deque/limits.hpp>
+#include <boost/fusion/container/deque/front_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/deque_initial_size.hpp>
+#include <boost/fusion/support/sequence_base.hpp>
+#include <boost/fusion/container/deque/detail/keyed_element.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/is_convertible.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/at_impl.hpp>
+#include <boost/fusion/container/deque/detail/begin_impl.hpp>
+#include <boost/fusion/container/deque/detail/end_impl.hpp>
+#include <boost/fusion/container/deque/detail/is_sequence_impl.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/mpl/bool.hpp>
+
+#include <boost/fusion/support/sequence_base.hpp>
+#include <boost/fusion/support/void.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
+#include <boost/fusion/container/deque/detail/preprocessed/deque.hpp>
+#else
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/deque" FUSION_MAX_DEQUE_SIZE_STR ".hpp")
+#endif
+
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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)
+
+ This is an auto-generated file. Do not edit!
+==============================================================================*/
+
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(preserve: 1)
+#endif
+
+namespace boost { namespace fusion {
+
+ struct deque_tag;
+
+ template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename T)>
+ struct deque
+ :
+ detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type,
+ sequence_base<deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)> >
+ {
+ typedef deque_tag fusion_tag;
+ typedef bidirectional_traversal_tag category;
+ typedef typename detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type base;
+ typedef typename detail::deque_initial_size<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type size;
+ typedef mpl::int_<size::value> next_up;
+ typedef mpl::int_<
+ mpl::if_<mpl::equal_to<size, mpl::int_<0> >, mpl::int_<0>, mpl::int_<-1> >::type::value> next_down;
+ typedef mpl::false_ is_view;
+
+#include <boost/fusion/container/deque/detail/deque_forward_ctor.hpp>
+
+ deque()
+ {}
+
+ explicit deque(typename add_reference<typename add_const<T0>::type>::type t0)
+ : base(t0, detail::nil_keyed_element())
+ {}
+
+ template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
+ deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)> const& seq)
+ : base(seq)
+ {}
+
+ template<typename Sequence>
+ deque(Sequence const& seq, typename disable_if<is_convertible<Sequence, T0> >::type* /*dummy*/ = 0)
+ : base(base::from_iterator(fusion::begin(seq)))
+ {}
+
+ template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
+ deque&
+ operator=(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)> const& rhs)
+ {
+ base::operator=(rhs);
+ return *this;
+ }
+
+ template <typename T>
+ deque&
+ operator=(T const& rhs)
+ {
+ base::operator=(rhs);
+ return *this;
+ }
+
+ };
+}}
+
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(output: null)
+#endif
+
+#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
+
+#endif
diff --git a/boost/fusion/container/deque/detail/cpp03_deque_fwd.hpp b/boost/fusion/container/deque/detail/cpp03_deque_fwd.hpp
new file mode 100644
index 0000000000..3a74447b17
--- /dev/null
+++ b/boost/fusion/container/deque/detail/cpp03_deque_fwd.hpp
@@ -0,0 +1,54 @@
+/*=============================================================================
+ Copyright (c) 2005-2012 Joel de Guzman
+ Copyright (c) 2005-2007 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(FUSION_CPP03_DEQUE_FORWARD_02092007_0749)
+#define FUSION_CPP03_DEQUE_FORWARD_02092007_0749
+
+#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
+#include <boost/fusion/container/deque/limits.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+
+#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
+#include <boost/fusion/container/deque/detail/preprocessed/deque_fwd.hpp>
+#else
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/deque" FUSION_MAX_DEQUE_SIZE_STR "_fwd.hpp")
+#endif
+
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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)
+
+ This is an auto-generated file. Do not edit!
+==============================================================================*/
+
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(preserve: 1)
+#endif
+
+namespace boost { namespace fusion
+{
+ struct void_;
+
+ template<
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ FUSION_MAX_DEQUE_SIZE, typename T, void_)>
+ struct deque;
+}}
+
+#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
+#pragma wave option(output: null)
+#endif
+
+#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
+
+#endif
diff --git a/boost/fusion/container/deque/detail/deque_keyed_values.hpp b/boost/fusion/container/deque/detail/cpp03_deque_keyed_values.hpp
index 898bc46b92..2fee47009b 100644
--- a/boost/fusion/container/deque/detail/deque_keyed_values.hpp
+++ b/boost/fusion/container/deque/detail/cpp03_deque_keyed_values.hpp
@@ -1,5 +1,5 @@
/*=============================================================================
- Copyright (c) 2005-2011 Joel de Guzman
+ Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,6 +8,10 @@
#if !defined(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)
+#error "C++03 only! This file should not have been included"
+#endif
+
#include <boost/fusion/container/deque/limits.hpp>
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
diff --git a/boost/fusion/container/deque/detail/cpp11_deque_keyed_values.hpp b/boost/fusion/container/deque/detail/cpp11_deque_keyed_values.hpp
new file mode 100644
index 0000000000..43ed5360a2
--- /dev/null
+++ b/boost/fusion/container/deque/detail/cpp11_deque_keyed_values.hpp
@@ -0,0 +1,56 @@
+/*=============================================================================
+ Copyright (c) 2005-2012 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_DEQUE_DETAIL_CPP11_DEQUE_KEYED_VALUES_07042012_1901)
+#define BOOST_FUSION_DEQUE_DETAIL_CPP11_DEQUE_KEYED_VALUES_07042012_1901
+
+#include <boost/fusion/container/deque/detail/keyed_element.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/mpl/int.hpp>
+
+namespace boost { namespace fusion { namespace detail
+{
+ template<typename Key, typename Value, typename Rest>
+ struct keyed_element;
+
+ template <typename N, typename ...Elements>
+ struct deque_keyed_values_impl;
+
+ template <typename N, typename Head, typename ...Tail>
+ struct deque_keyed_values_impl<N, Head, Tail...>
+ {
+ typedef mpl::int_<(N::value + 1)> next_index;
+ typedef typename deque_keyed_values_impl<next_index, Tail...>::type tail;
+ typedef keyed_element<N, Head, tail> type;
+
+ static type call(
+ typename detail::call_param<Head>::type head
+ , typename detail::call_param<Tail>::type... tail)
+ {
+ return type(
+ head
+ , deque_keyed_values_impl<next_index, Tail...>::call(tail...)
+ );
+ }
+ };
+
+ struct nil_keyed_element;
+
+ template <typename N>
+ struct deque_keyed_values_impl<N>
+ {
+ typedef nil_keyed_element type;
+ static type call() { return type(); }
+ };
+
+ template <typename ...Elements>
+ struct deque_keyed_values
+ : deque_keyed_values_impl<mpl::int_<0>, Elements...> {};
+}}}
+
+#endif
diff --git a/boost/fusion/container/deque/detail/deque_forward_ctor.hpp b/boost/fusion/container/deque/detail/deque_forward_ctor.hpp
index 38d5e6430c..b76916ebd8 100644
--- a/boost/fusion/container/deque/detail/deque_forward_ctor.hpp
+++ b/boost/fusion/container/deque/detail/deque_forward_ctor.hpp
@@ -1,14 +1,18 @@
/*=============================================================================
- Copyright (c) 2005-2011 Joel de Guzman
+ Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
- 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)
==============================================================================*/
#if !defined(BOOST_PP_IS_ITERATING)
#if !defined(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)
+#error "C++03 only! This file should not have been included"
+#endif
+
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
diff --git a/boost/fusion/container/deque/detail/deque_initial_size.hpp b/boost/fusion/container/deque/detail/deque_initial_size.hpp
index 738221ce26..edb3c176cc 100644
--- a/boost/fusion/container/deque/detail/deque_initial_size.hpp
+++ b/boost/fusion/container/deque/detail/deque_initial_size.hpp
@@ -1,5 +1,5 @@
/*=============================================================================
- Copyright (c) 2005-2011 Joel de Guzman
+ Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,6 +8,10 @@
#if !defined(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)
+#error "C++03 only! This file should not have been included"
+#endif
+
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/mpl/find.hpp>
#include <boost/mpl/begin.hpp>
diff --git a/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp b/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp
index d96f16a0cf..f95960bcfc 100644
--- a/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp
+++ b/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp
@@ -1,5 +1,5 @@
/*=============================================================================
- Copyright (c) 2005-2011 Joel de Guzman
+ Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -9,6 +9,10 @@
#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
+#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
+#error "C++03 only! This file should not have been included"
+#endif
+
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
diff --git a/boost/fusion/container/deque/detail/end_impl.hpp b/boost/fusion/container/deque/detail/end_impl.hpp
index 0727e00f54..8037689abf 100644
--- a/boost/fusion/container/deque/detail/end_impl.hpp
+++ b/boost/fusion/container/deque/detail/end_impl.hpp
@@ -1,8 +1,8 @@
/*=============================================================================
- Copyright (c) 2005-2011 Joel de Guzman
+ Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
- 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)
==============================================================================*/
#if !defined(BOOST_FUSION_DEQUE_END_IMPL_09122006_2034)
@@ -13,27 +13,29 @@
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/if.hpp>
-namespace boost { namespace fusion {
-
+namespace boost { namespace fusion
+{
struct deque_tag;
- namespace extension
+ namespace extension
{
template<typename T>
struct end_impl;
-
+
template<>
struct end_impl<deque_tag>
{
template<typename Sequence>
struct apply
{
- typedef typename mpl::if_<
- mpl::equal_to<typename Sequence::next_down, typename Sequence::next_up>,
- deque_iterator<Sequence, 0>,
- deque_iterator<
- Sequence, Sequence::next_up::value> >::type type;
-
+ typedef typename
+ mpl::if_c<
+ (Sequence::next_down::value == Sequence::next_up::value)
+ , deque_iterator<Sequence, 0>
+ , deque_iterator<Sequence, Sequence::next_up::value>
+ >::type
+ type;
+
static type call(Sequence& seq)
{
return type(seq);
diff --git a/boost/fusion/container/deque/detail/is_sequence_impl.hpp b/boost/fusion/container/deque/detail/is_sequence_impl.hpp
index ff88ed6f2c..b4718be41a 100644
--- a/boost/fusion/container/deque/detail/is_sequence_impl.hpp
+++ b/boost/fusion/container/deque/detail/is_sequence_impl.hpp
@@ -1,7 +1,7 @@
/*=============================================================================
Copyright (c) 2010 Christopher Schmidt
- 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)
==============================================================================*/
@@ -14,18 +14,16 @@ namespace boost { namespace fusion
{
struct deque_tag;
- namespace extension
+ namespace extension
{
template<typename T>
struct is_sequence_impl;
-
+
template<>
struct is_sequence_impl<deque_tag>
{
template<typename Sequence>
- struct apply
- : mpl::true_
- {};
+ struct apply : mpl::true_ {};
};
}
}}
diff --git a/boost/fusion/container/deque/detail/keyed_element.hpp b/boost/fusion/container/deque/detail/keyed_element.hpp
index 1b5e346879..d1b219dee7 100644
--- a/boost/fusion/container/deque/detail/keyed_element.hpp
+++ b/boost/fusion/container/deque/detail/keyed_element.hpp
@@ -1,47 +1,45 @@
/*=============================================================================
- Copyright (c) 2005-2011 Joel de Guzman
+ Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
- 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)
==============================================================================*/
#if !defined(BOOST_FUSION_DEQUE_DETAIL_KEYED_ELEMENT_26112006_1330)
#define BOOST_FUSION_DEQUE_DETAIL_KEYED_ELEMENT_26112006_1330
-#include <boost/type_traits/add_reference.hpp>
-#include <boost/type_traits/add_const.hpp>
-
+#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp>
-namespace boost { namespace fusion {
-
+namespace boost { namespace fusion
+{
struct fusion_sequence_tag;
+}}
-namespace detail {
-
+namespace boost { namespace fusion { namespace detail
+{
struct nil_keyed_element
{
typedef fusion_sequence_tag tag;
void get();
template<typename It>
- static nil_keyed_element
+ static nil_keyed_element
from_iterator(It const&)
{
return nil_keyed_element();
}
};
- template<typename Key, typename Value, typename Rest>
- struct keyed_element
- : Rest
+ template <typename Key, typename Value, typename Rest>
+ struct keyed_element : Rest
{
typedef Rest base;
typedef fusion_sequence_tag tag;
using Rest::get;
- template<typename It>
+ template <typename It>
static keyed_element
from_iterator(It const& it)
{
@@ -49,9 +47,9 @@ namespace detail {
*it, base::from_iterator(fusion::next(it)));
}
- template<typename U, typename Rst>
+ template <typename U, typename Rst>
keyed_element(keyed_element<Key, U, Rst> const& rhs)
- : Rest(rhs.get_base()), value_(rhs.value_)
+ : Rest(rhs.get_base()), value_(rhs.value_)
{}
Rest const get_base() const
@@ -59,17 +57,17 @@ namespace detail {
return *this;
}
- typename add_reference<typename add_const<Value>::type>::type get(Key) const
+ typename cref_result<Value>::type get(Key) const
{
return value_;
}
- typename add_reference<Value>::type get(Key)
+ typename ref_result<Value>::type get(Key)
{
return value_;
}
- keyed_element(typename add_reference<typename add_const<Value>::type>::type value, Rest const& rest)
+ keyed_element(typename call_param<Value>::type value, Rest const& rest)
: Rest(rest), value_(value)
{}
@@ -97,7 +95,7 @@ namespace detail {
template<typename Elem, typename Key>
struct keyed_element_value_at
- : keyed_element_value_at<typename Elem::base, Key>
+ : keyed_element_value_at<typename Elem::base, Key>
{};
template<typename Key, typename Value, typename Rest>
@@ -105,7 +103,6 @@ namespace detail {
{
typedef Value type;
};
-
}}}
#endif
diff --git a/boost/fusion/container/deque/detail/value_at_impl.hpp b/boost/fusion/container/deque/detail/value_at_impl.hpp
index 64dbe5e16f..cba31a3e0a 100644
--- a/boost/fusion/container/deque/detail/value_at_impl.hpp
+++ b/boost/fusion/container/deque/detail/value_at_impl.hpp
@@ -1,8 +1,8 @@
/*=============================================================================
- Copyright (c) 2005-2011 Joel de Guzman
+ Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
- 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)
==============================================================================*/
#if !defined(BOOST_FUSION_DEQUE_VALUE_AT_IMPL_08122006_0756)
@@ -13,15 +13,15 @@
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/assert.hpp>
-namespace boost { namespace fusion {
-
+namespace boost { namespace fusion
+{
struct deque_tag;
- namespace extension
+ namespace extension
{
template<typename T>
struct value_at_impl;
-
+
template<>
struct value_at_impl<deque_tag>
{
@@ -31,10 +31,12 @@ namespace boost { namespace fusion {
typedef typename Sequence::next_up next_up;
typedef typename Sequence::next_down next_down;
BOOST_MPL_ASSERT_RELATION(next_down::value, !=, next_up::value);
-
- typedef mpl::plus<next_down, mpl::int_<1> > offset;
- typedef mpl::int_<mpl::plus<N, offset>::value> adjusted_index;
- typedef typename detail::keyed_element_value_at<Sequence, adjusted_index>::type type;
+
+ static int const offset = next_down::value + 1;
+ typedef mpl::int_<(N::value + offset)> adjusted_index;
+ typedef typename
+ detail::keyed_element_value_at<Sequence, adjusted_index>::type
+ type;
};
};
}