forked from boostorg/fusion
adapt template classes/structs
[SVN r59846]
This commit is contained in:
169
include/boost/fusion/adapted/struct/detail/adapt_base.hpp
Normal file
169
include/boost/fusion/adapted/struct/detail/adapt_base.hpp
Normal file
@ -0,0 +1,169 @@
|
||||
/*=============================================================================
|
||||
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_DETAIL_STRUCT_ADAPT_BASE_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_ADAPT_BASE_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/fusion/support/tag_of_fwd.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/mpl/tag.hpp>
|
||||
#include <boost/type_traits/add_reference.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))>
|
||||
#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)
|
||||
|
||||
#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 struct_member<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ), I> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) type; \
|
||||
\
|
||||
template<typename Seq> \
|
||||
static typename add_reference<type>::type \
|
||||
call(Seq& seq) \
|
||||
{ \
|
||||
return seq.PREFIX \
|
||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE); \
|
||||
} \
|
||||
\
|
||||
template<typename Seq> \
|
||||
static typename add_reference<typename add_const<type>::type>::type \
|
||||
call(Seq const& seq) \
|
||||
{ \
|
||||
return seq.PREFIX \
|
||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE); \
|
||||
} \
|
||||
};
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_BASE( \
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ,TAG,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_SEQ_FOR_EACH_I_R( \
|
||||
1, \
|
||||
BOOST_FUSION_ADAPT_STRUCT_BASE_UNPACK_AND_CALL, \
|
||||
(ATTRIBUTES_CALLBACK,TEMPLATE_PARAMS_SEQ,NAME_SEQ), \
|
||||
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_SEQ_SIZE(ATTRIBUTES_SEQ)> \
|
||||
{}; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
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
|
@ -1,63 +1,58 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 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)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_AT_IMPL_24122005_1807)
|
||||
#define BOOST_FUSION_AT_IMPL_24122005_1807
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_AT_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_AT_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
struct struct_tag;
|
||||
template<typename>
|
||||
struct at_impl;
|
||||
|
||||
namespace extension
|
||||
template <>
|
||||
struct at_impl<struct_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct at_impl;
|
||||
|
||||
template <typename Struct, int N>
|
||||
struct struct_member;
|
||||
|
||||
template <typename Struct>
|
||||
struct struct_size;
|
||||
|
||||
template <>
|
||||
struct at_impl<struct_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::eval_if<
|
||||
is_const<Seq>
|
||||
, detail::cref_result<member>
|
||||
, detail::ref_result<member>
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Seq& seq)
|
||||
{
|
||||
static int const n_value = N::value;
|
||||
BOOST_MPL_ASSERT_RELATION(
|
||||
n_value, <=, extension::struct_size<Sequence>::value);
|
||||
|
||||
typedef typename
|
||||
extension::struct_member<Sequence, N::value>
|
||||
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::
|
||||
struct_member<Sequence, N::value>::call(seq);
|
||||
}
|
||||
};
|
||||
return member::call(seq);
|
||||
}
|
||||
};
|
||||
}
|
||||
}}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct at_impl<assoc_struct_tag>
|
||||
: at_impl<struct_tag>
|
||||
{};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
@ -1,54 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 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_20070508_2248)
|
||||
#define BOOST_FUSION_AT_KEY_IMPL_20070508_2248
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct struct_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct at_key_impl;
|
||||
|
||||
template <typename Struct, typename Key>
|
||||
struct struct_assoc_member;
|
||||
|
||||
template <>
|
||||
struct at_key_impl<struct_tag>
|
||||
{
|
||||
template <typename Sequence, typename Key>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
extension::struct_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::
|
||||
struct_assoc_member<Sequence, Key>::call(seq);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,40 +1,67 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 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)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_BEGIN_IMPL_24122005_1752)
|
||||
#define BOOST_FUSION_BEGIN_IMPL_24122005_1752
|
||||
|
||||
#include <boost/fusion/adapted/struct/struct_iterator.hpp>
|
||||
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_BEGIN_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_BEGIN_IMPL_HPP
|
||||
|
||||
namespace boost { namespace fusion
|
||||
#include <boost/fusion/iterator/basic_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
struct struct_tag;
|
||||
template<typename>
|
||||
struct begin_impl;
|
||||
|
||||
namespace extension
|
||||
template <>
|
||||
struct begin_impl<struct_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<struct_tag>
|
||||
template <typename Seq>
|
||||
struct apply
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef struct_iterator<Sequence, 0> type;
|
||||
typedef
|
||||
basic_iterator<
|
||||
struct_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_struct_tag>
|
||||
{
|
||||
template <typename Seq>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
basic_iterator<
|
||||
assoc_struct_iterator_tag
|
||||
, assoc_struct_category
|
||||
, Seq
|
||||
, 0
|
||||
>
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Seq& seq)
|
||||
{
|
||||
return type(seq,0);
|
||||
}
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
@ -1,34 +1,41 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 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)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_CATEGORY_OF_IMPL_24122005_1731)
|
||||
#define BOOST_FUSION_CATEGORY_OF_IMPL_24122005_1731
|
||||
|
||||
#include <boost/config/no_tr1/utility.hpp>
|
||||
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_CATEGORY_OF_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_CATEGORY_OF_IMPL_HPP
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct struct_tag;
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
template<typename>
|
||||
struct category_of_impl;
|
||||
|
||||
template<>
|
||||
struct category_of_impl<struct_tag>
|
||||
{
|
||||
template<typename T>
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
|
@ -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_DETAIL_STRUCT_DEREF_DATA_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_DEREF_DATA_IMPL_HPP
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct deref_data_impl;
|
||||
|
||||
template <>
|
||||
struct deref_data_impl<assoc_struct_iterator_tag>
|
||||
: deref_impl<assoc_struct_iterator_tag>
|
||||
{};
|
||||
}}}
|
||||
|
||||
#endif
|
56
include/boost/fusion/adapted/struct/detail/deref_impl.hpp
Normal file
56
include/boost/fusion/adapted/struct/detail/deref_impl.hpp
Normal file
@ -0,0 +1,56 @@
|
||||
/*=============================================================================
|
||||
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_DETAIL_STRUCT_DEREF_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_DEREF_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/is_const.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
|
||||
extension::struct_member<
|
||||
typename remove_const<typename It::seq_type>::type
|
||||
, It::index::value
|
||||
>
|
||||
member;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
is_const<typename It::seq_type>
|
||||
, detail::cref_result<member>
|
||||
, detail::ref_result<member>
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(It const& it)
|
||||
{
|
||||
return member::call(*it.seq);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct deref_impl<assoc_struct_iterator_tag>
|
||||
: deref_impl<struct_iterator_tag>
|
||||
{};
|
||||
}}}
|
||||
|
||||
#endif
|
@ -1,48 +1,68 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 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)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_END_IMPL_24122005_1755)
|
||||
#define BOOST_FUSION_END_IMPL_24122005_1755
|
||||
|
||||
#include <boost/fusion/adapted/struct/struct_iterator.hpp>
|
||||
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_END_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_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 struct_tag;
|
||||
template <typename>
|
||||
struct end_impl;
|
||||
|
||||
namespace extension
|
||||
template <>
|
||||
struct end_impl<struct_tag>
|
||||
{
|
||||
template <typename Tag>
|
||||
struct end_impl;
|
||||
|
||||
template <typename Struct>
|
||||
struct struct_size;
|
||||
|
||||
template <>
|
||||
struct end_impl<struct_tag>
|
||||
template <typename Seq>
|
||||
struct apply
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
struct_iterator<
|
||||
Sequence
|
||||
, struct_size<Sequence>::value
|
||||
>
|
||||
type;
|
||||
typedef
|
||||
basic_iterator<
|
||||
struct_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_struct_tag>
|
||||
{
|
||||
template <typename Seq>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
basic_iterator<
|
||||
assoc_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
|
||||
|
42
include/boost/fusion/adapted/struct/detail/extension.hpp
Normal file
42
include/boost/fusion/adapted/struct/detail/extension.hpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*=============================================================================
|
||||
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_DETAIL_STRUCT_EXTENSION_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_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 assoc_struct_iterator_tag;
|
||||
struct fusion_sequence_tag;
|
||||
|
||||
struct assoc_struct_category
|
||||
: bidirectional_traversal_tag, associative_tag
|
||||
{};
|
||||
|
||||
namespace extension
|
||||
{
|
||||
struct no_such_member;
|
||||
|
||||
template<typename Seq, int N>
|
||||
struct struct_member;
|
||||
|
||||
template<typename Seq, int N>
|
||||
struct struct_assoc_key;
|
||||
|
||||
template<typename Seq>
|
||||
struct struct_size;
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -1,40 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 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_20070508_2231)
|
||||
#define BOOST_FUSION_HAS_KEY_IMPL_20070508_2231
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct struct_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
struct no_such_member;
|
||||
|
||||
template<typename T>
|
||||
struct has_key_impl;
|
||||
|
||||
template<typename Struct, typename Key>
|
||||
struct struct_assoc_member;
|
||||
|
||||
template<>
|
||||
struct has_key_impl<struct_tag>
|
||||
{
|
||||
template<typename Sequence, typename Key>
|
||||
struct apply
|
||||
: mpl::not_<is_same<no_such_member, typename struct_assoc_member<Sequence, Key>::type> >
|
||||
{
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -5,27 +5,30 @@
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_IS_SEQUENCE_IMPL_27122005_1651)
|
||||
#define BOOST_FUSION_IS_SEQUENCE_IMPL_27122005_1651
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_IS_SEQUENCE_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_IS_SEQUENCE_IMPL_HPP
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
struct struct_tag;
|
||||
template<typename>
|
||||
struct is_sequence_impl;
|
||||
|
||||
namespace extension
|
||||
template<>
|
||||
struct is_sequence_impl<struct_tag>
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_sequence_impl;
|
||||
template<typename Seq>
|
||||
struct apply
|
||||
: mpl::true_
|
||||
{};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_sequence_impl<struct_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply : mpl::true_ {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
template <>
|
||||
struct is_sequence_impl<assoc_struct_tag>
|
||||
: is_sequence_impl<struct_tag>
|
||||
{};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
@ -5,28 +5,30 @@
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_IS_VIEW_IMPL_27042006_2219)
|
||||
#define BOOST_FUSION_IS_VIEW_IMPL_27042006_2219
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_IS_VIEW_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_IS_VIEW_IMPL_HPP
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
struct struct_tag;
|
||||
template<typename>
|
||||
struct is_view_impl;
|
||||
|
||||
namespace extension
|
||||
template<>
|
||||
struct is_view_impl<struct_tag>
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_view_impl;
|
||||
template<typename Seq>
|
||||
struct apply
|
||||
: mpl::false_
|
||||
{};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_view_impl<struct_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply : mpl::false_
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
template <>
|
||||
struct is_view_impl<assoc_struct_tag>
|
||||
: is_view_impl<struct_tag>
|
||||
{};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
34
include/boost/fusion/adapted/struct/detail/key_of_impl.hpp
Normal file
34
include/boost/fusion/adapted/struct/detail/key_of_impl.hpp
Normal file
@ -0,0 +1,34 @@
|
||||
/*=============================================================================
|
||||
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_DETAIL_STRUCT_KEY_OF_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_KEY_OF_IMPL_HPP
|
||||
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct key_of_impl;
|
||||
|
||||
template <>
|
||||
struct key_of_impl<assoc_struct_iterator_tag>
|
||||
{
|
||||
template <typename It>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
extension::struct_assoc_key<
|
||||
typename remove_const<typename It::seq_type>::type
|
||||
, It::index::value
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
60
include/boost/fusion/adapted/struct/detail/proxy_type.hpp
Normal file
60
include/boost/fusion/adapted/struct/detail/proxy_type.hpp
Normal file
@ -0,0 +1,60 @@
|
||||
/*=============================================================================
|
||||
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/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>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_PROXY_DUMMY4(A,B,C,D)
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_PROXY_TYPE_NS_BEGIN(R,DATA,ELEM) \
|
||||
namespace ELEM {
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_PROXY_TYPE_NS_END(Z,I,DATA) }
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION_I(Z,I,ELEM) ELEM::
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE( \
|
||||
WRAPPED_TYPE,NAMESPACE_SEQ,NAME) \
|
||||
\
|
||||
BOOST_PP_IF( \
|
||||
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(NAMESPACE_SEQ)), \
|
||||
BOOST_PP_SEQ_FOR_EACH_R, \
|
||||
BOOST_FUSION_ADAPT_STRUCT_PROXY_DUMMY4)( \
|
||||
1, \
|
||||
BOOST_FUSION_ADAPT_STRUCT_PROXY_TYPE_NS_BEGIN, \
|
||||
_, \
|
||||
BOOST_PP_SEQ_TAIL(NAMESPACE_SEQ)) \
|
||||
\
|
||||
struct NAME \
|
||||
{ \
|
||||
NAME(WRAPPED_TYPE& obj) \
|
||||
: obj(obj) \
|
||||
{} \
|
||||
\
|
||||
WRAPPED_TYPE& obj; \
|
||||
}; \
|
||||
\
|
||||
BOOST_PP_REPEAT_1( \
|
||||
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(NAMESPACE_SEQ)), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_PROXY_TYPE_NS_END, \
|
||||
_)
|
||||
|
||||
#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_FUSION_ADAPT_STRUCT_PROXY_DUMMY4)( \
|
||||
1, \
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION_I, \
|
||||
_, \
|
||||
BOOST_PP_SEQ_TAIL(NAMESPACE_SEQ))
|
||||
|
||||
#endif
|
@ -5,33 +5,30 @@
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_SIZE_IMPL_24122005_1759)
|
||||
#define BOOST_FUSION_SIZE_IMPL_24122005_1759
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_SIZE_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_SIZE_IMPL_HPP
|
||||
|
||||
namespace boost { namespace fusion
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
namespace extension
|
||||
template<typename>
|
||||
struct size_impl;
|
||||
|
||||
template <>
|
||||
struct size_impl<struct_tag>
|
||||
{
|
||||
template <typename Struct>
|
||||
struct struct_size;
|
||||
}
|
||||
template <typename Seq>
|
||||
struct apply
|
||||
: struct_size<typename remove_const<Seq>::type>
|
||||
{};
|
||||
};
|
||||
|
||||
struct struct_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct size_impl;
|
||||
|
||||
template <>
|
||||
struct size_impl<struct_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply : extension::struct_size<Sequence> {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
template <>
|
||||
struct size_impl<assoc_struct_tag>
|
||||
: size_impl<struct_tag>
|
||||
{};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
@ -5,43 +5,30 @@
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_VALUE_AT_IMPL_24122005_1917)
|
||||
#define BOOST_FUSION_VALUE_AT_IMPL_24122005_1917
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_VALUE_AT_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_VALUE_AT_IMPL_HPP
|
||||
|
||||
namespace boost { namespace fusion
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
struct struct_tag;
|
||||
template<typename>
|
||||
struct value_at_impl;
|
||||
|
||||
namespace extension
|
||||
template <>
|
||||
struct value_at_impl<struct_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct value_at_impl;
|
||||
template <typename Seq, typename N>
|
||||
struct apply
|
||||
: struct_member<typename remove_const<Seq>::type, N::value>
|
||||
{};
|
||||
};
|
||||
|
||||
template <typename Struct, int N>
|
||||
struct struct_member;
|
||||
|
||||
template <typename Struct>
|
||||
struct struct_size;
|
||||
|
||||
template <>
|
||||
struct value_at_impl<struct_tag>
|
||||
{
|
||||
template <typename Sequence, typename N>
|
||||
struct apply
|
||||
{
|
||||
static int const n_value = N::value;
|
||||
BOOST_MPL_ASSERT_RELATION(
|
||||
n_value, <=, extension::struct_size<Sequence>::value);
|
||||
|
||||
typedef typename
|
||||
extension::struct_member<Sequence, N::value>::type
|
||||
type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
template <>
|
||||
struct value_at_impl<assoc_struct_tag>
|
||||
: value_at_impl<struct_tag>
|
||||
{};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
@ -1,39 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 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_20070508_2300)
|
||||
#define BOOST_FUSION_VALUE_AT_KEY_IMPL_20070508_2300
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct struct_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct value_at_key_impl;
|
||||
|
||||
template <typename Struct, typename Key>
|
||||
struct struct_assoc_member;
|
||||
|
||||
template <>
|
||||
struct value_at_key_impl<struct_tag>
|
||||
{
|
||||
template <typename Sequence, typename Key>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
extension::struct_assoc_member<Sequence, Key>::type
|
||||
type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -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_DETAIL_STRUCT_VALUE_OF_DATA_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_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_struct_iterator_tag>
|
||||
: value_of_impl<assoc_struct_iterator_tag>
|
||||
{};
|
||||
}}}
|
||||
|
||||
#endif
|
39
include/boost/fusion/adapted/struct/detail/value_of_impl.hpp
Normal file
39
include/boost/fusion/adapted/struct/detail/value_of_impl.hpp
Normal file
@ -0,0 +1,39 @@
|
||||
/*=============================================================================
|
||||
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_DETAIL_STRUCT_VALUE_OF_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_VALUE_OF_IMPL_HPP
|
||||
|
||||
#include <boost/type_traits/remove_const.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
|
||||
{
|
||||
typedef typename
|
||||
extension::struct_member<
|
||||
typename remove_const<typename It::seq_type>::type
|
||||
, It::index::value
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct value_of_impl<assoc_struct_iterator_tag>
|
||||
: value_of_impl<struct_iterator_tag>
|
||||
{};
|
||||
}}}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user