|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65044 - in sandbox/SOC/2009/fusion: boost/fusion/adapted/detail/array boost/fusion/adapted/detail/po_array boost/fusion/adapted/detail/struct boost/fusion/adapted/detail/tuple boost/fusion/algorithm/iteration boost/fusion/algorithm/iteration/detail boost/fusion/algorithm/query/detail boost/fusion/algorithm/transformation/detail boost/fusion/container/list boost/fusion/container/vector/detail/variadic_templates boost/fusion/functional/invocation/detail/variadic_templates boost/fusion/support boost/fusion/support/internal boost/fusion/view/detail boost/fusion/view/filter_view boost/fusion/view/joint_view boost/fusion/view/nview boost/fusion/view/repetitive_view boost/fusion/view/reverse_view boost/fusion/view/transform_view libs/fusion/example/extension/struct libs/fusion/example/extension/struct/detail libs/fusion/example/extension/triple libs/fusion/example/extension/vtuple libs/fusion/example/performance libs/fusion/test/suite1/algorithm libs/fusion/test/suite2
From: mr.chr.schmidt_at_[hidden]
Date: 2010-08-26 18:14:23
Author: cschmidt
Date: 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
New Revision: 65044
URL: http://svn.boost.org/trac/boost/changeset/65044
Log:
parameterized unrolling
Added:
sandbox/SOC/2009/fusion/boost/fusion/support/config.hpp (contents, props changed)
sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/adapt_example_struct.hpp (contents, props changed)
sandbox/SOC/2009/fusion/libs/fusion/example/extension/triple/triple_.cpp (contents, props changed)
sandbox/SOC/2009/fusion/libs/fusion/example/extension/vtuple/vtuple_.cpp (contents, props changed)
Text files modified:
sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/array/tag_of.hpp | 4
sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/po_array/tag_of.hpp | 4
sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/adapt_base.hpp | 4
sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/define_struct.hpp | 2
sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/extension.hpp | 1
sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/tuple/tag_of.hpp | 22 -
sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/fold.hpp | 492 +++++++++++++++++----------------------
sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/for_each.hpp | 122 ++++-----
sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/for_each.hpp | 11
sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/all.hpp | 169 +++++--------
sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/find_if.hpp | 127 +++++-----
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/filter_key_view.hpp | 4
sandbox/SOC/2009/fusion/boost/fusion/container/list/cons.hpp | 3
sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/variadic_templates/vector.hpp | 82 ++++-
sandbox/SOC/2009/fusion/boost/fusion/functional/invocation/detail/variadic_templates/invoke_impl.hpp | 366 +++++++++++++----------------
sandbox/SOC/2009/fusion/boost/fusion/support/internal/is_explicitly_convertible.hpp | 12
sandbox/SOC/2009/fusion/boost/fusion/support/tag_of_fwd.hpp | 21 +
sandbox/SOC/2009/fusion/boost/fusion/view/detail/view_storage.hpp | 17 +
sandbox/SOC/2009/fusion/boost/fusion/view/filter_view/filter_view.hpp | 2
sandbox/SOC/2009/fusion/boost/fusion/view/joint_view/joint_view.hpp | 4
sandbox/SOC/2009/fusion/boost/fusion/view/nview/nview.hpp | 2
sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/repetitive_view.hpp | 4
sandbox/SOC/2009/fusion/boost/fusion/view/reverse_view/reverse_view.hpp | 4
sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/transform_view.hpp | 6
sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/Jamfile | 4
sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/advance_impl.hpp | 2
sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/at_impl.hpp | 4
sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/deref_impl.hpp | 2
sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/distance_impl.hpp | 4
sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/equal_to_impl.hpp | 4
sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/key_of_impl.hpp | 2
sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/tag_of.hpp | 87 ++++--
sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/value_of_impl.hpp | 2
sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/example_struct.hpp | 43 +--
sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/test_example.cpp | 2
sandbox/SOC/2009/fusion/libs/fusion/example/extension/triple/Jamfile | 4
sandbox/SOC/2009/fusion/libs/fusion/example/extension/vtuple/Jamfile | 4
sandbox/SOC/2009/fusion/libs/fusion/example/performance/Jamfile | 4
sandbox/SOC/2009/fusion/libs/fusion/test/suite1/algorithm/fold.cpp | 8
sandbox/SOC/2009/fusion/libs/fusion/test/suite1/algorithm/fold.hpp | 5
sandbox/SOC/2009/fusion/libs/fusion/test/suite2/Jamfile | 4
41 files changed, 787 insertions(+), 883 deletions(-)
Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/array/tag_of.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/array/tag_of.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/array/tag_of.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -24,7 +24,6 @@
struct array_tag;
struct array_iterator_tag;
struct random_access_traversal_tag;
- struct fusion_sequence_tag;
namespace traits
{
@@ -57,9 +56,6 @@
namespace mpl
{
- template<typename>
- struct sequence_tag;
-
template<typename T, std::size_t N>
struct sequence_tag<BOOST_FUSION_ADAPTED_ARRAY_NAMESPACE::array<T,N> >
{
Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/po_array/tag_of.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/po_array/tag_of.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/po_array/tag_of.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -18,7 +18,6 @@
struct po_array_tag;
struct po_array_iterator_tag;
struct random_access_traversal_tag;
- struct fusion_sequence_tag;
namespace traits
{
@@ -53,9 +52,6 @@
namespace mpl
{
- template<typename>
- struct sequence_tag;
-
template<typename T, std::size_t N>
struct sequence_tag<T[N]>
{
Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/adapt_base.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/adapt_base.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/adapt_base.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -22,7 +22,6 @@
#include <boost/preprocessor/tuple/eat.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <boost/mpl/bool.hpp>
-#include <boost/mpl/tag.hpp>
#define BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME_TEMPLATE_PARAMS(SEQ) \
BOOST_PP_SEQ_HEAD(SEQ)<BOOST_PP_SEQ_ENUM(BOOST_PP_SEQ_TAIL(SEQ))>
@@ -201,9 +200,6 @@
\
namespace mpl \
{ \
- template<typename> \
- struct sequence_tag; \
- \
template< \
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS( \
TEMPLATE_PARAMS_SEQ) \
Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/define_struct.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/define_struct.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/define_struct.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -139,7 +139,7 @@
#define BOOST_FUSION_DEFINE_STRUCT_SEQ_CTOR_DISABLER( \
ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
\
- , typename boost::disable_if< \
+ , typename boost::disable_if< \
boost::fusion::detail::is_explicitly_convertible< \
BOOST_FUSION_R_ELSE_CLREF(Seq) \
, BOOST_PP_TUPLE_ELEM( \
Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/extension.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/extension.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/extension.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -17,7 +17,6 @@
struct struct_tag;
struct struct_iterator_tag;
struct assoc_struct_tag;
- struct fusion_sequence_tag;
struct assoc_struct_category
: random_access_traversal_tag, associative_tag
Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/tuple/tag_of.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/tuple/tag_of.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/tuple/tag_of.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -8,8 +8,6 @@
#include <boost/config.hpp>
#include <boost/fusion/support/tag_of_fwd.hpp>
-
-#include <boost/mpl/tag.hpp>
#if defined(BOOST_FUSION_ADAPTED_STD_TUPLE) &&\
(defined(BOOST_NO_0X_HDR_TUPLE) || defined(BOOST_NO_VARIADIC_TEMPLATES))
# include <boost/preprocessor/enum_params.hpp>
@@ -27,7 +25,6 @@
struct std_tuple_iterator_tag;
struct boost_tuple_tag;
struct boost_tuple_iterator_tag;
- struct fusion_sequence_tag;
struct random_access_traversal_tag;
namespace traits
@@ -58,8 +55,8 @@
# ifdef BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS
# define BOOST_FUSION_TUPLE_TAG_OF_SPECIALIZATION(MODIFIER,_)\
template<\
- class T0, class T1, class T2, class T3, class T4, \
- class T5, class T6, class T7, class T8, class T9\
+ class T0, class T1, class T2, class T3, class T4\
+ , class T5, class T6, class T7, class T8, class T9\
>\
struct tag_of<\
tuples::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> MODIFIER\
@@ -83,8 +80,8 @@
# else
# define BOOST_FUSION_TUPLE_TAG_OF_SPECIALIZATION(MODIFIER,_)\
template<\
- class T0, class T1, class T2, class T3, class T4, \
- class T5, class T6, class T7, class T8, class T9\
+ class T0, class T1, class T2, class T3, class T4\
+ , class T5, class T6, class T7, class T8, class T9\
>\
struct tag_of<\
tuples::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> MODIFIER\
@@ -116,9 +113,6 @@
namespace mpl
{
- template<typename>
- struct sequence_tag;
-
#ifdef BOOST_FUSION_ADAPTED_STD_TUPLE
# ifndef BOOST_FUSION_STD_TUPLE_UPPER_LIMIT
template<typename... Types>
@@ -159,8 +153,8 @@
# endif
#else
template<
- class T0, class T1, class T2, class T3, class T4,
- class T5, class T6, class T7, class T8, class T9
+ class T0, class T1, class T2, class T3, class T4
+ , class T5, class T6, class T7, class T8, class T9
>
struct sequence_tag<
tuples::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>
@@ -170,8 +164,8 @@
};
template<
- class T0, class T1, class T2, class T3, class T4,
- class T5, class T6, class T7, class T8, class T9
+ class T0, class T1, class T2, class T3, class T4
+ , class T5, class T6, class T7, class T8, class T9
>
struct sequence_tag<
tuples::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> const
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/fold.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/fold.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/fold.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -20,10 +20,17 @@
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/prior.hpp>
#include <boost/fusion/iterator/next.hpp>
+#include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/internal/result_of.hpp>
#include <boost/fusion/support/internal/ref.hpp>
#include <boost/fusion/support/internal/assert.hpp>
#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/bool.hpp>
@@ -71,309 +78,247 @@
namespace detail
{
template<typename State, typename It, typename F>
- struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)
+ struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _result_of_helper)
: boost::result_of<
F(
#ifdef BOOST_NO_RVALUE_REFERENCES
typename add_lref<typename add_const<State>::type>::type,
#else
- State&&,
+ typename remove_reference<State>::type&,
#endif
BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It))
>
{};
- template<typename Result,int N>
- struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)
- {
- template<typename State, typename It0, typename F>
- static Result
- call(BOOST_FUSION_R_ELSE_CLREF(State) state,
- It0 const& it0,
- BOOST_FUSION_RREF_ELSE_OBJ(F) f)
- {
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It0 const&
- >::type
- It1;
- It1 it1 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0);
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It1&
- >::type
- It2;
- It2 it2 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1);
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It2&
- >::type
- It3;
- It3 it3 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it2);
-
- return BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<
- Result
- , N-4
- >::call(
- f(
- f(
- f(
- f(
- BOOST_FUSION_FORWARD(State,state),
- BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(
- it0)
- ),
- BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)
- ),
- BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2)
- ),
- BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it3)
- ),
- fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it3),
- BOOST_FUSION_FORWARD(F,f));
- }
- };
-
- template<typename Result>
- struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,3>
- {
- template<typename State, typename It0, typename F>
- static Result
- call(BOOST_FUSION_R_ELSE_CLREF(State) state,
- It0 const& it0,
- BOOST_FUSION_RREF_ELSE_OBJ(F) f)
- {
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It0 const&
- >::type
- It1;
- It1 it1 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0);
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It1&
- >::type
- It2;
- It2 it2 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1);
+ template<typename State0, typename It0, typename F, int N>
+ struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME);
- return f(
- f(
- f(
- BOOST_FUSION_FORWARD(State,state),
- BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)
- ),
- BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)
- ),
- BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(
- fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1)
- ));
- }
- };
-
- template<typename Result>
- struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,2>
- {
- template<typename State, typename It0, typename F>
- static Result
- call(BOOST_FUSION_R_ELSE_CLREF(State) state,
- It0 const& it0,
- BOOST_FUSION_RREF_ELSE_OBJ(F) f)
- {
- return f(
- f(BOOST_FUSION_FORWARD(State,state),
- BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)),
- BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(
- fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0)));
- }
- };
+#ifdef BOOST_NO_RVALUE_REFERENCES
+# define BOOST_FUSION_CONST_IF_NO_RVALUE_REFERENCES const
+#else
+# define BOOST_FUSION_CONST_IF_NO_RVALUE_REFERENCES
+#endif
- template<typename Result>
- struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,1>
- {
- template<typename State, typename It0, typename F>
- static Result
- call(BOOST_FUSION_R_ELSE_CLREF(State) state,
- It0 const& it0,
- BOOST_FUSION_RREF_ELSE_OBJ(F) f)
- {
- return f(BOOST_FUSION_FORWARD(State,state),
- BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0));
- }
- };
+#define BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_IT_DEF(Z, N, _) \
+ typedef typename \
+ result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION< \
+ BOOST_PP_CAT(It,N) const& \
+ >::type \
+ BOOST_PP_CAT(It,BOOST_PP_INC(N));
+
+#define BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_STATE_DEF(Z, N, _) \
+ typedef typename \
+ BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _result_of_helper)< \
+ BOOST_PP_CAT(State,N) BOOST_FUSION_CONST_IF_NO_RVALUE_REFERENCES\
+ , BOOST_PP_CAT(It,N) const& \
+ , F \
+ >::type \
+ BOOST_PP_CAT(State,BOOST_PP_INC(N)); \
+
+#define BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_NEXT(N_) \
+ typename BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)< \
+ BOOST_PP_CAT(State,N_) \
+ , typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION< \
+ BOOST_PP_CAT(It,BOOST_PP_DEC(N_)) const& \
+ >::type \
+ , F \
+ , N-BOOST_FUSION_UNROLLED_DEPTH \
+ >::type
- template<typename Result>
- struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,0>
- {
- template<typename State, typename It0, typename F>
- static Result
- call(BOOST_FUSION_R_ELSE_CLREF(State) state,
- It0 const&,
- BOOST_FUSION_RREF_ELSE_OBJ(F))
- {
- return static_cast<Result>(state);
- }
- };
+#define BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_LAST(N) BOOST_PP_CAT(State,N)
- template<typename StateRef, typename It0, typename F, int N>
+#define BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_DECLERATION(N_) \
+ template<typename State0, typename It0, typename F, int N> \
struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)
- {
- typedef typename
- BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)<
- StateRef
- , It0 const&
- , F
- >::type
- rest1;
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It0 const&
- >::type
- it1;
- typedef typename
- BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)<
- rest1
- , it1&
- , F
- >::type
- rest2;
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<it1&>::type
- it2;
- typedef typename
- BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)<
- rest2
- , it2&
- , F
- >::type
- rest3;
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<it2&>::type
- it3;
- typedef typename
- BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
- typename BOOST_PP_CAT(
- BOOST_FUSION_FOLD_NAME, _rvalue_state)<
- rest3
- , it3&
- , F
- >::type
- , typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- it3&
- >::type
- , F
- , N-4
- >::type
- type;
- };
+#define BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_SPECIALIZATION(N) \
+ template<typename State0, typename It0, typename F> \
+ struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)< \
+ State0 \
+ , It0 \
+ , F \
+ , N \
+ >
- template<typename StateRef, typename It0, typename F>
+#define BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL(Z,N,_) \
+ BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(N,BOOST_FUSION_UNROLLED_DEPTH), \
+ BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_DECLERATION, \
+ BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_SPECIALIZATION)(N) \
+ { \
+ BOOST_PP_REPEAT( \
+ BOOST_PP_DEC(N), \
+ BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_IT_DEF, \
+ _) \
+ BOOST_PP_REPEAT( \
+ N, \
+ BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_STATE_DEF, \
+ _) \
+ \
+ typedef \
+ BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(N,BOOST_FUSION_UNROLLED_DEPTH), \
+ BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_NEXT, \
+ BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_LAST)(N) \
+ type; \
+ };
+
+ BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_FUSION_UNROLLED_DEPTH),
+ BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL,
+ _)
+
+#undef BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL
+#undef BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_DECLERATION
+#undef BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_SPECIALIZATION
+#undef BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_NEXT
+#undef BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_LAST
+#undef BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_STATE_DEF
+#undef BOOST_FUSION_RESULT_OF_UNROLLED_FOLD_IMPL_IT_DEF
+
+ template<typename State0, typename It0, typename F>
struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
- StateRef
+ State0
, It0
, F
- , 3
+ , 0
>
{
- typedef typename
- BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)<
- StateRef
- , It0 const&
- , F
- >::type
- rest1;
- typedef typename
- result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It0 const&
- >::type
- it1;
-
- typedef typename
- BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)<
- typename BOOST_PP_CAT(
- BOOST_FUSION_FOLD_NAME, _rvalue_state)<
- rest1
- , it1&
- , F
- >::type
- , BOOST_FUSION_R_ELSE_CLREF(
- typename result_of::
- BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- it1&
- >::type)
- , F
- >::type
- type;
+ typedef State0 type;
};
- template<typename StateRef, typename It0, typename F>
- struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
- StateRef
- , It0
- , F
- , 2
- >
- : BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)<
- typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)<
- StateRef
- , It0 const&
- , F
- >::type
- , BOOST_FUSION_R_ELSE_CLREF(
- typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It0 const&
- >::type)
- , F
- >
- {};
+ template<typename FFuncBase, typename Result,int N>
+ struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME);
- template<typename StateRef, typename It0, typename F>
- struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
- StateRef
- , It0
- , F
- , 1
+#if defined(BOOST_NO_AUTO_DECLARATIONS) || defined(BOOST_NO_RVALUE_REFERENCES)
+# define BOOST_FUSION_UNROLLED_FOLD_IMPL_LOCAL_INIT(Z,N,_) \
+ typedef typename \
+ result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION< \
+ BOOST_PP_CAT(It,N) const& \
+ >::type \
+ BOOST_PP_CAT(It,BOOST_PP_INC(N)); \
+ BOOST_PP_CAT(It,BOOST_PP_INC(N)) const BOOST_PP_CAT(it,BOOST_PP_INC(N))(\
+ fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION( \
+ BOOST_PP_CAT(it,N))); \
+ \
+ typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME,_result_of_helper)<\
+ BOOST_PP_CAT(State,N) BOOST_FUSION_CONST_IF_NO_RVALUE_REFERENCES \
+ , BOOST_PP_CAT(It,N) const& \
+ , FFuncBase \
+ >::type BOOST_PP_CAT(State,BOOST_PP_INC(N)); \
+ BOOST_PP_CAT(State,BOOST_PP_INC(N)) \
+ BOOST_FUSION_CONST_IF_NO_RVALUE_REFERENCES \
+ BOOST_PP_CAT(state,BOOST_PP_INC(N))( \
+ f( \
+ BOOST_PP_CAT(state,N), \
+ BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM( \
+ BOOST_PP_CAT(it,N))) \
+ );
+#else
+# define BOOST_FUSION_UNROLLED_FOLD_IMPL_LOCAL_INIT(Z,N,_) \
+ auto const BOOST_PP_CAT(it,BOOST_PP_INC(N))= \
+ fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(BOOST_PP_CAT(it,N));\
+ auto&& BOOST_PP_CAT(state,BOOST_PP_INC(N))=f( \
+ BOOST_PP_CAT(state,N), \
+ BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(BOOST_PP_CAT(it,N)));
+#endif
+
+#define BOOST_FUSION_UNROLLED_FOLD_IMPL_DECLERATION(N_) \
+ template<typename FFuncBase, typename Result,int N> \
+ struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)
+
+#define BOOST_FUSION_UNROLLED_FOLD_IMPL_SPECIALIZATION(N) \
+ template<typename FFuncBase, typename Result> \
+ struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)< \
+ FFuncBase \
+ , Result \
+ , N \
>
- : BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)<
- StateRef
- , It0 const&
- , F
- >
- {};
- template<typename StateRef, typename It0, typename F>
- struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
- StateRef
- , It0
- , F
+#define BOOST_FUSION_UNROLLED_FOLD_IMPL_NEXT(N_) \
+ BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)< \
+ FFuncBase \
+ , Result \
+ , N-BOOST_FUSION_UNROLLED_DEPTH \
+ >::call(f( \
+ BOOST_PP_CAT(state,BOOST_PP_DEC(N_)), \
+ BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM( \
+ BOOST_PP_CAT(it,BOOST_PP_DEC(N_)))), \
+ fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION( \
+ BOOST_PP_CAT(it,BOOST_PP_DEC(N_))), \
+ f)
+
+#define BOOST_FUSION_UNROLLED_FOLD_IMPL_RETURN(N) \
+ f(BOOST_PP_CAT(state,BOOST_PP_DEC(N)), \
+ BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM( \
+ BOOST_PP_CAT(it,BOOST_PP_DEC(N))))
+
+#define BOOST_FUSION_UNROLLED_FOLD_IMPL(Z,N,_) \
+ BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(N,BOOST_FUSION_UNROLLED_DEPTH), \
+ BOOST_FUSION_UNROLLED_FOLD_IMPL_DECLERATION, \
+ BOOST_FUSION_UNROLLED_FOLD_IMPL_SPECIALIZATION)(N) \
+ { \
+ template<typename State0, typename It0, typename F> \
+ static Result \
+ call(BOOST_FUSION_R_ELSE_CLREF(State0) state0, \
+ It0 const& it0, \
+ BOOST_FUSION_RREF_ELSE_OBJ(F) f) \
+ { \
+ BOOST_PP_REPEAT( \
+ BOOST_PP_DEC(N), \
+ BOOST_FUSION_UNROLLED_FOLD_IMPL_LOCAL_INIT, \
+ _) \
+ \
+ return BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(N,BOOST_FUSION_UNROLLED_DEPTH), \
+ BOOST_FUSION_UNROLLED_FOLD_IMPL_NEXT, \
+ BOOST_FUSION_UNROLLED_FOLD_IMPL_RETURN)(N); \
+ } \
+ };
+
+ BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_FUSION_UNROLLED_DEPTH),
+ BOOST_FUSION_UNROLLED_FOLD_IMPL,
+ _)
+
+#undef BOOST_FUSION_UNROLLED_FOLD_IMPL
+#undef BOOST_FUSION_UNROLLED_FOLD_IMPL_NEXT
+#undef BOOST_FUSION_UNROLLED_FOLD_IMPL_RETURN
+#undef BOOST_FUSION_UNROLLED_FOLD_IMPL_SPECIALIZATION
+#undef BOOST_FUSION_UNROLLED_FOLD_IMPL_DECLERATION
+#undef BOOST_FUSION_UNROLLED_FOLD_IMPL_LOCAL_INIT
+
+#undef BOOST_FUSION_CONST_IF_NO_RVALUE_REFERENCES
+
+ template<typename FFuncBase, typename Result>
+ struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<
+ FFuncBase
+ , Result
, 0
>
{
- typedef StateRef type;
+ template<typename State0, typename It0, typename F>
+ static Result
+ call(BOOST_FUSION_R_ELSE_CLREF(State0) state0,
+ It0 const&,
+ BOOST_FUSION_RREF_ELSE_OBJ(F))
+ {
+ return static_cast<Result>(state0);
+ }
};
template<typename StateRef, typename It0, typename F, int SeqSize>
struct BOOST_PP_CAT(result_of_first_unrolled,BOOST_FUSION_FOLD_NAME)
- {
- typedef typename get_func_base<F>::type f;
-
- typedef typename
- BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
- typename boost::result_of<
- f(
- StateRef,
- BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(
- It0 const&)
- )
- >::type
- , typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
- It0 const&
- >::type
- , f
- , SeqSize-1
- >::type
- type;
- };
+ : BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
+ StateRef
+ , It0
+ , typename get_func_base<F>::type
+ , SeqSize
+ >
+ {};
template<int SeqSize, typename StateRef, typename It0, typename F>
struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME,_impl)
@@ -398,7 +343,8 @@
call(StateRef state, It0 const& it0, F f)
{
return BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<
- type
+ typename get_func_base<F>::type
+ , type
, SeqSize
>::call(
BOOST_FUSION_FORWARD(StateRef,state),
@@ -471,7 +417,11 @@
#ifdef BOOST_NO_RVALUE_REFERENCES
template<typename Seq, typename State, typename F>
- inline typename result_of::fold<Seq&,State const&,F>::type
+ inline typename result_of::BOOST_FUSION_FOLD_NAME<
+ Seq&
+ , State const&
+ , F
+ >::type
BOOST_FUSION_FOLD_NAME(Seq& seq,State const& state,F f)
{
return result_of::BOOST_FUSION_FOLD_NAME<Seq&,State const&,F>::call(
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/for_each.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/for_each.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/for_each.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -1,5 +1,6 @@
/*==============================================================================
Copyright (c) 2001-2006 Joel de Guzman
+ Copyright (c) 2009-2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -10,83 +11,70 @@
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
-#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
-#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>
-
-#include <boost/mpl/bool.hpp>
+#include <boost/fusion/support/config.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor/comparison/not_equal.hpp>
+#include <boost/preprocessor/control/expr_if.hpp>
+#include <boost/preprocessor/control/expr_iif.hpp>
+#include <boost/preprocessor/tuple/eat.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
namespace boost { namespace fusion { namespace detail
{
template<int N>
- struct for_each_unrolled
- {
- template<typename It0, typename F>
- static void call(It0 const& it0, BOOST_FUSION_RREF_ELSE_OBJ(F) f)
- {
- typedef typename result_of::next<It0 const&>::type It1;
- It1 it1(fusion::next(it0));
- typedef typename result_of::next<It1&>::type It2;
- It2 it2(fusion::next(it1));
- typedef typename result_of::next<It2&>::type It3;
- It3 it3(fusion::next(it2));
-
- f(fusion::deref(it0));
- f(fusion::deref(it1));
- f(fusion::deref(it2));
- f(fusion::deref(it3));
-
- for_each_unrolled<N-4>::call(
- fusion::next(it3),
- BOOST_FUSION_FORWARD(F,f));
- }
- };
-
- template<>
- struct for_each_unrolled<3>
- {
- template<typename It0, typename F>
- static void call(It0 const& it0, BOOST_FUSION_RREF_ELSE_OBJ(F) f)
- {
- typedef typename result_of::next<It0 const&>::type It1;
- It1 it1(fusion::next(it0));
-
- f(fusion::deref(it0));
- f(fusion::deref(it1));
- f(fusion::deref(fusion::next(it1)));
- }
- };
+ struct for_each_unrolled;
- template<>
- struct for_each_unrolled<2>
- {
- template<typename It0, typename F>
- static void call(It0 const& it0, BOOST_FUSION_RREF_ELSE_OBJ(F) f)
- {
- f(fusion::deref(it0));
- f(fusion::deref(fusion::next(it0)));
- }
+#define BOOST_FUSION_UNROLLED_FOR_EACH_IMPL_N(Z,N,_) \
+ f(fusion::deref(BOOST_PP_CAT(it,N))); \
+ \
+ typedef typename \
+ result_of::next<BOOST_PP_CAT(It,N) const&>::type \
+ BOOST_PP_CAT(It,BOOST_PP_INC(N)); \
+ BOOST_PP_CAT(It,BOOST_PP_INC(N)) const BOOST_PP_CAT(it,BOOST_PP_INC(N))( \
+ fusion::next(BOOST_PP_CAT(it,N)));
+
+#define BOOST_FUSION_UNROLLED_FOR_EACH_IMPL_NEXT(N_) \
+ for_each_unrolled<N-BOOST_FUSION_UNROLLED_DEPTH>::call( \
+ fusion::next(BOOST_PP_CAT(it,BOOST_PP_DEC(N_))), \
+ BOOST_FUSION_FORWARD(F,f));
+
+#define BOOST_FUSION_UNROLLED_FOR_EACH_IMPL(Z,N_,_) \
+ template<BOOST_PP_EXPR_IIF( \
+ BOOST_PP_EQUAL(BOOST_PP_INC(N_),BOOST_FUSION_UNROLLED_DEPTH), int N) \
+ > \
+ struct for_each_unrolled \
+ BOOST_PP_EXPR_IIF( \
+ BOOST_PP_NOT_EQUAL(BOOST_PP_INC(N_),BOOST_FUSION_UNROLLED_DEPTH), <N_>) \
+ { \
+ template<typename It0, typename F> \
+ static void \
+ call( \
+ It0 const& BOOST_PP_EXPR_IF(N_,it0), \
+ BOOST_FUSION_RREF_ELSE_OBJ(F) BOOST_PP_EXPR_IF(N_,f)) \
+ { \
+ BOOST_PP_REPEAT(N_,BOOST_FUSION_UNROLLED_FOR_EACH_IMPL_N,_) \
+ \
+ BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(N_,BOOST_FUSION_UNROLLED_DEPTH), \
+ BOOST_FUSION_UNROLLED_FOR_EACH_IMPL_NEXT, \
+ BOOST_PP_TUPLE_EAT(1))(N); \
+ } \
};
- template<>
- struct for_each_unrolled<1>
- {
- template<typename It0, typename F>
- static void call(It0 const& it0, BOOST_FUSION_RREF_ELSE_OBJ(F) f)
- {
- f(fusion::deref(it0));
- }
- };
-
- template<>
- struct for_each_unrolled<0>
- {
- template<typename It, typename F>
- static void call(It const&, BOOST_FUSION_RREF_ELSE_OBJ(F))
- {}
- };
+ BOOST_PP_REPEAT(
+ BOOST_FUSION_UNROLLED_DEPTH,
+ BOOST_FUSION_UNROLLED_FOR_EACH_IMPL,
+ _)
+
+#undef BOOST_FUSION_UNROLLED_FOR_EACH_IMPL
+#undef BOOST_FUSION_UNROLLED_FOR_EACH_IMPL_NEXT
+#undef BOOST_FUSION_UNROLLED_FOR_EACH_IMPL_N
}}}
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/for_each.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/for_each.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/for_each.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -1,7 +1,7 @@
/*==============================================================================
Copyright (c) 2001-2007 Joel de Guzman
Copyright (c) 2007 Dan Marsden
- Copyright (c) 2009 Christopher Schmidt
+ Copyright (c) 2009-2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -13,7 +13,6 @@
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/support/internal/ref.hpp>
#include <boost/fusion/support/internal/assert.hpp>
-
#include <boost/fusion/algorithm/iteration/detail/for_each.hpp>
namespace boost { namespace fusion
@@ -41,7 +40,8 @@
{
detail::for_each_unrolled<
result_of::size<BOOST_FUSION_R_ELSE_CLREF(Seq)>::value
- >::call(fusion::begin(BOOST_FUSION_FORWARD(Seq,seq)),
+ >::call(
+ fusion::begin(BOOST_FUSION_FORWARD(Seq,seq)),
BOOST_FUSION_FORWARD(F,f));
}
@@ -50,8 +50,9 @@
inline typename result_of::for_each<Seq&,F>::type
for_each(Seq& seq,F f)
{
- detail::for_each_unrolled<result_of::size<Seq>::value>::call(
- fusion::begin(seq),f);
+ detail::for_each_unrolled<
+ result_of::size<Seq>::value
+ >::call(fusion::begin(seq),f);
}
#endif
}}
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/all.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/all.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/all.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -10,121 +10,78 @@
#ifndef BOOST_FUSION_ALGORITHM_QUERY_DETAIL_ALL_HPP
#define BOOST_FUSION_ALGORITHM_QUERY_DETAIL_ALL_HPP
-#include <boost/config.hpp>
-#include <boost/fusion/iterator/advance.hpp>
-#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>
-#include <boost/fusion/support/internal/constexpr.hpp>
-
-#include <boost/mpl/bool.hpp>
+#include <boost/fusion/support/config.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor/comparison/not_equal.hpp>
+#include <boost/preprocessor/control/expr_if.hpp>
+#include <boost/preprocessor/control/expr_iif.hpp>
+#include <boost/preprocessor/tuple/eat.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
namespace boost { namespace fusion { namespace detail
{
template<int N>
- struct unrolled_all
- {
- template<typename It0, typename F>
- static bool
- call(It0 const& it0, BOOST_FUSION_RREF_ELSE_OBJ(F) f)
- {
- if(!f(fusion::deref(it0)))
- {
- return false;
- }
-
- typedef typename result_of::next<It0 const&>::type It1;
- It1 it1 = fusion::next(it0);
- if(!f(fusion::deref(it1)))
- {
- return false;
- }
-
- typedef typename result_of::next<It1&>::type It2;
- It2 it2 = fusion::next(it1);
- if(!f(fusion::deref(it2)))
- {
- return false;
- }
-
- typedef typename result_of::next<It2&>::type It3;
- It3 it3 = fusion::next(it2);
- if(!f(fusion::deref(it3)))
- {
- return false;
- }
-
- return unrolled_all<N-4>::call(
- fusion::next(it3),
- BOOST_FUSION_FORWARD(F,f));
- }
- };
-
- template<>
- struct unrolled_all<3>
- {
- template<typename It0, typename F>
- static bool
- call(It0 const& it0, BOOST_FUSION_RREF_ELSE_OBJ(F) f)
- {
- if(!f(fusion::deref(it0)))
- {
- return false;
- }
-
- typedef typename result_of::next<It0 const&>::type It1;
- It1 it1 = fusion::next(it0);
- if(!f(fusion::deref(it1)))
- {
- return false;
- }
-
- typedef typename result_of::next<It1&>::type It2;
- It2 it2 = fusion::next(it1);
- return f(fusion::deref(it2));
- }
- };
+ struct unrolled_all;
- template<>
- struct unrolled_all<2>
- {
- template<typename It0, typename F>
- static bool
- call(It0 const& it0, BOOST_FUSION_RREF_ELSE_OBJ(F) f)
- {
- if(!f(fusion::deref(it0)))
- {
- return false;
- }
-
- typedef typename result_of::next<It0 const&>::type It1;
- It1 it1 = fusion::next(it0);
- return f(fusion::deref(it1));
- }
+#define BOOST_FUSION_UNROLLED_ALL_IMPL_N(Z,N,_) \
+ if(!f(fusion::deref(BOOST_PP_CAT(it,N)))) \
+ { \
+ return false; \
+ } \
+ \
+ typedef typename \
+ result_of::next<BOOST_PP_CAT(It,N) const&>::type \
+ BOOST_PP_CAT(It,BOOST_PP_INC(N)); \
+ BOOST_PP_CAT(It,BOOST_PP_INC(N)) const BOOST_PP_CAT(it,BOOST_PP_INC(N))( \
+ fusion::next(BOOST_PP_CAT(it,N)));
+
+#define BOOST_FUSION_UNROLLED_ALL_IMPL_LAST(_) true;
+
+#define BOOST_FUSION_UNROLLED_ALL_IMPL_NEXT(N_) \
+ unrolled_all<N-BOOST_FUSION_UNROLLED_DEPTH>::call( \
+ fusion::next(BOOST_PP_CAT(it,BOOST_PP_DEC(N_))), \
+ BOOST_FUSION_FORWARD(F,f));
+
+#define BOOST_FUSION_UNROLLED_ALL_IMPL(Z,N_,_) \
+ template<BOOST_PP_EXPR_IIF( \
+ BOOST_PP_EQUAL(BOOST_PP_INC(N_),BOOST_FUSION_UNROLLED_DEPTH), int N) \
+ > \
+ struct unrolled_all \
+ BOOST_PP_EXPR_IIF( \
+ BOOST_PP_NOT_EQUAL(BOOST_PP_INC(N_),BOOST_FUSION_UNROLLED_DEPTH), <N_>) \
+ { \
+ template<typename It0, typename F> \
+ static bool \
+ call( \
+ It0 const& BOOST_PP_EXPR_IF(N_,it0), \
+ BOOST_FUSION_RREF_ELSE_OBJ(F) BOOST_PP_EXPR_IF(N_,f)) \
+ { \
+ BOOST_PP_REPEAT(N_,BOOST_FUSION_UNROLLED_ALL_IMPL_N,_) \
+ \
+ return BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(N_,BOOST_FUSION_UNROLLED_DEPTH), \
+ BOOST_FUSION_UNROLLED_ALL_IMPL_NEXT, \
+ BOOST_FUSION_UNROLLED_ALL_IMPL_LAST)(N); \
+ } \
};
- template<>
- struct unrolled_all<1>
- {
- template<typename It0, typename F>
- static bool
- call(It0 const& it0, BOOST_FUSION_RREF_ELSE_OBJ(F) f)
- {
- return f(fusion::deref(it0));
- }
- };
-
- template<>
- struct unrolled_all<0>
- {
- template<typename It0, typename F>
- static BOOST_FUSION_CONSTEXPR
- bool
- call(It0 const&, BOOST_FUSION_RREF_ELSE_OBJ(F))
- {
- return true;
- }
- };
+ BOOST_PP_REPEAT(
+ BOOST_FUSION_UNROLLED_DEPTH,
+ BOOST_FUSION_UNROLLED_ALL_IMPL,
+ _)
+
+#undef BOOST_FUSION_UNROLLED_ALL_IMPL
+#undef BOOST_FUSION_UNROLLED_ALL_IMPL_NEXT
+#undef BOOST_FUSION_UNROLLED_ALL_IMPL_LAST
+#undef BOOST_FUSION_UNROLLED_ALL_IMPL_N
}}}
#endif
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/find_if.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/find_if.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/find_if.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -1,7 +1,7 @@
/*==============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2007 Dan Marsden
- Copyright (c) 2009 Christopher Schmidt
+ Copyright (c) 2009-2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -16,7 +16,12 @@
#include <boost/fusion/iterator/advance_c.hpp>
#include <boost/fusion/iterator/distance.hpp>
#include <boost/fusion/support/category_of.hpp>
-
+#include <boost/fusion/support/config.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/or.hpp>
@@ -61,9 +66,6 @@
: main_find_if<Begin, End, Pred>
{};
- template<typename It, typename Pred, int N>
- struct unroll_again;
-
template<typename It, typename Pred, int Offset>
struct apply_offset_filter
: mpl::apply1<
@@ -72,69 +74,68 @@
>::type
{};
- template<typename It, typename Pred, int N>
- struct unrolled_find_if
- : mpl::eval_if<
- typename mpl::apply1<Pred,It>::type
- , mpl::identity<It>
- , mpl::eval_if<
- apply_offset_filter<It, Pred, 1>
- , result_of::next<It>
- , mpl::eval_if<
- apply_offset_filter<It, Pred, 2>
- , result_of::advance_c<It, 2>
- , mpl::eval_if<
- apply_offset_filter<It, Pred, 3>
- , result_of::advance_c<It, 3>
- , unroll_again<
- It
- , Pred
- , N
- >
- >
- >
- >
- >
- {};
+ template<typename It0, typename Pred, int N>
+ struct unrolled_find_if;
- template<typename It, typename Pred, int n>
+ template<typename It, typename Pred, int N>
struct unroll_again
: unrolled_find_if<
- typename result_of::advance_c<It, 4>::type
+ typename result_of::advance_c<
+ It
+ , BOOST_FUSION_UNROLLED_DEPTH
+ >::type
, Pred
- , n-4
+ , N-BOOST_FUSION_UNROLLED_DEPTH
>
{};
- template<typename It, typename Pred>
- struct unrolled_find_if<It, Pred, 3>
- : mpl::eval_if<
- typename mpl::apply1<Pred,It>::type
- , mpl::identity<It>
- , mpl::eval_if<
- apply_offset_filter<It, Pred, 1>
- , result_of::next<It>
- , mpl::eval_if<
- apply_offset_filter<It, Pred, 2>
- , result_of::advance_c<It, 2>
- , result_of::advance_c<It, 3>
- >
- >
- >
- {};
+#define BOOST_FUSION_UNROLLED_FIND_IF_IMPL_DECLERATION(_) \
+ template<typename It0, typename Pred, int N> \
+ struct unrolled_find_if
- template<typename It, typename Pred>
- struct unrolled_find_if<It, Pred, 2>
- : mpl::eval_if<
- typename mpl::apply1<Pred,It>::type
- , mpl::identity<It>
- , mpl::eval_if<
- apply_offset_filter<It, Pred, 1>
- , result_of::next<It>
- , result_of::advance_c<It, 2>
- >
- >
- {};
+#define BOOST_FUSION_UNROLLED_FIND_IF_IMPL_SPECIALIZATION(N) \
+ template<typename It0, typename Pred> \
+ struct unrolled_find_if<It0, Pred, N>
+
+#define BOOST_FUSION_UNROLLED_FIND_IF_HIERARCHY(Z,N,_) \
+ , mpl::eval_if< \
+ apply_offset_filter<It0, Pred, N> \
+ , result_of::advance_c<It0,N>
+
+#define BOOST_FUSION_UNROLLED_FIND_IF_HIERARCHY_CLOSE(Z,N,_) >
+
+#define BOOST_FUSION_UNROLLED_FIND_IF_IMPL(Z,N_,_) \
+ BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(BOOST_PP_INC(N_),BOOST_FUSION_UNROLLED_DEPTH), \
+ BOOST_FUSION_UNROLLED_FIND_IF_IMPL_DECLERATION, \
+ BOOST_FUSION_UNROLLED_FIND_IF_IMPL_SPECIALIZATION)(N_) \
+ : mpl::eval_if< \
+ typename mpl::apply1<Pred,It0>::type \
+ , mpl::identity<It0> \
+ , mpl::eval_if< \
+ apply_offset_filter<It0, Pred, 1> \
+ , result_of::next<It0> \
+ BOOST_PP_REPEAT_FROM_TO( \
+ 2, \
+ N_, \
+ BOOST_FUSION_UNROLLED_FIND_IF_HIERARCHY, \
+ _) \
+ , result_of::advance_c<It0, N_> \
+ BOOST_PP_REPEAT( \
+ N_,BOOST_FUSION_UNROLLED_FIND_IF_HIERARCHY_CLOSE,_) \
+ {};
+
+ BOOST_PP_REPEAT_FROM_TO(
+ 2,
+ BOOST_FUSION_UNROLLED_DEPTH,
+ BOOST_FUSION_UNROLLED_FIND_IF_IMPL,
+ _)
+
+#undef BOOST_FUSION_UNROLLED_FIND_IF_IMPL
+#undef BOOST_FUSION_UNROLLED_FIND_IF_HIERARCHY_CLOSE
+#undef BOOST_FUSION_UNROLLED_FIND_IF_HIERARCHY
+#undef BOOST_FUSION_UNROLLED_FIND_IF_IMPL_DECLERATION
+#undef BOOST_FUSION_UNROLLED_FIND_IF_IMPL_SPECIALIZATION
template<typename It, typename Pred>
struct unrolled_find_if<It, Pred, 1>
@@ -145,10 +146,10 @@
>
{};
- template<typename It, typename Pred>
- struct unrolled_find_if<It, Pred, 0>
+ template<typename It0, typename Pred>
+ struct unrolled_find_if<It0, Pred, 0>
{
- typedef It type;
+ typedef It0 type;
};
template<typename Begin, typename End, typename Pred>
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/filter_key_view.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/filter_key_view.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/filter_key_view.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -31,7 +31,7 @@
struct filter_key_view
: sequence_base<filter_key_view<Seq, Pred> >
{
- typedef view_storage<Seq> storage_type;
+ typedef BOOST_FUSION_DETAIL_VIEW_STROAGE(Seq) storage_type;
typedef typename storage_type::type seq_type;
typedef Pred pred_type;
@@ -77,7 +77,7 @@
return *this;
}
- detail::view_storage<Seq> seq;
+ storage_type seq;
};
}
}}
Modified: sandbox/SOC/2009/fusion/boost/fusion/container/list/cons.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/container/list/cons.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/container/list/cons.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -148,7 +148,8 @@
{}
#ifdef BOOST_NO_VARIADIC_TEMPLATES
-# ifdef BOOST_NO_RVALUE_REFERENCES
+//cschmidt: https://svn.boost.org/trac/boost/ticket/4530#comment:1
+# if defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MSVC)
explicit
cons(typename call_traits<Car>::param_type car)
: car(car)
Modified: sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/variadic_templates/vector.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/variadic_templates/vector.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/variadic_templates/vector.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -13,6 +13,7 @@
#include <boost/fusion/iterator/advance_c.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#ifdef BOOST_FUSION_PREFER_MPL
# include <boost/fusion/support/internal/variadic_templates/variadic_arguments_to_vector.hpp>
@@ -165,7 +166,7 @@
{}
template<typename It>
- vector_impl(assign_by_deref,It const& it)
+ vector_impl(assign_by_deref,It const&)
{}
vector_impl(assign_directly)
@@ -173,7 +174,7 @@
template<typename It0>
void
- assign(It0 const& it0)
+ assign(It0 const&)
{}
};
@@ -293,40 +294,59 @@
BOOST_PP_REPEAT(N,BOOST_FUSION_UNROLLED_VECTOR_AT,_)\
};
- BOOST_PP_REPEAT_FROM_TO(1, 5, BOOST_FUSION_UNROLLED_VECTOR_IMPL, _)
-
- template<int I, BOOST_PP_ENUM_PARAMS(4, typename H), typename... Others>
- struct vector_impl<I,BOOST_PP_ENUM_PARAMS(4, H),Others...>
- : vector_impl<I+4,Others...>
+ BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(BOOST_FUSION_UNROLLED_DEPTH),
+ BOOST_FUSION_UNROLLED_VECTOR_IMPL,
+ _)
+
+ template<
+ int I,
+ BOOST_PP_ENUM_PARAMS(BOOST_FUSION_UNROLLED_DEPTH, typename H),
+ typename... Others>
+ struct vector_impl<
+ I
+ , BOOST_PP_ENUM_PARAMS(BOOST_FUSION_UNROLLED_DEPTH, H)
+ , Others...
+ >
+ : vector_impl<I+BOOST_FUSION_UNROLLED_DEPTH,Others...>
{
- typedef vector_impl<I+4,Others...> base_type;
+ typedef
+ vector_impl<I+BOOST_FUSION_UNROLLED_DEPTH,Others...>
+ base_type;
typedef base_type chain_upper;
using base_type::at_impl;
vector_impl()
- : BOOST_PP_ENUM(4,
- BOOST_FUSION_UNROLLED_VECTOR_MEMBER_DEFAULT_INIT,
- _)
+ : BOOST_PP_ENUM(
+ BOOST_FUSION_UNROLLED_DEPTH,
+ BOOST_FUSION_UNROLLED_VECTOR_MEMBER_DEFAULT_INIT,
+ _)
{}
template<typename It>
vector_impl(assign_by_deref,It const& it)
- : base_type(assign_by_deref(),fusion::advance_c<4>(it))
- , BOOST_PP_ENUM(4,
+ : base_type(
+ assign_by_deref(),
+ fusion::advance_c<BOOST_FUSION_UNROLLED_DEPTH>(it))
+ , BOOST_PP_ENUM(
+ BOOST_FUSION_UNROLLED_DEPTH,
BOOST_FUSION_UNROLLED_VECTOR_MEMBER_DEREF_ASSIGN_PARAMS,
_)
{}
# ifndef BOOST_NO_RVALUE_REFERENCES
template<
- BOOST_PP_ENUM_PARAMS(4, typename OtherH)
+ BOOST_PP_ENUM_PARAMS(
+ BOOST_FUSION_UNROLLED_DEPTH, typename OtherH)
, typename... OtherElements
>
# endif
vector_impl(
assign_directly,
- BOOST_FUSION_UNROLLED_VECTOR_MEMBER_DIRECT_ASSIGN_PARAMS(4),
+ BOOST_FUSION_UNROLLED_VECTOR_MEMBER_DIRECT_ASSIGN_PARAMS(
+ BOOST_FUSION_UNROLLED_DEPTH),
# ifdef BOOST_NO_RVALUE_REFERENCES
typename call_traits<Others>::param_type... elements
# else
@@ -334,22 +354,30 @@
# endif
)
: base_type(assign_directly(),
- BOOST_FUSION_FORWARD(OtherElements,elements)...)
- , BOOST_PP_ENUM(4, BOOST_FUSION_UNROLLED_VECTOR_DIRECT_ASSIGN, _)
+ BOOST_FUSION_FORWARD(OtherElements,elements)...)
+ , BOOST_PP_ENUM(
+ BOOST_FUSION_UNROLLED_DEPTH,
+ BOOST_FUSION_UNROLLED_VECTOR_DIRECT_ASSIGN,
+ _)
{}
template<typename It0>
void
assign(It0 const& it0)
{
- BOOST_PP_REPEAT(4,
- BOOST_FUSION_UNROLLED_VECTOR_MEMBER_DEREF_ASSIGN,
- _)
+ BOOST_PP_REPEAT(
+ BOOST_FUSION_UNROLLED_DEPTH,
+ BOOST_FUSION_UNROLLED_VECTOR_MEMBER_DEREF_ASSIGN,
+ _)
- static_cast<base_type*>(this)->assign(fusion::next(it4));
+ static_cast<base_type*>(this)->assign(
+ fusion::next(BOOST_PP_CAT(it,BOOST_FUSION_UNROLLED_DEPTH)));
}
- BOOST_PP_REPEAT(4,BOOST_FUSION_UNROLLED_VECTOR_AT,_)
+ BOOST_PP_REPEAT(
+ BOOST_FUSION_UNROLLED_DEPTH,
+ BOOST_FUSION_UNROLLED_VECTOR_AT,
+ _)
};
# undef BOOST_FUSION_UNROLLED_VECTOR_MEMBER_DEFAULT_INIT
@@ -366,7 +394,10 @@
# ifndef BOOST_FUSION_PREFER_MPL
template<typename Vector, int I>
struct vector_meta_value_at
- : vector_meta_value_at<typename Vector::chain_upper, I-4>
+ : vector_meta_value_at<
+ typename Vector::chain_upper
+ , I-BOOST_FUSION_UNROLLED_DEPTH
+ >
{};
# define BOOST_FUSION_META_VALUE_AT_SPECIALIZATION(Z,N,_)\
@@ -376,7 +407,10 @@
typedef typename Vector::BOOST_PP_CAT(h,N) type;\
};
- BOOST_PP_REPEAT(4, BOOST_FUSION_META_VALUE_AT_SPECIALIZATION, _)
+ BOOST_PP_REPEAT(
+ BOOST_FUSION_UNROLLED_DEPTH,
+ BOOST_FUSION_META_VALUE_AT_SPECIALIZATION,
+ _)
# undef BOOST_FUSION_META_VALUE_AT_SPECIALIZATION
# endif
Modified: sandbox/SOC/2009/fusion/boost/fusion/functional/invocation/detail/variadic_templates/invoke_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/functional/invocation/detail/variadic_templates/invoke_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/functional/invocation/detail/variadic_templates/invoke_impl.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -17,9 +17,19 @@
# include <boost/fusion/functional/invocation/detail/member_object_pointer_helper.hpp>
# include <boost/fusion/functional/invocation/detail/that_ptr.hpp>
#endif
+#include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/support/internal/result_of.hpp>
#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/control/expr_iif.hpp>
+#include <boost/preprocessor/facilities/intercept.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/if.hpp>
@@ -70,9 +80,9 @@
, Result
>::type
BOOST_PP_CAT(BOOST_FUSION_INVOKE_NAME,_call_impl)(
- F&& f,
- Instance&& instance,
- Args&&... args)
+ F&& f,
+ Instance&& instance,
+ Args&&... args)
{
# ifndef BOOST_FUSION_RETURN_VOID
return
@@ -88,9 +98,9 @@
, Result
>::type
BOOST_PP_CAT(BOOST_FUSION_INVOKE_NAME,_call_impl)(
- F&& f,
- Instance&& instance,
- Args&&... args)
+ F&& f,
+ Instance&& instance,
+ Args&&... args)
{
BOOST_FUSION_STATIC_ASSERT(!sizeof...(Args));
@@ -107,221 +117,167 @@
namespace bidirectional_impl
{
#ifndef BOOST_FUSION_RETURN_VOID
+
template<
int NumElementsLeft
, typename F
- , typename It4
+ , typename It
, typename...Args
>
- struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME)
- {
- typedef typename result_of::prior<It4>::type It3;
- typedef typename result_of::prior<It3>::type It2;
- typedef typename result_of::prior<It2>::type It1;
- typedef typename result_of::prior<It1>::type It0;
-
- typedef typename
- BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME)<
- NumElementsLeft-4
- , F
- , typename result_of::prior<It0>::type
- , typename result_of::deref<It0>::type
- , typename result_of::deref<It1>::type
- , typename result_of::deref<It2>::type
- , typename result_of::deref<It3>::type
- , Args...
- >::type
- type;
- };
+ struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME);
- template<typename F, typename It3, typename...Args>
- struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME)<
- 3
- , F
- , It3
- , Args...
+# define BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_IT_DEF(Z, N, MAX_N) \
+ typedef typename \
+ result_of::prior<BOOST_PP_CAT(It,BOOST_PP_SUB(MAX_N, N)) const&>::type \
+ BOOST_PP_CAT(It,BOOST_PP_DEC(BOOST_PP_SUB(MAX_N, N)));
+
+# define BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_SPECIALIZATION(N) \
+ template<typename F, typename BOOST_PP_CAT(It,N), typename... Args> \
+ struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME)< \
+ N \
+ , F \
+ , BOOST_PP_CAT(It,N) \
+ , Args... \
>
- {
- typedef typename result_of::prior<It3>::type It2;
- typedef typename result_of::prior<It2>::type It1;
- typedef typename
- detail::BOOST_PP_CAT(
- BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME),
- _impl)
- <
- F
- , typename result_of::deref<
- typename result_of::prior<It1>::type
- >::type
- , typename result_of::deref<It1>::type
- , typename result_of::deref<It2>::type
- , Args...
- >::type
- type;
- };
-
- template<typename F, typename It2, typename...Args>
- struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME)<
- 2
- , F
- , It2
- , Args...
- >
- {
- typedef typename result_of::prior<It2>::type It1;
+# define BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_DECLERATION(N) \
+ template< \
+ int NumElementsLeft \
+ , typename F \
+ , typename BOOST_PP_CAT(It,N) \
+ , typename...Args \
+ > \
+ struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME)
- typedef typename
- detail::BOOST_PP_CAT(
- BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME),
- _impl)
- <
- F
- , typename result_of::deref<
- typename result_of::prior<It1>::type
- >::type
- , typename result_of::deref<It1>::type
- , Args...
- >::type
- type;
+# define BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_NEXT() \
+ BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME)< \
+ NumElementsLeft-BOOST_FUSION_UNROLLED_DEPTH \
+ , F \
+ , typename result_of::prior<It0 const&>::type
+
+# define BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_LAST() \
+ detail::BOOST_PP_CAT( \
+ BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME), \
+ _impl) \
+ < \
+ F
+
+# define BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL(Z,N,_) \
+ BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(N,BOOST_FUSION_UNROLLED_DEPTH), \
+ BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_DECLERATION, \
+ BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_SPECIALIZATION)(N) \
+ { \
+ BOOST_PP_REPEAT( \
+ N, \
+ BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_IT_DEF, \
+ N) \
+ \
+ typedef typename \
+ BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(N,BOOST_FUSION_UNROLLED_DEPTH), \
+ BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_NEXT, \
+ BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_LAST)() \
+ BOOST_PP_COMMA_IF(N) \
+ BOOST_PP_ENUM_BINARY_PARAMS( \
+ N, \
+ typename result_of::deref<It, \
+ >::type BOOST_PP_INTERCEPT) \
+ , Args... \
+ >::type \
+ type; \
};
- template<typename F, typename It1, typename...Args>
- struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME)<
- 1
- , F
- , It1
- , Args...
- >
- {
- typedef typename
- detail::BOOST_PP_CAT(
- BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME),
- _impl)
- <
- F
- , typename result_of::deref<
- typename result_of::prior<It1>::type
- >::type
- , Args...
- >::type
- type;
- };
+ BOOST_PP_REPEAT(
+ BOOST_PP_INC(BOOST_FUSION_UNROLLED_DEPTH),
+ BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL,
+ _)
+
+# undef BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL
+# undef BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_NEXT
+# undef BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_LAST
+# undef BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_DECLERATION
+# undef BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_SPECIALIZATION
+# undef BOOST_FUSION_RESULT_OF_UNROLLED_INVOKE_IMPL_IT_DEF
- template<typename F, typename It0, typename...Args>
- struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME)<
- 0
- , F
- , It0
- , Args...
- >
- {
- typedef typename
- detail::BOOST_PP_CAT(
- BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_INVOKE_NAME),
- _impl)
- <
- F
- , Args...
- >::type
- type;
- };
#endif
template<typename F, typename Result>
struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_INVOKE_NAME)
{
- template<int NumElementsLeft,typename It4,typename...Args>
- static Result
- call(mpl::int_<NumElementsLeft>,
- F f,
- It4 const& it4,
- Args&&... args)
- {
- typedef typename result_of::prior<It4 const&>::type It3;
- It3 it3 = fusion::prior(it4);
- typedef typename result_of::prior<It3&>::type It2;
- It2 it2 = fusion::prior(it3);
- typedef typename result_of::prior<It2&>::type It1;
- It1 it1 = fusion::prior(it2);
- typedef typename result_of::prior<It1&>::type It0;
- It0 it0 = fusion::prior(it1);
-
- return call(
- mpl::int_<NumElementsLeft-4>(),
- static_cast<F>(f),
- it0,
- fusion::deref(it0),
- fusion::deref(it1),
- fusion::deref(it2),
- fusion::deref(it3),
- std::forward<Args>(args)...);
- }
+#if defined(BOOST_NO_AUTO_DECLARATIONS) || defined(BOOST_NO_RVALUE_REFERENCES)
+# define BOOST_FUSION_UNROLLED_INVOKE_IMPL_IT_DEF(Z, N, MAX_N) \
+ typedef typename \
+ result_of::prior<BOOST_PP_CAT(It,BOOST_PP_SUB(MAX_N, N)) const&>::type \
+ BOOST_PP_CAT(It,BOOST_PP_DEC(BOOST_PP_SUB(MAX_N, N))); \
+ BOOST_PP_CAT(It,BOOST_PP_DEC(BOOST_PP_SUB(MAX_N, N))) const \
+ BOOST_PP_CAT(it,BOOST_PP_DEC(BOOST_PP_SUB(MAX_N, N)))= \
+ fusion::prior(BOOST_PP_CAT(it,BOOST_PP_SUB(MAX_N, N)));
+#else
+# define BOOST_FUSION_UNROLLED_INVOKE_IMPL_IT_DEF(Z, N, MAX_N) \
+ auto const BOOST_PP_CAT(it,BOOST_PP_DEC(BOOST_PP_SUB(MAX_N, N)))= \
+ fusion::prior(BOOST_PP_CAT(it,BOOST_PP_SUB(MAX_N, N)));
+#endif
- template<typename It3,typename...Args>
- static Result
- call(mpl::int_<3>,
- F f,
- It3 const& it3,
- Args&&... args)
- {
- typedef typename result_of::prior<It3 const&>::type It2;
- It2 it2 = fusion::prior(it3);
- typedef typename result_of::prior<It2&>::type It1;
- It1 it1 = fusion::prior(it2);
+#define BOOST_FUSION_UNROLLED_INVOKE_IMPL_IT_ENUM(Z,N,_) \
+ fusion::deref(BOOST_PP_CAT(it,N)),
- return BOOST_PP_CAT(BOOST_FUSION_INVOKE_NAME,_call_impl)<
- Result
- >(static_cast<F>(f),
- fusion::deref(fusion::prior(it1)),
- fusion::deref(it1),
- fusion::deref(it2),
- std::forward<Args>(args)...);
+#define BOOST_FUSION_UNROLLED_INVOKE_IMPL_NEXT() \
+ call( \
+ mpl::int_<NumElementsLeft-BOOST_FUSION_UNROLLED_DEPTH>(), \
+ static_cast<F>(f), \
+ it0
+
+#define BOOST_FUSION_UNROLLED_INVOKE_IMPL_LAST() \
+ BOOST_PP_CAT(BOOST_FUSION_INVOKE_NAME,_call_impl)< \
+ Result \
+ >(static_cast<F>(f)
+
+#define BOOST_FUSION_UNROLLED_INVOKE_IMPL(Z,N,_) \
+ template< \
+ BOOST_PP_EXPR_IIF( \
+ BOOST_PP_EQUAL(N,BOOST_FUSION_UNROLLED_DEPTH), \
+ int NumElementsLeft) \
+ BOOST_PP_COMMA_IF( \
+ BOOST_PP_EQUAL(N,BOOST_FUSION_UNROLLED_DEPTH)) \
+ typename BOOST_PP_CAT(It,N) \
+ , typename...Args \
+ > \
+ static Result \
+ call( \
+ mpl::int_<BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(N,BOOST_FUSION_UNROLLED_DEPTH), \
+ NumElementsLeft, \
+ N) \
+ >, \
+ F f, \
+ BOOST_PP_CAT(It,N) const& BOOST_PP_CAT(it,N), \
+ Args&&... args) \
+ { \
+ BOOST_PP_REPEAT( \
+ N, \
+ BOOST_FUSION_UNROLLED_INVOKE_IMPL_IT_DEF, \
+ N) \
+ \
+ return BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(N,BOOST_FUSION_UNROLLED_DEPTH), \
+ BOOST_FUSION_UNROLLED_INVOKE_IMPL_NEXT, \
+ BOOST_FUSION_UNROLLED_INVOKE_IMPL_LAST)(), \
+ BOOST_PP_REPEAT( \
+ N, BOOST_FUSION_UNROLLED_INVOKE_IMPL_IT_ENUM, _) \
+ std::forward<Args>(args)...); \
}
- template<typename It2,typename...Args>
- static Result
- call(mpl::int_<2>,
- F f,
- It2 const& it2,
- Args&&... args)
- {
- typedef typename result_of::prior<It2 const&>::type It1;
- It1 it1 = fusion::prior(it2);
-
- return BOOST_PP_CAT(BOOST_FUSION_INVOKE_NAME,_call_impl)<
- Result
- >(static_cast<F>(f),
- fusion::deref(fusion::prior(it1)),
- fusion::deref(it1),
- std::forward<Args>(args)...);
- }
-
- template<typename It1,typename...Args>
- static Result
- call(mpl::int_<1>,
- F f,
- It1 const& it1,
- Args&&... args)
- {
- return BOOST_PP_CAT(BOOST_FUSION_INVOKE_NAME,_call_impl)<
- Result
- >(static_cast<F>(f),
- fusion::deref(fusion::prior(it1)),
- std::forward<Args>(args)...);
- }
-
- template<typename It,typename...Args>
- static Result
- call(mpl::int_<0>,
- F f,
- It const& it,
- Args&&... args)
- {
- return BOOST_PP_CAT(BOOST_FUSION_INVOKE_NAME,_call_impl)<
- Result
- >(static_cast<F>(f),std::forward<Args>(args)...);
- }
+ BOOST_PP_REPEAT(
+ BOOST_PP_INC(BOOST_FUSION_UNROLLED_DEPTH),
+ BOOST_FUSION_UNROLLED_INVOKE_IMPL,
+ _)
+
+#undef BOOST_FUSION_UNROLLED_INVOKE_IMPL
+#undef BOOST_FUSION_UNROLLED_INVOKE_IMPL_NEXT
+#undef BOOST_FUSION_UNROLLED_INVOKE_IMPL_LAST
+#undef BOOST_FUSION_UNROLLED_INVOKE_IMPL_IT_ENUM
+#undef BOOST_FUSION_UNROLLED_INVOKE_IMPL_IT_DEF
};
}
@@ -374,11 +330,11 @@
call(mpl::int_<NumArgsLeft>, F f, Begin const& begin,Args&&... args)
{
return call(
- mpl::int_<NumArgsLeft-1>(),
- static_cast<F>(f),
- begin,
- fusion::deref(fusion::advance_c<NumArgsLeft-1>(begin)),
- std::forward<Args>(args)...);
+ mpl::int_<NumArgsLeft-1>(),
+ static_cast<F>(f),
+ begin,
+ fusion::deref(fusion::advance_c<NumArgsLeft-1>(begin)),
+ std::forward<Args>(args)...);
}
};
}
Added: sandbox/SOC/2009/fusion/boost/fusion/support/config.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/support/config.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -0,0 +1,15 @@
+/*==============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_SUPPORT_CONFIG_HPP
+#define BOOST_FUSION_SUPPORT_CONFIG_HPP
+
+#ifndef BOOST_FUSION_UNROLLED_DEPTH
+# define BOOST_FUSION_UNROLLED_DEPTH 6
+#endif
+
+#endif
Modified: sandbox/SOC/2009/fusion/boost/fusion/support/internal/is_explicitly_convertible.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/support/internal/is_explicitly_convertible.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/support/internal/is_explicitly_convertible.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -8,6 +8,7 @@
#ifndef BOOST_FUSION_SUPPORT_INTERNAL_IS_EXPLICITLY_CONVERTIBLE_HPP
#define BOOST_FUSION_SUPPORT_INTERNAL_IS_EXPLICITLY_CONVERTIBLE_HPP
+#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/type_traits/is_convertible.hpp>
#if !BOOST_WORKAROUND(__GNUC__,<4) && !defined(BOOST_MSVC)
@@ -15,17 +16,24 @@
# include <boost/fusion/support/internal/small_big_type.hpp>
# include <boost/mpl/bool.hpp>
# include <cstddef>
+#elif defined(BOOST_MSVC)
+# include <type_traits>
#endif
namespace boost { namespace fusion { namespace detail
{
+#if BOOST_WORKAROUND(__GNUC__,<4)
//cschmidt: Fall back due to a defect in gcc 3.x's call_expr...
-//... and a bug in MSVC
-#if BOOST_WORKAROUND(__GNUC__,<4) || defined(BOOST_MSVC)
template<typename From, typename To>
struct is_explicitly_convertible
: is_convertible<From,To>
{};
+#elif defined(BOOST_MSVC)
+//cschmidt: https://svn.boost.org/trac/boost/ticket/4530#comment:1
+ template<typename From, typename To>
+ struct is_explicitly_convertible
+ : std::tr1::is_convertible<From,To>
+ {};
#else
template<typename T>
T
Modified: sandbox/SOC/2009/fusion/boost/fusion/support/tag_of_fwd.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/support/tag_of_fwd.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/support/tag_of_fwd.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -11,13 +11,24 @@
#include <boost/config.hpp>
-namespace boost { namespace fusion
+namespace boost
{
- namespace traits
+ namespace fusion
{
- template<typename Seq, typename Enable=void>
- struct tag_of;
+ struct fusion_sequence_tag;
+
+ namespace traits
+ {
+ template<typename Seq, typename Enable=void>
+ struct tag_of;
+ }
+ }
+
+ namespace mpl
+ {
+ template<typename>
+ struct sequence_tag;
}
-}}
+}
#endif
Modified: sandbox/SOC/2009/fusion/boost/fusion/view/detail/view_storage.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/detail/view_storage.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/detail/view_storage.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -8,13 +8,24 @@
#ifndef BOOST_FUSION_VIEW_DETAIL_VIEW_STORAGE_HPP
#define BOOST_FUSION_VIEW_DETAIL_VIEW_STORAGE_HPP
+#include <boost/config.hpp>
#include <boost/fusion/support/is_view.hpp>
#include <boost/fusion/support/internal/ref.hpp>
namespace boost { namespace fusion { namespace detail
{
+#ifdef BOOST_MSVC
+# define BOOST_FUSION_DETAIL_VIEW_STROAGE(SEQ)\
+ detail::view_storage<SEQ, traits::is_view<SEQ>::type::value>
+
+ template<typename T, bool IsView>
+ struct view_storage;
+#else
+# define BOOST_FUSION_DETAIL_VIEW_STROAGE(SEQ) detail::view_storage<SEQ>
+
template<typename T, bool IsView=traits::is_view<T>::type::value>
struct view_storage;
+#endif
template<typename View>
struct view_storage<View, /*IsView*/true>
@@ -28,7 +39,8 @@
#define BOOST_FUSION_VIEW_STORAGE_CTOR(MODIFIER,_)\
template<typename OtherT, bool IsView>\
- view_storage(view_storage<OtherT, IsView> MODIFIER storage)\
+ view_storage(\
+ view_storage<OtherT, IsView> MODIFIER storage)\
: view(storage.template get<view_storage<OtherT, IsView> MODIFIER>())\
{}
@@ -85,7 +97,8 @@
#define BOOST_FUSION_VIEW_STORAGE_CTOR(MODIFIER,_)\
template<typename OtherSeq>\
- view_storage(view_storage<OtherSeq, false> MODIFIER storage)\
+ view_storage(\
+ view_storage<OtherSeq, false> MODIFIER storage)\
: seq(storage.seq)\
{}
Modified: sandbox/SOC/2009/fusion/boost/fusion/view/filter_view/filter_view.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/filter_view/filter_view.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/filter_view/filter_view.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -49,7 +49,7 @@
BOOST_FUSION_MPL_ASSERT((traits::is_sequence<Seq>));
BOOST_FUSION_MPL_ASSERT((traits::is_forward<Seq>));
- typedef detail::view_storage<Seq> storage_type;
+ typedef BOOST_FUSION_DETAIL_VIEW_STROAGE(Seq) storage_type;
typedef typename storage_type::type seq_type;
typedef Pred pred_type;
typedef PredIsMetafunction pred_is_metafunction;
Modified: sandbox/SOC/2009/fusion/boost/fusion/view/joint_view/joint_view.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/joint_view/joint_view.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/joint_view/joint_view.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -50,9 +50,9 @@
BOOST_FUSION_MPL_ASSERT((traits::is_sequence<Seq2>));
BOOST_FUSION_MPL_ASSERT((traits::is_forward<Seq2>));
- typedef detail::view_storage<Seq1> storage1_type;
+ typedef BOOST_FUSION_DETAIL_VIEW_STROAGE(Seq1) storage1_type;
typedef typename storage1_type::type seq1_type;
- typedef detail::view_storage<Seq2> storage2_type;
+ typedef BOOST_FUSION_DETAIL_VIEW_STROAGE(Seq2) storage2_type;
typedef typename storage2_type::type seq2_type;
typedef typename
Modified: sandbox/SOC/2009/fusion/boost/fusion/view/nview/nview.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/nview/nview.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/nview/nview.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -62,7 +62,7 @@
BOOST_FUSION_MPL_ASSERT((traits::is_random_access<Seq>));
typedef Indices indices;
- typedef detail::view_storage<Seq> storage_type;
+ typedef BOOST_FUSION_DETAIL_VIEW_STROAGE(Seq) storage_type;
typedef typename storage_type::type seq_type;
typedef nview_tag fusion_tag;
Modified: sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/repetitive_view.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/repetitive_view.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/repetitive_view.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -58,7 +58,7 @@
, mpl::not_<Size>
>));
- typedef detail::view_storage<Seq> storage_type;
+ typedef BOOST_FUSION_DETAIL_VIEW_STROAGE(Seq) storage_type;
typedef typename storage_type::type seq_type;
typedef typename traits::category_of<seq_type>::type category;
@@ -106,7 +106,7 @@
return *this;
}
- detail::view_storage<Seq> seq;
+ storage_type seq;
};
namespace result_of
Modified: sandbox/SOC/2009/fusion/boost/fusion/view/reverse_view/reverse_view.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/reverse_view/reverse_view.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/reverse_view/reverse_view.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -49,7 +49,7 @@
BOOST_FUSION_MPL_ASSERT((traits::is_sequence<Seq>));
BOOST_FUSION_MPL_ASSERT((traits::is_bidirectional<Seq>));
- typedef detail::view_storage<Seq> storage_type;
+ typedef BOOST_FUSION_DETAIL_VIEW_STROAGE(Seq) storage_type;
typedef typename storage_type::type seq_type;
typedef typename traits::category_of<seq_type>::type category;
@@ -91,7 +91,7 @@
return *this;
}
- detail::view_storage<Seq> seq;
+ storage_type seq;
};
}}
Modified: sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/transform_view.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/transform_view.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/transform_view.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -73,9 +73,9 @@
mpl::equal_to<result_of::size<Seq1>,result_of::size<Seq2> >));
typedef IsAssociative is_associative;
- typedef detail::view_storage<Seq1> storage1_type;
+ typedef BOOST_FUSION_DETAIL_VIEW_STROAGE(Seq1) storage1_type;
typedef typename storage1_type::type seq1_type;
- typedef detail::view_storage<Seq2> storage2_type;
+ typedef BOOST_FUSION_DETAIL_VIEW_STROAGE(Seq2) storage2_type;
typedef typename storage2_type::type seq2_type;
typedef F transform_type;
typedef typename
@@ -154,7 +154,7 @@
BOOST_FUSION_MPL_ASSERT((traits::is_forward<Seq>));
typedef IsAssociative is_associative;
- typedef detail::view_storage<Seq> storage_type;
+ typedef BOOST_FUSION_DETAIL_VIEW_STROAGE(Seq) storage_type;
typedef typename storage_type::type seq_type;
typedef typename
mpl::eval_if<
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/Jamfile
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/Jamfile (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/Jamfile 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -12,11 +12,11 @@
import testing ;
project
- : requirements
+ : requirements
<define>BOOST_FUSION_ENABLE_STATIC_ASSERTS
<warnings>all
<toolset>gcc:<cxxflags>-Wno-long-long
- ;
+ ;
{
test-suite struct : ;
Added: sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/adapt_example_struct.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/adapt_example_struct.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -0,0 +1,40 @@
+/*==============================================================================
+ Copyright (c) 2001-2006 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+ Copyright (c) 2010 Christopher Schmidt
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+#ifndef EXTENSION_STRUCT_ADAPT_EXAMPLE_STRUCT_HPP
+#define EXTENSION_STRUCT_ADAPT_EXAMPLE_STRUCT_HPP
+
+#include "example_struct.hpp"
+
+#include <boost/type_traits/remove_reference.hpp>
+#include "detail/tag_of.hpp"
+#include "detail/at_impl.hpp"
+#include "detail/at_key_impl.hpp"
+#include "detail/begin_impl.hpp"
+#include "detail/category_of_impl.hpp"
+#include "detail/end_impl.hpp"
+#include "detail/has_key_impl.hpp"
+#include "detail/is_sequence_impl.hpp"
+#include "detail/is_view_impl.hpp"
+#include "detail/size_impl.hpp"
+#include "detail/value_at_impl.hpp"
+#include "detail/value_at_key_impl.hpp"
+#include "detail/example_struct_iterator.hpp"
+#include "detail/advance_impl.hpp"
+#include "detail/deref_data_impl.hpp"
+#include "detail/deref_impl.hpp"
+#include "detail/distance_impl.hpp"
+#include "detail/equal_to_impl.hpp"
+#include "detail/key_of_impl.hpp"
+#include "detail/next_impl.hpp"
+#include "detail/prior_impl.hpp"
+#include "detail/value_of_data_impl.hpp"
+#include "detail/value_of_impl.hpp"
+
+#endif
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/advance_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/advance_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/advance_impl.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -20,7 +20,7 @@
template<typename ItRef, typename N>
struct apply
{
- typedef typename detail::remove_reference<ItRef>::type it;
+ typedef typename remove_reference<ItRef>::type it;
typedef
example::example_struct_iterator<
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/at_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/at_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/at_impl.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -31,7 +31,7 @@
{
typedef typename
mpl::if_<
- is_const<typename detail::remove_reference<SeqRef>::type>
+ is_const<typename remove_reference<SeqRef>::type>
, std::string const&
, std::string&
>::type
@@ -49,7 +49,7 @@
{
typedef typename
mpl::if_<
- is_const<typename detail::remove_reference<SeqRef>::type>
+ is_const<typename remove_reference<SeqRef>::type>
, int const&
, int&
>::type
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/deref_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/deref_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/deref_impl.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -24,7 +24,7 @@
template<typename ItRef>
struct apply
{
- typedef typename detail::remove_reference<ItRef>::type it;
+ typedef typename remove_reference<ItRef>::type it;
typedef typename
mpl::if_c<
!it::index::value
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/distance_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/distance_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/distance_impl.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -22,8 +22,8 @@
template<typename It1Ref, typename It2Ref>
struct apply
: mpl::minus<
- typename detail::remove_reference<It2Ref>::type::index
- , typename detail::remove_reference<It1Ref>::type::index
+ typename remove_reference<It2Ref>::type::index
+ , typename remove_reference<It1Ref>::type::index
>
{};
};
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/equal_to_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/equal_to_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/equal_to_impl.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -22,8 +22,8 @@
template<typename It1Ref, typename It2Ref>
struct apply
: mpl::equal_to<
- typename detail::remove_reference<It1Ref>::type::index
- , typename detail::remove_reference<It2Ref>::type::index
+ typename remove_reference<It1Ref>::type::index
+ , typename remove_reference<It2Ref>::type::index
>
{};
};
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/key_of_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/key_of_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/key_of_impl.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -21,7 +21,7 @@
template<typename ItRef>
struct apply
: mpl::if_c<
- !detail::remove_reference<ItRef>::type::index::value
+ !remove_reference<ItRef>::type::index::value
, fields::name
, fields::age
>
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/tag_of.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/tag_of.hpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/tag_of.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -11,7 +11,6 @@
#include <boost/config.hpp>
#include <boost/fusion/support/tag_of_fwd.hpp>
-#include <string>
namespace fields
{
@@ -30,45 +29,63 @@
struct example_struct_iterator_tag;
}
-namespace boost { namespace fusion { namespace traits
+namespace boost
{
- template<>
- struct tag_of<example::example_struct>
+ namespace fusion { namespace traits
{
- typedef example::example_sequence_tag type;
- };
-
- template<>
- struct tag_of<example::example_struct const>
- {
- typedef example::example_sequence_tag type;
- };
-
- template<>
- struct tag_of<example::example_struct&>
- {
- typedef example::example_sequence_tag type;
- };
-
- template<>
- struct tag_of<example::example_struct const&>
- {
- typedef example::example_sequence_tag type;
- };
+ template<>
+ struct tag_of<example::example_struct>
+ {
+ typedef example::example_sequence_tag type;
+ };
+
+ template<>
+ struct tag_of<example::example_struct const>
+ {
+ typedef example::example_sequence_tag type;
+ };
+
+ template<>
+ struct tag_of<example::example_struct&>
+ {
+ typedef example::example_sequence_tag type;
+ };
+
+ template<>
+ struct tag_of<example::example_struct const&>
+ {
+ typedef example::example_sequence_tag type;
+ };
#ifndef BOOST_NO_RVALUE_REFERENCES
- template<>
- struct tag_of<example::example_struct&&>
- {
- typedef example::example_sequence_tag type;
- };
+ template<>
+ struct tag_of<example::example_struct&&>
+ {
+ typedef example::example_sequence_tag type;
+ };
+
+ template<>
+ struct tag_of<example::example_struct const&&>
+ {
+ typedef example::example_sequence_tag type;
+ };
+#endif
+ }}
- template<>
- struct tag_of<example::example_struct const&&>
+ namespace mpl
{
- typedef example::example_sequence_tag type;
- };
-#endif
-}}}
+ template<>
+ struct sequence_tag<example::example_struct>
+ {
+ typedef fusion::fusion_sequence_tag type;
+ };
+
+ template<>
+ struct sequence_tag<example::example_struct const>
+ {
+ typedef fusion::fusion_sequence_tag type;
+ };
+ }
+}
#endif
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/value_of_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/value_of_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/detail/value_of_impl.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -22,7 +22,7 @@
template<typename ItRef>
struct apply
: mpl::if_c<
- !detail::remove_reference<ItRef>::type::index::value
+ !remove_reference<ItRef>::type::index::value
, std::string
, int
>
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/example_struct.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/example_struct.hpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/example_struct.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -1,7 +1,6 @@
/*==============================================================================
Copyright (c) 2001-2006 Joel de Guzman
- Copyright (c) 2005-2006 Dan Marsden
- Copyright (c) 2010 Christopher Schmidt
+ Copyright (c) 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)
@@ -10,32 +9,20 @@
#ifndef EXTENSION_STRUCT_EXAMPLE_STRUCT_HPP
#define EXTENSION_STRUCT_EXAMPLE_STRUCT_HPP
-#include <boost/fusion/support/internal/ref.hpp>
+#include <string>
-#include "detail/tag_of.hpp"
-
-#include "detail/at_impl.hpp"
-#include "detail/at_key_impl.hpp"
-#include "detail/begin_impl.hpp"
-#include "detail/category_of_impl.hpp"
-#include "detail/end_impl.hpp"
-#include "detail/has_key_impl.hpp"
-#include "detail/is_sequence_impl.hpp"
-#include "detail/is_view_impl.hpp"
-#include "detail/size_impl.hpp"
-#include "detail/value_at_impl.hpp"
-#include "detail/value_at_key_impl.hpp"
-
-#include "detail/example_struct_iterator.hpp"
-#include "detail/advance_impl.hpp"
-#include "detail/deref_data_impl.hpp"
-#include "detail/deref_impl.hpp"
-#include "detail/distance_impl.hpp"
-#include "detail/equal_to_impl.hpp"
-#include "detail/key_of_impl.hpp"
-#include "detail/next_impl.hpp"
-#include "detail/prior_impl.hpp"
-#include "detail/value_of_data_impl.hpp"
-#include "detail/value_of_impl.hpp"
+namespace example
+{
+ struct example_struct
+ {
+ std::string name;
+ int age;
+
+ example_struct(std::string const& name,int age)
+ : name(name)
+ , age(age)
+ {}
+ };
+}
#endif
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/test_example.cpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/test_example.cpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/struct/test_example.cpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -7,7 +7,7 @@
==============================================================================*/
#include "example_struct.hpp"
-#include "example_struct_type.hpp"
+#include "adapt_example_struct.hpp"
#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/sequence.hpp>
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/triple/Jamfile
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/triple/Jamfile (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/triple/Jamfile 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -12,11 +12,11 @@
import testing ;
project
- : requirements
+ : requirements
<define>BOOST_FUSION_ENABLE_STATIC_ASSERTS
<warnings>all
<toolset>gcc:<cxxflags>-Wno-long-long
- ;
+ ;
{
test-suite triple : ;
Added: sandbox/SOC/2009/fusion/libs/fusion/example/extension/triple/triple_.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/triple/triple_.cpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -0,0 +1,346 @@
+/*==============================================================================
+ Copyright (c) 2001-2006 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+ Copyright (c) 2010 Christopher Schmidt
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+
+/*
+An implementation of a std::pair like triple<T0, T1, T2>
+
+We use fusion::sequence_facade and fusion::iterator_facade to make our triple a
+fully conforming Boost.Fusion random traversal sequence.
+*/
+
+#include <boost/config.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/iterator.hpp>
+#include <boost/fusion/support.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/minus.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <string>
+
+namespace mpl = boost::mpl;
+namespace fusion = boost::fusion;
+
+namespace demo
+{
+ template<typename SeqRef, int N>
+ struct triple_iterator
+ : fusion::iterator_facade<
+ triple_iterator<SeqRef, N>
+ , fusion::random_access_traversal_tag
+ >
+ {
+ typedef mpl::int_<N> index;
+ typedef SeqRef seq_type;
+ typedef typename boost::remove_reference<SeqRef>::type seq_nonref_type;
+
+ triple_iterator(SeqRef seq)
+ : seq(seq)
+ {}
+
+ SeqRef seq;
+
+ template<typename ItRef>
+ struct value_of;
+
+ template<typename ItRef>
+ struct value_of<ItRef&>
+ : value_of<ItRef>
+ {};
+
+#ifndef BOOST_NO_RVALUE_REFERENCES
+ template<typename ItRef>
+ struct value_of<ItRef&&>
+ : value_of<ItRef>
+ {};
+#endif
+
+ template<typename It>
+ struct value_of<It const>
+ : value_of<It>
+ {};
+
+ template<typename SeqRef_>
+ struct value_of<triple_iterator<SeqRef_, 0> >
+ {
+ typedef typename seq_nonref_type::t0_type type;
+ };
+
+ template<typename SeqRef_>
+ struct value_of<triple_iterator<SeqRef_, 1> >
+ {
+ typedef typename seq_nonref_type::t1_type type;
+ };
+
+ template<typename SeqRef_>
+ struct value_of<triple_iterator<SeqRef_, 2> >
+ {
+ typedef typename seq_nonref_type::t2_type type;
+ };
+
+ template<typename ItRef>
+ struct deref;
+
+ template<typename ItRef>
+ struct deref<ItRef&>
+ : deref<ItRef>
+ {};
+
+#ifndef BOOST_NO_RVALUE_REFERENCES
+ template<typename ItRef>
+ struct deref<ItRef&&>
+ : deref<ItRef>
+ {};
+#endif
+
+ template<typename It>
+ struct deref<It const>
+ : deref<It>
+ {};
+
+ template<typename SeqRef_>
+ struct deref<triple_iterator<SeqRef_, 0> >
+ {
+ typedef typename
+ mpl::if_<
+ boost::is_const<seq_nonref_type>
+ , typename seq_nonref_type::t0_type const&
+ , typename seq_nonref_type::t0_type&
+ >::type
+ type;
+
+ static type
+ call(triple_iterator<SeqRef, 0> const& iter)
+ {
+ return iter.seq.t0;
+ }
+ };
+
+ template<typename SeqRef_>
+ struct deref<triple_iterator<SeqRef_, 1> >
+ {
+ typedef typename
+ mpl::if_<
+ boost::is_const<seq_nonref_type>
+ , typename seq_nonref_type::t1_type const&
+ , typename seq_nonref_type::t1_type&
+ >::type
+ type;
+
+ static type
+ call(triple_iterator<SeqRef, 1> const& iter)
+ {
+ return iter.seq.t1;
+ }
+ };
+
+ template<typename SeqRef_>
+ struct deref<triple_iterator<SeqRef_, 2> >
+ {
+ typedef typename
+ mpl::if_<
+ boost::is_const<seq_nonref_type>
+ , typename seq_nonref_type::t2_type const&
+ , typename seq_nonref_type::t2_type&
+ >::type
+ type;
+
+ static type
+ call(triple_iterator<SeqRef, 2> const& iter)
+ {
+ return iter.seq.t2;
+ }
+ };
+
+ template<typename ItRef1, typename ItRef2>
+ struct distance
+ : mpl::minus<
+ typename boost::remove_reference<ItRef2>::type::index
+ , typename boost::remove_reference<ItRef1>::type::index
+ >
+ {};
+
+ template<typename ItRef, typename M>
+ struct advance
+ {
+ typedef
+ triple_iterator<
+ seq_type,
+ N + M::value
+ >
+ type;
+
+ static type
+ call(ItRef it)
+ {
+ return type(it.seq);
+ }
+ };
+
+ template<typename ItRef>
+ struct next
+ : advance<ItRef, mpl::int_<1> >
+ {};
+
+ template<typename ItRef>
+ struct prior
+ : advance<ItRef, mpl::int_<-1> >
+ {};
+ };
+
+ template<typename T0, typename T1, typename T2>
+ struct triple
+ : fusion::sequence_facade<
+ triple<T0, T1, T2>
+ , fusion::random_access_traversal_tag
+ >
+ {
+ typedef T0 t0_type;
+ typedef T1 t1_type;
+ typedef T2 t2_type;
+
+ triple(T0 const& t0, T1 const& t1, T2 const& t2)
+ : t0(t0), t1(t1), t2(t2)
+ {}
+
+ template<typename SeqRef>
+ struct begin
+ {
+ typedef demo::triple_iterator<SeqRef, 0> type;
+
+ static type
+ call(SeqRef seq)
+ {
+ return type(seq);
+ }
+ };
+
+ template<typename SeqRef>
+ struct end
+ {
+ typedef demo::triple_iterator<SeqRef, 3> type;
+
+ static type call(SeqRef seq)
+ {
+ return type(seq);
+ }
+ };
+
+ template<typename SeqRef>
+ struct size
+ : mpl::int_<3>
+ {};
+
+ template<typename SeqRef, typename N>
+ struct value_at
+ : value_at<SeqRef, mpl::int_<N::value> >
+ {};
+
+ template<typename SeqRef>
+ struct value_at<SeqRef, mpl::int_<0> >
+ {
+ typedef T0 type;
+ };
+
+ template<typename SeqRef>
+ struct value_at<SeqRef, mpl::int_<1> >
+ {
+ typedef T1 type;
+ };
+
+ template<typename SeqRef>
+ struct value_at<SeqRef, mpl::int_<2> >
+ {
+ typedef T2 type;
+ };
+
+ template<typename SeqRef, typename N>
+ struct at
+ : at<SeqRef, mpl::int_<N::value> >
+ {};
+
+ template<typename SeqRef>
+ struct at<SeqRef, mpl::int_<0> >
+ {
+ typedef typename boost::remove_reference<SeqRef>::type seq;
+
+ typedef typename
+ mpl::if_<boost::is_const<seq>, T0 const&, T0&>::type
+ type;
+
+ static type
+ call(SeqRef seq)
+ {
+ return seq.t0;
+ }
+ };
+
+ template<typename SeqRef>
+ struct at<SeqRef, mpl::int_<1> >
+ {
+ typedef typename boost::remove_reference<SeqRef>::type seq;
+
+ typedef typename
+ mpl::if_<boost::is_const<seq>, T1 const&, T1&>::type
+ type;
+
+ static type
+ call(SeqRef seq)
+ {
+ return seq.t1;
+ }
+ };
+
+ template<typename SeqRef>
+ struct at<SeqRef, mpl::int_<2> >
+ {
+ typedef typename boost::remove_reference<SeqRef>::type seq;
+
+ typedef typename
+ mpl::if_<boost::is_const<seq>, T2 const&, T2&>::type
+ type;
+
+ static type
+ call(SeqRef seq)
+ {
+ return seq.t2;
+ }
+ };
+
+ T0 t0;
+ T1 t1;
+ T2 t2;
+ };
+}
+
+int main()
+{
+ typedef demo::triple<int, char, std::string> my_triple;
+ my_triple t(101, 'a', "hello");
+
+ BOOST_TEST(*fusion::begin(t) == 101);
+ BOOST_TEST(*fusion::next(fusion::begin(t)) == 'a');
+ BOOST_TEST(*fusion::prior(fusion::end(t)) == "hello");
+ BOOST_TEST(fusion::distance(fusion::begin(t), fusion::end(t)) == 3);
+ BOOST_TEST(fusion::size(t) == 3);
+
+ BOOST_MPL_ASSERT((boost::is_same<int, fusion::result_of::value_at_c<my_triple, 0>::type>));
+ BOOST_MPL_ASSERT((boost::is_same<char, fusion::result_of::value_at_c<my_triple, 1>::type>));
+ BOOST_MPL_ASSERT((boost::is_same<std::string, fusion::result_of::value_at_c<my_triple, 2>::type>));
+
+ BOOST_TEST(fusion::at_c<0>(t) == 101);
+ BOOST_TEST(fusion::at_c<1>(t) == 'a');
+ BOOST_TEST(fusion::at_c<2>(t) == "hello");
+
+ return boost::report_errors();
+}
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/vtuple/Jamfile
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/vtuple/Jamfile (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/vtuple/Jamfile 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -10,11 +10,11 @@
import testing ;
project
- : requirements
+ : requirements
<define>BOOST_FUSION_ENABLE_STATIC_ASSERTS
<warnings>all
<toolset>gcc:<cxxflags>-Wno-long-long
- ;
+ ;
{
test-suite vtriple : ;
Added: sandbox/SOC/2009/fusion/libs/fusion/example/extension/vtuple/vtuple_.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/vtuple/vtuple_.cpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -0,0 +1,416 @@
+/*==============================================================================
+ Copyright (c) 2001-2006 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+ Copyright (c) 2010 Christopher Schmidt
+ Copyright (c) 2010 John Fletcher
+
+ 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)
+==============================================================================*/
+
+/*
+This file changes over to use a variadic tuple in place of the triple. This
+version works with gcc 4.4.3 with -std=gnu++0x and boost 1.42.0 plus Christopher
+Schmidt's modifications (not yet in a boost release).
+
+John Fletcher J.P.Fletcher_at_[hidden]
+*/
+
+#include <boost/config.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#ifndef BOOST_NO_VARIADIC_TEMPLATES
+# include <boost/fusion/sequence.hpp>
+# include <boost/fusion/iterator.hpp>
+# include <boost/fusion/support.hpp>
+# include <boost/mpl/int.hpp>
+# include <boost/mpl/minus.hpp>
+# include <boost/mpl/assert.hpp>
+# include <boost/type_traits/remove_reference.hpp>
+# include <boost/type_traits/is_const.hpp>
+# include <boost/type_traits/is_same.hpp>
+
+# include <tuple>
+# include <string>
+
+namespace mpl = boost::mpl;
+namespace fusion = boost::fusion;
+
+namespace variadic_tuple
+{
+// Test for tuple index size too large.
+template<typename Sq, int N>
+struct VARIADIC_TUPLE_INDEX_TOO_LARGE
+ : boost::mpl::greater_equal<boost::mpl::int_<N>,boost::mpl::int_<
+ std::tuple_size<typename Sq::base_type>::value> >
+{};
+
+// Test for tuple index size too small.
+template<typename Sq, int N>
+struct VARIADIC_TUPLE_INDEX_TOO_SMALL
+ : boost::mpl::less<boost::mpl::int_<N>,boost::mpl::int_<0> >
+{};
+
+// This has been added for the member functions defined below.
+template<typename Sq, int N>
+struct VARIADIC_TUPLE_RETURN_TYPE_N : boost::mpl::if_<
+ VARIADIC_TUPLE_INDEX_TOO_LARGE<Sq,N>,
+ boost::mpl::void_,
+ std::tuple_element<N,typename Sq::base_type> >::type
+{};
+
+// This has been added for the member functions defined below.
+// This does not have the checks for type in at the moment.
+// It defines a member type internally instead of by inheritance.
+template<typename Sq, typename Key, typename Key_Sq>
+struct VARIADIC_TUPLE_RETURN_TYPE_KEY
+{
+ typedef typename std::tuple_element<
+ boost::mpl::find<Key_Sq,Key>::type::pos::value,
+ typename Sq::base_type >::type type;
+};
+
+ template<typename SeqRef, int NN>
+ struct vtuple_iterator
+ : fusion::iterator_facade<
+ vtuple_iterator<SeqRef, NN>
+ , fusion::random_access_traversal_tag
+ >
+ {
+ typedef mpl::int_<NN> index;
+ typedef SeqRef sequence_type;
+ typedef typename remove_reference<SeqRef>::type seq_nonref_type;
+
+ vtuple_iterator(SeqRef seq)
+ : seq(seq) {}
+
+ SeqRef seq;
+
+ template<typename ItRef>
+ struct value_of;
+
+ template<typename ItRef>
+ struct value_of<ItRef&>
+ : value_of<ItRef>
+ {};
+
+#ifndef BOOST_NO_RVALUE_REFERENCES
+ template<typename ItRef>
+ struct value_of<ItRef&&>
+ : value_of<ItRef>
+ {};
+#endif
+
+ template<typename It>
+ struct value_of<It const>
+ : value_of<It>
+ {};
+
+ template<typename SeqRef_, int N>
+ struct value_of<vtuple_iterator<SeqRef_, N> >
+ {
+ typedef typename remove_reference<SeqRef_>::type seq_;
+ BOOST_MPL_ASSERT_NOT((VARIADIC_TUPLE_INDEX_TOO_LARGE<seq_,N>));
+ typedef typename std::tuple_element<N,
+ typename seq_::base_type>::type type;
+ };
+
+ template<typename T>
+ struct deref;
+
+ template<typename ItRef>
+ struct deref<ItRef&>
+ : deref<ItRef>
+ {};
+
+#ifndef BOOST_NO_RVALUE_REFERENCES
+ template<typename ItRef>
+ struct deref<ItRef&&>
+ : deref<ItRef>
+ {};
+#endif
+
+ template<typename It>
+ struct deref<It const>
+ : deref<It>
+ {};
+
+ template<typename SeqRef_, int N>
+ struct deref<vtuple_iterator<SeqRef_, N> >
+ {
+ typedef typename remove_reference<SeqRef_>::type seq_;
+ BOOST_MPL_ASSERT_NOT((VARIADIC_TUPLE_INDEX_TOO_LARGE<seq_,N>));
+ typedef typename std::tuple_element<N,typename seq_::base_type>::type typeN;
+ typedef typename
+ mpl::if_<
+ boost::is_const<seq_>
+ , typeN const&
+ , typeN
+ >::type
+ type;
+
+ static type
+ call(vtuple_iterator<SeqRef, N> const& iter)
+ {
+ return std::get<N>(iter.seq);
+ }
+ };
+
+ template<typename ItRef1, typename ItRef2>
+ struct distance
+ : mpl::minus<
+ typename remove_reference<ItRef2>::type::index
+ , typename remove_reference<ItRef1>::type::index
+ >
+ {};
+
+ template<typename ItRef, typename M>
+ struct advance
+ {
+ typedef
+ vtuple_iterator<
+ sequence_type,
+ NN + M::value
+ >
+ type;
+
+ static type
+ call(ItRef it)
+ {
+ return type(it.seq);
+ }
+ };
+
+ template<typename ItRef>
+ struct next
+ : advance<ItRef, mpl::int_<1> >
+ {};
+
+ template<typename ItRef>
+ struct prior
+ : advance<ItRef, mpl::int_<-1> >
+ {};
+
+ };
+
+ template<typename... Types>
+ struct vtuple
+ : fusion::sequence_facade<vtuple<Types...>, fusion::random_access_traversal_tag>,
+ public std::tuple<Types...>
+ {
+ typedef vtuple<Types...> This_type;
+ typedef std::tuple<Types...> base_type;
+
+ vtuple()
+ : base_type() {}
+
+ template<typename... Args>
+ vtuple(const Args&... args) : base_type(args...) { }
+
+ template<typename... Args>
+ vtuple(Args&... args) : base_type(args...) { }
+
+ template<typename T>
+ explicit vtuple(T const& rhs)
+ : base_type(rhs) {}
+
+ template<typename T>
+ vtuple&
+ operator=(T const& rhs)
+ {
+ base_type::operator=(rhs);
+ return *this;
+ }
+
+ // I want to make member functions which will return the same things as
+ // the nonmember functions....
+ // I am having trouble with the grammar....
+ // The problem was not the grammar, but with the null constructor.
+ // I have taken this out of use. What is needed is something to sort this out
+ // to compile conditionally for cases with at least one type...
+ // This now works so the default constructor can go back in.
+ typename VARIADIC_TUPLE_RETURN_TYPE_N<This_type,0>::type
+ first() const
+ {
+ BOOST_MPL_ASSERT_NOT((VARIADIC_TUPLE_INDEX_TOO_LARGE<This_type,0>));
+ return std::get<0>(*this);
+ }
+
+ typename VARIADIC_TUPLE_RETURN_TYPE_N<This_type,1>::type
+ second() const
+ {
+ BOOST_MPL_ASSERT_NOT((VARIADIC_TUPLE_INDEX_TOO_LARGE<This_type,1>));
+ return std::get<1>(*this);
+ }
+
+ typename VARIADIC_TUPLE_RETURN_TYPE_N<This_type,2>::type
+ third() const
+ {
+ BOOST_MPL_ASSERT_NOT((VARIADIC_TUPLE_INDEX_TOO_LARGE<This_type,2>));
+ return std::get<2>(*this);
+ }
+
+ // Generalised for any element in the sequence.
+ template<int N>
+ typename VARIADIC_TUPLE_RETURN_TYPE_N<This_type,N>::type
+ any() const
+ {
+ BOOST_MPL_ASSERT_NOT((VARIADIC_TUPLE_INDEX_TOO_LARGE<This_type,N>));
+ return std::get<N>(*this);
+ }
+
+ // Generalised for any element in the sequence by key.
+ template<typename Key,typename Key_Sequence>
+ typename VARIADIC_TUPLE_RETURN_TYPE_KEY<This_type,Key,Key_Sequence>::type
+ any_key() const
+ {
+ typedef typename boost::mpl::end<Key_Sequence>::type finish;
+ typedef typename boost::mpl::find<Key_Sequence,Key>::type pos_type;
+ // This checks that the key is in the sequence
+ BOOST_STATIC_ASSERT((!boost::is_same<pos_type,finish>::value));
+ // This checks against the size of the tuple
+ BOOST_MPL_ASSERT_NOT((VARIADIC_TUPLE_INDEX_TOO_LARGE<This_type,pos_type::pos::value>));
+
+ return std::get<pos_type::pos::value>(*this);
+ }
+
+ // Find the postion of a given key.
+ // I have had to include the Key_Sequence parameter as the actual sequence
+ // is not available when this is compiled - as far as I can work out.
+ // This has in fact liberated the top level code to supply any key sequence.
+ // It does not have to be the same length as the sequence.
+ // Any problem cases will not compile because of the tests here.
+ template<typename Key,typename Key_Sequence>
+ int pos()
+ {
+ typedef typename boost::mpl::end<Key_Sequence>::type finish;
+ typedef typename boost::mpl::find<Key_Sequence,Key>::type pos_type;
+ // This checks that the key is in the sequence
+ BOOST_STATIC_ASSERT((!boost::is_same<pos_type,finish>::value));
+ // This checks against the size of the tuple
+ BOOST_MPL_ASSERT_NOT((VARIADIC_TUPLE_INDEX_TOO_LARGE<This_type,pos_type::pos::value>));
+ return pos_type::pos::value;
+ }
+
+ // location function for the enum method
+ template<typename Enums, Enums Key>
+ int locate()
+ {
+ BOOST_MPL_ASSERT_NOT((VARIADIC_TUPLE_INDEX_TOO_LARGE<This_type,
+ boost::mpl::integral_c<Enums,Key>::value>));
+ return boost::mpl::integral_c<Enums,Key>::value;
+ }
+ // Access function for the enum method
+ /* template<typename Enums, Enums Key>
+ typename VARIADIC_TUPLE_RETURN_TYPE_N<This_type,
+ boost::mpl::integral_c<Enums,Key>::value>::type
+ at()
+ {
+ BOOST_MPL_ASSERT_NOT((VARIADIC_TUPLE_INDEX_TOO_LARGE<This_type,
+ boost::mpl::integral_c<Enums,Key>::value>));
+ return std::get<boost::mpl::integral_c<Enums,Key>::value >(*this);
+ }
+ */
+ template<typename Sq>
+ struct begin
+ {
+ typedef variadic_tuple::vtuple_iterator<
+ Sq, 0> type;
+
+ static type call(Sq sq)
+ {
+ return type(sq);
+ }
+ };
+
+ template<typename Sq>
+ struct end
+ {
+ typedef typename
+ fusion::detail::remove_reference<Sq>::type
+ seq;
+ typedef variadic_tuple::vtuple_iterator<
+ Sq,
+ std::tuple_size<typename seq::base_type>::value
+ > type;
+ static type call(Sq sq)
+ {
+ return type(sq);
+ }
+ };
+
+ template<typename Sq>
+ struct size
+ // : mpl::int_<
+ // std::tuple_size<typename Sq::sequence_type::base_type>::value
+ // >
+ {
+ typedef typename remove_reference<Sq>::type seq;
+ typedef typename mpl::int_<
+ std::tuple_size<typename seq::base_type>::value>::type type;
+ };
+ template<typename Sq, typename N>
+ struct value_at
+ : value_at<Sq, mpl::int_<N::value> >
+ {};
+
+ template<typename Sq, int N>
+ struct value_at<Sq, mpl::int_<N> >
+ {
+ typedef typename remove_reference<Sq>::type seq;
+ BOOST_MPL_ASSERT_NOT((VARIADIC_TUPLE_INDEX_TOO_LARGE<seq,N>));
+ typedef typename std::tuple_element<N,
+ typename seq::base_type>::type type;
+ };
+
+ template<typename Sq, typename N>
+ struct at
+ : at<Sq, mpl::int_<N::value> >
+ {};
+
+
+ template<typename Sq, int N>
+ struct at<Sq, mpl::int_<N> >
+ {
+ typedef typename remove_reference<Sq>::type seq;
+ BOOST_MPL_ASSERT_NOT((VARIADIC_TUPLE_INDEX_TOO_LARGE<seq,N>));
+ typedef typename std::tuple_element<N,
+ typename seq::base_type>::type typeN;
+ typedef typename mpl::if_<
+ boost::is_const<seq>,
+ typeN const&,
+ typeN&>::type type;
+ static type call(Sq seq)
+ {
+ return std::get<N>(seq);
+ }
+ };
+
+ };
+}
+
+int main()
+{
+ typedef variadic_tuple::vtuple<int> my_mono;
+ typedef variadic_tuple::vtuple<int, char> my_duo;
+ typedef variadic_tuple::vtuple<int, char, std::string> my_tuple;
+ my_tuple t(101, 'a', "hello");
+ BOOST_TEST(*fusion::begin(t) == 101);
+ BOOST_TEST(*fusion::next(fusion::begin(t)) == 'a');
+ BOOST_TEST(*fusion::prior(fusion::end(t)) == "hello");
+ BOOST_TEST(fusion::distance(fusion::begin(t), fusion::end(t)) == 3);
+ BOOST_TEST(fusion::size(t) == 3);
+ BOOST_MPL_ASSERT((boost::is_same<int, fusion::result_of::value_at_c<my_tuple, 0>::type>));
+ BOOST_MPL_ASSERT((boost::is_same<char, fusion::result_of::value_at_c<my_tuple, 1>::type>));
+ BOOST_MPL_ASSERT((boost::is_same<std::string, fusion::result_of::value_at_c<my_tuple, 2>::type>));
+ BOOST_TEST(fusion::at_c<0>(t) == 101);
+ BOOST_TEST(fusion::at_c<1>(t) == 'a');
+ BOOST_TEST(fusion::at_c<2>(t) == "hello");
+ return boost::report_errors();
+}
+#else
+int main()
+{
+ return boost::report_errors();
+}
+#endif
Modified: sandbox/SOC/2009/fusion/libs/fusion/example/performance/Jamfile
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/performance/Jamfile (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/performance/Jamfile 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -9,11 +9,11 @@
#==============================================================================
project
- : requirements
+ : requirements
<define>BOOST_FUSION_ENABLE_STATIC_ASSERTS
<warnings>all
<toolset>gcc:<cxxflags>-Wno-long-long
- ;
+ ;
{
for local test-file in [ glob *.cpp ]
Modified: sandbox/SOC/2009/fusion/libs/fusion/test/suite1/algorithm/fold.cpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/test/suite1/algorithm/fold.cpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/suite1/algorithm/fold.cpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -37,10 +37,9 @@
template <typename State, typename T>
struct result<add_ints_only(State, T)>
{
- //TODO!!!
typedef typename
boost::remove_const<
- typename boost::fusion::detail::remove_reference<State>::type
+ typename boost::remove_reference<State>::type
>::type
type;
};
@@ -67,11 +66,10 @@
template <typename CountT, typename T>
struct result<count_ints(CountT, T)>
{
- //TODO!!!
typedef typename boost::remove_const<
- typename boost::fusion::detail::remove_reference<CountT>::type>::type state;
+ typename boost::remove_reference<CountT>::type>::type state;
typedef typename boost::remove_const<
- typename boost::fusion::detail::remove_reference<T>::type>::type elem;
+ typename boost::remove_reference<T>::type>::type elem;
typedef typename
if_<
Modified: sandbox/SOC/2009/fusion/libs/fusion/test/suite1/algorithm/fold.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/test/suite1/algorithm/fold.hpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/suite1/algorithm/fold.hpp 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -31,6 +31,7 @@
#include <boost/mpl/back_inserter.hpp>
#include <boost/mpl/always.hpp>
#include <boost/mpl/copy.hpp>
+#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/is_same.hpp>
#include <iostream>
@@ -102,7 +103,7 @@
BOOST_MPL_ASSERT((typename fusion::detail::is_lrref<State>::type));
BOOST_MPL_ASSERT((typename fusion::detail::is_lrref<T>::type));
- typedef typename fusion::detail::remove_reference<State>::type state;
+ typedef typename boost::remove_reference<State>::type state;
static const int n=mpl::front<state>::type::value;
typedef
@@ -113,7 +114,7 @@
#ifdef BOOST_FUSION_TEST_ITER_FOLD
fusion::result_of::value_of<
#else
- fusion::detail::remove_reference<
+ boost::remove_reference<
#endif
T
>::type
Modified: sandbox/SOC/2009/fusion/libs/fusion/test/suite2/Jamfile
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/test/suite2/Jamfile (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/suite2/Jamfile 2010-08-26 18:14:12 EDT (Thu, 26 Aug 2010)
@@ -10,14 +10,14 @@
import testing ;
project
- : requirements
+ : requirements
<define>BOOST_FUSION_TEST_MAX_N=20
<define>BOOST_FUSION_ENABLE_STATIC_ASSERTS
<warnings>all
<toolset>gcc:<cxxflags>-Wno-long-long
<library>/boost/test//boost_unit_test_framework
<link>static
- ;
+ ;
{
test-suite fusion_2 : ;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk