diff options
Diffstat (limited to 'boost/fusion/adapted/struct')
24 files changed, 1563 insertions, 0 deletions
diff --git a/boost/fusion/adapted/struct/adapt_assoc_struct.hpp b/boost/fusion/adapted/struct/adapt_assoc_struct.hpp new file mode 100644 index 0000000000..755bffd1c6 --- /dev/null +++ b/boost/fusion/adapted/struct/adapt_assoc_struct.hpp @@ -0,0 +1,96 @@ +/*============================================================================= + Copyright (c) 2001-2007 Joel de Guzman + Copyright (c) 2007 Dan Marsden + Copyright (c) 2009-2011 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_STRUCT_ADAPT_ASSOC_STRUCT_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_ASSOC_STRUCT_HPP + +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/empty.hpp> +#include <boost/preprocessor/tuple/elem.hpp> +#include <boost/type_traits/add_reference.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/add_const.hpp> +#include <boost/type_traits/remove_const.hpp> + +#include <boost/fusion/adapted/struct/detail/extension.hpp> +#include <boost/fusion/adapted/struct/detail/adapt_base.hpp> +#include <boost/fusion/adapted/struct/detail/at_impl.hpp> +#include <boost/fusion/adapted/struct/detail/is_view_impl.hpp> +#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp> +#include <boost/fusion/adapted/struct/detail/value_at_impl.hpp> +#include <boost/fusion/adapted/struct/detail/category_of_impl.hpp> +#include <boost/fusion/adapted/struct/detail/size_impl.hpp> +#include <boost/fusion/adapted/struct/detail/begin_impl.hpp> +#include <boost/fusion/adapted/struct/detail/end_impl.hpp> +#include <boost/fusion/adapted/struct/detail/value_of_impl.hpp> +#include <boost/fusion/adapted/struct/detail/deref_impl.hpp> +#include <boost/fusion/adapted/struct/detail/deref_data_impl.hpp> +#include <boost/fusion/adapted/struct/detail/key_of_impl.hpp> +#include <boost/fusion/adapted/struct/detail/value_of_data_impl.hpp> + +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(X, Y, Z) \ + ((X, Y, Z)) BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_1 +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_1(X, Y, Z) \ + ((X, Y, Z)) BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0 +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0_END +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_1_END + +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_C_BASE( \ + TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,PREFIX,ATTRIBUTE) \ + \ + BOOST_FUSION_ADAPT_STRUCT_C_BASE( \ + TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, PREFIX, ATTRIBUTE, 3) \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ + > \ + struct struct_assoc_key<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ), I> \ + { \ + typedef BOOST_PP_TUPLE_ELEM(3, 2, ATTRIBUTE) type; \ + }; + +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_C( \ + TEMPLATE_PARAMS_SEQ,NAME_SEQ, I, ATTRIBUTE) \ + \ + BOOST_FUSION_ADAPT_ASSOC_STRUCT_C_BASE( \ + TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,BOOST_PP_EMPTY,ATTRIBUTE) + +#define BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT( \ + TEMPLATE_PARAMS_SEQ, NAME_SEQ, ATTRIBUTES) \ + \ + BOOST_FUSION_ADAPT_STRUCT_BASE( \ + (1)TEMPLATE_PARAMS_SEQ, \ + (1)NAME_SEQ, \ + assoc_struct_tag, \ + 0, \ + BOOST_PP_CAT( \ + BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \ + BOOST_FUSION_ADAPT_ASSOC_STRUCT_C) + +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT(NAME, ATTRIBUTES) \ + BOOST_FUSION_ADAPT_STRUCT_BASE( \ + (0), \ + (0)(NAME), \ + assoc_struct_tag, \ + 0, \ + BOOST_PP_CAT( \ + BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \ + BOOST_FUSION_ADAPT_ASSOC_STRUCT_C) + +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_AS_VIEW(NAME, ATTRIBUTES) \ + BOOST_FUSION_ADAPT_STRUCT_BASE( \ + (0), \ + (0)(NAME), \ + assoc_struct_tag, \ + 1, \ + BOOST_PP_CAT( \ + BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \ + BOOST_FUSION_ADAPT_ASSOC_STRUCT_C) + +#endif diff --git a/boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp b/boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp new file mode 100644 index 0000000000..92c3aa3e30 --- /dev/null +++ b/boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp @@ -0,0 +1,37 @@ +/*============================================================================= + Copyright (c) 2010-2011 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_STRUCT_ADAPT_ASSOC_STRUCT_NAMED_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_ASSOC_STRUCT_NAMED_HPP + +#include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp> +#include <boost/fusion/adapted/struct/detail/proxy_type.hpp> + +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_FILLER_0(X, Y, Z) \ + (X, obj.Y, Z) BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_FILLER_1 +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_FILLER_1(X, Y, Z) \ + (X, obj.Y, Z) BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_FILLER_0 +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_FILLER_0_END +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_FILLER_1_END + +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_NS( \ + WRAPPED_TYPE, NAMESPACE_SEQ, NAME, ATTRIBUTES) \ + \ + BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE_IMPL( \ + WRAPPED_TYPE,(0)NAMESPACE_SEQ,NAME) \ + \ + BOOST_FUSION_ADAPT_ASSOC_STRUCT_AS_VIEW( \ + BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ)NAME, \ + BOOST_PP_CAT( \ + BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_FILLER_0 ATTRIBUTES, \ + _END)) + +#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \ + BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_NS( \ + WRAPPED_TYPE,(boost)(fusion)(adapted),NAME,ATTRIBUTES) + +#endif diff --git a/boost/fusion/adapted/struct/adapt_struct.hpp b/boost/fusion/adapted/struct/adapt_struct.hpp new file mode 100644 index 0000000000..f20533c99e --- /dev/null +++ b/boost/fusion/adapted/struct/adapt_struct.hpp @@ -0,0 +1,71 @@ +/*============================================================================= + Copyright (c) 2001-2007 Joel de Guzman + Copyright (c) 2009-2011 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_STRUCT_ADAPT_STRUCT_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_STRUCT_HPP + +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/empty.hpp> +#include <boost/type_traits/add_reference.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/add_const.hpp> +#include <boost/type_traits/remove_const.hpp> + +#include <boost/fusion/adapted/struct/detail/extension.hpp> +#include <boost/fusion/adapted/struct/detail/adapt_base.hpp> +#include <boost/fusion/adapted/struct/detail/at_impl.hpp> +#include <boost/fusion/adapted/struct/detail/is_view_impl.hpp> +#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp> +#include <boost/fusion/adapted/struct/detail/value_at_impl.hpp> +#include <boost/fusion/adapted/struct/detail/category_of_impl.hpp> +#include <boost/fusion/adapted/struct/detail/size_impl.hpp> +#include <boost/fusion/adapted/struct/detail/begin_impl.hpp> +#include <boost/fusion/adapted/struct/detail/end_impl.hpp> +#include <boost/fusion/adapted/struct/detail/value_of_impl.hpp> +#include <boost/fusion/adapted/struct/detail/deref_impl.hpp> + +#define BOOST_FUSION_ADAPT_STRUCT_FILLER_0(X, Y) \ + ((X, Y)) BOOST_FUSION_ADAPT_STRUCT_FILLER_1 +#define BOOST_FUSION_ADAPT_STRUCT_FILLER_1(X, Y) \ + ((X, Y)) BOOST_FUSION_ADAPT_STRUCT_FILLER_0 +#define BOOST_FUSION_ADAPT_STRUCT_FILLER_0_END +#define BOOST_FUSION_ADAPT_STRUCT_FILLER_1_END + +#define BOOST_FUSION_ADAPT_STRUCT_C(TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE)\ + BOOST_FUSION_ADAPT_STRUCT_C_BASE( \ + TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,BOOST_PP_EMPTY,ATTRIBUTE,2) + +#define BOOST_FUSION_ADAPT_TPL_STRUCT(TEMPLATE_PARAMS_SEQ,NAME_SEQ, ATTRIBUTES) \ + BOOST_FUSION_ADAPT_STRUCT_BASE( \ + (1)TEMPLATE_PARAMS_SEQ, \ + (1)NAME_SEQ, \ + struct_tag, \ + 0, \ + ((0,0)) BOOST_PP_CAT( \ + BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END), \ + BOOST_FUSION_ADAPT_STRUCT_C) + +#define BOOST_FUSION_ADAPT_STRUCT(NAME, ATTRIBUTES) \ + BOOST_FUSION_ADAPT_STRUCT_BASE( \ + (0), \ + (0)(NAME), \ + struct_tag, \ + 0, \ + BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \ + BOOST_FUSION_ADAPT_STRUCT_C) + +#define BOOST_FUSION_ADAPT_STRUCT_AS_VIEW(NAME, ATTRIBUTES) \ + BOOST_FUSION_ADAPT_STRUCT_BASE( \ + (0), \ + (0)(NAME), \ + struct_tag, \ + 1, \ + BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \ + BOOST_FUSION_ADAPT_STRUCT_C) + +#endif diff --git a/boost/fusion/adapted/struct/adapt_struct_named.hpp b/boost/fusion/adapted/struct/adapt_struct_named.hpp new file mode 100644 index 0000000000..17a3d8e3ca --- /dev/null +++ b/boost/fusion/adapted/struct/adapt_struct_named.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + Copyright (c) 2001-2007 Joel de Guzman + Copyright (c) 2009-2010 Hartmut Kaiser + Copyright (c) 2010-2011 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_STRUCT_ADAPT_STRUCT_NAMED_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_STRUCT_NAMED_HPP + +#include <boost/fusion/adapted/struct/adapt_struct.hpp> +#include <boost/fusion/adapted/struct/detail/proxy_type.hpp> +#include <boost/preprocessor/empty.hpp> + +#define BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_0(X, Y) \ + (X, obj.Y) BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_1 +#define BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_1(X, Y) \ + (X, obj.Y) BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_0 +#define BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_0_END +#define BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_1_END + +#define BOOST_FUSION_ADAPT_STRUCT_NAMED_NS( \ + WRAPPED_TYPE, NAMESPACE_SEQ, NAME, ATTRIBUTES) \ + \ + BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE_IMPL( \ + WRAPPED_TYPE,(0)NAMESPACE_SEQ,NAME) \ + \ + BOOST_FUSION_ADAPT_STRUCT_AS_VIEW( \ + BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ)NAME, \ + BOOST_PP_CAT( \ + BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_0 ATTRIBUTES,_END)) + +#define BOOST_FUSION_ADAPT_STRUCT_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \ + BOOST_FUSION_ADAPT_STRUCT_NAMED_NS( \ + WRAPPED_TYPE,(boost)(fusion)(adapted),NAME,ATTRIBUTES) + +#endif diff --git a/boost/fusion/adapted/struct/define_assoc_struct.hpp b/boost/fusion/adapted/struct/define_assoc_struct.hpp new file mode 100644 index 0000000000..9d264e4085 --- /dev/null +++ b/boost/fusion/adapted/struct/define_assoc_struct.hpp @@ -0,0 +1,43 @@ +/*============================================================================= + Copyright (c) 2010-2011 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_STRUCT_DEFINE_ASSOC_STRUCT_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DEFINE_ASSOC_STRUCT_HPP + +#include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp> +#include <boost/fusion/adapted/struct/detail/define_struct.hpp> + +#define BOOST_FUSION_DEFINE_ASSOC_TPL_STRUCT( \ + TEMPLATE_PARAMS_SEQ, NAMESPACE_SEQ, NAME, ATTRIBUTES) \ + \ + BOOST_FUSION_DEFINE_TPL_STRUCT_IMPL( \ + TEMPLATE_PARAMS_SEQ, \ + (0)NAMESPACE_SEQ, \ + NAME, \ + BOOST_PP_CAT( \ + BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \ + 3) \ + \ + BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT( \ + TEMPLATE_PARAMS_SEQ, \ + (BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ) NAME)\ + TEMPLATE_PARAMS_SEQ, \ + ATTRIBUTES) + +#define BOOST_FUSION_DEFINE_ASSOC_STRUCT(NAMESPACE_SEQ, NAME, ATTRIBUTES) \ + BOOST_FUSION_DEFINE_STRUCT_IMPL( \ + (0)NAMESPACE_SEQ, \ + NAME, \ + BOOST_PP_CAT( \ + BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \ + 3) \ + \ + BOOST_FUSION_ADAPT_ASSOC_STRUCT( \ + BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ) NAME, \ + ATTRIBUTES) + +#endif diff --git a/boost/fusion/adapted/struct/define_struct.hpp b/boost/fusion/adapted/struct/define_struct.hpp new file mode 100644 index 0000000000..b733115ac0 --- /dev/null +++ b/boost/fusion/adapted/struct/define_struct.hpp @@ -0,0 +1,41 @@ +/*============================================================================= + Copyright (c) 2010-2011 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_STRUCT_DEFINE_STRUCT_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DEFINE_STRUCT_HPP + +#include <boost/fusion/adapted/struct/adapt_struct.hpp> +#include <boost/fusion/adapted/struct/detail/define_struct.hpp> + +#define BOOST_FUSION_DEFINE_TPL_STRUCT( \ + TEMPLATE_PARAMS_SEQ, NAMESPACE_SEQ, NAME, ATTRIBUTES) \ + \ + BOOST_FUSION_DEFINE_TPL_STRUCT_IMPL( \ + TEMPLATE_PARAMS_SEQ, \ + (0)NAMESPACE_SEQ, \ + NAME, \ + BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \ + 2) \ + \ + BOOST_FUSION_ADAPT_TPL_STRUCT( \ + TEMPLATE_PARAMS_SEQ, \ + (BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ) NAME)\ + TEMPLATE_PARAMS_SEQ, \ + ATTRIBUTES) + +#define BOOST_FUSION_DEFINE_STRUCT(NAMESPACE_SEQ, NAME, ATTRIBUTES) \ + BOOST_FUSION_DEFINE_STRUCT_IMPL( \ + (0)NAMESPACE_SEQ, \ + NAME, \ + BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \ + 2) \ + \ + BOOST_FUSION_ADAPT_STRUCT( \ + BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ) NAME, \ + ATTRIBUTES) + +#endif diff --git a/boost/fusion/adapted/struct/detail/adapt_base.hpp b/boost/fusion/adapted/struct/detail/adapt_base.hpp new file mode 100644 index 0000000000..1c8f040850 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/adapt_base.hpp @@ -0,0 +1,245 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + Copyright (c) 2009-2011 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_STRUCT_DETAIL_ADAPT_BASE_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_ADAPT_BASE_HPP + +#include <boost/config.hpp> +#include <boost/fusion/support/tag_of_fwd.hpp> + +#include <boost/preprocessor/empty.hpp> +#include <boost/preprocessor/stringize.hpp> +#include <boost/preprocessor/control/if.hpp> +#include <boost/preprocessor/seq/size.hpp> +#include <boost/preprocessor/seq/for_each.hpp> +#include <boost/preprocessor/seq/for_each_i.hpp> +#include <boost/preprocessor/seq/enum.hpp> +#include <boost/preprocessor/seq/seq.hpp> +#include <boost/preprocessor/tuple/eat.hpp> +#include <boost/preprocessor/tuple/elem.hpp> +#include <boost/preprocessor/arithmetic/dec.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/tag.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/type_traits/add_const.hpp> + +#define BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME_TEMPLATE_PARAMS(SEQ) \ + BOOST_PP_SEQ_HEAD(SEQ)<BOOST_PP_SEQ_ENUM(BOOST_PP_SEQ_TAIL(SEQ))> \ + BOOST_PP_EMPTY() + +#define BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(SEQ) \ + BOOST_PP_IF( \ + BOOST_PP_SEQ_HEAD(SEQ), \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME_TEMPLATE_PARAMS, \ + BOOST_PP_SEQ_HEAD)(BOOST_PP_SEQ_TAIL(SEQ)) + +#define BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS_IMPL_C(R, _, ELEM) \ + (typename ELEM) +#define BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS_IMPL(SEQ) \ + BOOST_PP_SEQ_ENUM( \ + BOOST_PP_SEQ_FOR_EACH( \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS_IMPL_C, \ + _, \ + BOOST_PP_SEQ_TAIL(SEQ))) +#define BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(SEQ) \ + BOOST_PP_IF( \ + BOOST_PP_SEQ_HEAD(SEQ), \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS_IMPL, \ + BOOST_PP_TUPLE_EAT(1))(SEQ) + +#ifdef BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS +# define BOOST_FUSION_ADAPT_STRUCT_TAG_OF_SPECIALIZATION( \ + MODIFIER, TEMPLATE_PARAMS_SEQ, NAME_SEQ, TAG) \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ + > \ + struct tag_of< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) MODIFIER \ + , void \ + > \ + { \ + typedef TAG type; \ + }; +#else +# define BOOST_FUSION_ADAPT_STRUCT_TAG_OF_SPECIALIZATION( \ + MODIFIER, TEMPLATE_PARAMS_SEQ, NAME_SEQ, TAG) \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ + > \ + struct tag_of<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) MODIFIER> \ + { \ + typedef TAG type; \ + }; +#endif + +#define BOOST_FUSION_ADAPT_STRUCT_BASE_UNPACK_AND_CALL(R,DATA,I,ATTRIBUTE) \ + BOOST_PP_TUPLE_ELEM(3,0,DATA)( \ + BOOST_PP_TUPLE_ELEM(3,1,DATA), \ + BOOST_PP_TUPLE_ELEM(3,2,DATA), \ + I, \ + ATTRIBUTE) + +#ifdef BOOST_MSVC +# define BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAM(R,_,ELEM) \ + typedef ELEM ELEM; +# define BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS_IMPL(SEQ) \ + BOOST_PP_SEQ_FOR_EACH( \ + BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAM, \ + _, \ + BOOST_PP_SEQ_TAIL(SEQ)) +# define BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS(SEQ) \ + BOOST_PP_IF( \ + BOOST_PP_SEQ_HEAD(SEQ), \ + BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS_IMPL, \ + BOOST_PP_TUPLE_EAT(1))(SEQ) +#else +# define BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS(SEQ) +#endif + +#define BOOST_FUSION_ADAPT_STRUCT_C_BASE( \ + TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,PREFIX,ATTRIBUTE,ATTRIBUTE_TUPEL_SIZE) \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ + > \ + struct access::struct_member< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ + , I \ + > \ + { \ + typedef \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) \ + attribute_type; \ + BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS( \ + TEMPLATE_PARAMS_SEQ) \ + \ + typedef attribute_type type; \ + \ + template<typename Seq> \ + struct apply \ + { \ + typedef typename \ + add_reference< \ + typename mpl::eval_if< \ + is_const<Seq> \ + , add_const<attribute_type> \ + , mpl::identity<attribute_type> \ + >::type \ + >::type \ + type; \ + \ + static type \ + call(Seq& seq) \ + { \ + return seq.PREFIX() \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE); \ + } \ + }; \ + }; \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ + > \ + struct struct_member_name< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ + , I \ + > \ + { \ + typedef char const* type; \ + \ + static type \ + call() \ + { \ + return BOOST_PP_STRINGIZE( \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,1,ATTRIBUTE)); \ + } \ + }; + +#define BOOST_FUSION_ADAPT_STRUCT_BASE( \ + TEMPLATE_PARAMS_SEQ, \ + NAME_SEQ, \ + TAG, \ + IS_VIEW, \ + ATTRIBUTES_SEQ, \ + ATTRIBUTES_CALLBACK) \ + \ +namespace boost \ +{ \ + namespace fusion \ + { \ + namespace traits \ + { \ + BOOST_FUSION_ADAPT_STRUCT_TAG_OF_SPECIALIZATION( \ + BOOST_PP_EMPTY(), TEMPLATE_PARAMS_SEQ, NAME_SEQ, TAG) \ + BOOST_FUSION_ADAPT_STRUCT_TAG_OF_SPECIALIZATION( \ + const, TEMPLATE_PARAMS_SEQ, NAME_SEQ, TAG) \ + } \ + \ + namespace extension \ + { \ + BOOST_PP_IF( \ + BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ)), \ + BOOST_PP_SEQ_FOR_EACH_I_R, \ + BOOST_PP_TUPLE_EAT(4))( \ + 1, \ + BOOST_FUSION_ADAPT_STRUCT_BASE_UNPACK_AND_CALL, \ + (ATTRIBUTES_CALLBACK,TEMPLATE_PARAMS_SEQ,NAME_SEQ), \ + BOOST_PP_SEQ_TAIL(ATTRIBUTES_SEQ)) \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS( \ + TEMPLATE_PARAMS_SEQ) \ + > \ + struct struct_size<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)> \ + : mpl::int_<BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ))> \ + {}; \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS( \ + TEMPLATE_PARAMS_SEQ) \ + > \ + struct struct_is_view< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ + > \ + : mpl::BOOST_PP_IF(IS_VIEW,true_,false_) \ + {}; \ + } \ + } \ + \ + namespace mpl \ + { \ + template<typename> \ + struct sequence_tag; \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS( \ + TEMPLATE_PARAMS_SEQ) \ + > \ + struct sequence_tag<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)> \ + { \ + typedef fusion::fusion_sequence_tag type; \ + }; \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS( \ + TEMPLATE_PARAMS_SEQ) \ + > \ + struct sequence_tag< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const \ + > \ + { \ + typedef fusion::fusion_sequence_tag type; \ + }; \ + } \ +} + +#endif diff --git a/boost/fusion/adapted/struct/detail/at_impl.hpp b/boost/fusion/adapted/struct/detail/at_impl.hpp new file mode 100644 index 0000000000..68fd241a88 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/at_impl.hpp @@ -0,0 +1,38 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + Copyright (c) 2009-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_STRUCT_DETAIL_AT_IMPL_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_AT_IMPL_HPP + +#include <boost/mpl/int.hpp> + +namespace boost { namespace fusion { namespace extension +{ + template<typename> + struct at_impl; + + template <> + struct at_impl<struct_tag> + { + template <typename Seq, typename N> + struct apply + : access::struct_member< + typename remove_const<Seq>::type + , N::value + >::template apply<Seq> + {}; + }; + + template <> + struct at_impl<assoc_struct_tag> + : at_impl<struct_tag> + {}; +}}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/begin_impl.hpp b/boost/fusion/adapted/struct/detail/begin_impl.hpp new file mode 100644 index 0000000000..a7901fcad5 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/begin_impl.hpp @@ -0,0 +1,67 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + Copyright (c) 2009-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_STRUCT_DETAIL_BEGIN_IMPL_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_BEGIN_IMPL_HPP + +#include <boost/fusion/iterator/basic_iterator.hpp> + +namespace boost { namespace fusion { namespace extension +{ + template<typename> + struct begin_impl; + + template <> + struct begin_impl<struct_tag> + { + template <typename Seq> + struct apply + { + typedef + basic_iterator< + struct_iterator_tag + , random_access_traversal_tag + , Seq + , 0 + > + type; + + static type + call(Seq& seq) + { + return type(seq,0); + } + }; + }; + + template <> + struct begin_impl<assoc_struct_tag> + { + template <typename Seq> + struct apply + { + typedef + basic_iterator< + struct_iterator_tag + , assoc_struct_category + , Seq + , 0 + > + type; + + static type + call(Seq& seq) + { + return type(seq,0); + } + }; + }; +}}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/category_of_impl.hpp b/boost/fusion/adapted/struct/detail/category_of_impl.hpp new file mode 100644 index 0000000000..b98e824202 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/category_of_impl.hpp @@ -0,0 +1,42 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + Copyright (c) 2009-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_STRUCT_DETAIL_CATEGORY_OF_IMPL_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_CATEGORY_OF_IMPL_HPP + +namespace boost { namespace fusion +{ + namespace extension + { + template<typename> + struct category_of_impl; + + template<> + struct category_of_impl<struct_tag> + { + template<typename Seq> + struct apply + { + typedef random_access_traversal_tag type; + }; + }; + + template<> + struct category_of_impl<assoc_struct_tag> + { + template<typename Seq> + struct apply + { + typedef assoc_struct_category type; + }; + }; + } +}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/define_struct.hpp b/boost/fusion/adapted/struct/detail/define_struct.hpp new file mode 100644 index 0000000000..53f1e5d646 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/define_struct.hpp @@ -0,0 +1,353 @@ +/*============================================================================= + Copyright (c) 2010-2011 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_STRUCT_DEFINE_STRUCT_HPP +#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_DEFINE_STRUCT_HPP + +#include <boost/config.hpp> +#include <boost/fusion/sequence/intrinsic/begin.hpp> +#include <boost/fusion/iterator/deref.hpp> +#include <boost/fusion/iterator/next.hpp> +#include <boost/fusion/iterator/advance.hpp> +#include <boost/fusion/adapted/struct/detail/adapt_base.hpp> +#include <boost/fusion/adapted/struct/detail/namespace.hpp> +#include <boost/preprocessor/inc.hpp> +#include <boost/preprocessor/if.hpp> +#include <boost/preprocessor/expr_if.hpp> +#include <boost/preprocessor/dec.hpp> +#include <boost/preprocessor/logical/not.hpp> +#include <boost/preprocessor/punctuation/comma_if.hpp> +#include <boost/preprocessor/comparison/equal.hpp> +#include <boost/preprocessor/seq/seq.hpp> +#include <boost/preprocessor/seq/for_each.hpp> +#include <boost/preprocessor/seq/for_each_i.hpp> +#include <boost/preprocessor/seq/enum.hpp> +#include <boost/preprocessor/seq/size.hpp> +#include <boost/preprocessor/tuple/elem.hpp> +#include <boost/preprocessor/tuple/eat.hpp> +#include <boost/call_traits.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/utility/enable_if.hpp> + +#define BOOST_FUSION_DEFINE_STRUCT_COPY_CTOR_FILLER_I( \ + R, ATTRIBUTE_TUPEL_SIZE, I, ATTRIBUTE) \ + \ + BOOST_PP_COMMA_IF(I) \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,1,ATTRIBUTE)( \ + other_self.BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,1,ATTRIBUTE)) + +#define BOOST_FUSION_DEFINE_STRUCT_ASSIGN_FILLER_I( \ + R, ATTRIBUTE_TUPEL_SIZE, I_, ATTRIBUTE) \ + \ + BOOST_PP_EXPR_IF( \ + I_, \ + typedef typename \ + boost::fusion::result_of::next< \ + BOOST_PP_CAT(I,BOOST_PP_DEC(I_)) \ + >::type \ + BOOST_PP_CAT(I,I_); \ + BOOST_PP_CAT(I,I_) BOOST_PP_CAT(i,I_)= \ + boost::fusion::next(BOOST_PP_CAT(i,BOOST_PP_DEC(I_))); \ + ) \ + \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,1,ATTRIBUTE)= \ + boost::fusion::deref(BOOST_PP_CAT(i,I_)); + +#define BOOST_FUSION_DEFINE_STRUCT_ASSIGN_OP( \ + ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + template<typename Seq> \ + self_type& \ + operator=(Seq const& seq) \ + { \ + typedef typename \ + boost::fusion::result_of::begin<Seq const>::type \ + I0; \ + I0 i0=boost::fusion::begin(seq); \ + \ + BOOST_PP_SEQ_FOR_EACH_I_R( \ + 1, \ + BOOST_FUSION_DEFINE_STRUCT_ASSIGN_FILLER_I, \ + ATTRIBUTE_TUPEL_SIZE, \ + ATTRIBUTES_SEQ) \ + \ + return *this; \ + } + +#define BOOST_FUSION_DEFINE_STRUCT_ATTR_I(R, ATTRIBUTE_TUPEL_SIZE, ATTRIBUTE) \ + \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,0,ATTRIBUTE) \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,1,ATTRIBUTE); + +#define BOOST_FUSION_DEFINE_STRUCT_SEQ_CTOR_FILLER_I( \ + R, ATTRIBUTE_TUPEL_SIZE, I, ATTRIBUTE) \ + \ + BOOST_PP_COMMA_IF(I) \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,1,ATTRIBUTE)( \ + boost::fusion::deref(boost::fusion::advance_c<I>(boost::fusion::begin( \ + seq)))) + +#define BOOST_FUSION_DEFINE_STRUCT_SEQ_CTOR_DISABLER( \ + ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + , typename boost::disable_if< \ + boost::is_convertible< \ + Seq const& \ + , BOOST_PP_TUPLE_ELEM( \ + ATTRIBUTE_TUPEL_SIZE, \ + 0, \ + BOOST_PP_SEQ_HEAD(ATTRIBUTES_SEQ)) \ + > \ + >::type* =0 + +#define BOOST_FUSION_DEFINE_STRUCT_SEQ_DEFAULT_CTOR_FILLER_I( \ + R, ATTRIBUTE_TUPEL_SIZE, I, ATTRIBUTE) \ + \ + BOOST_PP_COMMA_IF(I) \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,1,ATTRIBUTE)() + +#define BOOST_FUSION_DEFINE_STRUCT_IMPL_IMPL( \ + NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + BOOST_PP_SEQ_FOR_EACH_R( \ + 1, \ + BOOST_FUSION_DEFINE_STRUCT_ATTR_I, \ + ATTRIBUTE_TUPEL_SIZE, \ + ATTRIBUTES_SEQ) \ + \ + NAME() \ + : BOOST_PP_SEQ_FOR_EACH_I_R( \ + 1, \ + BOOST_FUSION_DEFINE_STRUCT_SEQ_DEFAULT_CTOR_FILLER_I, \ + ATTRIBUTE_TUPEL_SIZE, \ + ATTRIBUTES_SEQ) \ + {} \ + \ + NAME(self_type const& other_self) \ + : BOOST_PP_SEQ_FOR_EACH_I_R( \ + 1, \ + BOOST_FUSION_DEFINE_STRUCT_COPY_CTOR_FILLER_I, \ + ATTRIBUTE_TUPEL_SIZE, \ + ATTRIBUTES_SEQ) \ + {} \ + \ + template<typename Seq> \ + NAME(Seq const& seq \ + BOOST_PP_IF( \ + BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ)), \ + BOOST_PP_TUPLE_EAT(2), \ + BOOST_FUSION_DEFINE_STRUCT_SEQ_CTOR_DISABLER)( \ + ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + ) \ + : BOOST_PP_SEQ_FOR_EACH_I_R( \ + 1, \ + BOOST_FUSION_DEFINE_STRUCT_SEQ_CTOR_FILLER_I, \ + ATTRIBUTE_TUPEL_SIZE, \ + ATTRIBUTES_SEQ) \ + {} \ + \ + BOOST_FUSION_DEFINE_STRUCT_ASSIGN_OP(ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) + +#define BOOST_FUSION_DEFINE_STRUCT_CTOR_1( \ + NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + explicit \ + NAME(boost::call_traits< \ + BOOST_PP_TUPLE_ELEM( \ + ATTRIBUTE_TUPEL_SIZE,0,BOOST_PP_SEQ_HEAD(ATTRIBUTES_SEQ)) \ + >::param_type arg) \ + : BOOST_PP_TUPLE_ELEM( \ + ATTRIBUTE_TUPEL_SIZE,1,BOOST_PP_SEQ_HEAD(ATTRIBUTES_SEQ))(arg) \ + {} + +#define BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR_1( \ + TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + explicit \ + NAME(typename boost::call_traits< \ + typename boost::fusion::detail::get_first_arg< \ + BOOST_PP_TUPLE_ELEM( \ + ATTRIBUTE_TUPEL_SIZE, \ + 0, \ + BOOST_PP_SEQ_HEAD(ATTRIBUTES_SEQ)) \ + , BOOST_PP_SEQ_HEAD(TEMPLATE_PARAMS_SEQ) \ + >::type \ + >::param_type arg) \ + : BOOST_PP_TUPLE_ELEM( \ + ATTRIBUTE_TUPEL_SIZE,1,BOOST_PP_SEQ_HEAD(ATTRIBUTES_SEQ))(arg) \ + {} + +#define BOOST_FUSION_DEFINE_STRUCT_CTOR_FILLER_I( \ + R, ATTRIBUTE_TUPEL_SIZE, I, ATTRIBUTE) \ + \ + BOOST_PP_COMMA_IF(I) \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,1,ATTRIBUTE)(BOOST_PP_CAT(_,I)) + +#define BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR_ARG_I(R, DATA, I, ATTRIBUTE) \ + \ + BOOST_PP_COMMA_IF(I) \ + typename boost::call_traits< \ + typename boost::fusion::detail::get_first_arg< \ + BOOST_PP_TUPLE_ELEM( \ + BOOST_PP_TUPLE_ELEM(3,0,DATA), \ + 0, \ + ATTRIBUTE) \ + , BOOST_PP_TUPLE_ELEM(3,2,DATA) \ + >::type \ + >::param_type BOOST_PP_CAT(_,I) + +#define BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR_N( \ + TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + NAME(BOOST_PP_SEQ_FOR_EACH_I_R( \ + 1, \ + BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR_ARG_I, \ + ( \ + ATTRIBUTE_TUPEL_SIZE, \ + BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ), \ + BOOST_PP_SEQ_HEAD(TEMPLATE_PARAMS_SEQ) \ + ), \ + ATTRIBUTES_SEQ)) \ + : BOOST_PP_SEQ_FOR_EACH_I_R( \ + 1, \ + BOOST_FUSION_DEFINE_STRUCT_CTOR_FILLER_I, \ + ATTRIBUTE_TUPEL_SIZE, \ + ATTRIBUTES_SEQ) \ + {} + +#define BOOST_FUSION_DEFINE_STRUCT_CTOR_ARG_I( \ + R, ATTRIBUTE_TUPEL_SIZE, I, ATTRIBUTE) \ + \ + BOOST_PP_COMMA_IF(I) \ + boost::call_traits< \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,0,ATTRIBUTE) \ + >::param_type BOOST_PP_CAT(_,I) + +#define BOOST_FUSION_DEFINE_STRUCT_CTOR_N( \ + NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + NAME(BOOST_PP_SEQ_FOR_EACH_I_R( \ + 1, \ + BOOST_FUSION_DEFINE_STRUCT_CTOR_ARG_I, \ + ATTRIBUTE_TUPEL_SIZE, \ + ATTRIBUTES_SEQ)) \ + : BOOST_PP_SEQ_FOR_EACH_I_R( \ + 1, \ + BOOST_FUSION_DEFINE_STRUCT_CTOR_FILLER_I, \ + ATTRIBUTE_TUPEL_SIZE, \ + ATTRIBUTES_SEQ) \ + {} + +#define BOOST_FUSION_DEFINE_STRUCT_CTOR( \ + NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ)), \ + BOOST_FUSION_DEFINE_STRUCT_CTOR_N, \ + BOOST_FUSION_DEFINE_STRUCT_CTOR_1)( \ + NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) + +#define BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR( \ + TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ)), \ + BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR_N, \ + BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR_1)( \ + TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) + +#define BOOST_FUSION_DEFINE_NONEMPTY_STRUCT_IMPL( \ + NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + BOOST_FUSION_DEFINE_STRUCT_IMPL_IMPL( \ + NAME, BOOST_PP_SEQ_TAIL(ATTRIBUTES_SEQ), ATTRIBUTE_TUPEL_SIZE) \ + \ + BOOST_FUSION_DEFINE_STRUCT_CTOR( \ + NAME, BOOST_PP_SEQ_TAIL(ATTRIBUTES_SEQ), ATTRIBUTE_TUPEL_SIZE) + +#define BOOST_FUSION_DEFINE_EMPTY_STRUCT_IMPL( \ + NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + template<typename Seq> \ + NAME(Seq const&) \ + {} \ + \ + template<typename Seq> \ + self_type& \ + operator=(Seq const& seq) \ + { \ + return *this; \ + } + +#define BOOST_FUSION_DEFINE_STRUCT_IMPL( \ + NAMESPACE_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_BEGIN(NAMESPACE_SEQ) \ + \ + struct NAME \ + { \ + typedef NAME self_type; \ + \ + BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ)), \ + BOOST_FUSION_DEFINE_NONEMPTY_STRUCT_IMPL, \ + BOOST_FUSION_DEFINE_EMPTY_STRUCT_IMPL)( \ + NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + }; \ + \ + BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_END(NAMESPACE_SEQ) + +#define BOOST_FUSION_DEFINE_NONEMPTY_TPL_STRUCT_IMPL( \ + TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + BOOST_FUSION_DEFINE_STRUCT_IMPL_IMPL( \ + NAME, BOOST_PP_SEQ_TAIL(ATTRIBUTES_SEQ), ATTRIBUTE_TUPEL_SIZE) \ + \ + BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR( \ + TEMPLATE_PARAMS_SEQ, \ + NAME, \ + BOOST_PP_SEQ_TAIL(ATTRIBUTES_SEQ), \ + ATTRIBUTE_TUPEL_SIZE) + +#define BOOST_FUSION_DEFINE_EMPTY_TPL_STRUCT_IMPL( \ + TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \ + \ + BOOST_FUSION_DEFINE_EMPTY_STRUCT_IMPL( \ + NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) + +#define BOOST_FUSION_DEFINE_TPL_STRUCT_IMPL( \ + TEMPLATE_PARAMS_SEQ, \ + NAMESPACE_SEQ, \ + NAME, \ + ATTRIBUTES_SEQ, \ + ATTRIBUTE_TUPEL_SIZE) \ + \ + BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_BEGIN(NAMESPACE_SEQ) \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS_IMPL( \ + (0)TEMPLATE_PARAMS_SEQ) \ + > \ + struct NAME \ + { \ + typedef NAME self_type; \ + \ + BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ)), \ + BOOST_FUSION_DEFINE_NONEMPTY_TPL_STRUCT_IMPL, \ + BOOST_FUSION_DEFINE_EMPTY_TPL_STRUCT_IMPL)( \ + TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE)\ + }; \ + \ + BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_END(NAMESPACE_SEQ) + +namespace boost { namespace fusion { namespace detail +{ + template<typename A1, typename A2> + struct get_first_arg + { + typedef A1 type; + }; +}}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/deref_data_impl.hpp b/boost/fusion/adapted/struct/detail/deref_data_impl.hpp new file mode 100644 index 0000000000..d3b6ced6c6 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/deref_data_impl.hpp @@ -0,0 +1,22 @@ +/*============================================================================= + Copyright (c) 2009-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_STRUCT_DETAIL_DEREF_DATA_IMPL_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_DEREF_DATA_IMPL_HPP + +namespace boost { namespace fusion { namespace extension +{ + template <typename> + struct deref_data_impl; + + template <> + struct deref_data_impl<struct_iterator_tag> + : deref_impl<struct_iterator_tag> + {}; +}}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/deref_impl.hpp b/boost/fusion/adapted/struct/detail/deref_impl.hpp new file mode 100644 index 0000000000..3f25efef58 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/deref_impl.hpp @@ -0,0 +1,41 @@ +/*============================================================================= + Copyright (c) 2009-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_STRUCT_DETAIL_DEREF_IMPL_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_DEREF_IMPL_HPP + +namespace boost { namespace fusion { namespace extension +{ + template <typename> + struct deref_impl; + + template <> + struct deref_impl<struct_iterator_tag> + { + template <typename It> + struct apply + { + typedef typename + access::struct_member< + typename remove_const<typename It::seq_type>::type + , It::index::value + >::template apply<typename It::seq_type> + impl; + + typedef typename impl::type type; + + static + type + call(It const& it) + { + return impl::call(*it.seq); + } + }; + }; +}}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/end_impl.hpp b/boost/fusion/adapted/struct/detail/end_impl.hpp new file mode 100644 index 0000000000..0d09092957 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/end_impl.hpp @@ -0,0 +1,67 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + Copyright (c) 2009-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_STRUCT_DETAIL_END_IMPL_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_END_IMPL_HPP + +#include <boost/fusion/iterator/basic_iterator.hpp> + +namespace boost { namespace fusion { namespace extension +{ + template <typename> + struct end_impl; + + template <> + struct end_impl<struct_tag> + { + template <typename Seq> + struct apply + { + typedef + basic_iterator< + struct_iterator_tag + , random_access_traversal_tag + , Seq + , struct_size<typename remove_const<Seq>::type>::value + > + type; + + static type + call(Seq& seq) + { + return type(seq,0); + } + }; + }; + + template <> + struct end_impl<assoc_struct_tag> + { + template <typename Seq> + struct apply + { + typedef + basic_iterator< + struct_iterator_tag + , assoc_struct_category + , Seq + , struct_size<typename remove_const<Seq>::type>::value + > + type; + + static type + call(Seq& seq) + { + return type(seq,0); + } + }; + }; +}}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/extension.hpp b/boost/fusion/adapted/struct/detail/extension.hpp new file mode 100644 index 0000000000..17edb89dca --- /dev/null +++ b/boost/fusion/adapted/struct/detail/extension.hpp @@ -0,0 +1,57 @@ +/*============================================================================= + Copyright (c) 2001-2007 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + Copyright (c) 2009-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_STRUCT_DETAIL_EXTENSION_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_EXTENSION_HPP + +#include <boost/fusion/support/category_of.hpp> + +namespace boost { namespace fusion +{ + struct struct_tag; + struct struct_iterator_tag; + struct assoc_struct_tag; + struct fusion_sequence_tag; + + struct assoc_struct_category + : random_access_traversal_tag, associative_tag + {}; + + namespace extension + { + struct no_such_member; + + struct access + { + template<typename Seq, int N> + struct struct_member; + + template<typename Seq, int N> + struct adt_attribute_access; + }; + + template <typename T, int N, bool Const> + struct adt_attribute_proxy; + + template<typename Seq, int N> + struct struct_member_name; + + template<typename Seq> + struct struct_size; + + template<typename Seq> + struct struct_is_view; + + template<typename Seq, int N> + struct struct_assoc_key; + + } +}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/is_sequence_impl.hpp b/boost/fusion/adapted/struct/detail/is_sequence_impl.hpp new file mode 100644 index 0000000000..c32222f8cf --- /dev/null +++ b/boost/fusion/adapted/struct/detail/is_sequence_impl.hpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + Copyright (c) 2009-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_STRUCT_DETAIL_IS_SEQUENCE_IMPL_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_IS_SEQUENCE_IMPL_HPP + +#include <boost/mpl/bool.hpp> + +namespace boost { namespace fusion { namespace extension +{ + template<typename> + struct is_sequence_impl; + + template<> + struct is_sequence_impl<struct_tag> + { + template<typename Seq> + struct apply + : mpl::true_ + {}; + }; + + template <> + struct is_sequence_impl<assoc_struct_tag> + : is_sequence_impl<struct_tag> + {}; +}}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/is_view_impl.hpp b/boost/fusion/adapted/struct/detail/is_view_impl.hpp new file mode 100644 index 0000000000..71d284077c --- /dev/null +++ b/boost/fusion/adapted/struct/detail/is_view_impl.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + Copyright (c) 2009-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_STRUCT_DETAIL_IS_VIEW_IMPL_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_IS_VIEW_IMPL_HPP + +namespace boost { namespace fusion { namespace extension +{ + template<typename> + struct is_view_impl; + + template<> + struct is_view_impl<struct_tag> + { + template<typename Seq> + struct apply + : struct_is_view<typename remove_const<Seq>::type> + {}; + }; + + template <> + struct is_view_impl<assoc_struct_tag> + : is_view_impl<struct_tag> + {}; +}}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/key_of_impl.hpp b/boost/fusion/adapted/struct/detail/key_of_impl.hpp new file mode 100644 index 0000000000..d24a24b1b3 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/key_of_impl.hpp @@ -0,0 +1,29 @@ +/*============================================================================= + Copyright (c) 2009-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_STRUCT_DETAIL_KEY_OF_IMPL_HPP +#define 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<struct_iterator_tag> + { + template <typename It> + struct apply + : extension::struct_assoc_key< + typename remove_const<typename It::seq_type>::type + , It::index::value + > + {}; + }; +}}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/namespace.hpp b/boost/fusion/adapted/struct/detail/namespace.hpp new file mode 100644 index 0000000000..0f3ec5e0b1 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/namespace.hpp @@ -0,0 +1,51 @@ +/*============================================================================= + 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) +==============================================================================*/ + +#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_NAMESPACE_HPP +#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_NAMESPACE_HPP + +#include <boost/preprocessor/dec.hpp> +#include <boost/preprocessor/control/if.hpp> +#include <boost/preprocessor/seq/seq.hpp> +#include <boost/preprocessor/seq/for_each.hpp> +#include <boost/preprocessor/seq/size.hpp> +#include <boost/preprocessor/repetition/repeat.hpp> +#include <boost/preprocessor/tuple/eat.hpp> + +#define BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_BEGIN_I(R,DATA,ELEM) \ + namespace ELEM { +#define BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_END_I(Z,I,DATA) } +#define BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION_I(Z,I,ELEM) ELEM:: + +#define BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_BEGIN(NAMESPACE_SEQ) \ + BOOST_PP_IF( \ + BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(NAMESPACE_SEQ)), \ + BOOST_PP_SEQ_FOR_EACH_R, \ + BOOST_PP_TUPLE_EAT(4))( \ + 1, \ + BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_BEGIN_I, \ + _, \ + BOOST_PP_SEQ_TAIL(NAMESPACE_SEQ)) + +#define BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_END(NAMESPACE_SEQ) \ + BOOST_PP_REPEAT_1( \ + BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(NAMESPACE_SEQ)), \ + BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_END_I, \ + _) + +#define BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION(NAMESPACE_SEQ) \ + BOOST_PP_IF( \ + BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(NAMESPACE_SEQ)), \ + BOOST_PP_SEQ_FOR_EACH_R, \ + BOOST_PP_TUPLE_EAT(4))( \ + 1, \ + BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION_I, \ + _, \ + BOOST_PP_SEQ_TAIL(NAMESPACE_SEQ)) + +#endif diff --git a/boost/fusion/adapted/struct/detail/proxy_type.hpp b/boost/fusion/adapted/struct/detail/proxy_type.hpp new file mode 100644 index 0000000000..bf0a6ebd53 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/proxy_type.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + 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) +==============================================================================*/ + +#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_PROXY_TYPE_HPP +#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_PROXY_TYPE_HPP + +#include <boost/fusion/adapted/struct/detail/namespace.hpp> + +#define BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE_IMPL( \ + WRAPPED_TYPE,NAMESPACE_SEQ,NAME) \ + \ + BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_BEGIN(NAMESPACE_SEQ) \ + \ + struct NAME \ + { \ + NAME(WRAPPED_TYPE& in_obj) \ + : obj(in_obj) \ + {} \ + \ + WRAPPED_TYPE& obj; \ + \ + private: \ + NAME& operator= (NAME const&); \ + }; \ + \ + BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_END(NAMESPACE_SEQ) + +#define BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE( \ + WRAPPED_TYPE, NAMESPACE_SEQ, NAME) \ + \ + BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE_IMPL( \ + WRAPPED_TYPE, (0)NAMESPACE_SEQ, NAME) + +#endif diff --git a/boost/fusion/adapted/struct/detail/size_impl.hpp b/boost/fusion/adapted/struct/detail/size_impl.hpp new file mode 100644 index 0000000000..baf411bd00 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/size_impl.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + Copyright (c) 2009-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_STRUCT_DETAIL_SIZE_IMPL_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_SIZE_IMPL_HPP + +namespace boost { namespace fusion { namespace extension +{ + template<typename> + struct size_impl; + + template <> + struct size_impl<struct_tag> + { + template <typename Seq> + struct apply + : struct_size<typename remove_const<Seq>::type> + {}; + }; + + template <> + struct size_impl<assoc_struct_tag> + : size_impl<struct_tag> + {}; +}}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/value_at_impl.hpp b/boost/fusion/adapted/struct/detail/value_at_impl.hpp new file mode 100644 index 0000000000..f820475324 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/value_at_impl.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + Copyright (c) 2009-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_STRUCT_DETAIL_VALUE_AT_IMPL_HPP +#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_VALUE_AT_IMPL_HPP + +namespace boost { namespace fusion { namespace extension +{ + template<typename> + struct value_at_impl; + + template <> + struct value_at_impl<struct_tag> + { + template <typename Seq, typename N> + struct apply + : access::struct_member<typename remove_const<Seq>::type, N::value> + {}; + }; + + template <> + struct value_at_impl<assoc_struct_tag> + : value_at_impl<struct_tag> + {}; +}}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/value_of_data_impl.hpp b/boost/fusion/adapted/struct/detail/value_of_data_impl.hpp new file mode 100644 index 0000000000..4528b854a4 --- /dev/null +++ b/boost/fusion/adapted/struct/detail/value_of_data_impl.hpp @@ -0,0 +1,22 @@ +/*============================================================================= + Copyright (c) 2009-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_STRUCT_DETAIL_VALUE_OF_DATA_IMPL_HPP +#define 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<struct_iterator_tag> + : value_of_impl<struct_iterator_tag> + {}; +}}} + +#endif diff --git a/boost/fusion/adapted/struct/detail/value_of_impl.hpp b/boost/fusion/adapted/struct/detail/value_of_impl.hpp new file mode 100644 index 0000000000..63dcbe52ff --- /dev/null +++ b/boost/fusion/adapted/struct/detail/value_of_impl.hpp @@ -0,0 +1,29 @@ +/*============================================================================= + Copyright (c) 2009-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_STRUCT_DETAIL_VALUE_OF_IMPL_HPP +#define 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<struct_iterator_tag> + { + template <typename It> + struct apply + : access::struct_member< + typename remove_const<typename It::seq_type>::type + , It::index::value + > + {}; + }; +}}} + +#endif |