migrated std_pair_iterator and mpl_iterator to iterator_facade

[SVN r35321]
This commit is contained in:
Joel de Guzman
2006-09-25 13:56:22 +00:00
parent f017aa86ce
commit ac31f6d1cb
20 changed files with 328 additions and 743 deletions

View File

@ -1,45 +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_ADVANCE_IMPL_09232005_2324)
#define FUSION_ADVANCE_IMPL_09232005_2324
#include <boost/mpl/advance.hpp>
namespace boost { namespace fusion
{
struct mpl_iterator_tag;
template <typename Iterator>
struct mpl_iterator;
namespace extension
{
template <typename Tag>
struct advance_impl;
template <>
struct advance_impl<mpl_iterator_tag>
{
template <typename Iterator, typename N>
struct apply
{
typedef mpl_iterator<
typename mpl::advance<typename Iterator::iterator_type, N>::type>
type;
static type
call(Iterator const& i)
{
return type();
}
};
};
}
}}
#endif

View File

@ -1,44 +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_DEREF_IMPL_05052005_0733)
#define FUSION_DEREF_IMPL_05052005_0733
#include <boost/mpl/deref.hpp>
namespace boost { namespace fusion
{
struct mpl_iterator_tag;
namespace extension
{
template <typename Tag>
struct deref_impl;
template <>
struct deref_impl<mpl_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename mpl::deref<
typename Iterator::iterator_type>::type
type;
static type
call(Iterator)
{
return type();
}
};
};
}
}}
#endif

View File

@ -1,48 +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_DISTANCE_IMPL_09232005_2303)
#define FUSION_DISTANCE_IMPL_09232005_2303
#include <boost/mpl/minus.hpp>
#include <boost/mpl/distance.hpp>
namespace boost { namespace fusion
{
struct mpl_iterator_tag;
namespace extension
{
template <typename Tag>
struct distance_impl;
template <>
struct distance_impl<mpl_iterator_tag>
{
template <typename First, typename Last>
struct apply
: mpl::distance<
typename First::iterator_type
, typename Last::iterator_type>
{
static typename mpl::distance<
typename First::iterator_type
, typename Last::iterator_type>::type
call(First const&, Last const&)
{
typedef typename mpl::distance<
typename First::iterator_type
, typename Last::iterator_type>::type
result;
return result();
}
};
};
}
}}
#endif

View File

@ -1,41 +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_EQUAL_TO_IMPL_05232005_0621)
#define FUSION_EQUAL_TO_IMPL_05232005_0621
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/and.hpp>
namespace boost { namespace fusion
{
struct mpl_iterator_tag;
namespace extension
{
template <typename Tag>
struct equal_to_impl;
template <>
struct equal_to_impl<mpl_iterator_tag>
{
template <typename I1, typename I2>
struct apply
: is_same<
typename remove_const<typename I1::iterator_type>::type
, typename remove_const<typename I2::iterator_type>::type
>
{
};
};
}
}}
#endif

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_NEXT_IMPL_05052005_0733)
#define FUSION_NEXT_IMPL_05052005_0733
#include <boost/mpl/next.hpp>
namespace boost { namespace fusion
{
struct mpl_iterator_tag;
template <typename Iterator>
struct mpl_iterator;
namespace extension
{
template <typename Tag>
struct next_impl;
template <>
struct next_impl<mpl_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef mpl_iterator<
typename mpl::next<typename Iterator::iterator_type>::type
> type;
static type
call(Iterator)
{
return type();
}
};
};
}
}}
#endif

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_PRIOR_IMPL_05202005_0930)
#define FUSION_PRIOR_IMPL_05202005_0930
#include <boost/mpl/next.hpp>
namespace boost { namespace fusion
{
struct mpl_iterator_tag;
template <typename Iterator>
struct mpl_iterator;
namespace extension
{
template <typename Tag>
struct prior_impl;
template <>
struct prior_impl<mpl_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef mpl_iterator<
typename mpl::prior<typename Iterator::iterator_type>::type
> type;
static type
call(Iterator)
{
return type();
}
};
};
}
}}
#endif

View File

@ -1,38 +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_VALUE_OF_TRAITS_05052005_0734)
#define FUSION_VALUE_OF_TRAITS_05052005_0734
#include <boost/mpl/deref.hpp>
namespace boost { namespace fusion
{
struct mpl_iterator_tag;
namespace extension
{
template <typename Tag>
struct value_of_impl;
template <>
struct value_of_impl<mpl_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename mpl::deref<
typename Iterator::iterator_type>::type
type;
};
};
}
}}
#endif

View File

@ -8,30 +8,104 @@
#if !defined(FUSION_MPL_ITERATOR_05052005_0731)
#define FUSION_MPL_ITERATOR_05052005_0731
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/support/detail/mpl_iterator_category.hpp>
#include <boost/fusion/sequence/adapted/mpl/detail/deref_impl.hpp>
#include <boost/fusion/sequence/adapted/mpl/detail/next_impl.hpp>
#include <boost/fusion/sequence/adapted/mpl/detail/prior_impl.hpp>
#include <boost/fusion/sequence/adapted/mpl/detail/value_of_impl.hpp>
#include <boost/fusion/sequence/adapted/mpl/detail/equal_to_impl.hpp>
#include <boost/fusion/sequence/adapted/mpl/detail/distance_impl.hpp>
#include <boost/fusion/sequence/adapted/mpl/detail/advance_impl.hpp>
#include <boost/fusion/iterator/iterator_facade.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/prior.hpp>
#include <boost/mpl/advance.hpp>
#include <boost/mpl/distance.hpp>
namespace boost { namespace fusion
{
struct mpl_iterator_tag;
template <typename Iterator>
struct mpl_iterator
: iterator_base<mpl_iterator<Iterator> >
: iterator_facade<
mpl_iterator<Iterator>
, typename detail::mpl_iterator_category<typename Iterator::category>::type
>
{
typedef mpl_iterator_tag fusion_tag;
typedef typename detail::mpl_iterator_category<
typename Iterator::category>::type
category;
typedef typename remove_const<Iterator>::type iterator_type;
template <typename Iterator>
struct value_of : mpl::deref<typename Iterator::iterator_type> {};
template <typename Iterator>
struct deref
{
typedef typename mpl::deref<
typename Iterator::iterator_type>::type
type;
static type
call(Iterator)
{
return type();
}
};
template <typename Iterator>
struct next
{
typedef mpl_iterator<
typename mpl::next<typename Iterator::iterator_type>::type>
type;
static type
call(Iterator)
{
return type();
}
};
template <typename Iterator>
struct prior
{
typedef mpl_iterator<
typename mpl::prior<typename Iterator::iterator_type>::type>
type;
static type
call(Iterator)
{
return type();
}
};
template <typename Iterator, typename N>
struct advance
{
typedef mpl_iterator<
typename mpl::advance<typename Iterator::iterator_type, N>::type>
type;
static type
call(Iterator const& i)
{
return type();
}
};
template <typename I1, typename I2>
struct distance :
mpl::distance<
typename I1::iterator_type
, typename I2::iterator_type>
{
typedef typename
mpl::distance<
typename I1::iterator_type
, typename I2::iterator_type
>::type
type;
static type
call(I1 const&, I2 const&)
{
return type();
}
};
};
}}