adapted/array is now using iterator_facade

[SVN r35317]
This commit is contained in:
Joel de Guzman
2006-09-25 09:06:15 +00:00
parent 654fd0918e
commit f017aa86ce
28 changed files with 281 additions and 491 deletions

View File

@ -10,23 +10,38 @@
#include <boost/fusion/support/detail/category_of.hpp>
#include <boost/fusion/support/tag_of.hpp>
#include <boost/fusion/support/tags.hpp>
#include <boost/type_traits/is_base_of.hpp>
namespace boost { namespace fusion
{
// Special tags:
struct array_tag; // boost::array tag
struct mpl_sequence_tag; // mpl sequence tag
struct std_pair_tag; // std::pair tag
struct incrementable_traversal_tag {};
struct single_pass_traversal_tag
: incrementable_traversal_tag {};
struct forward_traversal_tag
: single_pass_traversal_tag {};
struct bidirectional_traversal_tag
: forward_traversal_tag {};
struct random_access_traversal_tag
: bidirectional_traversal_tag {};
struct associative_sequence_tag {};
namespace extension
{
template<typename Tag>
struct category_of_impl
{
template<typename T>
struct apply
: detail::fusion_category_of<T>
{};
struct apply : detail::fusion_category_of<T> {};
};
template <>
@ -46,6 +61,49 @@ namespace boost { namespace fusion
: extension::category_of_impl<typename detail::tag_of<T>::type>::
template apply<T>
{};
}}}
template <typename T>
struct is_associative
: is_base_of<
associative_sequence_tag
, typename category_of<T>::type>
{};
template <typename T>
struct is_incrementable
: is_base_of<
incrementable_traversal_tag
, typename category_of<T>::type>
{};
template <typename T>
struct is_single_pass
: is_base_of<
single_pass_traversal_tag
, typename category_of<T>::type>
{};
template <typename T>
struct is_forward
: is_base_of<
forward_traversal_tag
, typename category_of<T>::type>
{};
template <typename T>
struct is_bidirectional
: is_base_of<
bidirectional_traversal_tag
, typename category_of<T>::type>
{};
template <typename T>
struct is_random_access
: is_base_of<
random_access_traversal_tag
, typename category_of<T>::type>
{};
}
}}
#endif

View File

@ -1,62 +0,0 @@
/*=============================================================================
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_ITERATOR_TO_SEQUENCE_CATEGORY_07212005_0726)
#define FUSION_ITERATOR_TO_SEQUENCE_CATEGORY_07212005_0726
namespace boost { namespace fusion
{
struct incrementable_traversal_tag;
struct single_pass_traversal_tag;
struct forward_traversal_tag;
struct bidirectional_traversal_tag;
struct random_access_traversal_tag;
struct incrementable_sequence_tag;
struct single_pass_sequence_tag;
struct forward_sequence_tag;
struct bidirectional_sequence_tag;
struct random_access_sequence_tag;
}}
namespace boost { namespace fusion { namespace detail
{
template <typename Category>
struct iterator_to_sequence_category;
template <>
struct iterator_to_sequence_category<incrementable_traversal_tag>
{
typedef incrementable_sequence_tag type;
};
template <>
struct iterator_to_sequence_category<single_pass_traversal_tag>
{
typedef single_pass_sequence_tag type;
};
template <>
struct iterator_to_sequence_category<forward_traversal_tag>
{
typedef forward_sequence_tag type;
};
template <>
struct iterator_to_sequence_category<bidirectional_traversal_tag>
{
typedef bidirectional_sequence_tag type;
};
template <>
struct iterator_to_sequence_category<random_access_traversal_tag>
{
typedef random_access_sequence_tag type;
};
}}}
#endif

View File

@ -1,37 +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(FUSION_IS_ASSOCIATIVE_09242005_1018)
#define FUSION_IS_ASSOCIATIVE_09242005_1018
#include <boost/mpl/bool.hpp>
#include <boost/fusion/support/tag_of.hpp>
namespace boost { namespace fusion
{
namespace extension
{
template<typename Tag>
struct is_associative_impl
{
template<typename Seq>
struct apply : mpl::false_ {};
};
}
namespace traits
{
template <typename Seq>
struct is_associative
: extension::is_associative_impl<typename detail::tag_of<Seq>::type>::
template apply<Seq>
{};
}
}}
#endif

View File

@ -8,14 +8,14 @@
#if !defined(FUSION_IS_ITERATOR_05062005_1219)
#define FUSION_IS_ITERATOR_05062005_1219
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/type_traits/is_base_of.hpp>
namespace boost { namespace fusion
{
struct iterator_root;
template <typename T>
struct is_fusion_iterator : is_base_and_derived<iterator_root, T> {};
struct is_fusion_iterator : is_base_of<iterator_root, T> {};
}}
#endif

View File

@ -8,7 +8,7 @@
#if !defined(FUSION_IS_SEQUENCE_05052005_1002)
#define FUSION_IS_SEQUENCE_05052005_1002
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/tag_of.hpp>
#include <boost/mpl/is_sequence.hpp>
@ -17,6 +17,7 @@
namespace boost { namespace fusion
{
// Special tags:
struct non_fusion_tag;
struct array_tag; // boost::array tag
struct mpl_sequence_tag; // mpl sequence tag
@ -26,18 +27,15 @@ namespace boost { namespace fusion
{
template <typename T>
struct is_sequence_impl
: is_base_and_derived<sequence_root, T>
{
template<typename Sequence>
struct apply
: is_base_and_derived<sequence_root, Sequence>
{};
template <typename Sequence>
struct apply : is_base_of<sequence_root, Sequence> {};
};
template <>
struct is_sequence_impl<non_fusion_tag>
{
template<typename T>
template <typename T>
struct apply : mpl::false_ {};
};

View File

@ -13,6 +13,8 @@
namespace boost { namespace fusion
{
// 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
@ -22,12 +24,19 @@ namespace boost { namespace fusion
template<typename Tag>
struct is_view_impl
{
template<typename T>
template <typename T>
struct apply
: detail::fusion_is_view<T>
{};
};
template <>
struct is_view_impl<sequence_facade_tag>
{
template <typename Sequence>
struct apply : Sequence::is_view {};
};
template <>
struct is_view_impl<array_tag>;

View File

@ -13,6 +13,7 @@
#include <boost/fusion/support/detail/is_mpl_sequence.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/mpl/bool.hpp>
#include <utility>
namespace boost
@ -24,7 +25,7 @@ namespace boost
namespace boost { namespace fusion
{
struct non_fusion_tag;
namespace detail
{
BOOST_MPL_HAS_XXX_TRAIT_DEF(fusion_tag)

View File

@ -1,47 +0,0 @@
/*=============================================================================
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_TAGS_07212005_1031)
#define FUSION_TAGS_07212005_1031
namespace boost { namespace fusion
{
// Iterator Classification
struct incrementable_traversal_tag {};
struct single_pass_traversal_tag
: incrementable_traversal_tag {};
struct forward_traversal_tag
: single_pass_traversal_tag {};
struct bidirectional_traversal_tag
: forward_traversal_tag {};
struct random_access_traversal_tag
: bidirectional_traversal_tag {};
// Sequence Classification
struct incrementable_sequence_tag {};
struct single_pass_sequence_tag
: incrementable_sequence_tag {};
struct forward_sequence_tag
: single_pass_sequence_tag {};
struct bidirectional_sequence_tag
: forward_sequence_tag {};
struct random_access_sequence_tag
: bidirectional_sequence_tag {};
struct associative_sequence_tag // $$$ this is no longer true $$$
: forward_sequence_tag {};
}}
#endif