[SVN r77811]
This commit is contained in:
Joel de Guzman
2012-04-07 10:57:10 +00:00
parent 2936fd30fb
commit ec99f829f3
16 changed files with 83 additions and 45 deletions

View File

@ -21,7 +21,9 @@ namespace boost { namespace fusion
template <typename Sequence> template <typename Sequence>
struct as_deque struct as_deque
{ {
typedef typename detail::as_deque<result_of::size<Sequence>::value> gen; typedef typename
detail::as_deque<result_of::size<Sequence>::value>
gen;
typedef typename gen:: typedef typename gen::
template apply<typename result_of::begin<Sequence>::type>::type template apply<typename result_of::begin<Sequence>::type>::type
type; type;

View File

@ -8,6 +8,10 @@
#if !defined(BOOST_CPP03_FUSION_DEQUE_26112006_1649) #if !defined(BOOST_CPP03_FUSION_DEQUE_26112006_1649)
#define 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/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>

View File

@ -8,6 +8,10 @@
#if !defined(FUSION_CPP03_DEQUE_FORWARD_02092007_0749) #if !defined(FUSION_CPP03_DEQUE_FORWARD_02092007_0749)
#define 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/fusion/container/deque/limits.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp> #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>

View File

@ -15,6 +15,9 @@
|| defined(BOOST_NO_RVALUE_REFERENCES)) || defined(BOOST_NO_RVALUE_REFERENCES))
# include <boost/fusion/container/deque/cpp03_deque.hpp> # include <boost/fusion/container/deque/cpp03_deque.hpp>
#else #else
# if !defined(BOOST_FUSION_HAS_CPP11_DEQUE)
# define BOOST_FUSION_HAS_CPP11_DEQUE
# endif
# include <boost/fusion/container/deque/cpp11_deque.hpp> # include <boost/fusion/container/deque/cpp11_deque.hpp>
#endif #endif

View File

@ -15,6 +15,9 @@
|| defined(BOOST_NO_RVALUE_REFERENCES)) || defined(BOOST_NO_RVALUE_REFERENCES))
# include <boost/fusion/container/deque/cpp03_deque_fwd.hpp> # include <boost/fusion/container/deque/cpp03_deque_fwd.hpp>
#else #else
# if !defined(BOOST_FUSION_HAS_CPP11_DEQUE)
# define BOOST_FUSION_HAS_CPP11_DEQUE
# endif
# include <boost/fusion/container/deque/cpp11_deque_fwd.hpp> # include <boost/fusion/container/deque/cpp11_deque_fwd.hpp>
#endif #endif

View File

@ -19,8 +19,8 @@
#include <boost/type_traits/add_const.hpp> #include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp> #include <boost/type_traits/add_reference.hpp>
namespace boost { namespace fusion { namespace boost { namespace fusion
{
struct deque_tag; struct deque_tag;
namespace extension namespace extension
@ -44,11 +44,14 @@ namespace boost { namespace fusion {
detail::keyed_element_value_at<Sequence, adjusted_index>::type detail::keyed_element_value_at<Sequence, adjusted_index>::type
element_type; element_type;
typedef typename add_reference< typedef typename
typename mpl::eval_if< add_reference<
is_const<Sequence>, typename mpl::eval_if<
add_const<element_type>, is_const<Sequence>,
mpl::identity<element_type> >::type>::type type; add_const<element_type>,
mpl::identity<element_type> >::type
>::type
type;
static type call(Sequence& seq) static type call(Sequence& seq)
{ {

View File

@ -13,8 +13,8 @@
#include <boost/mpl/equal_to.hpp> #include <boost/mpl/equal_to.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
namespace boost { namespace fusion { namespace boost { namespace fusion
{
struct deque_tag; struct deque_tag;
namespace extension namespace extension

View File

@ -28,7 +28,7 @@ namespace boost { namespace fusion
template <typename Sequence> template <typename Sequence>
struct apply 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:: typedef typename gen::
template apply<typename result_of::begin<Sequence>::type>::type template apply<typename result_of::begin<Sequence>::type>::type
type; type;

View File

@ -2,13 +2,17 @@
Copyright (c) 2005-2012 Joel de Guzman Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden 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) 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_PP_IS_ITERATING)
#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)
#error "C++03 only! This file should not have been included"
#endif
#include <boost/preprocessor/iterate.hpp> #include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp> #include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp> #include <boost/preprocessor/repetition/enum_binary_params.hpp>

View File

@ -8,6 +8,10 @@
#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)
#error "C++03 only! This file should not have been included"
#endif
#include <boost/preprocessor/repetition/enum_params.hpp> #include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/mpl/find.hpp> #include <boost/mpl/find.hpp>
#include <boost/mpl/begin.hpp> #include <boost/mpl/begin.hpp>

View File

@ -8,6 +8,10 @@
#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)
#error "C++03 only! This file should not have been included"
#endif
#include <boost/fusion/container/deque/limits.hpp> #include <boost/fusion/container/deque/limits.hpp>
#include <boost/fusion/container/deque/detail/keyed_element.hpp> #include <boost/fusion/container/deque/detail/keyed_element.hpp>

View File

@ -9,6 +9,10 @@
#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)
#error "C++03 only! This file should not have been included"
#endif
#include <boost/preprocessor/iterate.hpp> #include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp> #include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp> #include <boost/preprocessor/repetition/enum_binary_params.hpp>

View File

@ -2,7 +2,7 @@
Copyright (c) 2005-2012 Joel de Guzman Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden 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) 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) #if !defined(BOOST_FUSION_DEQUE_END_IMPL_09122006_2034)
@ -13,27 +13,29 @@
#include <boost/mpl/equal_to.hpp> #include <boost/mpl/equal_to.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
namespace boost { namespace fusion { namespace boost { namespace fusion
{
struct deque_tag; struct deque_tag;
namespace extension namespace extension
{ {
template<typename T> template<typename T>
struct end_impl; struct end_impl;
template<> template<>
struct end_impl<deque_tag> struct end_impl<deque_tag>
{ {
template<typename Sequence> template<typename Sequence>
struct apply struct apply
{ {
typedef typename mpl::if_< typedef typename
mpl::equal_to<typename Sequence::next_down, typename Sequence::next_up>, mpl::if_c<
deque_iterator<Sequence, 0>, (Sequence::next_down::value == Sequence::next_up::value)
deque_iterator< , deque_iterator<Sequence, 0>
Sequence, Sequence::next_up::value> >::type type; , deque_iterator<Sequence, Sequence::next_up::value>
>::type
type;
static type call(Sequence& seq) static type call(Sequence& seq)
{ {
return type(seq); return type(seq);

View File

@ -1,7 +1,7 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2010 Christopher Schmidt 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) 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; struct deque_tag;
namespace extension namespace extension
{ {
template<typename T> template<typename T>
struct is_sequence_impl; struct is_sequence_impl;
template<> template<>
struct is_sequence_impl<deque_tag> struct is_sequence_impl<deque_tag>
{ {
template<typename Sequence> template<typename Sequence>
struct apply struct apply : mpl::true_ {};
: mpl::true_
{};
}; };
} }
}} }}

View File

@ -14,12 +14,13 @@
#include <boost/fusion/iterator/deref.hpp> #include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp> #include <boost/fusion/iterator/next.hpp>
namespace boost { namespace fusion { namespace boost { namespace fusion
{
struct fusion_sequence_tag; struct fusion_sequence_tag;
}}
namespace detail { namespace boost { namespace fusion { namespace detail
{
struct nil_keyed_element struct nil_keyed_element
{ {
typedef fusion_sequence_tag tag; typedef fusion_sequence_tag tag;
@ -33,15 +34,18 @@ namespace detail {
} }
}; };
template<typename Key, typename Value, typename Rest> template <typename Key, typename Value, typename Rest>
struct keyed_element struct keyed_element : Rest
: Rest
{ {
typedef Rest base; typedef Rest base;
typedef fusion_sequence_tag tag; typedef fusion_sequence_tag tag;
typedef typename
add_reference<typename add_const<Value>::type>::type
const_value_type;
typedef typename add_reference<Value>::type value_type;
using Rest::get; using Rest::get;
template<typename It> template <typename It>
static keyed_element static keyed_element
from_iterator(It const& it) from_iterator(It const& it)
{ {
@ -51,7 +55,7 @@ namespace detail {
template <typename U, typename Rst> template <typename U, typename Rst>
keyed_element(keyed_element<Key, U, Rst> const& rhs) 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 Rest const get_base() const
@ -59,17 +63,17 @@ namespace detail {
return *this; return *this;
} }
typename add_reference<typename add_const<Value>::type>::type get(Key) const const_value_type get(Key) const
{ {
return value_; return value_;
} }
typename add_reference<Value>::type get(Key) value_type get(Key)
{ {
return value_; return value_;
} }
keyed_element(typename add_reference<typename add_const<Value>::type>::type value, Rest const& rest) keyed_element(const_value_type value, Rest const& rest)
: Rest(rest), value_(value) : Rest(rest), value_(value)
{} {}
@ -97,7 +101,7 @@ namespace detail {
template<typename Elem, typename Key> template<typename Elem, typename Key>
struct keyed_element_value_at 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> template<typename Key, typename Value, typename Rest>
@ -105,7 +109,6 @@ namespace detail {
{ {
typedef Value type; typedef Value type;
}; };
}}} }}}
#endif #endif

View File

@ -13,8 +13,8 @@
#include <boost/mpl/equal_to.hpp> #include <boost/mpl/equal_to.hpp>
#include <boost/mpl/assert.hpp> #include <boost/mpl/assert.hpp>
namespace boost { namespace fusion { namespace boost { namespace fusion
{
struct deque_tag; struct deque_tag;
namespace extension namespace extension