better adapt structs/classes implementation

[SVN r59913]
This commit is contained in:
Christopher Schmidt
2010-02-25 20:10:37 +00:00
parent f84bc30bd3
commit e67765747d
39 changed files with 266 additions and 701 deletions

View File

@ -1,4 +1,6 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2007 Dan Marsden
Copyright (c) 2010 Christopher Schmidt Copyright (c) 2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
@ -11,22 +13,27 @@
#include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/empty.hpp> #include <boost/preprocessor/empty.hpp>
#include <boost/preprocessor/tuple/elem.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/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>
#include <boost/fusion/adapted/class/detail/extension.hpp> #include <boost/fusion/adapted/class/detail/extension.hpp>
#include <boost/fusion/adapted/class/detail/adapt_base.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/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>
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0(A, B, C, D, E)\ #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 ((A, B, C, D, E)) BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_1
@ -54,7 +61,7 @@
BOOST_FUSION_ADAPT_STRUCT_BASE( \ BOOST_FUSION_ADAPT_STRUCT_BASE( \
(1)TEMPLATE_PARAMS_SEQ, \ (1)TEMPLATE_PARAMS_SEQ, \
(1)NAME_SEQ, \ (1)NAME_SEQ, \
assoc_class_tag, \ assoc_struct_tag, \
BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0 ATTRIBUTES,_END), \ BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0 ATTRIBUTES,_END), \
BOOST_FUSION_ADAPT_ASSOC_CLASS_C) BOOST_FUSION_ADAPT_ASSOC_CLASS_C)
@ -62,7 +69,7 @@
BOOST_FUSION_ADAPT_STRUCT_BASE( \ BOOST_FUSION_ADAPT_STRUCT_BASE( \
(0), \ (0), \
(0)(NAME), \ (0)(NAME), \
assoc_class_tag, \ assoc_struct_tag, \
BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0 ATTRIBUTES,_END), \ BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0 ATTRIBUTES,_END), \
BOOST_FUSION_ADAPT_ASSOC_CLASS_C) BOOST_FUSION_ADAPT_ASSOC_CLASS_C)

View File

@ -1,4 +1,6 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2009-2010 Hartmut Kaiser
Copyright (c) 2010 Christopher Schmidt Copyright (c) 2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
@ -10,19 +12,25 @@
#include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/empty.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>
#include <boost/fusion/adapted/class/detail/extension.hpp> #include <boost/fusion/adapted/class/detail/extension.hpp>
#include <boost/fusion/adapted/class/detail/adapt_base.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/value_of_impl.hpp>
#include <boost/fusion/adapted/class/detail/deref_impl.hpp>
#define BOOST_FUSION_ADAPT_CLASS_FILLER_0(A, B, C, D)\ #define BOOST_FUSION_ADAPT_CLASS_FILLER_0(A, B, C, D)\
((A, B, C, D)) BOOST_FUSION_ADAPT_CLASS_FILLER_1 ((A, B, C, D)) BOOST_FUSION_ADAPT_CLASS_FILLER_1
@ -39,7 +47,7 @@
BOOST_FUSION_ADAPT_STRUCT_BASE( \ BOOST_FUSION_ADAPT_STRUCT_BASE( \
(1)TEMPLATE_PARAMS_SEQ, \ (1)TEMPLATE_PARAMS_SEQ, \
(1)NAME_SEQ, \ (1)NAME_SEQ, \
class_tag, \ struct_tag, \
BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_FILLER_0 ATTRIBUTES,_END), \ BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_FILLER_0 ATTRIBUTES,_END), \
BOOST_FUSION_ADAPT_CLASS_C) BOOST_FUSION_ADAPT_CLASS_C)
@ -47,7 +55,7 @@
BOOST_FUSION_ADAPT_STRUCT_BASE( \ BOOST_FUSION_ADAPT_STRUCT_BASE( \
(0), \ (0), \
(0)(NAME), \ (0)(NAME), \
class_tag, \ struct_tag, \
BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_FILLER_0 ATTRIBUTES,_END), \ BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_FILLER_0 ATTRIBUTES,_END), \
BOOST_FUSION_ADAPT_CLASS_C) BOOST_FUSION_ADAPT_CLASS_C)

View File

@ -1,4 +1,6 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2009-2010 Hartmut Kaiser
Copyright (c) 2010 Christopher Schmidt Copyright (c) 2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying

View File

@ -1,14 +1,35 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2010 Christopher Schmidt Copyright (c) 2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 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 #ifndef BOOST_FUSION_ADAPTED_CLASS_DETAIL_ADAPT_BASE_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_ADAPT_BASE_HPP #define BOOST_FUSION_ADAPTED_CLASS_DETAIL_ADAPT_BASE_HPP
#include <boost/fusion/adapted/struct/detail/adapt_base.hpp> #include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/preprocessor/seq/elem.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
//cschmidt: Spirit relies on Fusion defining class_member_proxy in the
//boost::fusion::extension namespace, with two nested types named lvalue and
//rvalue.
#define BOOST_FUSION_ADAPT_CLASS_GET_IDENTITY_TEMPLATE_IMPL(TEMPLATE_PARAMS_SEQ)\
typename detail::get_identity< \
lvalue \
, BOOST_PP_SEQ_ELEM(1,TEMPLATE_PARAMS_SEQ) \
>::type
#define BOOST_FUSION_ADAPT_CLASS_GET_IDENTITY_NON_TEMPLATE_IMPL( \
TEMPLATE_PARAMS_SEQ) \
\
lvalue
#define BOOST_FUSION_ADAPT_CLASS_C_BASE(\ #define BOOST_FUSION_ADAPT_CLASS_C_BASE(\
TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,ATTRIBUTE,ATTRIBUTE_TUPEL_SIZE) \ TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,ATTRIBUTE,ATTRIBUTE_TUPEL_SIZE) \
@ -21,9 +42,8 @@
, I \ , I \
> \ > \
{ \ { \
typedef \ typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) lvalue; \
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) \ typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) rvalue; \
type; \
\ \
class_member_proxy(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj)\ class_member_proxy(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj)\
: obj(obj) \ : obj(obj) \
@ -31,13 +51,13 @@
\ \
template<class Arg> \ template<class Arg> \
class_member_proxy& \ class_member_proxy& \
operator=(Arg val) \ operator=(Arg const& val) \
{ \ { \
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 3, ATTRIBUTE); \ BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 3, ATTRIBUTE); \
return *this; \ return *this; \
} \ } \
\ \
operator type() \ operator lvalue() \
{ \ { \
return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \ return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \
} \ } \
@ -50,10 +70,19 @@
> \ > \
struct struct_member<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ), I> \ 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, 0, ATTRIBUTE) lvalue; \
\
typedef \ typedef \
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) \ BOOST_PP_IF( \
get_type; \ BOOST_PP_SEQ_HEAD(TEMPLATE_PARAMS_SEQ), \
BOOST_FUSION_ADAPT_CLASS_GET_IDENTITY_TEMPLATE_IMPL, \
BOOST_FUSION_ADAPT_CLASS_GET_IDENTITY_NON_TEMPLATE_IMPL)( \
TEMPLATE_PARAMS_SEQ) \
type; \
\
template<typename Seq> \
struct apply \
{ \
typedef \ typedef \
class_member_proxy< \ class_member_proxy< \
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
@ -61,23 +90,26 @@
> \ > \
proxy; \ proxy; \
\ \
static get_type \ typedef typename \
call(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const& obj) \ mpl::if_< \
{ \ is_const<Seq> \
return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \ , BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) \
}; \ , proxy \
>::type \
type; \
\ \
static proxy \ static proxy \
call(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj) \ call(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj) \
{ \ { \
return proxy(obj); \ return proxy(obj); \
} \
\
static BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) \
call(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const& obj) \
{ \
return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \
} \
}; \ }; \
}; };
namespace boost { namespace fusion { namespace extension
{
template <typename T, int N>
struct class_member_proxy;
}}}
#endif #endif

View File

@ -1,55 +0,0 @@
/*=============================================================================
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_AT_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_AT_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 at_impl;
template <>
struct at_impl<class_tag>
{
template<typename Seq, 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)
{
return member::call(seq);
}
};
};
template <>
struct at_impl<assoc_class_tag>
: at_impl<class_tag>
{};
}}}
#endif

View File

@ -1,65 +0,0 @@
/*=============================================================================
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_BEGIN_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_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<class_tag>
{
template <typename Seq>
struct apply
{
typedef
basic_iterator<
class_iterator_tag
, random_access_traversal_tag
, Seq
, 0
>
type;
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,32 +0,0 @@
/*=============================================================================
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_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
{
namespace extension
{
template<typename>
struct category_of_impl;
template<>
struct category_of_impl<class_tag>
: category_of_impl<struct_tag>
{};
template<>
struct category_of_impl<assoc_class_tag>
: category_of_impl<assoc_struct_tag>
{};
}
}}
#endif

View File

@ -1,22 +0,0 @@
/*=============================================================================
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

@ -1,55 +0,0 @@
/*=============================================================================
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,66 +0,0 @@
/*=============================================================================
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_END_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_END_IMPL_HPP
#include <boost/fusion/iterator/basic_iterator.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion { namespace extension
{
template <typename>
struct end_impl;
template <>
struct end_impl<class_tag>
{
template <typename Seq>
struct apply
{
typedef
basic_iterator<
class_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_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

@ -1,23 +1,33 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2010 Christopher Schmidt Copyright (c) 2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_CLASS_EXTENSION_HPP #ifndef BOOST_FUSION_ADAPTED_CLASS_DETAIL_EXTENSION_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_EXTENSION_HPP #define BOOST_FUSION_ADAPTED_CLASS_DETAIL_EXTENSION_HPP
#include <boost/fusion/adapted/struct/detail/extension.hpp> #include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
struct class_tag; namespace detail
struct class_iterator_tag; {
struct assoc_class_tag; template <typename T, typename Dummy>
struct assoc_class_iterator_tag; struct get_identity
: remove_const<typename remove_reference<T>::type>
{};
}
typedef assoc_struct_category assoc_class_category; namespace extension
{
template <typename T, int N>
struct class_member_proxy;
}
}} }}
#endif #endif

View File

@ -1,29 +0,0 @@
/*=============================================================================
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_IS_SEQUENCE_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_IS_SEQUENCE_IMPL_HPP
#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
namespace boost { namespace fusion { namespace extension
{
template<typename>
struct is_sequence_impl;
template<>
struct is_sequence_impl<class_tag>
: is_sequence_impl<struct_tag>
{};
template <>
struct is_sequence_impl<assoc_class_tag>
: is_sequence_impl<assoc_struct_tag>
{};
}}}
#endif

View File

@ -1,29 +0,0 @@
/*=============================================================================
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_IS_VIEW_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_IS_VIEW_IMPL_HPP
#include <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<class_tag>
: is_view_impl<struct_tag>
{};
template <>
struct is_view_impl<assoc_class_tag>
: is_view_impl<assoc_struct_tag>
{};
}}}
#endif

View File

@ -1,24 +0,0 @@
/*=============================================================================
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,29 +0,0 @@
/*=============================================================================
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_SIZE_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_SIZE_IMPL_HPP
#include <boost/fusion/adapted/struct/detail/size_impl.hpp>
namespace boost { namespace fusion { namespace extension
{
template<typename>
struct size_impl;
template <>
struct size_impl<class_tag>
: size_impl<struct_tag>
{};
template <>
struct size_impl<assoc_class_tag>
: size_impl<assoc_struct_tag>
{};
}}}
#endif

View File

@ -1,29 +0,0 @@
/*=============================================================================
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_AT_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_VALUE_AT_IMPL_HPP
#include <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<class_tag>
: value_at_impl<struct_tag>
{};
template <>
struct value_at_impl<assoc_class_tag>
: value_at_impl<assoc_struct_tag>
{};
}}}
#endif

View File

@ -1,24 +0,0 @@
/*=============================================================================
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

@ -1,29 +0,0 @@
/*=============================================================================
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

@ -13,6 +13,10 @@
#include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/empty.hpp> #include <boost/preprocessor/empty.hpp>
#include <boost/preprocessor/tuple/elem.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/extension.hpp>
#include <boost/fusion/adapted/struct/detail/adapt_base.hpp> #include <boost/fusion/adapted/struct/detail/adapt_base.hpp>

View File

@ -11,6 +11,10 @@
#include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/empty.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/extension.hpp>
#include <boost/fusion/adapted/struct/detail/adapt_base.hpp> #include <boost/fusion/adapted/struct/detail/adapt_base.hpp>

View File

@ -1,4 +1,6 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2007 Joel de Guzman
Copyright (c) 2009-2010 Hartmut Kaiser
Copyright (c) 2010 Christopher Schmidt Copyright (c) 2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying

View File

@ -1,16 +1,20 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2009-2010 Christopher Schmidt Copyright (c) 2009-2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 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 #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_ADAPT_BASE_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_ADAPT_BASE_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_ADAPT_BASE_HPP
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/support/tag_of_fwd.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/control/if.hpp>
#include <boost/preprocessor/seq/size.hpp> #include <boost/preprocessor/seq/size.hpp>
#include <boost/preprocessor/seq/for_each.hpp> #include <boost/preprocessor/seq/for_each.hpp>
@ -20,11 +24,14 @@
#include <boost/preprocessor/tuple/eat.hpp> #include <boost/preprocessor/tuple/eat.hpp>
#include <boost/preprocessor/tuple/elem.hpp> #include <boost/preprocessor/tuple/elem.hpp>
#include <boost/mpl/tag.hpp> #include <boost/mpl/tag.hpp>
#include <boost/type_traits/add_reference.hpp> #include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/add_const.hpp> #include <boost/type_traits/add_const.hpp>
#define BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME_TEMPLATE_PARAMS(SEQ) \ #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_SEQ_HEAD(SEQ)<BOOST_PP_SEQ_ENUM(BOOST_PP_SEQ_TAIL(SEQ))> \
BOOST_PP_EMPTY()
#define BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(SEQ) \ #define BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(SEQ) \
BOOST_PP_IF( \ BOOST_PP_IF( \
BOOST_PP_SEQ_HEAD(SEQ), \ BOOST_PP_SEQ_HEAD(SEQ), \
@ -90,19 +97,46 @@
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) type; \ typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) type; \
\ \
template<typename Seq> \ template<typename Seq> \
static typename add_reference<type>::type \ struct apply \
{ \
typedef typename \
add_reference< \
typename mpl::eval_if< \
is_const<Seq> \
, add_const<BOOST_PP_TUPLE_ELEM( \
ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) \
> \
, mpl::identity<BOOST_PP_TUPLE_ELEM( \
ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) \
> \
>::type \
>::type \
type; \
\
static type \
call(Seq& seq) \ call(Seq& seq) \
{ \ { \
return seq.PREFIX \ return seq.PREFIX \
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE); \ BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE); \
} \ } \
}; \
}; \
\ \
template<typename Seq> \ template< \
static typename add_reference<typename add_const<type>::type>::type \ BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
call(Seq const& seq) \ > \
struct struct_member_name< \
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
, I \
> \
{ \ { \
return seq.PREFIX \ typedef char const* type; \
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE); \ \
static type \
call() \
{ \
return BOOST_PP_STRINGIZE( \
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,1,ATTRIBUTE)); \
} \ } \
}; };

View File

@ -7,13 +7,10 @@
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_AT_IMPL_HPP #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_AT_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_AT_IMPL_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_AT_IMPL_HPP
#include <boost/fusion/support/detail/access.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 extension namespace boost { namespace fusion { namespace extension
{ {
@ -25,28 +22,11 @@ namespace boost { namespace fusion { namespace extension
{ {
template <typename Seq, typename N> template <typename Seq, typename N>
struct apply struct apply
{ : extension::struct_member<
typedef
extension::struct_member<
typename remove_const<Seq>::type typename remove_const<Seq>::type
, N::value , N::value
> >::template apply<Seq>
member; {};
typedef typename
mpl::eval_if<
is_const<Seq>
, detail::cref_result<member>
, detail::ref_result<member>
>::type
type;
static type
call(Seq& seq)
{
return member::call(seq);
}
};
}; };
template <> template <>

View File

@ -7,8 +7,8 @@
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_BEGIN_IMPL_HPP #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_BEGIN_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_BEGIN_IMPL_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_BEGIN_IMPL_HPP
#include <boost/fusion/iterator/basic_iterator.hpp> #include <boost/fusion/iterator/basic_iterator.hpp>
@ -48,7 +48,7 @@ namespace boost { namespace fusion { namespace extension
{ {
typedef typedef
basic_iterator< basic_iterator<
assoc_struct_iterator_tag struct_iterator_tag
, assoc_struct_category , assoc_struct_category
, Seq , Seq
, 0 , 0

View File

@ -7,8 +7,8 @@
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_CATEGORY_OF_IMPL_HPP #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_CATEGORY_OF_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_CATEGORY_OF_IMPL_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_CATEGORY_OF_IMPL_HPP
namespace boost { namespace fusion namespace boost { namespace fusion
{ {

View File

@ -5,8 +5,8 @@
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 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 #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_DEREF_DATA_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_DEREF_DATA_IMPL_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_DEREF_DATA_IMPL_HPP
namespace boost { namespace fusion { namespace extension namespace boost { namespace fusion { namespace extension
{ {
@ -14,8 +14,8 @@ namespace boost { namespace fusion { namespace extension
struct deref_data_impl; struct deref_data_impl;
template <> template <>
struct deref_data_impl<assoc_struct_iterator_tag> struct deref_data_impl<struct_iterator_tag>
: deref_impl<assoc_struct_iterator_tag> : deref_impl<struct_iterator_tag>
{}; {};
}}} }}}

View File

@ -5,13 +5,8 @@
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 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 #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_DEREF_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_DEREF_IMPL_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_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 namespace boost { namespace fusion { namespace extension
{ {
@ -24,33 +19,23 @@ namespace boost { namespace fusion { namespace extension
template <typename It> template <typename It>
struct apply struct apply
{ {
typedef typedef typename
extension::struct_member< extension::struct_member<
typename remove_const<typename It::seq_type>::type typename remove_const<typename It::seq_type>::type
, It::index::value , It::index::value
> >::template apply<typename It::seq_type>
member; impl;
typedef typename typedef typename impl::type type;
mpl::eval_if<
is_const<typename It::seq_type>
, detail::cref_result<member>
, detail::ref_result<member>
>::type
type;
static type static
type
call(It const& it) call(It const& it)
{ {
return member::call(*it.seq); return impl::call(*it.seq);
} }
}; };
}; };
template <>
struct deref_impl<assoc_struct_iterator_tag>
: deref_impl<struct_iterator_tag>
{};
}}} }}}
#endif #endif

View File

@ -7,11 +7,10 @@
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_END_IMPL_HPP #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_END_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_END_IMPL_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_END_IMPL_HPP
#include <boost/fusion/iterator/basic_iterator.hpp> #include <boost/fusion/iterator/basic_iterator.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion { namespace extension namespace boost { namespace fusion { namespace extension
{ {
@ -49,7 +48,7 @@ namespace boost { namespace fusion { namespace extension
{ {
typedef typedef
basic_iterator< basic_iterator<
assoc_struct_iterator_tag struct_iterator_tag
, assoc_struct_category , assoc_struct_category
, Seq , Seq
, struct_size<typename remove_const<Seq>::type>::value , struct_size<typename remove_const<Seq>::type>::value

View File

@ -7,8 +7,8 @@
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_EXTENSION_HPP #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_EXTENSION_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_EXTENSION_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_EXTENSION_HPP
#include <boost/fusion/support/category_of.hpp> #include <boost/fusion/support/category_of.hpp>
@ -17,7 +17,6 @@ namespace boost { namespace fusion
struct struct_tag; struct struct_tag;
struct struct_iterator_tag; struct struct_iterator_tag;
struct assoc_struct_tag; struct assoc_struct_tag;
struct assoc_struct_iterator_tag;
struct fusion_sequence_tag; struct fusion_sequence_tag;
struct assoc_struct_category struct assoc_struct_category
@ -31,6 +30,9 @@ namespace boost { namespace fusion
template<typename Seq, int N> template<typename Seq, int N>
struct struct_member; struct struct_member;
template<typename Seq, int N>
struct struct_member_name;
template<typename Seq, int N> template<typename Seq, int N>
struct struct_assoc_key; struct struct_assoc_key;

View File

@ -1,13 +1,14 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2009-2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_IS_SEQUENCE_IMPL_HPP #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_IS_SEQUENCE_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_IS_SEQUENCE_IMPL_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_IS_SEQUENCE_IMPL_HPP
#include <boost/mpl/bool.hpp> #include <boost/mpl/bool.hpp>

View File

@ -1,13 +1,14 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2009-2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_IS_VIEW_IMPL_HPP #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_IS_VIEW_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_IS_VIEW_IMPL_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_IS_VIEW_IMPL_HPP
#include <boost/mpl/bool.hpp> #include <boost/mpl/bool.hpp>

View File

@ -5,10 +5,8 @@
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 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 #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_KEY_OF_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_KEY_OF_IMPL_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_KEY_OF_IMPL_HPP
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion { namespace extension namespace boost { namespace fusion { namespace extension
{ {
@ -16,18 +14,15 @@ namespace boost { namespace fusion { namespace extension
struct key_of_impl; struct key_of_impl;
template <> template <>
struct key_of_impl<assoc_struct_iterator_tag> struct key_of_impl<struct_iterator_tag>
{ {
template <typename It> template <typename It>
struct apply struct apply
{ : extension::struct_assoc_key<
typedef typename
extension::struct_assoc_key<
typename remove_const<typename It::seq_type>::type typename remove_const<typename It::seq_type>::type
, It::index::value , It::index::value
>::type >
type; {};
};
}; };
}}} }}}

View File

@ -1,12 +1,13 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2009-2010 Hartmut Kaiser
Copyright (c) 2010 Christopher Schmidt Copyright (c) 2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 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 #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_PROXY_TYPE_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_PROXY_TYPE_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_PROXY_TYPE_HPP
#include <boost/preprocessor/dec.hpp> #include <boost/preprocessor/dec.hpp>
#include <boost/preprocessor/control/if.hpp> #include <boost/preprocessor/control/if.hpp>

View File

@ -1,15 +1,14 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2009-2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_SIZE_IMPL_HPP #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_SIZE_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_SIZE_IMPL_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_SIZE_IMPL_HPP
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion { namespace extension namespace boost { namespace fusion { namespace extension
{ {

View File

@ -1,15 +1,14 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2009-2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_VALUE_AT_IMPL_HPP #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_VALUE_AT_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_VALUE_AT_IMPL_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_VALUE_AT_IMPL_HPP
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion { namespace extension namespace boost { namespace fusion { namespace extension
{ {

View File

@ -5,8 +5,8 @@
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 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 #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_VALUE_OF_DATA_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_VALUE_OF_DATA_IMPL_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_VALUE_OF_DATA_IMPL_HPP
namespace boost { namespace fusion { namespace extension namespace boost { namespace fusion { namespace extension
{ {
@ -14,8 +14,8 @@ namespace boost { namespace fusion { namespace extension
struct value_of_data_impl; struct value_of_data_impl;
template <> template <>
struct value_of_data_impl<assoc_struct_iterator_tag> struct value_of_data_impl<struct_iterator_tag>
: value_of_impl<assoc_struct_iterator_tag> : value_of_impl<struct_iterator_tag>
{}; {};
}}} }}}

View File

@ -5,10 +5,8 @@
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 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 #ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_VALUE_OF_IMPL_HPP
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_VALUE_OF_IMPL_HPP #define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_VALUE_OF_IMPL_HPP
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion { namespace extension namespace boost { namespace fusion { namespace extension
{ {
@ -20,20 +18,12 @@ namespace boost { namespace fusion { namespace extension
{ {
template <typename It> template <typename It>
struct apply struct apply
{ : extension::struct_member<
typedef typename
extension::struct_member<
typename remove_const<typename It::seq_type>::type typename remove_const<typename It::seq_type>::type
, It::index::value , It::index::value
>::type >
type;
};
};
template <>
struct value_of_impl<assoc_struct_iterator_tag>
: value_of_impl<struct_iterator_tag>
{}; {};
};
}}} }}}
#endif #endif

View File

@ -32,9 +32,8 @@ namespace boost { namespace fusion { namespace detail
static bool static bool
call(I1 const& a, I2 const& b, mpl::false_) call(I1 const& a, I2 const& b, mpl::false_)
{ {
return *a > *b return *a > *b ||
|| !(*b > *a) (!(*b > *a) && call(fusion::next(a), fusion::next(b)));
&& call(fusion::next(a), fusion::next(b));
} }
template <typename I1, typename I2> template <typename I1, typename I2>

View File

@ -32,9 +32,8 @@ namespace boost { namespace fusion { namespace detail
static bool static bool
call(I1 const& a, I2 const& b, mpl::false_) call(I1 const& a, I2 const& b, mpl::false_)
{ {
return *a < *b return *a < *b ||
|| !(*b < *a) (!(*b < *a) && call(fusion::next(a), fusion::next(b)));
&& call(fusion::next(a), fusion::next(b));
} }
template <typename I1, typename I2> template <typename I1, typename I2>