mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-15 21:32:22 +02:00
Compare commits
24 Commits
boost-1.42
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
cd1fa857c7 | |||
f7fd836354 | |||
b1b171f130 | |||
d366a4f0e2 | |||
514d48903b | |||
f0cd405f04 | |||
2587757d47 | |||
f1da55c1e9 | |||
03290abb85 | |||
65895017bd | |||
60fabbdf9a | |||
dab67207cf | |||
9b26b4a0f7 | |||
35e469e2d5 | |||
43f861ca87 | |||
d978cec6b6 | |||
e26d26d511 | |||
9ebe273fb3 | |||
a110ea9304 | |||
959b0b0839 | |||
9a1bc7d677 | |||
178973a05c | |||
7b89755a67 | |||
fdb399e022 |
113
include/boost/fusion/adapted/class/adapt_assoc_class.hpp
Normal file
113
include/boost/fusion/adapted/class/adapt_assoc_class.hpp
Normal file
@ -0,0 +1,113 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 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_ADAPT_ASSOC_CLASS_OCTOBER_4_2009_840PM)
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_OCTOBER_4_2009_840PM
|
||||
|
||||
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||
#include <boost/fusion/adapted/class/extension.hpp>
|
||||
#include <boost/fusion/adapted/class/class_iterator.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/is_view_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/is_sequence_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/category_of_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/end_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/size_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/at_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/has_key_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/at_key_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/value_at_key_impl.hpp>
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/seq/for_each_i.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/config/no_tr1/utility.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension {
|
||||
template<typename Class, typename Key>
|
||||
struct class_assoc_member;
|
||||
}}}
|
||||
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS(name, bseq) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_CLASS_I( \
|
||||
name, BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_X bseq, 0)) \
|
||||
/***/
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_X(x, y, z) ((x, y, z)) BOOST_FUSION_ADAPT_ASSOC_CLASS_Y
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_Y(x, y, z) ((x, y, z)) BOOST_FUSION_ADAPT_ASSOC_CLASS_X
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_X0
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_Y0
|
||||
|
||||
// BOOST_FUSION_ADAPT_ASSOC_CLASS_I generates the overarching structure and uses
|
||||
// SEQ_FOR_EACH_I to generate the "linear" substructures.
|
||||
// Thanks to Paul Mensonides for the PP macro help
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_I(name, seq) \
|
||||
namespace boost { namespace fusion { namespace traits \
|
||||
{ \
|
||||
template <> \
|
||||
struct tag_of<name> \
|
||||
{ \
|
||||
typedef class_tag type; \
|
||||
}; \
|
||||
}}} \
|
||||
\
|
||||
namespace boost { namespace mpl \
|
||||
{ \
|
||||
template<typename> \
|
||||
struct sequence_tag; \
|
||||
\
|
||||
template<> \
|
||||
struct sequence_tag<name> \
|
||||
{ \
|
||||
typedef fusion::fusion_sequence_tag type; \
|
||||
}; \
|
||||
\
|
||||
template<> \
|
||||
struct sequence_tag<name const> \
|
||||
{ \
|
||||
typedef fusion::fusion_sequence_tag type; \
|
||||
}; \
|
||||
}} \
|
||||
\
|
||||
namespace boost { namespace fusion { namespace extension \
|
||||
{ \
|
||||
template <> \
|
||||
struct class_size<name> : mpl::int_<BOOST_PP_SEQ_SIZE(seq)> {}; \
|
||||
BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_ADAPT_ASSOC_CLASS_C, name, seq) \
|
||||
}}} \
|
||||
/***/
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_CLASS_C(r, name, i, xy) \
|
||||
template <> \
|
||||
struct class_member<name, i> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(3, 0, xy) type; \
|
||||
static type& call(name& class_) \
|
||||
{ \
|
||||
return class_.BOOST_PP_TUPLE_ELEM(3, 1, xy); \
|
||||
}; \
|
||||
}; \
|
||||
template<> \
|
||||
struct class_assoc_member<name, BOOST_PP_TUPLE_ELEM(3, 2, xy)> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(3, 0, xy) type; \
|
||||
static type& call(name& class_) \
|
||||
{ \
|
||||
return class_.BOOST_PP_TUPLE_ELEM(3, 1, xy); \
|
||||
}; \
|
||||
};
|
||||
/***/
|
||||
|
||||
#endif
|
123
include/boost/fusion/adapted/class/adapt_class.hpp
Normal file
123
include/boost/fusion/adapted/class/adapt_class.hpp
Normal file
@ -0,0 +1,123 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_ADAPT_CLASS_OCTOBER_4_2009_840PM)
|
||||
#define BOOST_FUSION_ADAPT_CLASS_OCTOBER_4_2009_840PM
|
||||
|
||||
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||
#include <boost/fusion/adapted/class/extension.hpp>
|
||||
#include <boost/fusion/adapted/class/class_iterator.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/is_view_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/is_sequence_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/category_of_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/end_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/size_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/at_impl.hpp>
|
||||
#include <boost/fusion/adapted/class/detail/value_at_impl.hpp>
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/seq/for_each_i.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/config/no_tr1/utility.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_CLASS(name, bseq) \
|
||||
BOOST_FUSION_ADAPT_CLASS_I( \
|
||||
name, BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_X bseq, 0)) \
|
||||
/***/
|
||||
|
||||
#define BOOST_FUSION_ADAPT_CLASS_X(w, x, y, z) ((w, x, y, z)) BOOST_FUSION_ADAPT_CLASS_Y
|
||||
#define BOOST_FUSION_ADAPT_CLASS_Y(w, x, y, z) ((w, x, y, z)) BOOST_FUSION_ADAPT_CLASS_X
|
||||
#define BOOST_FUSION_ADAPT_CLASS_X0
|
||||
#define BOOST_FUSION_ADAPT_CLASS_Y0
|
||||
|
||||
// BOOST_FUSION_ADAPT_CLASS_I generates the overarching structure and uses
|
||||
// SEQ_FOR_EACH_I to generate the "linear" substructures.
|
||||
// Thanks to Paul Mensonides for the PP macro help
|
||||
|
||||
#define BOOST_FUSION_ADAPT_CLASS_I(name, seq) \
|
||||
namespace boost { namespace fusion { namespace traits \
|
||||
{ \
|
||||
template <> \
|
||||
struct tag_of<name> \
|
||||
{ \
|
||||
typedef class_tag type; \
|
||||
}; \
|
||||
}}} \
|
||||
\
|
||||
namespace boost { namespace mpl \
|
||||
{ \
|
||||
template<typename> \
|
||||
struct sequence_tag; \
|
||||
\
|
||||
template<> \
|
||||
struct sequence_tag<name> \
|
||||
{ \
|
||||
typedef fusion::fusion_sequence_tag type; \
|
||||
}; \
|
||||
\
|
||||
template<> \
|
||||
struct sequence_tag<name const> \
|
||||
{ \
|
||||
typedef fusion::fusion_sequence_tag type; \
|
||||
}; \
|
||||
}} \
|
||||
\
|
||||
namespace boost { namespace fusion { namespace extension \
|
||||
{ \
|
||||
template <> \
|
||||
struct class_size<name> : mpl::int_<BOOST_PP_SEQ_SIZE(seq)> {}; \
|
||||
BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_ADAPT_CLASS_C, name, seq) \
|
||||
}}} \
|
||||
/***/
|
||||
|
||||
#define BOOST_FUSION_ADAPT_CLASS_C(r, name, i, xy) \
|
||||
template <> \
|
||||
struct class_member<name, i> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(4, 0, xy) type; \
|
||||
typedef BOOST_PP_TUPLE_ELEM(4, 1, xy) get_type; \
|
||||
struct proxy \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(4, 0, xy) type; \
|
||||
typedef BOOST_PP_TUPLE_ELEM(4, 1, xy) get_type; \
|
||||
typedef \
|
||||
add_reference<add_const<type>::type>::type \
|
||||
cref_type; \
|
||||
\
|
||||
proxy(name& obj) : obj(obj) {} \
|
||||
name& obj; \
|
||||
\
|
||||
proxy& operator=(cref_type val) \
|
||||
{ \
|
||||
BOOST_PP_TUPLE_ELEM(4, 3, xy); \
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
operator get_type() \
|
||||
{ \
|
||||
return BOOST_PP_TUPLE_ELEM(4, 2, xy); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
static get_type call(name const& obj) \
|
||||
{ \
|
||||
return BOOST_PP_TUPLE_ELEM(4, 2, xy); \
|
||||
}; \
|
||||
\
|
||||
static proxy call(name& obj) \
|
||||
{ \
|
||||
return proxy(obj); \
|
||||
}; \
|
||||
}; \
|
||||
/***/
|
||||
|
||||
#endif
|
105
include/boost/fusion/adapted/class/class_iterator.hpp
Normal file
105
include/boost/fusion/adapted/class/class_iterator.hpp
Normal file
@ -0,0 +1,105 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_CLASS_ITERATOR_OCTOBER_4_2009_839M)
|
||||
#define FUSION_CLASS_ITERATOR_OCTOBER_4_2009_839M
|
||||
|
||||
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||
#include <boost/fusion/adapted/class/extension.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/minus.hpp>
|
||||
#include <boost/config/no_tr1/utility.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
template <typename Class, int N_>
|
||||
struct class_iterator
|
||||
: iterator_facade<class_iterator<Class, N_>, random_access_traversal_tag>
|
||||
{
|
||||
BOOST_MPL_ASSERT_RELATION(N_, >=, 0);
|
||||
BOOST_MPL_ASSERT_RELATION(N_, <=, extension::class_size<Class>::value);
|
||||
|
||||
typedef mpl::int_<N_> index;
|
||||
typedef Class class_type;
|
||||
|
||||
class_iterator(Class& class_)
|
||||
: class_(class_) {}
|
||||
Class& class_;
|
||||
|
||||
template <typename Iterator>
|
||||
struct value_of
|
||||
: extension::class_member<Class, N_>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
struct deref
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_const<Class>
|
||||
, typename extension::class_member<Class, N_>::get_type
|
||||
, typename extension::class_member<Class, N_>::proxy
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator const& iter)
|
||||
{
|
||||
return extension::class_member<Class, N_>::
|
||||
call(iter.class_);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Iterator, typename N>
|
||||
struct advance
|
||||
{
|
||||
typedef typename Iterator::index index;
|
||||
typedef typename Iterator::class_type class_type;
|
||||
typedef class_iterator<class_type, index::value + N::value> type;
|
||||
|
||||
static type
|
||||
call(Iterator const& iter)
|
||||
{
|
||||
return type(iter.class_);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
struct next : advance<Iterator, mpl::int_<1> > {};
|
||||
|
||||
template <typename Iterator>
|
||||
struct prior : advance<Iterator, mpl::int_<-1> > {};
|
||||
|
||||
template <typename I1, typename I2>
|
||||
struct distance : mpl::minus<typename I2::index, typename I1::index>
|
||||
{
|
||||
typedef typename
|
||||
mpl::minus<
|
||||
typename I2::index, typename I1::index
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(I1 const&, I2 const&)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
70
include/boost/fusion/adapted/class/detail/at_impl.hpp
Normal file
70
include/boost/fusion/adapted/class/detail/at_impl.hpp
Normal file
@ -0,0 +1,70 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_AT_IMPL_OCTOBER_4_2009_920PM)
|
||||
#define BOOST_FUSION_AT_IMPL_OCTOBER_4_2009_920PM
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct at_impl;
|
||||
|
||||
template <typename Class, int N>
|
||||
struct class_member;
|
||||
|
||||
template <typename Class>
|
||||
struct class_size;
|
||||
|
||||
template <>
|
||||
struct at_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence, typename N>
|
||||
struct apply
|
||||
{
|
||||
static int const n_value = N::value;
|
||||
BOOST_MPL_ASSERT_RELATION(
|
||||
n_value, <=, extension::class_size<Sequence>::value);
|
||||
|
||||
typedef typename
|
||||
extension::class_member<Sequence, N::value>
|
||||
element;
|
||||
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_const<Sequence>
|
||||
, typename class_member<Sequence, N::value>::get_type
|
||||
, typename class_member<Sequence, N::value>::proxy
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return extension::
|
||||
class_member<Sequence, N::value>::call(seq);
|
||||
}
|
||||
|
||||
//~ static typename class_member<Sequence, N::value>::get_type
|
||||
//~ call(Sequence const& seq)
|
||||
//~ {
|
||||
//~ return extension::
|
||||
//~ class_member<Sequence, N::value>::call(seq);
|
||||
//~ }
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
54
include/boost/fusion/adapted/class/detail/at_key_impl.hpp
Normal file
54
include/boost/fusion/adapted/class/detail/at_key_impl.hpp
Normal file
@ -0,0 +1,54 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_AT_KEY_IMPL_OCTOBER_4_2009_920PM)
|
||||
#define BOOST_FUSION_AT_KEY_IMPL_OCTOBER_4_2009_920PM
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct at_key_impl;
|
||||
|
||||
template <typename Class, typename Key>
|
||||
struct class_assoc_member;
|
||||
|
||||
template <>
|
||||
struct at_key_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence, typename Key>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
extension::class_assoc_member<Sequence, Key>
|
||||
element;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
is_const<Sequence>
|
||||
, detail::cref_result<element>
|
||||
, detail::ref_result<element>
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return extension::
|
||||
class_assoc_member<Sequence, Key>::call(seq);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
40
include/boost/fusion/adapted/class/detail/begin_impl.hpp
Normal file
40
include/boost/fusion/adapted/class/detail/begin_impl.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_BEGIN_IMPL_OCTOBER_4_2009_920PM)
|
||||
#define BOOST_FUSION_BEGIN_IMPL_OCTOBER_4_2009_920PM
|
||||
|
||||
#include <boost/fusion/adapted/class/class_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef class_iterator<Sequence, 0> type;
|
||||
|
||||
static type
|
||||
call(Sequence& v)
|
||||
{
|
||||
return type(v);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,35 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_CATEGORY_OF_IMPL_OCTOBER_4_2009_919PM)
|
||||
#define BOOST_FUSION_CATEGORY_OF_IMPL_OCTOBER_4_2009_919PM
|
||||
|
||||
#include <boost/config/no_tr1/utility.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct category_of_impl;
|
||||
|
||||
template<>
|
||||
struct category_of_impl<class_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply
|
||||
{
|
||||
typedef random_access_traversal_tag type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
48
include/boost/fusion/adapted/class/detail/end_impl.hpp
Normal file
48
include/boost/fusion/adapted/class/detail/end_impl.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_END_IMPL_OCTOBER_4_2009_919PM)
|
||||
#define BOOST_FUSION_END_IMPL_OCTOBER_4_2009_919PM
|
||||
|
||||
#include <boost/fusion/adapted/class/class_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct end_impl;
|
||||
|
||||
template <typename Class>
|
||||
struct class_size;
|
||||
|
||||
template <>
|
||||
struct end_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
class_iterator<
|
||||
Sequence
|
||||
, class_size<Sequence>::value
|
||||
>
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Sequence& v)
|
||||
{
|
||||
return type(v);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
40
include/boost/fusion/adapted/class/detail/has_key_impl.hpp
Normal file
40
include/boost/fusion/adapted/class/detail/has_key_impl.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_HAS_KEY_IMPL_OCTOBER_4_2009_919PM)
|
||||
#define BOOST_FUSION_HAS_KEY_IMPL_OCTOBER_4_2009_919PM
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
struct no_such_member;
|
||||
|
||||
template<typename T>
|
||||
struct has_key_impl;
|
||||
|
||||
template<typename Class, typename Key>
|
||||
struct class_assoc_member;
|
||||
|
||||
template<>
|
||||
struct has_key_impl<class_tag>
|
||||
{
|
||||
template<typename Sequence, typename Key>
|
||||
struct apply
|
||||
: mpl::not_<is_same<no_such_member, typename class_assoc_member<Sequence, Key>::type> >
|
||||
{
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,31 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_IS_SEQUENCE_IMPL_OCTOBER_4_2009_919PM)
|
||||
#define BOOST_FUSION_IS_SEQUENCE_IMPL_OCTOBER_4_2009_919PM
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_sequence_impl;
|
||||
|
||||
template<>
|
||||
struct is_sequence_impl<class_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply : mpl::true_ {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
32
include/boost/fusion/adapted/class/detail/is_view_impl.hpp
Normal file
32
include/boost/fusion/adapted/class/detail/is_view_impl.hpp
Normal file
@ -0,0 +1,32 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_IS_VIEW_IMPL_OCTOBER_4_2009_919PM)
|
||||
#define BOOST_FUSION_IS_VIEW_IMPL_OCTOBER_4_2009_919PM
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_view_impl;
|
||||
|
||||
template<>
|
||||
struct is_view_impl<class_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply : mpl::false_
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
37
include/boost/fusion/adapted/class/detail/size_impl.hpp
Normal file
37
include/boost/fusion/adapted/class/detail/size_impl.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_SIZE_IMPL_OCTOBER_4_2009_919PM)
|
||||
#define BOOST_FUSION_SIZE_IMPL_OCTOBER_4_2009_919PM
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace extension
|
||||
{
|
||||
template <typename Class>
|
||||
struct class_size;
|
||||
}
|
||||
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct size_impl;
|
||||
|
||||
template <>
|
||||
struct size_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply : extension::class_size<Sequence> {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
47
include/boost/fusion/adapted/class/detail/value_at_impl.hpp
Normal file
47
include/boost/fusion/adapted/class/detail/value_at_impl.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_VALUE_AT_IMPL_OCTOBER_4_2009_918PM)
|
||||
#define BOOST_FUSION_VALUE_AT_IMPL_OCTOBER_4_2009_918PM
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct value_at_impl;
|
||||
|
||||
template <typename Class, int N>
|
||||
struct class_member;
|
||||
|
||||
template <typename Class>
|
||||
struct class_size;
|
||||
|
||||
template <>
|
||||
struct value_at_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence, typename N>
|
||||
struct apply
|
||||
{
|
||||
static int const n_value = N::value;
|
||||
BOOST_MPL_ASSERT_RELATION(
|
||||
n_value, <=, extension::class_size<Sequence>::value);
|
||||
|
||||
typedef typename
|
||||
extension::class_member<Sequence, N::value>::type
|
||||
type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,39 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2007 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_VALUE_AT_KEY_IMPL_OCTOBER_4_2009_918PM)
|
||||
#define BOOST_FUSION_VALUE_AT_KEY_IMPL_OCTOBER_4_2009_918PM
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct class_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct value_at_key_impl;
|
||||
|
||||
template <typename Class, typename Key>
|
||||
struct class_assoc_member;
|
||||
|
||||
template <>
|
||||
struct value_at_key_impl<class_tag>
|
||||
{
|
||||
template <typename Sequence, typename Key>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
extension::class_assoc_member<Sequence, Key>::type
|
||||
type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
61
include/boost/fusion/adapted/class/extension.hpp
Normal file
61
include/boost/fusion/adapted/class/extension.hpp
Normal file
@ -0,0 +1,61 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_CLASS_EXTENSION_OCTOBER_4_2009_839PM)
|
||||
#define FUSION_CLASS_EXTENSION_OCTOBER_4_2009_839PM
|
||||
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct fusion_sequence_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Class, int N>
|
||||
struct class_member;
|
||||
|
||||
template <typename Class>
|
||||
struct class_size;
|
||||
|
||||
template <typename Class, int N>
|
||||
struct class_member<Class const, N> : class_member<Class, N> {};
|
||||
|
||||
template <typename Class>
|
||||
struct class_size<Class const>
|
||||
: class_size<Class>
|
||||
{};
|
||||
|
||||
struct no_such_member;
|
||||
|
||||
template<typename Class, typename Key>
|
||||
struct class_assoc_member
|
||||
{
|
||||
typedef no_such_member type;
|
||||
};
|
||||
|
||||
template<typename Class, typename Key>
|
||||
struct class_assoc_member<Class const, Key>
|
||||
{
|
||||
typedef typename
|
||||
add_const<typename class_assoc_member<Class, Key>::type>::type
|
||||
type;
|
||||
|
||||
static type&
|
||||
call(Class const& class_)
|
||||
{
|
||||
return class_assoc_member<Class, Key>::call(
|
||||
const_cast<Class&>(class_));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,118 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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_PP_IS_ITERATING)
|
||||
# error "This file has to be included by a preprocessor loop construct!"
|
||||
#elif BOOST_PP_ITERATION_DEPTH() == 1
|
||||
|
||||
# if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_DETAIL_POW2_EXPLODE_HPP_INCLUDED)
|
||||
# include <boost/preprocessor/config/limits.hpp>
|
||||
# include <boost/preprocessor/slot/slot.hpp>
|
||||
# include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
# define BOOST_FUSION_FUNCTIONAL_ADAPTER_DETAIL_POW2_EXPLODE_HPP_INCLUDED
|
||||
# endif
|
||||
|
||||
# define BOOST_PP_VALUE 0
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
|
||||
# define BOOST_PP_FILENAME_2 \
|
||||
<boost/fusion/functional/adapter/detail/pow2_explode.hpp>
|
||||
# define BOOST_PP_VALUE (1 << N) >> 4
|
||||
# if BOOST_PP_VALUE > BOOST_PP_LIMIT_ITERATION
|
||||
# error "Preprocessor limit exceeded."
|
||||
# endif
|
||||
|
||||
# include BOOST_PP_ASSIGN_SLOT(2)
|
||||
# define BOOST_PP_ITERATION_LIMITS (0,BOOST_PP_DEC(BOOST_PP_SLOT_2()))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
#elif BOOST_PP_ITERATION_DEPTH() == 2
|
||||
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# if BOOST_PP_SLOT_1() < 1 << N
|
||||
# include BOOST_PP_INDIRECT_SELF
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT_1() + 1
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
@ -1,71 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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).
|
||||
==============================================================================*/
|
||||
|
||||
// No include guard - this file is included multiple times intentionally.
|
||||
|
||||
#if BOOST_PP_SLOT_1() & 0x001
|
||||
# define PT0 T0 &
|
||||
#else
|
||||
# define PT0 T0 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x002
|
||||
# define PT1 T1 &
|
||||
#else
|
||||
# define PT1 T1 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x004
|
||||
# define PT2 T2 &
|
||||
#else
|
||||
# define PT2 T2 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x008
|
||||
# define PT3 T3 &
|
||||
#else
|
||||
# define PT3 T3 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x010
|
||||
# define PT4 T4 &
|
||||
#else
|
||||
# define PT4 T4 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x020
|
||||
# define PT5 T5 &
|
||||
#else
|
||||
# define PT5 T5 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x040
|
||||
# define PT6 T6 &
|
||||
#else
|
||||
# define PT6 T6 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x080
|
||||
# define PT7 T7 &
|
||||
#else
|
||||
# define PT7 T7 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x100
|
||||
# define PT8 T8 &
|
||||
#else
|
||||
# define PT8 T8 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x200
|
||||
# define PT9 T9 &
|
||||
#else
|
||||
# define PT9 T9 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x400
|
||||
# define PT10 T10 &
|
||||
#else
|
||||
# define PT10 T10 const &
|
||||
#endif
|
||||
#if BOOST_PP_SLOT_1() & 0x800
|
||||
# define PT11 T11 &
|
||||
#else
|
||||
# define PT11 T11 const &
|
||||
#endif
|
||||
|
@ -1,23 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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).
|
||||
==============================================================================*/
|
||||
|
||||
// No include guard - this file is included multiple times intentionally.
|
||||
|
||||
#undef PT0
|
||||
#undef PT1
|
||||
#undef PT2
|
||||
#undef PT3
|
||||
#undef PT4
|
||||
#undef PT5
|
||||
#undef PT6
|
||||
#undef PT7
|
||||
#undef PT8
|
||||
#undef PT9
|
||||
#undef PT10
|
||||
#undef PT11
|
||||
|
@ -1,175 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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_FUNCTIONAL_ADAPTER_UNFUSED_GENERIC_HPP_INCLUDED)
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
|
||||
#include <boost/fusion/functional/adapter/limits.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <class Function> class unfused_generic;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
template <class Function>
|
||||
class unfused_generic
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
typedef typename detail::qf_c<Function>::type function_c;
|
||||
typedef typename detail::qf<Function>::type function;
|
||||
|
||||
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
||||
|
||||
public:
|
||||
|
||||
inline explicit unfused_generic(func_const_fwd_t f = Function())
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
typedef typename boost::result_of<
|
||||
function_c(fusion::vector0 &) >::type call_const_0_result;
|
||||
|
||||
inline call_const_0_result operator()() const
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
typedef typename boost::result_of<
|
||||
function (fusion::vector0 &) >::type call_0_result;
|
||||
|
||||
inline call_0_result operator()()
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
#define BOOST_FUSION_CODE(tpl_params,arg_types,params,args) \
|
||||
template <tpl_params> \
|
||||
inline typename boost::result_of<function_c( \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types> & )>::type \
|
||||
operator()(params) const \
|
||||
{ \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types> arg(args); \
|
||||
return this->fnc_transformed(arg); \
|
||||
} \
|
||||
template <tpl_params> \
|
||||
inline typename boost::result_of<function( \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types> & )>::type \
|
||||
operator()(params) \
|
||||
{ \
|
||||
BOOST_PP_CAT(fusion::vector,N)<arg_types> arg(args); \
|
||||
return this->fnc_transformed(arg); \
|
||||
}
|
||||
|
||||
#define BOOST_PP_INDIRECT_SELF \
|
||||
<boost/fusion/functional/adapter/unfused_generic.hpp>
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/functional/adapter/detail/pow2_explode.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS \
|
||||
(1,BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY)
|
||||
#define N BOOST_PP_ITERATION_1
|
||||
#include BOOST_PP_ITERATE()
|
||||
#undef N
|
||||
|
||||
#undef BOOST_FUSION_CODE
|
||||
};
|
||||
}}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<class F>
|
||||
struct result_of<boost::fusion::unfused_generic<F> const ()>
|
||||
{
|
||||
typedef typename boost::fusion::unfused_generic<F>::call_const_0_result type;
|
||||
};
|
||||
template<class F>
|
||||
struct result_of<boost::fusion::unfused_generic<F>()>
|
||||
{
|
||||
typedef typename boost::fusion::unfused_generic<F>::call_0_result type;
|
||||
};
|
||||
}
|
||||
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_GENERIC_HPP_INCLUDED
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/fusion/functional/adapter/detail/pt_def.hpp>
|
||||
|
||||
#if BOOST_PP_SLOT_1() == 0
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct result
|
||||
< Self const (BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: boost::result_of<function_c(
|
||||
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
typename detail::gref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct result
|
||||
< Self(BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: boost::result_of<function(
|
||||
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
typename detail::gref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1400))
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename boost::result_of<function_c(
|
||||
BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)> & )>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a)) const
|
||||
{
|
||||
BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)>
|
||||
arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename boost::result_of<function(
|
||||
BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)> & )>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a))
|
||||
{
|
||||
BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)>
|
||||
arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
#else
|
||||
BOOST_FUSION_CODE(BOOST_PP_ENUM_PARAMS(N,typename T),
|
||||
BOOST_PP_ENUM_PARAMS(N,PT), BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a),
|
||||
BOOST_PP_ENUM_PARAMS(N,a) )
|
||||
// ...generates uglier code but is faster - it caches ENUM_*
|
||||
#endif
|
||||
|
||||
#include <boost/fusion/functional/adapter/detail/pt_undef.hpp>
|
||||
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
#endif
|
||||
|
@ -1,136 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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_FUNCTIONAL_ADAPTER_UNFUSED_LVALUE_ARGS_HPP_INCLUDED)
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
|
||||
#include <boost/fusion/functional/adapter/limits.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <class Function> class unfused_lvalue_args;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
template <class Function> class unfused_lvalue_args
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
typedef typename detail::qf_c<Function>::type function_c;
|
||||
typedef typename detail::qf<Function>::type function;
|
||||
|
||||
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
||||
|
||||
public:
|
||||
|
||||
inline explicit unfused_lvalue_args(func_const_fwd_t f = function())
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
typedef typename boost::result_of<
|
||||
function_c(fusion::vector0 &) >::type call_const_0_result;
|
||||
|
||||
inline call_const_0_result operator()() const
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
typedef typename boost::result_of<
|
||||
function(fusion::vector0 &) >::type call_0_result;
|
||||
|
||||
inline call_0_result operator()()
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/functional/adapter/unfused_lvalue_args.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS \
|
||||
(1,BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY)
|
||||
#include BOOST_PP_ITERATE()
|
||||
};
|
||||
}}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<class F>
|
||||
struct result_of< boost::fusion::unfused_lvalue_args<F> const () >
|
||||
{
|
||||
typedef typename boost::fusion::unfused_lvalue_args<F>::call_const_0_result type;
|
||||
};
|
||||
template<class F>
|
||||
struct result_of< boost::fusion::unfused_lvalue_args<F>() >
|
||||
{
|
||||
typedef typename boost::fusion::unfused_lvalue_args<F>::call_0_result type;
|
||||
};
|
||||
}
|
||||
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_LVALUE_ARGS_HPP_INCLUDED
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: boost::result_of< function_c(
|
||||
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
typename detail::mref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct result< Self(BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: boost::result_of< function(
|
||||
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
typename detail::mref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename boost::result_of<function_c(BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> & )>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const
|
||||
{
|
||||
BOOST_PP_CAT(fusion::vector,N)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) >
|
||||
arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename boost::result_of<function(BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> & )>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a))
|
||||
{
|
||||
BOOST_PP_CAT(fusion::vector,N)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) >
|
||||
arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
#endif
|
||||
|
@ -1,137 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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_FUNCTIONAL_ADAPTER_UNFUSED_RVALUE_ARGS_HPP_INCLUDED)
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
|
||||
#include <boost/fusion/functional/adapter/limits.hpp>
|
||||
#include <boost/fusion/functional/adapter/detail/access.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <class Function> class unfused_rvalue_args;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
template <class Function> class unfused_rvalue_args
|
||||
{
|
||||
Function fnc_transformed;
|
||||
|
||||
typedef typename detail::qf_c<Function>::type function_c;
|
||||
typedef typename detail::qf<Function>::type function;
|
||||
|
||||
typedef typename detail::call_param<Function>::type func_const_fwd_t;
|
||||
|
||||
public:
|
||||
|
||||
inline explicit unfused_rvalue_args(func_const_fwd_t f = function())
|
||||
: fnc_transformed(f)
|
||||
{ }
|
||||
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
typedef typename boost::result_of<
|
||||
function_c(fusion::vector0 &) >::type call_const_0_result;
|
||||
|
||||
inline call_const_0_result operator()() const
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
typedef typename boost::result_of<
|
||||
function(fusion::vector0 &) >::type call_0_result;
|
||||
|
||||
inline call_0_result operator()()
|
||||
{
|
||||
fusion::vector0 arg;
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/functional/adapter/unfused_rvalue_args.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS \
|
||||
(1,BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY)
|
||||
#include BOOST_PP_ITERATE()
|
||||
};
|
||||
}}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<class F>
|
||||
struct result_of<boost::fusion::unfused_rvalue_args<F> const ()>
|
||||
{
|
||||
typedef typename boost::fusion::unfused_rvalue_args<F>::call_const_0_result type;
|
||||
};
|
||||
template<class F>
|
||||
struct result_of<boost::fusion::unfused_rvalue_args<F>()>
|
||||
{
|
||||
typedef typename boost::fusion::unfused_rvalue_args<F>::call_0_result type;
|
||||
};
|
||||
}
|
||||
|
||||
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_RVALUE_ARGS_HPP_INCLUDED
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: boost::result_of< function_c(
|
||||
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
typename detail::cref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
|
||||
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
struct result< Self (BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: boost::result_of< function(
|
||||
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
typename detail::cref<T,>::type BOOST_PP_INTERCEPT) > & )>
|
||||
{ };
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename boost::result_of<function_c(BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)> & )>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a)) const
|
||||
{
|
||||
BOOST_PP_CAT(fusion::vector,N)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT) >
|
||||
arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
|
||||
inline typename boost::result_of<function(BOOST_PP_CAT(fusion::vector,N)
|
||||
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)> & )>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a))
|
||||
{
|
||||
BOOST_PP_CAT(fusion::vector,N)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT) >
|
||||
arg(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
return this->fnc_transformed(arg);
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
#endif
|
||||
|
@ -1,18 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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_FUNCTIONAL_GENERATION_MAKE_UNFUSED_GENERIC_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_GENERATION_MAKE_UNFUSED_GENERIC_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/functional/adapter/unfused_generic.hpp>
|
||||
|
||||
#define BOOST_FUSION_CLASS_TPL_NAME unfused_generic
|
||||
#include <boost/fusion/functional/generation/detail/gen_make_adapter.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -1,18 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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_FUNCTIONAL_GENERATION_MAKE_UNFUSED_LVALUE_ARGS_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_GENERATION_MAKE_UNFUSED_LVALUE_ARGS_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/functional/adapter/unfused_lvalue_args.hpp>
|
||||
|
||||
#define BOOST_FUSION_CLASS_TPL_NAME unfused_lvalue_args
|
||||
#include <boost/fusion/functional/generation/detail/gen_make_adapter.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -1,18 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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_FUNCTIONAL_GENERATION_MAKE_UNFUSED_RVALUE_ARGS_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_FUNCTIONAL_GENERATION_MAKE_UNFUSED_RVALUE_ARGS_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/functional/adapter/unfused_rvalue_args.hpp>
|
||||
|
||||
#define BOOST_FUSION_CLASS_TPL_NAME unfused_rvalue_args
|
||||
#include <boost/fusion/functional/generation/detail/gen_make_adapter.hpp>
|
||||
|
||||
#endif
|
||||
|
12
include/boost/fusion/include/adapt_class.hpp
Normal file
12
include/boost/fusion/include/adapt_class.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_INCLUDE_ADAPT_CLASS)
|
||||
#define FUSION_INCLUDE_ADAPT_CLASS
|
||||
|
||||
#include <boost/fusion/adapted/class/adapt_class.hpp>
|
||||
|
||||
#endif
|
@ -1,124 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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).
|
||||
==============================================================================*/
|
||||
|
||||
#include <boost/fusion/functional/generation/make_unfused_generic.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/empty.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
using boost::noncopyable;
|
||||
typedef mpl::true_ no_nullary_call;
|
||||
|
||||
using boost::ref;
|
||||
using boost::cref;
|
||||
|
||||
template <class Base = boost::blank, class RemoveNullary = mpl::false_>
|
||||
struct test_func
|
||||
: Base
|
||||
{
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <class Self, class Seq>
|
||||
struct result< Self(Seq &) >
|
||||
: mpl::if_< mpl::and_< fusion::result_of::empty<Seq>, RemoveNullary >,
|
||||
boost::blank, mpl::identity<long> >::type
|
||||
{ };
|
||||
|
||||
template <typename Seq>
|
||||
long operator()(Seq const & seq) const
|
||||
{
|
||||
long state = 0;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
template < typename Seq >
|
||||
long operator()(Seq const & seq)
|
||||
{
|
||||
long state = 100;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct fold_op
|
||||
{
|
||||
typedef long result_type;
|
||||
|
||||
template <typename T>
|
||||
long operator()(T const & elem, long value) const
|
||||
{
|
||||
return value + sizeof(T) * elem;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
long operator()(T & elem, long value) const
|
||||
{
|
||||
elem += sizeof(T);
|
||||
return value;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline T const & const_(T const & t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test_func<> f;
|
||||
test_func<noncopyable> f_nc;
|
||||
|
||||
fusion::result_of::make_unfused_generic< test_func<> >::type unfused_func =
|
||||
fusion::make_unfused_generic(f);
|
||||
|
||||
fusion::result_of::make_unfused_generic< boost::reference_wrapper<
|
||||
test_func<noncopyable> > >::type unfused_func_ref =
|
||||
fusion::make_unfused_generic(ref(f_nc));
|
||||
|
||||
fusion::result_of::make_unfused_generic< boost::reference_wrapper<
|
||||
test_func<noncopyable> const> >::type unfused_func_c_ref =
|
||||
fusion::make_unfused_generic(cref(f_nc));
|
||||
|
||||
BOOST_TEST(unfused_func() == 100);
|
||||
BOOST_TEST(const_(unfused_func)() == 0);
|
||||
BOOST_TEST(unfused_func_ref() == 100);
|
||||
BOOST_TEST(unfused_func_c_ref() == 0);
|
||||
|
||||
long lvalue = 12;
|
||||
static const long expected = 1*sizeof(int) + 2*sizeof(long) + 7*sizeof(char);
|
||||
BOOST_TEST(unfused_func(lvalue,lvalue,1,2l,'\007') == 100 + expected);
|
||||
BOOST_TEST(lvalue == 12 + 2*sizeof(long));
|
||||
BOOST_TEST(const_(unfused_func)(lvalue,lvalue,1,2l,'\007') == 0 + expected);
|
||||
BOOST_TEST(lvalue == 12 + 4*sizeof(long));
|
||||
BOOST_TEST(unfused_func_ref(lvalue,lvalue,1,2l,'\007') == 100 + expected);
|
||||
BOOST_TEST(lvalue == 12 + 6*sizeof(long));
|
||||
BOOST_TEST(unfused_func_c_ref(lvalue,lvalue,1,2l,'\007') == 0 + expected);
|
||||
BOOST_TEST(lvalue == 12 + 8*sizeof(long));
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,126 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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).
|
||||
==============================================================================*/
|
||||
|
||||
#include <boost/fusion/functional/generation/make_unfused_lvalue_args.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/empty.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
using boost::noncopyable;
|
||||
typedef mpl::true_ no_nullary_call;
|
||||
|
||||
using boost::ref;
|
||||
using boost::cref;
|
||||
|
||||
template <class Base = boost::blank, class RemoveNullary = mpl::false_>
|
||||
struct test_func
|
||||
: Base
|
||||
{
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <class Self, class Seq>
|
||||
struct result< Self(Seq &) >
|
||||
: mpl::if_< mpl::and_< fusion::result_of::empty<Seq>, RemoveNullary >,
|
||||
boost::blank, mpl::identity<long> >::type
|
||||
{ };
|
||||
|
||||
template <typename Seq>
|
||||
long operator()(Seq const & seq) const
|
||||
{
|
||||
long state = 0;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
template < typename Seq >
|
||||
long operator()(Seq const & seq)
|
||||
{
|
||||
long state = 100;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct fold_op
|
||||
{
|
||||
typedef long result_type;
|
||||
|
||||
template <typename T>
|
||||
long operator()(T & elem, long value) const
|
||||
{
|
||||
elem += sizeof(T);
|
||||
return value + elem;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline T const & const_(T const & t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test_func<> f;
|
||||
test_func<noncopyable> f_nc;
|
||||
|
||||
fusion::result_of::make_unfused_lvalue_args< test_func<> >::type unfused_func =
|
||||
fusion::make_unfused_lvalue_args(f);
|
||||
|
||||
fusion::result_of::make_unfused_lvalue_args< boost::reference_wrapper<
|
||||
test_func<noncopyable> > >::type unfused_func_ref =
|
||||
fusion::make_unfused_lvalue_args(ref(f_nc));
|
||||
|
||||
fusion::result_of::make_unfused_lvalue_args< boost::reference_wrapper<
|
||||
test_func<noncopyable> const> >::type unfused_func_c_ref =
|
||||
fusion::make_unfused_lvalue_args(cref(f_nc));
|
||||
|
||||
BOOST_TEST(unfused_func() == 100);
|
||||
BOOST_TEST(const_(unfused_func)() == 0);
|
||||
BOOST_TEST(unfused_func_ref() == 100);
|
||||
BOOST_TEST(unfused_func_c_ref() == 0);
|
||||
|
||||
long lv1 = 2; int lv2 = 3l; char lv3 = '\007';
|
||||
long expected;
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func(lv1,lv2,lv3) == 100 + expected);
|
||||
BOOST_TEST(lv1 == 2+1*sizeof(lv1) && lv2 == 3+1*sizeof(lv2) && lv3 == 7+1*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(const_(unfused_func)(lv1,lv2,lv3) == 0 + expected);
|
||||
BOOST_TEST(lv1 == 2+2*sizeof(lv1) && lv2 == 3+2*sizeof(lv2) && lv3 == 7+2*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func_ref(lv1,lv2,lv3) == 100 + expected);
|
||||
BOOST_TEST(lv1 == 2+3*sizeof(lv1) && lv2 == 3+3*sizeof(lv2) && lv3 == 7+3*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func_c_ref(lv1,lv2,lv3) == 0 + expected);
|
||||
BOOST_TEST(lv1 == 2+4*sizeof(lv1) && lv2 == 3+4*sizeof(lv2) && lv3 == 7+4*sizeof(lv3));
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,110 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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).
|
||||
==============================================================================*/
|
||||
|
||||
#include <boost/fusion/functional/generation/make_unfused_rvalue_args.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/empty.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
using boost::noncopyable;
|
||||
typedef mpl::true_ no_nullary_call;
|
||||
|
||||
using boost::ref;
|
||||
using boost::cref;
|
||||
|
||||
template <class Base = boost::blank, class RemoveNullary = mpl::false_>
|
||||
struct test_func
|
||||
: Base
|
||||
{
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <class Self, class Seq>
|
||||
struct result< Self(Seq &) >
|
||||
: mpl::if_< mpl::and_< fusion::result_of::empty<Seq>, RemoveNullary >,
|
||||
boost::blank, mpl::identity<long> >::type
|
||||
{ };
|
||||
|
||||
template <typename Seq>
|
||||
long operator()(Seq const & seq) const
|
||||
{
|
||||
long state = 0;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
template < typename Seq >
|
||||
long operator()(Seq const & seq)
|
||||
{
|
||||
long state = 100;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct fold_op
|
||||
{
|
||||
typedef long result_type;
|
||||
|
||||
template <typename T>
|
||||
long operator()(T const & elem, long value) const
|
||||
{
|
||||
return value + sizeof(T) * elem;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline T const & const_(T const & t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test_func<> f;
|
||||
test_func<noncopyable> f_nc;
|
||||
|
||||
fusion::result_of::make_unfused_rvalue_args< test_func<> >::type unfused_func =
|
||||
fusion::make_unfused_rvalue_args(f);
|
||||
|
||||
fusion::result_of::make_unfused_rvalue_args< boost::reference_wrapper<
|
||||
test_func<noncopyable> > >::type unfused_func_ref =
|
||||
fusion::make_unfused_rvalue_args(ref(f_nc));
|
||||
|
||||
fusion::result_of::make_unfused_rvalue_args< boost::reference_wrapper<
|
||||
test_func<noncopyable> const> >::type unfused_func_c_ref =
|
||||
fusion::make_unfused_rvalue_args(cref(f_nc));
|
||||
|
||||
BOOST_TEST(unfused_func() == 100);
|
||||
BOOST_TEST(const_(unfused_func)() == 0);
|
||||
BOOST_TEST(unfused_func_ref() == 100);
|
||||
BOOST_TEST(unfused_func_c_ref() == 0);
|
||||
|
||||
static const long expected = 1*sizeof(int) + 2*sizeof(long) + 7*sizeof(char);
|
||||
BOOST_TEST(unfused_func(1,2l,'\007') == 100 + expected);
|
||||
BOOST_TEST(const_(unfused_func)(1,2l,'\007') == 0 + expected);
|
||||
BOOST_TEST(unfused_func_ref(1,2l,'\007') == 100 + expected);
|
||||
BOOST_TEST(unfused_func_c_ref(1,2l,'\007') == 0 + expected);
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,126 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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).
|
||||
==============================================================================*/
|
||||
|
||||
#include <boost/fusion/functional/adapter/unfused_generic.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
using boost::noncopyable;
|
||||
typedef mpl::true_ no_nullary_call;
|
||||
|
||||
template <class Base = boost::blank>
|
||||
struct test_func
|
||||
: Base
|
||||
{
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <class Self, class Seq>
|
||||
struct result< Self (Seq) >
|
||||
: mpl::identity<long>
|
||||
{ };
|
||||
|
||||
template <typename Seq>
|
||||
long operator()(Seq const & seq) const
|
||||
{
|
||||
long state = 0;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
template <typename Seq>
|
||||
long operator()(Seq const & seq)
|
||||
{
|
||||
long state = 100;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct fold_op
|
||||
{
|
||||
template <typename T>
|
||||
long operator()(T const & elem, long value) const
|
||||
{
|
||||
return value + sizeof(T) * elem;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
long operator()(T & elem, long value) const
|
||||
{
|
||||
elem += sizeof(T);
|
||||
return value;
|
||||
}
|
||||
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <class Self, typename T0, typename T1> struct result< Self(T0,T1) >
|
||||
: mpl::identity<long>
|
||||
{ };
|
||||
};
|
||||
};
|
||||
|
||||
void result_type_tests()
|
||||
{
|
||||
using boost::is_same;
|
||||
|
||||
typedef fusion::unfused_generic< test_func<> > t;
|
||||
BOOST_TEST(( is_same< boost::result_of< t () >::type, long >::value ));
|
||||
BOOST_TEST(( is_same< boost::result_of< t (int) >::type, long >::value ));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
result_type_tests();
|
||||
|
||||
test_func<noncopyable> f;
|
||||
fusion::unfused_generic< test_func<> > unfused_func;
|
||||
fusion::unfused_generic< test_func<noncopyable> & > unfused_func_ref(f);
|
||||
fusion::unfused_generic< test_func<> const > unfused_func_c;
|
||||
fusion::unfused_generic< test_func<> > const unfused_func_c2;
|
||||
fusion::unfused_generic< test_func<noncopyable> const & > unfused_func_c_ref(f);
|
||||
|
||||
BOOST_TEST(unfused_func() == 100);
|
||||
BOOST_TEST(unfused_func_ref() == 100);
|
||||
BOOST_TEST(unfused_func_c() == 0);
|
||||
BOOST_TEST(unfused_func_c2() == 0);
|
||||
BOOST_TEST(unfused_func_c_ref() == 0);
|
||||
|
||||
long lvalue = 12;
|
||||
// also test const lvalues to pick up compiler deficiencies in that area
|
||||
int const clvalue_1 = 1;
|
||||
long const clvalue_2 = 2;
|
||||
|
||||
static const long expected = 1*sizeof(int) + 2*sizeof(long) + 7*sizeof(char);
|
||||
BOOST_TEST(unfused_func(lvalue,lvalue,clvalue_1,clvalue_2,'\007') == 100 + expected);
|
||||
BOOST_TEST(lvalue == 12 + 2*sizeof(long));
|
||||
BOOST_TEST(unfused_func_ref(lvalue,lvalue,1,2l,'\007') == 100 + expected);
|
||||
BOOST_TEST(lvalue == 12 + 4*sizeof(long));
|
||||
BOOST_TEST(unfused_func_c(lvalue,lvalue,1,2l,'\007') == 0 + expected);
|
||||
BOOST_TEST(lvalue == 12 + 6*sizeof(long));
|
||||
BOOST_TEST(unfused_func_c2(lvalue,lvalue,1,2l,'\007') == 0 + expected);
|
||||
BOOST_TEST(lvalue == 12 + 8*sizeof(long));
|
||||
BOOST_TEST(unfused_func_c_ref(lvalue,lvalue,1,2l,'\007') == 0 + expected);
|
||||
BOOST_TEST(lvalue == 12 + 10*sizeof(long));
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,119 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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).
|
||||
==============================================================================*/
|
||||
|
||||
#include <boost/fusion/functional/adapter/unfused_lvalue_args.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/empty.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
using boost::noncopyable;
|
||||
|
||||
template <class Base = boost::blank>
|
||||
struct test_func
|
||||
: Base
|
||||
{
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <class Self, class Seq>
|
||||
struct result< Self(Seq) >
|
||||
: mpl::identity<long>
|
||||
{ };
|
||||
|
||||
template <typename Seq>
|
||||
long operator()(Seq const & seq) const
|
||||
{
|
||||
long state = 0;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
template <typename Seq>
|
||||
long operator()(Seq const & seq)
|
||||
{
|
||||
long state = 100;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct fold_op
|
||||
{
|
||||
typedef long result_type;
|
||||
|
||||
template <typename T>
|
||||
long operator()(T & elem, long value) const
|
||||
{
|
||||
elem += sizeof(T);
|
||||
return value + elem;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
void result_type_tests()
|
||||
{
|
||||
using boost::is_same;
|
||||
|
||||
typedef fusion::unfused_lvalue_args< test_func<> > t;
|
||||
BOOST_TEST(( is_same< boost::result_of< t () >::type, long >::value ));
|
||||
BOOST_TEST(( is_same< boost::result_of< t (int) >::type, long >::value ));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
result_type_tests();
|
||||
|
||||
test_func<noncopyable> f;
|
||||
fusion::unfused_lvalue_args< test_func<> > unfused_func;
|
||||
fusion::unfused_lvalue_args< test_func<noncopyable> & > unfused_func_ref(f);
|
||||
fusion::unfused_lvalue_args< test_func<> const > unfused_func_c;
|
||||
fusion::unfused_lvalue_args< test_func<> > const unfused_func_c2;
|
||||
fusion::unfused_lvalue_args< test_func<noncopyable> const & > unfused_func_c_ref(f);
|
||||
|
||||
BOOST_TEST(unfused_func() == 100);
|
||||
BOOST_TEST(unfused_func_ref() == 100);
|
||||
BOOST_TEST(unfused_func_c() == 0);
|
||||
BOOST_TEST(unfused_func_c2() == 0);
|
||||
BOOST_TEST(unfused_func_c_ref() == 0);
|
||||
|
||||
long lv1 = 2; int lv2 = 3l; char lv3 = '\007';
|
||||
long expected;
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func(lv1,lv2,lv3) == 100 + expected);
|
||||
BOOST_TEST(lv1 == 2+1*sizeof(lv1) && lv2 == 3+1*sizeof(lv2) && lv3 == 7+1*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func_ref(lv1,lv2,lv3) == 100 + expected);
|
||||
BOOST_TEST(lv1 == 2+2*sizeof(lv1) && lv2 == 3+2*sizeof(lv2) && lv3 == 7+2*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func_c(lv1,lv2,lv3) == 0 + expected);
|
||||
BOOST_TEST(lv1 == 2+3*sizeof(lv1) && lv2 == 3+3*sizeof(lv2) && lv3 == 7+3*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func_c2(lv1,lv2,lv3) == 0 + expected);
|
||||
BOOST_TEST(lv1 == 2+4*sizeof(lv1) && lv2 == 3+4*sizeof(lv2) && lv3 == 7+4*sizeof(lv3));
|
||||
|
||||
expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
|
||||
BOOST_TEST(unfused_func_c_ref(lv1,lv2,lv3) == 0 + expected);
|
||||
BOOST_TEST(lv1 == 2+5*sizeof(lv1) && lv2 == 3+5*sizeof(lv2) && lv3 == 7+5*sizeof(lv3));
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,102 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to 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).
|
||||
==============================================================================*/
|
||||
|
||||
#include <boost/fusion/functional/adapter/unfused_rvalue_args.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/blank.hpp>
|
||||
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
using boost::noncopyable;
|
||||
typedef mpl::true_ no_nullary_call;
|
||||
|
||||
template <class Base = boost::blank>
|
||||
struct test_func
|
||||
: Base
|
||||
{
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <class Self, class Seq>
|
||||
struct result< Self(Seq) >
|
||||
: mpl::identity<long>
|
||||
{ };
|
||||
|
||||
template <typename Seq>
|
||||
long operator()(Seq const & seq) const
|
||||
{
|
||||
long state = 0;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
template < typename Seq >
|
||||
long operator()(Seq const & seq)
|
||||
{
|
||||
long state = 100;
|
||||
return fusion::fold(seq, state, fold_op());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct fold_op
|
||||
{
|
||||
typedef long result_type;
|
||||
|
||||
template <typename T>
|
||||
long operator()(T const & elem, long value) const
|
||||
{
|
||||
return value + sizeof(T) * elem;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
void result_type_tests()
|
||||
{
|
||||
using boost::is_same;
|
||||
|
||||
typedef fusion::unfused_rvalue_args< test_func<> > t;
|
||||
BOOST_TEST(( is_same< boost::result_of< t () >::type, long >::value ));
|
||||
BOOST_TEST(( is_same< boost::result_of< t (int) >::type, long >::value ));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
result_type_tests();
|
||||
|
||||
test_func<noncopyable> f;
|
||||
fusion::unfused_rvalue_args< test_func<> > unfused_func;
|
||||
fusion::unfused_rvalue_args< test_func<noncopyable> & > unfused_func_ref(f);
|
||||
fusion::unfused_rvalue_args< test_func<> const > unfused_func_c;
|
||||
fusion::unfused_rvalue_args< test_func<> > const unfused_func_c2;
|
||||
fusion::unfused_rvalue_args< test_func<noncopyable> const & > unfused_func_c_ref(f);
|
||||
|
||||
BOOST_TEST(unfused_func() == 100);
|
||||
BOOST_TEST(unfused_func_ref() == 100);
|
||||
BOOST_TEST(unfused_func_c() == 0);
|
||||
BOOST_TEST(unfused_func_c2() == 0);
|
||||
BOOST_TEST(unfused_func_c_ref() == 0);
|
||||
|
||||
static const long expected = 1*sizeof(int) + 2*sizeof(long) + 7*sizeof(char);
|
||||
BOOST_TEST(unfused_func(1,2l,'\007') == 100 + expected);
|
||||
BOOST_TEST(unfused_func_ref(1,2l,'\007') == 100 + expected);
|
||||
BOOST_TEST(unfused_func_c(1,2l,'\007') == 0 + expected);
|
||||
BOOST_TEST(unfused_func_c2(1,2l,'\007') == 0 + expected);
|
||||
BOOST_TEST(unfused_func_c_ref(1,2l,'\007') == 0 + expected);
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
129
test/sequence/adapt_class.cpp
Normal file
129
test/sequence/adapt_class.cpp
Normal file
@ -0,0 +1,129 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/fusion/adapted/class/adapt_class.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/empty.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/front.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/back.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
|
||||
#include <boost/fusion/sequence/io/out.hpp>
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
#include <boost/fusion/container/list/list.hpp>
|
||||
#include <boost/fusion/container/generation/make_vector.hpp>
|
||||
#include <boost/fusion/container/vector/convert.hpp>
|
||||
#include <boost/fusion/sequence/comparison/equal_to.hpp>
|
||||
#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
|
||||
#include <boost/fusion/sequence/comparison/less.hpp>
|
||||
#include <boost/fusion/sequence/comparison/less_equal.hpp>
|
||||
#include <boost/fusion/sequence/comparison/greater.hpp>
|
||||
#include <boost/fusion/sequence/comparison/greater_equal.hpp>
|
||||
#include <boost/fusion/mpl.hpp>
|
||||
#include <boost/fusion/support/is_view.hpp>
|
||||
#include <boost/mpl/front.hpp>
|
||||
#include <boost/mpl/is_sequence.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
namespace ns
|
||||
{
|
||||
class point
|
||||
{
|
||||
public:
|
||||
|
||||
point() : x(0), y(0) {}
|
||||
point(int x, int y) : x(x), y(y) {}
|
||||
|
||||
int get_x() const { return x; }
|
||||
int get_y() const { return y; }
|
||||
void set_x(int x_) { x = x_; }
|
||||
void set_y(int y_) { y = y_; }
|
||||
|
||||
private:
|
||||
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_FUSION_ADAPT_CLASS(
|
||||
ns::point,
|
||||
(int, int, obj.get_x(), obj.set_x(val))
|
||||
(int, int, obj.get_y(), obj.set_y(val))
|
||||
)
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<ns::point>));
|
||||
ns::point p(123, 456);
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
BOOST_TEST(p == make_vector(123, 456));
|
||||
|
||||
at_c<0>(p) = 6;
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
|
||||
BOOST_STATIC_ASSERT(result_of::size<ns::point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(!result_of::empty<ns::point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
}
|
||||
|
||||
{
|
||||
fusion::vector<int, float> v1(4, 2);
|
||||
ns::point v2(5, 3);
|
||||
fusion::vector<long, double> v3(5, 4);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
BOOST_TEST(v2 >= v1);
|
||||
BOOST_TEST(v2 < v3);
|
||||
BOOST_TEST(v2 <= v3);
|
||||
BOOST_TEST(v3 > v2);
|
||||
BOOST_TEST(v3 >= v2);
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to vector
|
||||
ns::point p(5, 3);
|
||||
fusion::vector<int, short> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to list
|
||||
ns::point p(5, 3);
|
||||
fusion::list<int, short> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT((mpl::is_sequence<ns::point>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<
|
||||
fusion::result_of::value_at_c<ns::point,0>::type
|
||||
, mpl::front<ns::point>::type>));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
Reference in New Issue
Block a user