Compare commits

..

24 Commits

Author SHA1 Message Date
cd1fa857c7 Branch for merging Boost.Build and Boost.Jam completely.
[SVN r59143]
2010-01-19 20:47:20 +00:00
f7fd836354 corrected category_of documentation (2)
[SVN r58568]
2009-12-29 18:29:59 +00:00
b1b171f130 corrected category_of documentation
[SVN r58559]
2009-12-29 14:10:17 +00:00
d366a4f0e2 updated changelog
[SVN r58558]
2009-12-29 13:44:01 +00:00
514d48903b associative forward iterators in example and docs
[SVN r58549]
2009-12-28 17:45:42 +00:00
f0cd405f04 mpl::sequence_tag specialization for adapted types
[SVN r58396]
2009-12-15 13:30:02 +00:00
2587757d47 corrected reverse_view
[SVN r58299]
2009-12-11 21:01:22 +00:00
f1da55c1e9 avoid iterator invalidation in segmented_range, fixes #3583
[SVN r57622]
2009-11-13 02:52:34 +00:00
03290abb85 Fusion: silenced a couple of MSVC warnings created during Spirit test runs
[SVN r57502]
2009-11-09 03:57:40 +00:00
65895017bd associative_sequence_tag -> associative_tag
[SVN r57337]
2009-11-03 17:35:33 +00:00
60fabbdf9a Fusion: adding a missing 'const'
[SVN r57248]
2009-10-30 15:14:50 +00:00
dab67207cf associative iterators & views (Fixes #3473)
[SVN r57242]
2009-10-30 00:19:19 +00:00
9b26b4a0f7 associative iterators & views
[SVN r57156]
2009-10-25 22:59:54 +00:00
35e469e2d5 fix for #2355: discrepancy between std::accumulate and fusion::accumulate
[SVN r57125]
2009-10-24 10:59:01 +00:00
43f861ca87 rm cmake from trunk. I'm not entirely sure this is necessary to satisfy the inspect script, but I'm not taking any chances, and it is easy to put back
[SVN r56942]
2009-10-17 02:07:38 +00:00
d978cec6b6 Fix default construction of vector
[SVN r56709]
2009-10-11 04:00:00 +00:00
e26d26d511 Fusion: added size_impl for nview
[SVN r56610]
2009-10-05 22:30:23 +00:00
9ebe273fb3 Fusion: fixing nview tests
[SVN r56609]
2009-10-05 22:29:10 +00:00
a110ea9304 Fixing mismatch of default parameter values
[SVN r56607]
2009-10-05 22:00:09 +00:00
959b0b0839 Fusion: fixing mismatch in default parameter to nview
[SVN r56604]
2009-10-05 21:36:55 +00:00
9a1bc7d677 BOOST_FUSION_ADAPT_CLASS
[SVN r56576]
2009-10-04 16:59:50 +00:00
178973a05c BOOST_FUSION_ADAPT_CLASS
[SVN r56575]
2009-10-04 16:59:37 +00:00
7b89755a67 Fusion: fixed a couple of typos in docs
[SVN r56472]
2009-09-29 14:48:36 +00:00
fdb399e022 Fusion: fixing regression tests
[SVN r56435]
2009-09-27 16:36:53 +00:00
32 changed files with 1016 additions and 1421 deletions

View 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

View 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

View 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

View 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

View 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

View 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

View File

@ -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

View 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

View 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

View File

@ -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

View 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

View 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

View 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

View File

@ -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

View 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View 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

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View 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();
}