adapt template classes/structs

[SVN r59846]
This commit is contained in:
Christopher Schmidt
2010-02-22 22:55:54 +00:00
parent bb88841f47
commit f84bc30bd3
79 changed files with 2489 additions and 2293 deletions

View File

@ -1,113 +1,69 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2007 Dan Marsden
Copyright (c) 2010 Christopher Schmidt
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_ADAPT_ASSOC_CLASS_OCTOBER_4_2009_840PM)
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_OCTOBER_4_2009_840PM
#include <boost/fusion/support/tag_of_fwd.hpp>
#include <boost/fusion/adapted/class/extension.hpp>
#include <boost/fusion/adapted/class/class_iterator.hpp>
#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_HPP
#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_HPP
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/empty.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <boost/fusion/adapted/class/detail/extension.hpp>
#include <boost/fusion/adapted/class/detail/adapt_base.hpp>
#include <boost/fusion/adapted/class/detail/at_impl.hpp>
#include <boost/fusion/adapted/class/detail/is_view_impl.hpp>
#include <boost/fusion/adapted/class/detail/is_sequence_impl.hpp>
#include <boost/fusion/adapted/class/detail/value_at_impl.hpp>
#include <boost/fusion/adapted/class/detail/category_of_impl.hpp>
#include <boost/fusion/adapted/class/detail/size_impl.hpp>
#include <boost/fusion/adapted/class/detail/begin_impl.hpp>
#include <boost/fusion/adapted/class/detail/end_impl.hpp>
#include <boost/fusion/adapted/class/detail/size_impl.hpp>
#include <boost/fusion/adapted/class/detail/at_impl.hpp>
#include <boost/fusion/adapted/class/detail/value_at_impl.hpp>
#include <boost/fusion/adapted/class/detail/has_key_impl.hpp>
#include <boost/fusion/adapted/class/detail/at_key_impl.hpp>
#include <boost/fusion/adapted/class/detail/value_at_key_impl.hpp>
#include <boost/fusion/adapted/class/detail/value_of_impl.hpp>
#include <boost/fusion/adapted/class/detail/deref_impl.hpp>
#include <boost/fusion/adapted/class/detail/deref_data_impl.hpp>
#include <boost/fusion/adapted/class/detail/key_of_impl.hpp>
#include <boost/fusion/adapted/class/detail/value_of_data_impl.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/seq/for_each_i.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/mpl/int.hpp>
#include <boost/config/no_tr1/utility.hpp>
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0(A, B, C, D, E)\
((A, B, C, D, E)) BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_1
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_1(A, B, C, D, E)\
((A, B, C, D, E)) BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0_END
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_1_END
namespace boost { namespace fusion { namespace extension {
template<typename Class, typename Key>
struct class_assoc_member;
}}}
#define BOOST_FUSION_ADAPT_ASSOC_CLASS(name, bseq) \
BOOST_FUSION_ADAPT_ASSOC_CLASS_I( \
name, BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_X bseq, 0)) \
/***/
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_X(x, y, z) ((x, y, z)) BOOST_FUSION_ADAPT_ASSOC_CLASS_Y
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_Y(x, y, z) ((x, y, z)) BOOST_FUSION_ADAPT_ASSOC_CLASS_X
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_X0
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_Y0
// BOOST_FUSION_ADAPT_ASSOC_CLASS_I generates the overarching structure and uses
// SEQ_FOR_EACH_I to generate the "linear" substructures.
// Thanks to Paul Mensonides for the PP macro help
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_I(name, seq) \
namespace boost { namespace fusion { namespace traits \
{ \
template <> \
struct tag_of<name> \
{ \
typedef class_tag type; \
}; \
}}} \
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_C( \
TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE) \
\
namespace boost { namespace mpl \
{ \
template<typename> \
struct sequence_tag; \
BOOST_FUSION_ADAPT_CLASS_C_BASE(TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,ATTRIBUTE,5) \
\
template<> \
struct sequence_tag<name> \
{ \
typedef fusion::fusion_sequence_tag type; \
}; \
\
template<> \
struct sequence_tag<name const> \
{ \
typedef fusion::fusion_sequence_tag type; \
}; \
}} \
\
namespace boost { namespace fusion { namespace extension \
template< \
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
> \
struct struct_assoc_key<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ), I> \
{ \
template <> \
struct class_size<name> : mpl::int_<BOOST_PP_SEQ_SIZE(seq)> {}; \
BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_ADAPT_ASSOC_CLASS_C, name, seq) \
}}} \
/***/
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_C(r, name, i, xy) \
template <> \
struct class_member<name, i> \
{ \
typedef BOOST_PP_TUPLE_ELEM(3, 0, xy) type; \
static type& call(name& class_) \
{ \
return class_.BOOST_PP_TUPLE_ELEM(3, 1, xy); \
}; \
}; \
template<> \
struct class_assoc_member<name, BOOST_PP_TUPLE_ELEM(3, 2, xy)> \
{ \
typedef BOOST_PP_TUPLE_ELEM(3, 0, xy) type; \
static type& call(name& class_) \
{ \
return class_.BOOST_PP_TUPLE_ELEM(3, 1, xy); \
}; \
typedef BOOST_PP_TUPLE_ELEM(5, 4, ATTRIBUTE) type; \
};
/***/
#define BOOST_FUSION_ADAPT_ASSOC_TPL_CLASS( \
TEMPLATE_PARAMS_SEQ, NAME_SEQ, ATTRIBUTES) \
\
BOOST_FUSION_ADAPT_STRUCT_BASE( \
(1)TEMPLATE_PARAMS_SEQ, \
(1)NAME_SEQ, \
assoc_class_tag, \
BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0 ATTRIBUTES,_END), \
BOOST_FUSION_ADAPT_ASSOC_CLASS_C)
#define BOOST_FUSION_ADAPT_ASSOC_CLASS(NAME, ATTRIBUTES) \
BOOST_FUSION_ADAPT_STRUCT_BASE( \
(0), \
(0)(NAME), \
assoc_class_tag, \
BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0 ATTRIBUTES,_END), \
BOOST_FUSION_ADAPT_ASSOC_CLASS_C)
#endif

View File

@ -0,0 +1,28 @@
/*=============================================================================
Copyright (c) 2010 Christopher Schmidt
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)
==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_NAMED_HPP
#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_NAMED_HPP
#include <boost/fusion/adapted/class/adapt_assoc_class.hpp>
#include <boost/fusion/adapted/struct/detail/proxy_type.hpp>
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_NAMED_NS( \
WRAPPED_TYPE, NAMESPACE_SEQ, NAME, ATTRIBUTES) \
\
BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE( \
WRAPPED_TYPE,(0)NAMESPACE_SEQ,NAME) \
\
BOOST_FUSION_ADAPT_ASSOC_CLASS( \
BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ)NAME, \
ATTRIBUTES)
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \
BOOST_FUSION_ADAPT_ASSOC_CLASS_NAMED_NS( \
WRAPPED_TYPE,(boost)(fusion)(adapted),NAME,ATTRIBUTES)
#endif

View File

@ -1,132 +1,55 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2009-2010 Hartmut Kaiser
Copyright (c) 2010 Christopher Schmidt
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_ADAPT_CLASS_OCTOBER_4_2009_840PM)
#define BOOST_FUSION_ADAPT_CLASS_OCTOBER_4_2009_840PM
#include <boost/fusion/support/tag_of_fwd.hpp>
#include <boost/fusion/adapted/class/extension.hpp>
#include <boost/fusion/adapted/class/class_iterator.hpp>
#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_HPP
#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_HPP
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/empty.hpp>
#include <boost/fusion/adapted/class/detail/extension.hpp>
#include <boost/fusion/adapted/class/detail/adapt_base.hpp>
#include <boost/fusion/adapted/class/detail/at_impl.hpp>
#include <boost/fusion/adapted/class/detail/is_view_impl.hpp>
#include <boost/fusion/adapted/class/detail/is_sequence_impl.hpp>
#include <boost/fusion/adapted/class/detail/value_at_impl.hpp>
#include <boost/fusion/adapted/class/detail/category_of_impl.hpp>
#include <boost/fusion/adapted/class/detail/size_impl.hpp>
#include <boost/fusion/adapted/class/detail/begin_impl.hpp>
#include <boost/fusion/adapted/class/detail/end_impl.hpp>
#include <boost/fusion/adapted/class/detail/size_impl.hpp>
#include <boost/fusion/adapted/class/detail/at_impl.hpp>
#include <boost/fusion/adapted/class/detail/value_at_impl.hpp>
#include <boost/fusion/adapted/class/detail/value_of_impl.hpp>
#include <boost/fusion/adapted/class/detail/deref_impl.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/seq/for_each_i.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/mpl/int.hpp>
#include <boost/config/no_tr1/utility.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
#define BOOST_FUSION_ADAPT_CLASS_FILLER_0(A, B, C, D)\
((A, B, C, D)) BOOST_FUSION_ADAPT_CLASS_FILLER_1
#define BOOST_FUSION_ADAPT_CLASS_FILLER_1(A, B, C, D)\
((A, B, C, D)) BOOST_FUSION_ADAPT_CLASS_FILLER_0
#define BOOST_FUSION_ADAPT_CLASS_FILLER_0_END
#define BOOST_FUSION_ADAPT_CLASS_FILLER_1_END
#define BOOST_FUSION_ADAPT_CLASS(name, bseq) \
BOOST_FUSION_ADAPT_CLASS_I( \
name, BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_X bseq, 0)) \
/***/
#define BOOST_FUSION_ADAPT_CLASS_C(TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE) \
BOOST_FUSION_ADAPT_CLASS_C_BASE( \
TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE, 4)
#define BOOST_FUSION_ADAPT_CLASS_X(w, x, y, z) ((w, x, y, z)) BOOST_FUSION_ADAPT_CLASS_Y
#define BOOST_FUSION_ADAPT_CLASS_Y(w, x, y, z) ((w, x, y, z)) BOOST_FUSION_ADAPT_CLASS_X
#define BOOST_FUSION_ADAPT_CLASS_X0
#define BOOST_FUSION_ADAPT_CLASS_Y0
#define BOOST_FUSION_ADAPT_TPL_CLASS(TEMPLATE_PARAMS_SEQ, NAME_SEQ , ATTRIBUTES)\
BOOST_FUSION_ADAPT_STRUCT_BASE( \
(1)TEMPLATE_PARAMS_SEQ, \
(1)NAME_SEQ, \
class_tag, \
BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_FILLER_0 ATTRIBUTES,_END), \
BOOST_FUSION_ADAPT_CLASS_C)
// BOOST_FUSION_ADAPT_CLASS_I generates the overarching structure and uses
// SEQ_FOR_EACH_I to generate the "linear" substructures.
// Thanks to Paul Mensonides for the PP macro help
#define BOOST_FUSION_ADAPT_CLASS_I(name, seq) \
namespace boost { namespace fusion { namespace traits \
{ \
template <> \
struct tag_of<name> \
{ \
typedef class_tag type; \
}; \
}}} \
\
namespace boost { namespace mpl \
{ \
template<typename> \
struct sequence_tag; \
\
template<> \
struct sequence_tag<name> \
{ \
typedef fusion::fusion_sequence_tag type; \
}; \
\
template<> \
struct sequence_tag<name const> \
{ \
typedef fusion::fusion_sequence_tag type; \
}; \
}} \
\
namespace boost { namespace fusion { namespace extension \
{ \
template <> \
struct class_size<name> : mpl::int_<BOOST_PP_SEQ_SIZE(seq)> {}; \
template <typename T, int N> struct class_member_proxy; \
BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_ADAPT_CLASS_C, name, seq) \
}}} \
/***/
#define BOOST_FUSION_ADAPT_CLASS_C(r, fullname, i, xy) \
template <> \
struct class_member_proxy<fullname, i> \
{ \
typedef BOOST_PP_TUPLE_ELEM(4, 0, xy) lvalue; \
typedef BOOST_PP_TUPLE_ELEM(4, 1, xy) rvalue; \
typedef remove_const<remove_reference<lvalue>::type>::type type; \
typedef add_reference<add_const<type>::type>::type cref_type; \
\
class_member_proxy(fullname& obj) : obj(obj) {} \
fullname& obj; \
\
class_member_proxy& operator=(cref_type val) \
{ \
BOOST_PP_TUPLE_ELEM(4, 3, xy); \
return *this; \
} \
\
operator lvalue() \
{ \
return BOOST_PP_TUPLE_ELEM(4, 2, xy); \
} \
}; \
\
template <> \
struct class_member<fullname, i> \
{ \
typedef class_member_proxy<fullname, i> proxy; \
typedef proxy::type type; \
typedef proxy::rvalue get_type; \
\
static get_type call(fullname const& obj) \
{ \
return BOOST_PP_TUPLE_ELEM(4, 2, xy); \
} \
\
static proxy call(fullname& obj) \
{ \
return proxy(obj); \
} \
}; \
/***/
#define BOOST_FUSION_ADAPT_CLASS(NAME, ATTRIBUTES) \
BOOST_FUSION_ADAPT_STRUCT_BASE( \
(0), \
(0)(NAME), \
class_tag, \
BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_FILLER_0 ATTRIBUTES,_END), \
BOOST_FUSION_ADAPT_CLASS_C)
#endif

View File

@ -1,156 +1,28 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2009-2010 Hartmut Kaiser
Copyright (c) 2010 Christopher Schmidt
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_ADAPT_CLASS_NAMED_JAN_27_2010_0614PM)
#define BOOST_FUSION_ADAPT_CLASS_NAMED_JAN_27_2010_0614PM
#include <boost/fusion/support/tag_of_fwd.hpp>
#include <boost/fusion/adapted/class/extension.hpp>
#include <boost/fusion/adapted/class/class_iterator.hpp>
#include <boost/fusion/adapted/class/detail/is_view_impl.hpp>
#include <boost/fusion/adapted/class/detail/is_sequence_impl.hpp>
#include <boost/fusion/adapted/class/detail/category_of_impl.hpp>
#include <boost/fusion/adapted/class/detail/begin_impl.hpp>
#include <boost/fusion/adapted/class/detail/end_impl.hpp>
#include <boost/fusion/adapted/class/detail/size_impl.hpp>
#include <boost/fusion/adapted/class/detail/at_impl.hpp>
#include <boost/fusion/adapted/class/detail/value_at_impl.hpp>
#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_NAMED_HPP
#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_NAMED_HPP
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/seq/for_each_i.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/mpl/int.hpp>
#include <boost/config/no_tr1/utility.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/fusion/adapted/class/adapt_class.hpp>
#include <boost/fusion/adapted/struct/detail/proxy_type.hpp>
#define BOOST_FUSION_ADAPT_CLASS_NAMED(name, newname, bseq) \
BOOST_FUSION_ADAPT_CLASS_NAMED_I(name, (boost)(fusion)(adapted), newname, \
BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_NAMED_X bseq, 0)) \
/***/
#define BOOST_FUSION_ADAPT_CLASS_NAMED_NS( \
WRAPPED_TYPE, NAMESPACE_SEQ, NAME, ATTRIBUTES) \
\
BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE( \
WRAPPED_TYPE,(0)NAMESPACE_SEQ,NAME) \
\
BOOST_FUSION_ADAPT_CLASS( \
BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ)NAME, \
ATTRIBUTES)
#define BOOST_FUSION_ADAPT_CLASS_NAMED_NS(name, ns, newname, bseq) \
BOOST_FUSION_ADAPT_CLASS_NAMED_I(name, ns, newname, \
BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_NAMED_X bseq, 0)) \
/***/
#define BOOST_FUSION_ADAPT_CLASS_NAMED_X(w, x, y, z) ((w, x, y, z)) BOOST_FUSION_ADAPT_CLASS_NAMED_Y
#define BOOST_FUSION_ADAPT_CLASS_NAMED_Y(w, x, y, z) ((w, x, y, z)) BOOST_FUSION_ADAPT_CLASS_NAMED_X
#define BOOST_FUSION_ADAPT_CLASS_NAMED_X0
#define BOOST_FUSION_ADAPT_CLASS_NAMED_Y0
// BOOST_FUSION_ADAPT_CLASS_I generates the overarching structure and uses
// SEQ_FOR_EACH_I to generate the "linear" substructures.
// Thanks to Paul Mensonides for the PP macro help
#define BOOST_FUSION_ADAPT_CLASS_NAMED_I(name, ns, newname, seq) \
BOOST_PP_SEQ_FOR_EACH_R(1, BOOST_FUSION_ADAPT_CLASS_NAMED_NS_B, _, ns) \
struct newname \
{ \
newname(name& s) : obj(s) {} \
name& obj; \
}; \
BOOST_PP_SEQ_FOR_EACH_R(1, BOOST_FUSION_ADAPT_CLASS_NAMED_NS_E, _, ns) \
\
namespace boost { namespace fusion { namespace traits \
{ \
template <> \
struct tag_of<BOOST_FUSION_ADAPT_CLASS_NAMED_NAME(ns, newname)> \
{ \
typedef class_tag type; \
}; \
}}} \
\
namespace boost { namespace mpl \
{ \
template<typename> \
struct sequence_tag; \
\
template<> \
struct sequence_tag<BOOST_FUSION_ADAPT_CLASS_NAMED_NAME(ns, newname)> \
{ \
typedef fusion::fusion_sequence_tag type; \
}; \
\
template<> \
struct sequence_tag<BOOST_FUSION_ADAPT_CLASS_NAMED_NAME(ns, newname) const> \
{ \
typedef fusion::fusion_sequence_tag type; \
}; \
}} \
\
namespace boost { namespace fusion { namespace extension \
{ \
template <> \
struct class_size<BOOST_FUSION_ADAPT_CLASS_NAMED_NAME(ns, newname)> \
: mpl::int_<BOOST_PP_SEQ_SIZE(seq)> {}; \
template <typename T, int N> struct class_member_proxy; \
BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_ADAPT_CLASS_NAMED_C, \
BOOST_FUSION_ADAPT_CLASS_NAMED_NAME(ns, newname),seq) \
}}} \
/***/
#define BOOST_FUSION_ADAPT_CLASS_NAMED_NAME(ns, newname) \
BOOST_PP_SEQ_FOR_EACH_R(1, BOOST_FUSION_ADAPT_CLASS_NAMED_NS_D, _, ns) \
newname \
/***/
#define BOOST_FUSION_ADAPT_CLASS_NAMED_NS_B(r, _, ns) namespace ns {
#define BOOST_FUSION_ADAPT_CLASS_NAMED_NS_D(r, _, ns) ns::
#define BOOST_FUSION_ADAPT_CLASS_NAMED_NS_E(r, _, ns) }
#define BOOST_FUSION_ADAPT_CLASS_NAMED_C(r, fullname, i, xy) \
template <> \
struct class_member_proxy<fullname, i> \
{ \
typedef BOOST_PP_TUPLE_ELEM(4, 0, xy) lvalue; \
typedef BOOST_PP_TUPLE_ELEM(4, 1, xy) rvalue; \
typedef remove_const<remove_reference<lvalue>::type>::type type; \
typedef add_reference<add_const<type>::type>::type cref_type; \
\
class_member_proxy(fullname& obj) : obj(obj) {} \
fullname& obj; \
\
class_member_proxy& operator=(cref_type val) \
{ \
BOOST_PP_TUPLE_ELEM(4, 3, xy); \
return *this; \
} \
\
operator lvalue() \
{ \
return BOOST_PP_TUPLE_ELEM(4, 2, xy); \
} \
}; \
\
template <> \
struct class_member<fullname, i> \
{ \
typedef class_member_proxy<fullname, i> proxy; \
typedef proxy::type type; \
typedef proxy::rvalue get_type; \
\
static get_type call(fullname const& obj) \
{ \
return BOOST_PP_TUPLE_ELEM(4, 2, xy); \
} \
\
static proxy call(fullname& obj) \
{ \
return proxy(obj); \
} \
}; \
/***/
#define BOOST_FUSION_ADAPT_CLASS_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \
BOOST_FUSION_ADAPT_CLASS_NAMED_NS( \
WRAPPED_TYPE,(boost)(fusion)(adapted),NAME,ATTRIBUTES)
#endif

View File

@ -1,105 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2009 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(FUSION_CLASS_ITERATOR_OCTOBER_4_2009_839M)
#define FUSION_CLASS_ITERATOR_OCTOBER_4_2009_839M
#include <boost/fusion/iterator/iterator_facade.hpp>
#include <boost/fusion/adapted/class/extension.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/minus.hpp>
#include <boost/config/no_tr1/utility.hpp>
namespace boost { namespace fusion
{
struct random_access_traversal_tag;
template <typename Class, int N_>
struct class_iterator
: iterator_facade<class_iterator<Class, N_>, random_access_traversal_tag>
{
BOOST_MPL_ASSERT_RELATION(N_, >=, 0);
BOOST_MPL_ASSERT_RELATION(N_, <=, extension::class_size<Class>::value);
typedef mpl::int_<N_> index;
typedef Class class_type;
class_iterator(Class& class_)
: class_(class_) {}
Class& class_;
template <typename Iterator>
struct value_of
: extension::class_member<Class, N_>
{
};
template <typename Iterator>
struct deref
{
typedef typename
mpl::if_<
is_const<Class>
, typename extension::class_member<Class, N_>::get_type
, typename extension::class_member<Class, N_>::proxy
>::type
type;
static type
call(Iterator const& iter)
{
return extension::class_member<Class, N_>::
call(iter.class_);
}
};
template <typename Iterator, typename N>
struct advance
{
typedef typename Iterator::index index;
typedef typename Iterator::class_type class_type;
typedef class_iterator<class_type, index::value + N::value> type;
static type
call(Iterator const& iter)
{
return type(iter.class_);
}
};
template <typename Iterator>
struct next : advance<Iterator, mpl::int_<1> > {};
template <typename Iterator>
struct prior : advance<Iterator, mpl::int_<-1> > {};
template <typename I1, typename I2>
struct distance : mpl::minus<typename I2::index, typename I1::index>
{
typedef typename
mpl::minus<
typename I2::index, typename I1::index
>::type
type;
static type
call(I1 const&, I2 const&)
{
return type();
}
};
};
}}
#endif

View File

@ -0,0 +1,83 @@
/*=============================================================================
Copyright (c) 2010 Christopher Schmidt
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)
==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_ADAPT_BASE_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_ADAPT_BASE_HPP
#include <boost/fusion/adapted/struct/detail/adapt_base.hpp>
#define BOOST_FUSION_ADAPT_CLASS_C_BASE(\
TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,ATTRIBUTE,ATTRIBUTE_TUPEL_SIZE) \
\
template< \
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
> \
struct class_member_proxy< \
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
, I \
> \
{ \
typedef \
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) \
type; \
\
class_member_proxy(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj)\
: obj(obj) \
{} \
\
template<class Arg> \
class_member_proxy& \
operator=(Arg val) \
{ \
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 3, ATTRIBUTE); \
return *this; \
} \
\
operator type() \
{ \
return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \
} \
\
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj; \
}; \
\
template< \
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
> \
struct struct_member<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ), I> \
{ \
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) type; \
typedef \
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) \
get_type; \
typedef \
class_member_proxy< \
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
, I \
> \
proxy; \
\
static get_type \
call(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const& obj) \
{ \
return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \
}; \
\
static proxy \
call(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj) \
{ \
return proxy(obj); \
}; \
};
namespace boost { namespace fusion { namespace extension
{
template <typename T, int N>
struct class_member_proxy;
}}}
#endif

View File

@ -1,70 +1,55 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2010 Christopher Schmidt
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_OCTOBER_4_2009_920PM)
#define BOOST_FUSION_AT_IMPL_OCTOBER_4_2009_920PM
#include <boost/fusion/support/detail/access.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/int.hpp>
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_AT_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_AT_IMPL_HPP
namespace boost { namespace fusion
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion { namespace extension
{
struct class_tag;
template<typename>
struct at_impl;
namespace extension
template <>
struct at_impl<class_tag>
{
template<typename T>
struct at_impl;
template <typename Class, int N>
struct class_member;
template <typename Class>
struct class_size;
template <>
struct at_impl<class_tag>
template<typename Seq, typename N>
struct apply
{
template <typename Sequence, typename N>
struct apply
typedef
extension::struct_member<
typename remove_const<Seq>::type
, N::value
>
member;
typedef typename
mpl::if_<
is_const<Seq>
, typename member::get_type
, typename member::proxy
>::type
type;
static type
call(Seq& seq)
{
static int const n_value = N::value;
BOOST_MPL_ASSERT_RELATION(
n_value, <=, extension::class_size<Sequence>::value);
typedef typename
extension::class_member<Sequence, N::value>
element;
typedef typename
mpl::if_<
is_const<Sequence>
, typename class_member<Sequence, N::value>::get_type
, typename class_member<Sequence, N::value>::proxy
>::type
type;
static type
call(Sequence& seq)
{
return extension::
class_member<Sequence, N::value>::call(seq);
}
//~ static typename class_member<Sequence, N::value>::get_type
//~ call(Sequence const& seq)
//~ {
//~ return extension::
//~ class_member<Sequence, N::value>::call(seq);
//~ }
};
return member::call(seq);
}
};
}
}}
};
template <>
struct at_impl<assoc_class_tag>
: at_impl<class_tag>
{};
}}}
#endif

View File

@ -1,54 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2007 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_AT_KEY_IMPL_OCTOBER_4_2009_920PM)
#define BOOST_FUSION_AT_KEY_IMPL_OCTOBER_4_2009_920PM
#include <boost/fusion/support/detail/access.hpp>
namespace boost { namespace fusion
{
struct class_tag;
namespace extension
{
template<typename T>
struct at_key_impl;
template <typename Class, typename Key>
struct class_assoc_member;
template <>
struct at_key_impl<class_tag>
{
template <typename Sequence, typename Key>
struct apply
{
typedef typename
extension::class_assoc_member<Sequence, Key>
element;
typedef typename
mpl::eval_if<
is_const<Sequence>
, detail::cref_result<element>
, detail::ref_result<element>
>::type
type;
static type
call(Sequence& seq)
{
return extension::
class_assoc_member<Sequence, Key>::call(seq);
}
};
};
}
}}
#endif

View File

@ -1,40 +1,65 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2010 Christopher Schmidt
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_OCTOBER_4_2009_920PM)
#define BOOST_FUSION_BEGIN_IMPL_OCTOBER_4_2009_920PM
#include <boost/fusion/adapted/class/class_iterator.hpp>
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_BEGIN_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_BEGIN_IMPL_HPP
namespace boost { namespace fusion
#include <boost/fusion/iterator/basic_iterator.hpp>
namespace boost { namespace fusion { namespace extension
{
struct class_tag;
template<typename>
struct begin_impl;
namespace extension
template <>
struct begin_impl<class_tag>
{
template<typename T>
struct begin_impl;
template <>
struct begin_impl<class_tag>
template <typename Seq>
struct apply
{
template <typename Sequence>
struct apply
{
typedef class_iterator<Sequence, 0> type;
typedef
basic_iterator<
class_iterator_tag
, random_access_traversal_tag
, Seq
, 0
>
type;
static type
call(Sequence& v)
{
return type(v);
}
};
static type
call(Seq& seq)
{
return type(seq,0);
}
};
}
}}
};
template <>
struct begin_impl<assoc_class_tag>
{
template <typename Seq>
struct apply
{
typedef
basic_iterator<
assoc_class_iterator_tag
, assoc_class_category
, Seq
, 0
>
type;
static type
call(Seq& seq)
{
return type(seq,0);
}
};
};
}}}
#endif

View File

@ -1,34 +1,31 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2010 Christopher Schmidt
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_OCTOBER_4_2009_919PM)
#define BOOST_FUSION_CATEGORY_OF_IMPL_OCTOBER_4_2009_919PM
#include <boost/config/no_tr1/utility.hpp>
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_CATEGORY_OF_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_CATEGORY_OF_IMPL_HPP
#include <boost/fusion/adapted/struct/detail/category_of_impl.hpp>
namespace boost { namespace fusion
{
struct class_tag;
struct random_access_traversal_tag;
namespace extension
{
template<typename T>
template<typename>
struct category_of_impl;
template<>
struct category_of_impl<class_tag>
{
template<typename T>
struct apply
{
typedef random_access_traversal_tag type;
};
};
: category_of_impl<struct_tag>
{};
template<>
struct category_of_impl<assoc_class_tag>
: category_of_impl<assoc_struct_tag>
{};
}
}}

View File

@ -0,0 +1,22 @@
/*=============================================================================
Copyright (c) 2010 Christopher Schmidt
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)
==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_DEREF_DATA_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_DEREF_DATA_IMPL_HPP
namespace boost { namespace fusion { namespace extension
{
template <typename>
struct deref_data_impl;
template <>
struct deref_data_impl<assoc_class_iterator_tag>
: deref_impl<assoc_class_iterator_tag>
{};
}}}
#endif

View File

@ -0,0 +1,55 @@
/*=============================================================================
Copyright (c) 2010 Christopher Schmidt
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)
==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_DEREF_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_DEREF_IMPL_HPP
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion { namespace extension
{
template <typename>
struct deref_impl;
template <>
struct deref_impl<class_iterator_tag>
{
template <typename It>
struct apply
{
typedef
extension::struct_member<
typename remove_const<typename It::seq_type>::type
, It::index::value
>
member;
typedef typename
mpl::if_<
is_const<typename It::seq_type>
, typename member::get_type
, typename member::proxy
>::type
type;
static type
call(It const& it)
{
return member::call(*it.seq);
}
};
};
template <>
struct deref_impl<assoc_class_iterator_tag>
: deref_impl<class_iterator_tag>
{};
}}}
#endif

View File

@ -1,48 +1,66 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2010 Christopher Schmidt
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_OCTOBER_4_2009_919PM)
#define BOOST_FUSION_END_IMPL_OCTOBER_4_2009_919PM
#include <boost/fusion/adapted/class/class_iterator.hpp>
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_END_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_END_IMPL_HPP
namespace boost { namespace fusion
#include <boost/fusion/iterator/basic_iterator.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion { namespace extension
{
struct class_tag;
template <typename>
struct end_impl;
namespace extension
template <>
struct end_impl<class_tag>
{
template <typename Tag>
struct end_impl;
template <typename Class>
struct class_size;
template <>
struct end_impl<class_tag>
template <typename Seq>
struct apply
{
template <typename Sequence>
struct apply
{
typedef
class_iterator<
Sequence
, class_size<Sequence>::value
>
type;
typedef
basic_iterator<
class_iterator_tag
, random_access_traversal_tag
, Seq
, struct_size<typename remove_const<Seq>::type>::value
>
type;
static type
call(Sequence& v)
{
return type(v);
}
};
static type
call(Seq& seq)
{
return type(seq,0);
}
};
}
}}
};
template <>
struct end_impl<assoc_class_tag>
{
template <typename Seq>
struct apply
{
typedef
basic_iterator<
assoc_class_iterator_tag
, assoc_class_category
, Seq
, struct_size<typename remove_const<Seq>::type>::value
>
type;
static type
call(Seq& seq)
{
return type(seq,0);
}
};
};
}}}
#endif

View File

@ -0,0 +1,23 @@
/*=============================================================================
Copyright (c) 2010 Christopher Schmidt
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)
==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_EXTENSION_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_EXTENSION_HPP
#include <boost/fusion/adapted/struct/detail/extension.hpp>
namespace boost { namespace fusion
{
struct class_tag;
struct class_iterator_tag;
struct assoc_class_tag;
struct assoc_class_iterator_tag;
typedef assoc_struct_category assoc_class_category;
}}
#endif

View File

@ -1,40 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2007 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_HAS_KEY_IMPL_OCTOBER_4_2009_919PM)
#define BOOST_FUSION_HAS_KEY_IMPL_OCTOBER_4_2009_919PM
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/not.hpp>
namespace boost { namespace fusion {
struct class_tag;
namespace extension
{
struct no_such_member;
template<typename T>
struct has_key_impl;
template<typename Class, typename Key>
struct class_assoc_member;
template<>
struct has_key_impl<class_tag>
{
template<typename Sequence, typename Key>
struct apply
: mpl::not_<is_same<no_such_member, typename class_assoc_member<Sequence, Key>::type> >
{
};
};
}
}}
#endif

View File

@ -1,31 +1,29 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2010 Christopher Schmidt
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_OCTOBER_4_2009_919PM)
#define BOOST_FUSION_IS_SEQUENCE_IMPL_OCTOBER_4_2009_919PM
#include <boost/mpl/bool.hpp>
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_IS_SEQUENCE_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_IS_SEQUENCE_IMPL_HPP
namespace boost { namespace fusion
#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
namespace boost { namespace fusion { namespace extension
{
struct class_tag;
template<typename>
struct is_sequence_impl;
namespace extension
{
template<typename Tag>
struct is_sequence_impl;
template<>
struct is_sequence_impl<class_tag>
: is_sequence_impl<struct_tag>
{};
template<>
struct is_sequence_impl<class_tag>
{
template<typename Sequence>
struct apply : mpl::true_ {};
};
}
}}
template <>
struct is_sequence_impl<assoc_class_tag>
: is_sequence_impl<assoc_struct_tag>
{};
}}}
#endif

View File

@ -1,32 +1,29 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2010 Christopher Schmidt
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_OCTOBER_4_2009_919PM)
#define BOOST_FUSION_IS_VIEW_IMPL_OCTOBER_4_2009_919PM
#include <boost/mpl/bool.hpp>
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_IS_VIEW_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_IS_VIEW_IMPL_HPP
namespace boost { namespace fusion
#include <boost/fusion/adapted/struct/detail/is_view_impl.hpp>
namespace boost { namespace fusion { namespace extension
{
struct class_tag;
template<typename>
struct is_view_impl;
namespace extension
{
template<typename Tag>
struct is_view_impl;
template<>
struct is_view_impl<class_tag>
: is_view_impl<struct_tag>
{};
template<>
struct is_view_impl<class_tag>
{
template<typename T>
struct apply : mpl::false_
{};
};
}
}}
template <>
struct is_view_impl<assoc_class_tag>
: is_view_impl<assoc_struct_tag>
{};
}}}
#endif

View File

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2010 Christopher Schmidt
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)
==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_KEY_OF_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_KEY_OF_IMPL_HPP
#include <boost/fusion/adapted/struct/detail/key_of_impl.hpp>
namespace boost { namespace fusion { namespace extension
{
template <typename>
struct key_of_impl;
template <>
struct key_of_impl<assoc_class_iterator_tag>
: key_of_impl<assoc_struct_iterator_tag>
{};
}}}
#endif

View File

@ -1,37 +1,29 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2010 Christopher Schmidt
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_OCTOBER_4_2009_919PM)
#define BOOST_FUSION_SIZE_IMPL_OCTOBER_4_2009_919PM
#include <boost/mpl/int.hpp>
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_SIZE_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_SIZE_IMPL_HPP
namespace boost { namespace fusion
#include <boost/fusion/adapted/struct/detail/size_impl.hpp>
namespace boost { namespace fusion { namespace extension
{
namespace extension
{
template <typename Class>
struct class_size;
}
template<typename>
struct size_impl;
struct class_tag;
template <>
struct size_impl<class_tag>
: size_impl<struct_tag>
{};
namespace extension
{
template<typename T>
struct size_impl;
template <>
struct size_impl<class_tag>
{
template <typename Sequence>
struct apply : extension::class_size<Sequence> {};
};
}
}}
template <>
struct size_impl<assoc_class_tag>
: size_impl<assoc_struct_tag>
{};
}}}
#endif

View File

@ -1,47 +1,29 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2010 Christopher Schmidt
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_OCTOBER_4_2009_918PM)
#define BOOST_FUSION_VALUE_AT_IMPL_OCTOBER_4_2009_918PM
#include <boost/mpl/if.hpp>
#include <boost/static_assert.hpp>
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_VALUE_AT_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_VALUE_AT_IMPL_HPP
namespace boost { namespace fusion
#include <boost/fusion/adapted/struct/detail/value_at_impl.hpp>
namespace boost { namespace fusion { namespace extension
{
struct class_tag;
template<typename>
struct value_at_impl;
namespace extension
{
template<typename T>
struct value_at_impl;
template <>
struct value_at_impl<class_tag>
: value_at_impl<struct_tag>
{};
template <typename Class, int N>
struct class_member;
template <typename Class>
struct class_size;
template <>
struct value_at_impl<class_tag>
{
template <typename Sequence, typename N>
struct apply
{
static int const n_value = N::value;
BOOST_MPL_ASSERT_RELATION(
n_value, <=, extension::class_size<Sequence>::value);
typedef typename
extension::class_member<Sequence, N::value>::type
type;
};
};
}
}}
template <>
struct value_at_impl<assoc_class_tag>
: value_at_impl<assoc_struct_tag>
{};
}}}
#endif

View File

@ -1,39 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2007 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_VALUE_AT_KEY_IMPL_OCTOBER_4_2009_918PM)
#define BOOST_FUSION_VALUE_AT_KEY_IMPL_OCTOBER_4_2009_918PM
#include <boost/mpl/if.hpp>
namespace boost { namespace fusion
{
struct class_tag;
namespace extension
{
template<typename T>
struct value_at_key_impl;
template <typename Class, typename Key>
struct class_assoc_member;
template <>
struct value_at_key_impl<class_tag>
{
template <typename Sequence, typename Key>
struct apply
{
typedef typename
extension::class_assoc_member<Sequence, Key>::type
type;
};
};
}
}}
#endif

View File

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2010 Christopher Schmidt
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)
==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_VALUE_OF_DATA_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_VALUE_OF_DATA_IMPL_HPP
#include <boost/fusion/adapted/struct/detail/value_of_data_impl.hpp>
namespace boost { namespace fusion { namespace extension
{
template <typename>
struct value_of_data_impl;
template <>
struct value_of_data_impl<assoc_class_iterator_tag>
: value_of_data_impl<assoc_struct_iterator_tag>
{};
}}}
#endif

View File

@ -0,0 +1,29 @@
/*=============================================================================
Copyright (c) 2010 Christopher Schmidt
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)
==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_VALUE_OF_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_VALUE_OF_IMPL_HPP
#include <boost/fusion/adapted/struct/detail/value_of_impl.hpp>
namespace boost { namespace fusion { namespace extension
{
template <typename>
struct value_of_impl;
template <>
struct value_of_impl<class_iterator_tag>
: value_of_impl<struct_iterator_tag>
{};
template <>
struct value_of_impl<assoc_class_iterator_tag>
: value_of_impl<class_iterator_tag>
{};
}}}
#endif

View File

@ -1,61 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2009 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(FUSION_CLASS_EXTENSION_OCTOBER_4_2009_839PM)
#define FUSION_CLASS_EXTENSION_OCTOBER_4_2009_839PM
#include <boost/type_traits/add_const.hpp>
namespace boost { namespace fusion
{
struct fusion_sequence_tag;
namespace extension
{
template <typename Class, int N>
struct class_member;
template <typename Class>
struct class_size;
template <typename Class, int N>
struct class_member<Class const, N> : class_member<Class, N> {};
template <typename Class>
struct class_size<Class const>
: class_size<Class>
{};
struct no_such_member;
template<typename Class, typename Key>
struct class_assoc_member
{
typedef no_such_member type;
};
template<typename Class, typename Key>
struct class_assoc_member<Class const, Key>
{
typedef typename
add_const<typename class_assoc_member<Class, Key>::type>::type
type;
static type&
call(Class const& class_)
{
return class_assoc_member<Class, Key>::call(
const_cast<Class&>(class_));
}
};
}
}}
#endif