prelude to iterator_facade and sequence_facade

[SVN r35316]
This commit is contained in:
Joel de Guzman
2006-09-25 08:37:16 +00:00
parent a37b435ce6
commit 654fd0918e
33 changed files with 160 additions and 128 deletions

View File

@ -119,14 +119,14 @@
<span class="keyword">struct</span> <span class="identifier">single_pass_sequence_tag</span> <span class="keyword">struct</span> <span class="identifier">single_pass_sequence_tag</span>
<span class="special">:</span> <span class="identifier">incrementable_sequence_tag</span> <span class="special">{};</span> <span class="special">:</span> <span class="identifier">incrementable_sequence_tag</span> <span class="special">{};</span>
<span class="keyword">struct</span> <span class="identifier">forward_sequence_tag</span> <span class="keyword">struct</span> <span class="identifier">forward_traversal_tag</span>
<span class="special">:</span> <span class="identifier">single_pass_sequence_tag</span> <span class="special">{};</span> <span class="special">:</span> <span class="identifier">single_pass_sequence_tag</span> <span class="special">{};</span>
<span class="keyword">struct</span> <span class="identifier">bidirectional_sequence_tag</span> <span class="keyword">struct</span> <span class="identifier">bidirectional_traversal_tag</span>
<span class="special">:</span> <span class="identifier">forward_sequence_tag</span> <span class="special">{};</span> <span class="special">:</span> <span class="identifier">forward_traversal_tag</span> <span class="special">{};</span>
<span class="keyword">struct</span> <span class="identifier">random_access_sequence_tag</span> <span class="keyword">struct</span> <span class="identifier">random_access_traversal_tag</span>
<span class="special">:</span> <span class="identifier">bidirectional_sequence_tag</span> <span class="special">{};</span> <span class="special">:</span> <span class="identifier">bidirectional_traversal_tag</span> <span class="special">{};</span>
<span class="special">}}</span> <span class="special">}}</span>
</pre> </pre>
<p> <p>
@ -157,8 +157,8 @@
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_base_of</span><span class="special">;</span> <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_base_of</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">traits</span><span class="special">::</span><span class="identifier">category_of</span><span class="special">&lt;</span><a href="../sequences/containers/list.html" title="list"><tt class="computeroutput"><span class="identifier">list</span></tt></a><span class="special">&lt;&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">list_category</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">traits</span><span class="special">::</span><span class="identifier">category_of</span><span class="special">&lt;</span><a href="../sequences/containers/list.html" title="list"><tt class="computeroutput"><span class="identifier">list</span></tt></a><span class="special">&lt;&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">list_category</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">traits</span><span class="special">::</span><span class="identifier">category_of</span><span class="special">&lt;</span><a href="../sequences/containers/vector.html" title="vector"><tt class="computeroutput"><span class="identifier">vector</span></tt></a><span class="special">&lt;&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">vector_category</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">traits</span><span class="special">::</span><span class="identifier">category_of</span><span class="special">&lt;</span><a href="../sequences/containers/vector.html" title="vector"><tt class="computeroutput"><span class="identifier">vector</span></tt></a><span class="special">&lt;&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">vector_category</span><span class="special">;</span>
<span class="identifier">BOOST_MPL_ASSERT</span><span class="special">((</span> <span class="identifier">is_base_of</span><span class="special">&lt;</span><span class="identifier">forward_sequence_tag</span><span class="special">,</span> <span class="identifier">list_category</span><span class="special">&gt;</span> <span class="special">));</span> <span class="identifier">BOOST_MPL_ASSERT</span><span class="special">((</span> <span class="identifier">is_base_of</span><span class="special">&lt;</span><span class="identifier">forward_traversal_tag</span><span class="special">,</span> <span class="identifier">list_category</span><span class="special">&gt;</span> <span class="special">));</span>
<span class="identifier">BOOST_MPL_ASSERT</span><span class="special">((</span> <span class="identifier">is_base_of</span><span class="special">&lt;</span><span class="identifier">random_access_sequence_tag</span><span class="special">,</span> <span class="identifier">vector_category</span><span class="special">&gt;</span> <span class="special">));</span> <span class="identifier">BOOST_MPL_ASSERT</span><span class="special">((</span> <span class="identifier">is_base_of</span><span class="special">&lt;</span><span class="identifier">random_access_traversal_tag</span><span class="special">,</span> <span class="identifier">vector_category</span><span class="special">&gt;</span> <span class="special">));</span>
</pre> </pre>
</div> </div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>

View File

@ -219,14 +219,14 @@ For Sequences, the return type is derived from one of:
struct single_pass_sequence_tag struct single_pass_sequence_tag
: incrementable_sequence_tag {}; : incrementable_sequence_tag {};
struct forward_sequence_tag struct forward_traversal_tag
: single_pass_sequence_tag {}; : single_pass_sequence_tag {};
struct bidirectional_sequence_tag struct bidirectional_traversal_tag
: forward_sequence_tag {}; : forward_traversal_tag {};
struct random_access_sequence_tag struct random_access_traversal_tag
: bidirectional_sequence_tag {}; : bidirectional_traversal_tag {};
}} }}
And optionally from: And optionally from:
@ -248,8 +248,8 @@ __sequence__ or __iterator__.
using boost::is_base_of; using boost::is_base_of;
typedef traits::category_of<__list__<> >::type list_category; typedef traits::category_of<__list__<> >::type list_category;
typedef traits::category_of<__vector__<> >::type vector_category; typedef traits::category_of<__vector__<> >::type vector_category;
BOOST_MPL_ASSERT(( is_base_of<forward_sequence_tag, list_category> )); BOOST_MPL_ASSERT(( is_base_of<forward_traversal_tag, list_category> ));
BOOST_MPL_ASSERT(( is_base_of<random_access_sequence_tag, vector_category> )); BOOST_MPL_ASSERT(( is_base_of<random_access_traversal_tag, vector_category> ));
[endsect] [endsect]

View File

@ -28,7 +28,6 @@ namespace boost { namespace fusion
{ {
static typename mpl::minus< static typename mpl::minus<
typename Last::index, typename First::index>::type typename Last::index, typename First::index>::type
call(First const&, Last const&) call(First const&, Last const&)
{ {
typedef typename mpl::minus< typedef typename mpl::minus<

View File

@ -9,7 +9,6 @@
#if !defined(BOOST_FUSION_CATEGORY_OF_IMPL_20060217_2141) #if !defined(BOOST_FUSION_CATEGORY_OF_IMPL_20060217_2141)
#define BOOST_FUSION_CATEGORY_OF_IMPL_20060217_2141 #define BOOST_FUSION_CATEGORY_OF_IMPL_20060217_2141
#include <boost/fusion/support/detail/iterator_to_sequence_category.hpp>
#include <boost/fusion/support/detail/mpl_iterator_category.hpp> #include <boost/fusion/support/detail/mpl_iterator_category.hpp>
#include <boost/mpl/begin_end.hpp> #include <boost/mpl/begin_end.hpp>
#include <boost/mpl/is_sequence.hpp> #include <boost/mpl/is_sequence.hpp>
@ -28,11 +27,9 @@ namespace boost { namespace fusion {
BOOST_STATIC_ASSERT(mpl::is_sequence<T>::value); BOOST_STATIC_ASSERT(mpl::is_sequence<T>::value);
typedef typename typedef typename
iterator_to_sequence_category< mpl_iterator_category<
typename mpl_iterator_category<
typename mpl::begin<T>::type::category typename mpl::begin<T>::type::category
>::type >::type
>::type
type; type;
}; };
} }

View File

@ -30,7 +30,7 @@ namespace boost { namespace fusion
{ {
struct void_; struct void_;
struct cons_tag; struct cons_tag;
struct forward_sequence_tag; struct forward_traversal_tag;
struct fusion_sequence_tag; struct fusion_sequence_tag;
struct nil : sequence_base<nil> struct nil : sequence_base<nil>
@ -39,7 +39,7 @@ namespace boost { namespace fusion
typedef cons_tag fusion_tag; typedef cons_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view; typedef mpl::false_ is_view;
typedef forward_sequence_tag category; typedef forward_traversal_tag category;
typedef void_ car_type; typedef void_ car_type;
typedef void_ cdr_type; typedef void_ cdr_type;
@ -62,7 +62,7 @@ namespace boost { namespace fusion
typedef cons_tag fusion_tag; typedef cons_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view; typedef mpl::false_ is_view;
typedef forward_sequence_tag category; typedef forward_traversal_tag category;
typedef Car car_type; typedef Car car_type;
typedef Cdr cdr_type; typedef Cdr cdr_type;

View File

@ -1,33 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Use, modification and distribution is subject to 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_IS_ASSOCIATIVE_IMPL_20060304_2310)
#define BOOST_FUSION_IS_ASSOCIATIVE_IMPL_20060304_2310
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion {
struct map_tag;
namespace extension {
template<typename Tag>
struct is_associative_impl;
template<>
struct is_associative_impl<fusion::map_tag>
{
template<typename Seq>
struct apply
: mpl::true_
{};
};
}
}}
#endif

View File

@ -9,7 +9,7 @@
#define FUSION_MAP_07212005_1106 #define FUSION_MAP_07212005_1106
#include <boost/fusion/support/pair.hpp> #include <boost/fusion/support/pair.hpp>
#include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/sequence/container/map/map_fwd.hpp> #include <boost/fusion/sequence/container/map/map_fwd.hpp>
#include <boost/fusion/sequence/container/map/detail/lookup_key.hpp> #include <boost/fusion/sequence/container/map/detail/lookup_key.hpp>
@ -17,7 +17,6 @@
#include <boost/fusion/sequence/container/map/detail/end_impl.hpp> #include <boost/fusion/sequence/container/map/detail/end_impl.hpp>
#include <boost/fusion/sequence/container/map/detail/at_key_impl.hpp> #include <boost/fusion/sequence/container/map/detail/at_key_impl.hpp>
#include <boost/fusion/sequence/container/map/detail/value_at_key_impl.hpp> #include <boost/fusion/sequence/container/map/detail/value_at_key_impl.hpp>
#include <boost/fusion/sequence/container/map/detail/is_associative_impl.hpp>
#include <boost/fusion/sequence/container/vector/vector.hpp> #include <boost/fusion/sequence/container/vector/vector.hpp>
#include <boost/mpl/identity.hpp> #include <boost/mpl/identity.hpp>
#include <boost/mpl/bool.hpp> #include <boost/mpl/bool.hpp>
@ -26,15 +25,15 @@ namespace boost { namespace fusion
{ {
struct void_; struct void_;
struct map_tag; struct map_tag;
struct forward_sequence_tag;
struct fusion_sequence_tag; struct fusion_sequence_tag;
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, typename T)> template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, typename T)>
struct map : sequence_base<map<BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, T)> > struct map : sequence_base<map<BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, T)> >
{ {
struct category : forward_traversal_tag, associative_sequence_tag {};
typedef map_tag fusion_tag; typedef map_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef forward_sequence_tag category;
typedef mpl::false_ is_view; typedef mpl::false_ is_view;
typedef vector< typedef vector<

View File

@ -1,33 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
Use, modification and distribution is subject to 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_IS_ASSOCIATIVE_IMPL_20060304_2219)
#define BOOST_FUSION_IS_ASSOCIATIVE_IMPL_20060304_2219
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion {
struct set_tag;
namespace extension {
template<typename Tag>
struct is_associative_impl;
template<>
struct is_associative_impl<fusion::set_tag>
{
template<typename Seq>
struct apply
: mpl::true_
{};
};
}
}}
#endif

View File

@ -9,6 +9,7 @@
#define FUSION_SET_09162005_1104 #define FUSION_SET_09162005_1104
#include <boost/fusion/support/sequence_base.hpp> #include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/sequence/container/set/set_fwd.hpp> #include <boost/fusion/sequence/container/set/set_fwd.hpp>
#include <boost/fusion/sequence/container/set/detail/lookup_key.hpp> #include <boost/fusion/sequence/container/set/detail/lookup_key.hpp>
@ -16,7 +17,6 @@
#include <boost/fusion/sequence/container/set/detail/end_impl.hpp> #include <boost/fusion/sequence/container/set/detail/end_impl.hpp>
#include <boost/fusion/sequence/container/set/detail/at_key_impl.hpp> #include <boost/fusion/sequence/container/set/detail/at_key_impl.hpp>
#include <boost/fusion/sequence/container/set/detail/value_at_key_impl.hpp> #include <boost/fusion/sequence/container/set/detail/value_at_key_impl.hpp>
#include <boost/fusion/sequence/container/set/detail/is_associative_impl.hpp>
#include <boost/fusion/sequence/container/vector/vector.hpp> #include <boost/fusion/sequence/container/vector/vector.hpp>
#include <boost/mpl/identity.hpp> #include <boost/mpl/identity.hpp>
#include <boost/mpl/bool.hpp> #include <boost/mpl/bool.hpp>
@ -25,15 +25,15 @@ namespace boost { namespace fusion
{ {
struct void_; struct void_;
struct set_tag; struct set_tag;
struct forward_sequence_tag;
struct fusion_sequence_tag; struct fusion_sequence_tag;
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_SET_SIZE, typename T)> template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_SET_SIZE, typename T)>
struct set : sequence_base<set<BOOST_PP_ENUM_PARAMS(FUSION_MAX_SET_SIZE, T)> > struct set : sequence_base<set<BOOST_PP_ENUM_PARAMS(FUSION_MAX_SET_SIZE, T)> >
{ {
struct category : forward_traversal_tag, associative_sequence_tag {};
typedef set_tag fusion_tag; typedef set_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef forward_sequence_tag category;
typedef mpl::false_ is_view; typedef mpl::false_ is_view;
typedef vector< typedef vector<

View File

@ -84,7 +84,7 @@
typedef vector_tag fusion_tag; typedef vector_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view; typedef mpl::false_ is_view;
typedef random_access_sequence_tag category; typedef random_access_traversal_tag category;
typedef mpl::int_<N> size; typedef mpl::int_<N> size;
BOOST_PP_CAT(vector, N)() {} BOOST_PP_CAT(vector, N)() {}

View File

@ -38,7 +38,7 @@ namespace boost { namespace fusion
{ {
struct vector_tag; struct vector_tag;
struct fusion_sequence_tag; struct fusion_sequence_tag;
struct random_access_sequence_tag; struct random_access_traversal_tag;
struct vector0 : sequence_base<vector0> struct vector0 : sequence_base<vector0>
{ {
@ -46,7 +46,7 @@ namespace boost { namespace fusion
typedef vector_tag fusion_tag; typedef vector_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view; typedef mpl::false_ is_view;
typedef random_access_sequence_tag category; typedef random_access_traversal_tag category;
typedef mpl::int_<0> size; typedef mpl::int_<0> size;
}; };

View File

@ -38,7 +38,7 @@ namespace boost { namespace fusion
{ {
struct vector_tag; struct vector_tag;
struct fusion_sequence_tag; struct fusion_sequence_tag;
struct random_access_sequence_tag; struct random_access_traversal_tag;
// expand vector11 to vector20 // expand vector11 to vector20
#define BOOST_PP_FILENAME_1 <boost/fusion/sequence/container/vector/detail/vector_n.hpp> #define BOOST_PP_FILENAME_1 <boost/fusion/sequence/container/vector/detail/vector_n.hpp>

View File

@ -38,7 +38,7 @@ namespace boost { namespace fusion
{ {
struct vector_tag; struct vector_tag;
struct fusion_sequence_tag; struct fusion_sequence_tag;
struct random_access_sequence_tag; struct random_access_traversal_tag;
// expand vector21 to vector30 // expand vector21 to vector30
#define BOOST_PP_FILENAME_1 <boost/fusion/sequence/container/vector/detail/vector_n.hpp> #define BOOST_PP_FILENAME_1 <boost/fusion/sequence/container/vector/detail/vector_n.hpp>

View File

@ -38,7 +38,7 @@ namespace boost { namespace fusion
{ {
struct vector_tag; struct vector_tag;
struct fusion_sequence_tag; struct fusion_sequence_tag;
struct random_access_sequence_tag; struct random_access_traversal_tag;
// expand vector31 to vector40 // expand vector31 to vector40
#define BOOST_PP_FILENAME_1 <boost/fusion/sequence/container/vector/detail/vector_n.hpp> #define BOOST_PP_FILENAME_1 <boost/fusion/sequence/container/vector/detail/vector_n.hpp>

View File

@ -38,7 +38,7 @@ namespace boost { namespace fusion
{ {
struct vector_tag; struct vector_tag;
struct fusion_sequence_tag; struct fusion_sequence_tag;
struct random_access_sequence_tag; struct random_access_traversal_tag;
// expand vector41 to vector50 // expand vector41 to vector50
#define BOOST_PP_FILENAME_1 <boost/fusion/sequence/container/vector/detail/vector_n.hpp> #define BOOST_PP_FILENAME_1 <boost/fusion/sequence/container/vector/detail/vector_n.hpp>

View File

@ -15,6 +15,8 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
// Special tags:
struct sequence_facade_tag;
struct array_tag; // boost::array tag struct array_tag; // boost::array tag
struct mpl_sequence_tag; // mpl sequence tag struct mpl_sequence_tag; // mpl sequence tag
struct std_pair_tag; // std::pair tag struct std_pair_tag; // std::pair tag
@ -28,6 +30,13 @@ namespace boost { namespace fusion
struct apply; struct apply;
}; };
template <>
struct at_impl<sequence_facade_tag>
{
template <typename Sequence, typename N>
struct apply : Sequence::template at<Sequence, N> {};
};
template <> template <>
struct at_impl<array_tag>; struct at_impl<array_tag>;

View File

@ -15,6 +15,8 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
// Special tags:
struct sequence_facade_tag;
struct array_tag; // boost::array tag struct array_tag; // boost::array tag
struct mpl_sequence_tag; // mpl sequence tag struct mpl_sequence_tag; // mpl sequence tag
struct std_pair_tag; // std::pair tag struct std_pair_tag; // std::pair tag
@ -28,6 +30,13 @@ namespace boost { namespace fusion
struct apply; struct apply;
}; };
template <>
struct at_key_impl<sequence_facade_tag>
{
template <typename Sequence, typename Key>
struct apply : Sequence::template at_key<Sequence, Key> {};
};
template <> template <>
struct at_key_impl<array_tag>; struct at_key_impl<array_tag>;

View File

@ -12,7 +12,8 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
struct fusion_sequence_tag; // Special tags:
struct sequence_facade_tag; // iterator facade tag
struct array_tag; // boost::array tag struct array_tag; // boost::array tag
struct mpl_sequence_tag; // mpl sequence tag struct mpl_sequence_tag; // mpl sequence tag
struct std_pair_tag; // std::pair tag struct std_pair_tag; // std::pair tag
@ -26,6 +27,13 @@ namespace boost { namespace fusion
struct apply; struct apply;
}; };
template <>
struct begin_impl<sequence_facade_tag>
{
template <typename Sequence>
struct apply : Sequence::template begin<Sequence> {};
};
template <> template <>
struct begin_impl<array_tag>; struct begin_impl<array_tag>;

View File

@ -14,7 +14,8 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
struct fusion_sequence_tag; // Special tags:
struct sequence_facade_tag;
struct mpl_sequence_tag; // mpl sequence tag struct mpl_sequence_tag; // mpl sequence tag
namespace extension namespace extension
@ -28,6 +29,13 @@ namespace boost { namespace fusion
{}; {};
}; };
template <>
struct empty_impl<sequence_facade_tag>
{
template <typename Sequence>
struct apply : Sequence::template empty<Sequence> {};
};
template <> template <>
struct empty_impl<mpl_sequence_tag>; struct empty_impl<mpl_sequence_tag>;
} }

View File

@ -12,7 +12,8 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
struct fusion_sequence_tag; // Special tags:
struct sequence_facade_tag;
struct array_tag; // boost::array tag struct array_tag; // boost::array tag
struct mpl_sequence_tag; // mpl sequence tag struct mpl_sequence_tag; // mpl sequence tag
struct std_pair_tag; // std::pair tag struct std_pair_tag; // std::pair tag
@ -26,6 +27,13 @@ namespace boost { namespace fusion
struct apply; struct apply;
}; };
template <>
struct end_impl<sequence_facade_tag>
{
template <typename Sequence>
struct apply : Sequence::template end<Sequence> {};
};
template <> template <>
struct end_impl<array_tag>; struct end_impl<array_tag>;

View File

@ -15,7 +15,9 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
struct void_; struct void_;
struct fusion_sequence_tag;
// Special tags:
struct sequence_facade_tag;
struct array_tag; // boost::array tag struct array_tag; // boost::array tag
struct mpl_sequence_tag; // mpl sequence tag struct mpl_sequence_tag; // mpl sequence tag
struct std_pair_tag; // std::pair tag struct std_pair_tag; // std::pair tag
@ -32,6 +34,13 @@ namespace boost { namespace fusion
{}; {};
}; };
template <>
struct has_key_impl<sequence_facade_tag>
{
template <typename Sequence, typename Key>
struct apply : Sequence::template has_key<Sequence, Key> {};
};
template <> template <>
struct has_key_impl<array_tag>; struct has_key_impl<array_tag>;

View File

@ -13,7 +13,11 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
struct fusion_sequence_tag; // Special tags:
struct sequence_facade_tag;
struct array_tag; // boost::array tag
struct mpl_sequence_tag; // mpl sequence tag
struct std_pair_tag; // std::pair tag
namespace extension namespace extension
{ {
@ -24,6 +28,13 @@ namespace boost { namespace fusion
struct apply : Sequence::size {}; struct apply : Sequence::size {};
}; };
template <>
struct size_impl<sequence_facade_tag>
{
template <typename Sequence>
struct apply : Sequence::template size<Sequence> {};
};
template <> template <>
struct size_impl<array_tag>; struct size_impl<array_tag>;

View File

@ -13,6 +13,8 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
// Special tags:
struct sequence_facade_tag;
struct array_tag; // boost::array tag struct array_tag; // boost::array tag
struct mpl_sequence_tag; // mpl sequence tag struct mpl_sequence_tag; // mpl sequence tag
struct std_pair_tag; // std::pair tag struct std_pair_tag; // std::pair tag
@ -26,6 +28,13 @@ namespace boost { namespace fusion
struct apply; struct apply;
}; };
template <>
struct value_at_impl<sequence_facade_tag>
{
template <typename Sequence, typename N>
struct apply : Sequence::template value_at<Sequence, N> {};
};
template <> template <>
struct value_at_impl<array_tag>; struct value_at_impl<array_tag>;

View File

@ -14,6 +14,8 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
// Special tags:
struct sequence_facade_tag;
struct array_tag; // boost::array tag struct array_tag; // boost::array tag
struct mpl_sequence_tag; // mpl sequence tag struct mpl_sequence_tag; // mpl sequence tag
struct std_pair_tag; // std::pair tag struct std_pair_tag; // std::pair tag
@ -23,10 +25,17 @@ namespace boost { namespace fusion
template <typename Tag> template <typename Tag>
struct value_at_key_impl struct value_at_key_impl
{ {
template <typename Sequence, typename N> template <typename Sequence, typename Key>
struct apply; struct apply;
}; };
template <>
struct value_at_key_impl<sequence_facade_tag>
{
template <typename Sequence, typename Key>
struct apply : Sequence::template value_at_key<Sequence, Key> {};
};
template <> template <>
struct value_at_key_impl<array_tag>; struct value_at_key_impl<array_tag>;

View File

@ -0,0 +1,28 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Use, modification and distribution is subject to 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_SEQUENCE_FACADE_09252006_1044)
#define FUSION_SEQUENCE_FACADE_09252006_1044
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct sequence_facade_tag;
template <typename Derived, typename Category, typename IsView = mpl::false_>
struct sequence_facade : sequence_base<Derived>
{
typedef sequence_facade_tag fusion_tag;
typedef Derived derived_type;
typedef Category category;
typedef IsView is_view;
};
}}
#endif

View File

@ -22,7 +22,7 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
struct filter_view_tag; struct filter_view_tag;
struct forward_sequence_tag; struct forward_traversal_tag;
struct fusion_sequence_tag; struct fusion_sequence_tag;
template <typename Sequence, typename Pred> template <typename Sequence, typename Pred>
@ -30,7 +30,7 @@ namespace boost { namespace fusion
{ {
typedef filter_view_tag fusion_tag; typedef filter_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef forward_sequence_tag category; typedef forward_traversal_tag category;
typedef mpl::true_ is_view; typedef mpl::true_ is_view;
typedef typename result_of::begin<Sequence>::type first_type; typedef typename result_of::begin<Sequence>::type first_type;

View File

@ -9,7 +9,6 @@
#define FUSION_ITERATOR_RANGE_05062005_1224 #define FUSION_ITERATOR_RANGE_05062005_1224
#include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/support/detail/iterator_to_sequence_category.hpp>
#include <boost/fusion/support/sequence_base.hpp> #include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/category_of.hpp> #include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/sequence/view/iterator_range/detail/begin_impl.hpp> #include <boost/fusion/sequence/view/iterator_range/detail/begin_impl.hpp>
@ -33,11 +32,7 @@ namespace boost { namespace fusion
typedef typename result_of::distance<begin_type, end_type>::type size; typedef typename result_of::distance<begin_type, end_type>::type size;
typedef mpl::true_ is_view; typedef mpl::true_ is_view;
typedef typename typedef typename traits::category_of<begin_type>::type category;
detail::iterator_to_sequence_category<
typename traits::category_of<begin_type>::type
>::type
category;
iterator_range(First const& first, Last const& last) iterator_range(First const& first, Last const& last)
: first(convert_iterator<First>::call(first)) : first(convert_iterator<First>::call(first))

View File

@ -24,7 +24,7 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
struct joint_view_tag; struct joint_view_tag;
struct forward_sequence_tag; struct forward_traversal_tag;
struct fusion_sequence_tag; struct fusion_sequence_tag;
template <typename Sequence1, typename Sequence2> template <typename Sequence1, typename Sequence2>
@ -32,7 +32,7 @@ namespace boost { namespace fusion
{ {
typedef joint_view_tag fusion_tag; typedef joint_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef forward_sequence_tag category; typedef forward_traversal_tag category;
typedef mpl::true_ is_view; typedef mpl::true_ is_view;
typedef typename result_of::begin<Sequence1>::type first_type; typedef typename result_of::begin<Sequence1>::type first_type;

View File

@ -18,7 +18,7 @@
#include <boost/fusion/sequence/intrinsic/begin.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp> #include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp> #include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/type_traits/is_base_and_derived.hpp> #include <boost/type_traits/is_base_of.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/mpl/bool.hpp> #include <boost/mpl/bool.hpp>
@ -40,7 +40,7 @@ namespace boost { namespace fusion
typedef typename result_of::size<Sequence>::type size; typedef typename result_of::size<Sequence>::type size;
BOOST_STATIC_ASSERT(( BOOST_STATIC_ASSERT((
is_base_and_derived< is_base_of<
bidirectional_traversal_tag bidirectional_traversal_tag
, typename traits::category_of<first_type>::type>::value)); , typename traits::category_of<first_type>::type>::value));

View File

@ -17,7 +17,7 @@
#include <boost/fusion/sequence/view/reverse_view/detail/advance_impl.hpp> #include <boost/fusion/sequence/view/reverse_view/detail/advance_impl.hpp>
#include <boost/fusion/sequence/view/reverse_view/detail/distance_impl.hpp> #include <boost/fusion/sequence/view/reverse_view/detail/distance_impl.hpp>
#include <boost/fusion/sequence/view/reverse_view/detail/value_of_impl.hpp> #include <boost/fusion/sequence/view/reverse_view/detail/value_of_impl.hpp>
#include <boost/type_traits/is_base_and_derived.hpp> #include <boost/type_traits/is_base_of.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
@ -34,7 +34,7 @@ namespace boost { namespace fusion
typedef typename traits::category_of<first_type>::type category; typedef typename traits::category_of<first_type>::type category;
BOOST_STATIC_ASSERT(( BOOST_STATIC_ASSERT((
is_base_and_derived< is_base_of<
bidirectional_traversal_tag bidirectional_traversal_tag
, category>::value)); , category>::value));

View File

@ -20,7 +20,7 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
struct single_view_tag; struct single_view_tag;
struct forward_sequence_tag; struct forward_traversal_tag;
struct fusion_sequence_tag; struct fusion_sequence_tag;
template <typename T> template <typename T>
@ -28,7 +28,7 @@ namespace boost { namespace fusion
{ {
typedef single_view_tag fusion_tag; typedef single_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef forward_sequence_tag category; typedef forward_traversal_tag category;
typedef mpl::true_ is_view; typedef mpl::true_ is_view;
typedef mpl::int_<1> size; typedef mpl::int_<1> size;
typedef T value_type; typedef T value_type;

View File

@ -13,7 +13,7 @@
#include <boost/fusion/sequence/intrinsic/has_key.hpp> #include <boost/fusion/sequence/intrinsic/has_key.hpp>
#include <boost/fusion/sequence/io/out.hpp> #include <boost/fusion/sequence/io/out.hpp>
#include <boost/fusion/support/pair.hpp> #include <boost/fusion/support/pair.hpp>
#include <boost/fusion/support/is_associative.hpp> #include <boost/fusion/support/category_of.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/mpl/assert.hpp> #include <boost/mpl/assert.hpp>
#include <iostream> #include <iostream>

View File

@ -13,7 +13,7 @@
#include <boost/fusion/sequence/intrinsic/has_key.hpp> #include <boost/fusion/sequence/intrinsic/has_key.hpp>
#include <boost/fusion/sequence/io/out.hpp> #include <boost/fusion/sequence/io/out.hpp>
#include <boost/fusion/support/pair.hpp> #include <boost/fusion/support/pair.hpp>
#include <boost/fusion/support/is_associative.hpp> #include <boost/fusion/support/category_of.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/mpl/assert.hpp> #include <boost/mpl/assert.hpp>
#include <iostream> #include <iostream>