forked from boostorg/fusion
added struct wrapping facilities to make it very easy to make any struct a conforming fusion sequence
[SVN r37328]
This commit is contained in:
@ -2,13 +2,12 @@
|
||||
Copyright (c) 2001-2006 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_MPL_31122005_1152)
|
||||
#define BOOST_FUSION_MPL_31122005_1152
|
||||
|
||||
#include <boost/fusion/sequence/adapted/mpl/mpl_iterator.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/end_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/is_sequence_impl.hpp>
|
||||
|
@ -2,20 +2,65 @@
|
||||
Copyright (c) 2001-2006 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_STD_PAIR_24122005_1744)
|
||||
#define BOOST_FUSION_STD_PAIR_24122005_1744
|
||||
|
||||
#include <boost/fusion/sequence/adapted/std_pair/tag_of.hpp>
|
||||
#include <boost/fusion/sequence/adapted/std_pair/detail/is_view_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/std_pair/detail/is_sequence_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/std_pair/detail/category_of_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/std_pair/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/std_pair/detail/end_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/std_pair/detail/size_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/std_pair/detail/at_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/std_pair/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||
#include <boost/fusion/sequence/adapted/struct.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct struct_tag;
|
||||
|
||||
namespace traits
|
||||
{
|
||||
template <typename T1, typename T2>
|
||||
struct tag_of<std::pair<T1, T2> >
|
||||
{
|
||||
typedef struct_tag type;
|
||||
};
|
||||
}
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Struct, int N>
|
||||
struct struct_member;
|
||||
|
||||
template <typename Struct>
|
||||
struct struct_size;
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct struct_member<std::pair<T1, T2>, 0>
|
||||
{
|
||||
typedef T1 type;
|
||||
|
||||
static type& call(std::pair<T1, T2>& pair)
|
||||
{
|
||||
return pair.first;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct struct_member<std::pair<T1, T2>, 1>
|
||||
{
|
||||
typedef T2 type;
|
||||
|
||||
static type& call(std::pair<T1, T2>& pair)
|
||||
{
|
||||
return pair.second;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct struct_size<std::pair<T1, T2> > : mpl::int_<2>
|
||||
{
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
@ -1,29 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 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_TAG_OF_24122005_1722)
|
||||
#define BOOST_FUSION_TAG_OF_24122005_1722
|
||||
|
||||
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct std_pair_tag;
|
||||
|
||||
namespace traits
|
||||
{
|
||||
template<typename T1, typename T2>
|
||||
struct tag_of<std::pair<T1, T2> >
|
||||
{
|
||||
typedef std_pair_tag type;
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
20
include/boost/fusion/sequence/adapted/struct.hpp
Normal file
20
include/boost/fusion/sequence/adapted/struct.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 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_STRUCT_24122005_1744)
|
||||
#define BOOST_FUSION_STD_STRUCT_24122005_1744
|
||||
|
||||
#include <boost/fusion/sequence/adapted/struct/detail/is_view_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/struct/detail/is_sequence_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/struct/detail/category_of_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/struct/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/struct/detail/end_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/struct/detail/size_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/struct/detail/at_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/struct/detail/value_at_impl.hpp>
|
||||
|
||||
#endif
|
@ -2,40 +2,43 @@
|
||||
Copyright (c) 2001-2006 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_AT_IMPL_24122005_1807)
|
||||
#define BOOST_FUSION_AT_IMPL_24122005_1807
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct std_pair_tag;
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct struct_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct at_impl;
|
||||
|
||||
template <typename Struct, int N>
|
||||
struct struct_member;
|
||||
|
||||
template <typename Struct>
|
||||
struct struct_size;
|
||||
|
||||
template <>
|
||||
struct at_impl<std_pair_tag>
|
||||
struct at_impl<struct_tag>
|
||||
{
|
||||
template <typename Sequence, typename N>
|
||||
struct apply
|
||||
struct apply
|
||||
{
|
||||
static int const n_value = N::value;
|
||||
BOOST_STATIC_ASSERT((n_value >= 0 && n_value < 2));
|
||||
BOOST_MPL_ASSERT_RELATION(
|
||||
n_value, <=, extension::struct_size<Sequence>::value);
|
||||
|
||||
typedef typename
|
||||
mpl::if_c<
|
||||
(n_value == 0)
|
||||
, typename Sequence::first_type
|
||||
, typename Sequence::second_type
|
||||
>
|
||||
extension::struct_member<Sequence, N::value>
|
||||
element;
|
||||
|
||||
typedef typename
|
||||
@ -46,22 +49,11 @@ namespace boost { namespace fusion {
|
||||
>::type
|
||||
type;
|
||||
|
||||
template <typename RT>
|
||||
static RT get(Sequence& p, mpl::int_<0>)
|
||||
{
|
||||
return p.first;
|
||||
}
|
||||
|
||||
template <typename RT>
|
||||
static RT get(Sequence& p, mpl::int_<1>)
|
||||
{
|
||||
return p.second;
|
||||
}
|
||||
|
||||
static type
|
||||
call(Sequence& p)
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return get<type>(p, N());
|
||||
return extension::
|
||||
struct_member<Sequence, N::value>::call(seq);
|
||||
}
|
||||
};
|
||||
};
|
@ -2,17 +2,17 @@
|
||||
Copyright (c) 2001-2006 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_BEGIN_IMPL_24122005_1752)
|
||||
#define BOOST_FUSION_BEGIN_IMPL_24122005_1752
|
||||
|
||||
#include <boost/fusion/sequence/adapted/std_pair/std_pair_iterator.hpp>
|
||||
#include <boost/fusion/sequence/adapted/struct/struct_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct std_pair_tag;
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct struct_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
@ -20,13 +20,13 @@ namespace boost { namespace fusion {
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<std_pair_tag>
|
||||
struct begin_impl<struct_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
struct apply
|
||||
{
|
||||
typedef std_pair_iterator<Sequence, 0> type;
|
||||
|
||||
typedef struct_iterator<Sequence, 0> type;
|
||||
|
||||
static type
|
||||
call(Sequence& v)
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
Copyright (c) 2001-2006 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_CATEGORY_OF_IMPL_24122005_1731)
|
||||
@ -10,9 +10,9 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct std_pair_tag;
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct struct_tag;
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
namespace extension
|
||||
@ -21,7 +21,7 @@ namespace boost { namespace fusion {
|
||||
struct category_of_impl;
|
||||
|
||||
template<>
|
||||
struct category_of_impl<std_pair_tag>
|
||||
struct category_of_impl<struct_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply
|
@ -2,17 +2,17 @@
|
||||
Copyright (c) 2001-2006 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_END_IMPL_24122005_1755)
|
||||
#define BOOST_FUSION_END_IMPL_24122005_1755
|
||||
|
||||
#include <boost/fusion/sequence/adapted/std_pair/std_pair_iterator.hpp>
|
||||
#include <boost/fusion/sequence/adapted/struct/struct_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct std_pair_tag;
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct struct_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
@ -20,13 +20,13 @@ namespace boost { namespace fusion {
|
||||
struct end_impl;
|
||||
|
||||
template <>
|
||||
struct end_impl<std_pair_tag>
|
||||
struct end_impl<struct_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
struct apply
|
||||
{
|
||||
typedef std_pair_iterator<Sequence, 2> type;
|
||||
|
||||
typedef struct_iterator<Sequence, 2> type;
|
||||
|
||||
static type
|
||||
call(Sequence& v)
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
Copyright (c) 2001-2006 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_IS_SEQUENCE_IMPL_27122005_1651)
|
||||
@ -10,9 +10,9 @@
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct std_pair_tag;
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct struct_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
@ -20,7 +20,7 @@ namespace boost { namespace fusion {
|
||||
struct is_sequence_impl;
|
||||
|
||||
template<>
|
||||
struct is_sequence_impl<std_pair_tag>
|
||||
struct is_sequence_impl<struct_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply : mpl::true_ {};
|
@ -2,7 +2,7 @@
|
||||
Copyright (c) 2001-2006 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_IS_VIEW_IMPL_27042006_2219)
|
||||
@ -10,9 +10,9 @@
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct std_pair_tag;
|
||||
struct struct_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
@ -20,7 +20,7 @@ namespace boost { namespace fusion
|
||||
struct is_view_impl;
|
||||
|
||||
template<>
|
||||
struct is_view_impl<std_pair_tag>
|
||||
struct is_view_impl<struct_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply : mpl::false_
|
@ -2,7 +2,7 @@
|
||||
Copyright (c) 2001-2006 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_SIZE_IMPL_24122005_1759)
|
||||
@ -10,9 +10,15 @@
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace extension
|
||||
{
|
||||
template <typename Struct>
|
||||
struct struct_size;
|
||||
}
|
||||
|
||||
struct std_pair_tag;
|
||||
struct struct_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
@ -20,10 +26,10 @@ namespace boost { namespace fusion {
|
||||
struct size_impl;
|
||||
|
||||
template <>
|
||||
struct size_impl<std_pair_tag>
|
||||
struct size_impl<struct_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply : mpl::int_<2> {};
|
||||
struct apply : extension::struct_size<Sequence> {};
|
||||
};
|
||||
}
|
||||
}}
|
@ -2,7 +2,7 @@
|
||||
Copyright (c) 2001-2006 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_VALUE_AT_IMPL_24122005_1917)
|
||||
@ -11,29 +11,33 @@
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct std_pair_tag;
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct struct_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct value_at_impl;
|
||||
|
||||
template <typename Struct, int N>
|
||||
struct struct_member;
|
||||
|
||||
template <typename Struct>
|
||||
struct struct_size;
|
||||
|
||||
template <>
|
||||
struct value_at_impl<std_pair_tag>
|
||||
struct value_at_impl<struct_tag>
|
||||
{
|
||||
template <typename Sequence, typename N>
|
||||
struct apply
|
||||
struct apply
|
||||
{
|
||||
static int const n_value = N::value;
|
||||
BOOST_STATIC_ASSERT((n_value >= 0 && n_value < 2));
|
||||
BOOST_MPL_ASSERT_RELATION(
|
||||
n_value, <=, extension::struct_size<Sequence>::value);
|
||||
|
||||
typedef typename
|
||||
mpl::if_c<
|
||||
(n_value == 0)
|
||||
, typename Sequence::first_type
|
||||
, typename Sequence::second_type
|
||||
>::type
|
||||
extension::struct_member<Sequence, N::value>::type
|
||||
type;
|
||||
};
|
||||
};
|
@ -1,14 +1,17 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2007 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(FUSION_STD_PAIR_ITERATOR_09262005_0934)
|
||||
#define FUSION_STD_PAIR_ITERATOR_09262005_0934
|
||||
#if !defined(FUSION_STRUCT_ITERATOR_APRIL_2_2007_1008AM)
|
||||
#define FUSION_STRUCT_ITERATOR_APRIL_2_2007_1008AM
|
||||
|
||||
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
@ -18,69 +21,71 @@
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
template <typename Pair_, int N_>
|
||||
struct std_pair_iterator
|
||||
: iterator_facade<std_pair_iterator<Pair_, N_>, random_access_traversal_tag>
|
||||
namespace extension
|
||||
{
|
||||
BOOST_MPL_ASSERT_RELATION(N_, >=, 0);
|
||||
BOOST_MPL_ASSERT_RELATION(N_, <=, 2);
|
||||
template <typename Struct, int N>
|
||||
struct struct_member;
|
||||
|
||||
typedef mpl::int_<N_> index;
|
||||
typedef Pair_ pair_type;
|
||||
template <typename Struct>
|
||||
struct struct_size;
|
||||
|
||||
std_pair_iterator(Pair_& pair)
|
||||
: pair(pair) {}
|
||||
Pair_& pair;
|
||||
|
||||
template <typename Iterator>
|
||||
struct value_of;
|
||||
|
||||
template <typename Pair>
|
||||
struct value_of<std_pair_iterator<Pair, 0> >
|
||||
: mpl::identity<typename Pair::first_type> {};
|
||||
|
||||
template <typename Pair>
|
||||
struct value_of<std_pair_iterator<Pair, 1> >
|
||||
: mpl::identity<typename Pair::second_type> {};
|
||||
|
||||
template <typename Iterator>
|
||||
struct deref;
|
||||
|
||||
template <typename Pair>
|
||||
struct deref<std_pair_iterator<Pair, 0> >
|
||||
template <typename Struct, int N>
|
||||
struct struct_member<Struct const, N>
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_const<Pair>
|
||||
, typename Pair::first_type const&
|
||||
, typename Pair::first_type&
|
||||
>::type
|
||||
add_const<typename struct_member<Struct, N>::type>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(std_pair_iterator<Pair, 0> const& iter)
|
||||
static type&
|
||||
call(Struct const& struct_)
|
||||
{
|
||||
return iter.pair.first;
|
||||
return struct_member<Struct, N>::call(
|
||||
const_cast<Struct&>(struct_));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Pair>
|
||||
struct deref<std_pair_iterator<Pair, 1> >
|
||||
template <typename Struct>
|
||||
struct struct_size<Struct const>
|
||||
: struct_size<Struct>
|
||||
{};
|
||||
}
|
||||
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
template <typename Struct, int N_>
|
||||
struct struct_iterator
|
||||
: iterator_facade<struct_iterator<Struct, N_>, random_access_traversal_tag>
|
||||
{
|
||||
BOOST_MPL_ASSERT_RELATION(N_, >=, 0);
|
||||
BOOST_MPL_ASSERT_RELATION(N_, <=, extension::struct_size<Struct>::value);
|
||||
|
||||
typedef mpl::int_<N_> index;
|
||||
typedef Struct struct_type;
|
||||
|
||||
struct_iterator(Struct& struct_)
|
||||
: struct_(struct_) {}
|
||||
Struct& struct_;
|
||||
|
||||
template <typename Iterator>
|
||||
struct value_of
|
||||
: extension::struct_member<Struct, N_>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
struct deref
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_const<Pair>
|
||||
, typename Pair::second_type const&
|
||||
, typename Pair::second_type&
|
||||
add_reference<
|
||||
typename extension::struct_member<Struct, N_>::type
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(std_pair_iterator<Pair, 1> const& iter)
|
||||
call(Iterator const& iter)
|
||||
{
|
||||
return iter.pair.second;
|
||||
return extension::struct_member<Struct, N_>::
|
||||
call(iter.struct_);
|
||||
}
|
||||
};
|
||||
|
||||
@ -88,13 +93,13 @@ namespace boost { namespace fusion
|
||||
struct advance
|
||||
{
|
||||
typedef typename Iterator::index index;
|
||||
typedef typename Iterator::pair_type pair_type;
|
||||
typedef std_pair_iterator<pair_type, index::value + N::value> type;
|
||||
typedef typename Iterator::struct_type struct_type;
|
||||
typedef struct_iterator<struct_type, index::value + N::value> type;
|
||||
|
||||
static type
|
||||
call(Iterator const& iter)
|
||||
{
|
||||
return type(iter.pair);
|
||||
return type(iter.struct_);
|
||||
}
|
||||
};
|
||||
|
||||
@ -110,7 +115,7 @@ namespace boost { namespace fusion
|
||||
typedef typename
|
||||
mpl::minus<
|
||||
typename I2::index, typename I1::index
|
||||
>::type
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
Reference in New Issue
Block a user