diff --git a/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp b/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp index fca135e5..cf3183b1 100644 --- a/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp +++ b/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp @@ -14,6 +14,9 @@ #include #include #include +#include +#include +#include #include namespace boost { namespace fusion @@ -91,6 +94,39 @@ namespace boost { namespace fusion return type(iter.cons.get_tail()); } }; + + template + struct distance; + + // detail + template + struct lazy_next_distance + { + typedef + typename mpl::plus< + mpl::int_<1>, + typename distance< + typename next::type, + I2 + >::type + >::type type; + }; + + template + struct distance + { + typedef typename mpl::eval_if< + boost::is_same, + mpl::int_<0>, + lazy_next_distance + >::type type; + + static type + call(I1 const&, I2 const&) + { + return type(); + } + }; }; template diff --git a/include/boost/fusion/algorithm/query/detail/all.hpp b/include/boost/fusion/algorithm/query/detail/all.hpp index 979cfb11..51fd393f 100644 --- a/include/boost/fusion/algorithm/query/detail/all.hpp +++ b/include/boost/fusion/algorithm/query/detail/all.hpp @@ -108,7 +108,7 @@ namespace boost { namespace fusion { namespace detail template static bool call(It const& it, F f) { - return false; + return true; } }; diff --git a/include/boost/fusion/algorithm/transformation.hpp b/include/boost/fusion/algorithm/transformation.hpp index 0757b5ee..9221cd45 100644 --- a/include/boost/fusion/algorithm/transformation.hpp +++ b/include/boost/fusion/algorithm/transformation.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -24,5 +25,6 @@ #include #include #include +#include #endif diff --git a/include/boost/fusion/algorithm/transformation/clear.hpp b/include/boost/fusion/algorithm/transformation/clear.hpp index 75328232..c9f849cb 100644 --- a/include/boost/fusion/algorithm/transformation/clear.hpp +++ b/include/boost/fusion/algorithm/transformation/clear.hpp @@ -16,7 +16,7 @@ namespace boost { namespace fusion template struct clear { - typedef vector0 type; + typedef vector0<> type; }; } @@ -24,7 +24,7 @@ namespace boost { namespace fusion inline typename result_of::clear::type clear(Sequence const& seq) { - return vector0(); + return vector0<>(); } }} diff --git a/include/boost/fusion/container/deque/deque_iterator.hpp b/include/boost/fusion/container/deque/deque_iterator.hpp index 90c68918..c6e46d54 100644 --- a/include/boost/fusion/container/deque/deque_iterator.hpp +++ b/include/boost/fusion/container/deque/deque_iterator.hpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace boost { namespace fusion { diff --git a/include/boost/fusion/container/generation/make_vector.hpp b/include/boost/fusion/container/generation/make_vector.hpp index 3f9b27f2..868ad0ca 100644 --- a/include/boost/fusion/container/generation/make_vector.hpp +++ b/include/boost/fusion/container/generation/make_vector.hpp @@ -1,7 +1,7 @@ /*============================================================================= Copyright (c) 2001-2006 Joel de Guzman - Distributed under the Boost Software License, Version 1.0. (See accompanying + Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #ifndef BOOST_PP_IS_ITERATING @@ -19,7 +19,7 @@ namespace boost { namespace fusion { struct void_; - + namespace result_of { template < @@ -28,18 +28,18 @@ namespace boost { namespace fusion , typename Extra = void_ > struct make_vector; - + template <> struct make_vector<> { - typedef vector<> type; + typedef vector0<> type; }; } - - inline vector<> + + inline vector0<> make_vector() { - return vector<>(); + return vector0<>(); } #define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data) \ @@ -74,15 +74,15 @@ namespace boost { namespace fusion struct make_vector #endif { - typedef vector type; + typedef BOOST_PP_CAT(vector, N) type; }; } template - inline vector + inline BOOST_PP_CAT(vector, N) make_vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _)) { - return vector( + return BOOST_PP_CAT(vector, N)( BOOST_PP_ENUM_PARAMS(N, _)); } diff --git a/include/boost/fusion/container/vector/detail/as_vector.hpp b/include/boost/fusion/container/vector/detail/as_vector.hpp index fa8dadcf..a70fd4ae 100644 --- a/include/boost/fusion/container/vector/detail/as_vector.hpp +++ b/include/boost/fusion/container/vector/detail/as_vector.hpp @@ -31,14 +31,14 @@ namespace boost { namespace fusion { namespace detail template struct apply { - typedef vector<> type; + typedef vector0<> type; }; template static typename apply::type call(Iterator) { - return vector<>(); + return vector0<>(); } }; @@ -82,7 +82,7 @@ namespace boost { namespace fusion { namespace detail { BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _) BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _) - typedef vector type; + typedef BOOST_PP_CAT(vector, N) type; }; template diff --git a/include/boost/fusion/container/vector/detail/vector_n_chooser.hpp b/include/boost/fusion/container/vector/detail/vector_n_chooser.hpp index 248b5058..f4b85d89 100644 --- a/include/boost/fusion/container/vector/detail/vector_n_chooser.hpp +++ b/include/boost/fusion/container/vector/detail/vector_n_chooser.hpp @@ -48,7 +48,7 @@ namespace boost { namespace fusion { namespace detail template <> struct vector_n_chooser { - typedef vector0 type; + typedef vector0<> type; }; #define BOOST_PP_FILENAME_1 \ diff --git a/include/boost/fusion/container/vector/vector.hpp b/include/boost/fusion/container/vector/vector.hpp index aef3134c..5b9a5608 100644 --- a/include/boost/fusion/container/vector/vector.hpp +++ b/include/boost/fusion/container/vector/vector.hpp @@ -56,7 +56,7 @@ namespace boost { namespace fusion template vector(Sequence const& rhs) -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1400) +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1500) : vec(ctor_helper(rhs, is_base_of())) {} #else : vec(rhs) {} @@ -129,7 +129,7 @@ namespace boost { namespace fusion private: -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1400) +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1500) static vector_n const& ctor_helper(vector const& rhs, mpl::true_) { diff --git a/include/boost/fusion/container/vector/vector10.hpp b/include/boost/fusion/container/vector/vector10.hpp index 28531b6f..929815ab 100644 --- a/include/boost/fusion/container/vector/vector10.hpp +++ b/include/boost/fusion/container/vector/vector10.hpp @@ -39,7 +39,8 @@ namespace boost { namespace fusion struct fusion_sequence_tag; struct random_access_traversal_tag; - struct vector0 : sequence_base + template + struct vector0 : sequence_base > { typedef mpl::vector0<> types; typedef vector_tag fusion_tag; diff --git a/include/boost/fusion/container/vector/vector_iterator.hpp b/include/boost/fusion/container/vector/vector_iterator.hpp index 9feeb520..d7ba8c88 100644 --- a/include/boost/fusion/container/vector/vector_iterator.hpp +++ b/include/boost/fusion/container/vector/vector_iterator.hpp @@ -7,6 +7,11 @@ #if !defined(FUSION_VECTOR_ITERATOR_05042005_0635) #define FUSION_VECTOR_ITERATOR_05042005_0635 +#if defined (BOOST_MSVC) +# pragma warning(push) +# pragma warning (disable: 4512) // assignment operator could not be generated. +#endif + #include #include #include @@ -42,5 +47,9 @@ namespace boost { namespace fusion }; }} +#if defined (BOOST_MSVC) +# pragma warning(pop) +#endif + #endif diff --git a/include/boost/fusion/functional/adapter.hpp b/include/boost/fusion/functional/adapter.hpp index 734dac39..1a1f9819 100644 --- a/include/boost/fusion/functional/adapter.hpp +++ b/include/boost/fusion/functional/adapter.hpp @@ -11,8 +11,6 @@ #include #include #include -#include -#include -#include +#include #include #endif diff --git a/include/boost/fusion/functional/adapter/limits.hpp b/include/boost/fusion/functional/adapter/limits.hpp index cf6701c4..783bc632 100644 --- a/include/boost/fusion/functional/adapter/limits.hpp +++ b/include/boost/fusion/functional/adapter/limits.hpp @@ -11,29 +11,16 @@ # include -# if !defined(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY) -# define BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY 6 +# if !defined(BOOST_FUSION_UNFUSED_MAX_ARITY) +# define BOOST_FUSION_UNFUSED_MAX_ARITY 6 # elif BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE # error "BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE" # endif -# if !defined(BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY) -# define BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY 6 -# elif BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE -# error "BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE" -# endif -# if !defined(BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY) -# define BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY 6 -# elif BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE -# error "BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE" -# endif # if !defined(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY) # define BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY 6 # elif BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE # error "BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE" # endif -# if !defined(BOOST_FUSION_CONSTRUCTOR_MAX_ARITY) -# define BOOST_FUSION_CONSTRUCTOR_MAX_ARITY 6 -# endif #endif diff --git a/include/boost/fusion/functional/adapter/unfused.hpp b/include/boost/fusion/functional/adapter/unfused.hpp new file mode 100755 index 00000000..48baf756 --- /dev/null +++ b/include/boost/fusion/functional/adapter/unfused.hpp @@ -0,0 +1,151 @@ +/*============================================================================= + Copyright (c) 2006-2007 Tobias Schwinger + + Use modification and distribution are subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +==============================================================================*/ + +#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_HPP_INCLUDED) +#if !defined(BOOST_PP_IS_ITERATING) + +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +namespace boost { namespace fusion +{ + template + class unfused; + + //----- ---- --- -- - - - - + + template + class unfused + : public unfused + { + typedef typename detail::qf_c::type function_c; + typedef typename detail::qf::type function; + typedef typename detail::call_param::type func_const_fwd_t; + public: + + using unfused::operator(); + + inline explicit unfused(func_const_fwd_t f = function()) + : unfused(f) + { } + + typedef typename boost::result_of< + function_c(fusion::vector0<> &) >::type call_const_0_result; + + inline call_const_0_result operator()() const + { + fusion::vector0<> arg; + return this->fnc_transformed(arg); + } + + typedef typename boost::result_of< + function(fusion::vector0<> &) >::type call_0_result; + + inline call_0_result operator()() + { + fusion::vector0<> arg; + return this->fnc_transformed(arg); + } + }; + + template class unfused + { + protected: + Function fnc_transformed; + typedef typename detail::qf_c::type function_c; + typedef typename detail::qf::type function; + typedef typename detail::call_param::type func_const_fwd_t; + public: + + inline explicit unfused(func_const_fwd_t f = function()) + : fnc_transformed(f) + { } + + template + struct result; + + #define BOOST_PP_FILENAME_1 \ + + #define BOOST_PP_ITERATION_LIMITS \ + (1,BOOST_FUSION_UNFUSED_MAX_ARITY) + #include BOOST_PP_ITERATE() + }; +}} + +namespace boost +{ + template + struct result_of< boost::fusion::unfused const () > + { + typedef typename boost::fusion::unfused::call_const_0_result type; + }; + template + struct result_of< boost::fusion::unfused() > + { + typedef typename boost::fusion::unfused::call_0_result type; + }; +} + +#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_HPP_INCLUDED +#else // defined(BOOST_PP_IS_ITERATING) +//////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +//////////////////////////////////////////////////////////////////////////////// +#define N BOOST_PP_ITERATION() + + template + struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) > + : boost::result_of< function_c( + BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N, + typename detail::mref::type BOOST_PP_INTERCEPT) > & )> + { }; + + template + struct result< Self(BOOST_PP_ENUM_PARAMS(N,T)) > + : boost::result_of< function( + BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N, + typename detail::mref::type BOOST_PP_INTERCEPT) > & )> + { }; + + template + inline typename boost::result_of & )>::type + operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const + { + BOOST_PP_CAT(fusion::vector,N)< + BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) > + arg(BOOST_PP_ENUM_PARAMS(N,a)); + return this->fnc_transformed(arg); + } + + template + inline typename boost::result_of & )>::type + operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) + { + BOOST_PP_CAT(fusion::vector,N)< + BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) > + arg(BOOST_PP_ENUM_PARAMS(N,a)); + return this->fnc_transformed(arg); + } +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) +#endif + diff --git a/include/boost/fusion/functional/generation.hpp b/include/boost/fusion/functional/generation.hpp index 3dabd3ee..3d812b9f 100644 --- a/include/boost/fusion/functional/generation.hpp +++ b/include/boost/fusion/functional/generation.hpp @@ -12,8 +12,6 @@ #include #include #include -#include -#include -#include +#include #endif diff --git a/include/boost/fusion/functional/generation/make_unfused.hpp b/include/boost/fusion/functional/generation/make_unfused.hpp new file mode 100644 index 00000000..79eadbd5 --- /dev/null +++ b/include/boost/fusion/functional/generation/make_unfused.hpp @@ -0,0 +1,18 @@ +/*============================================================================= + Copyright (c) 2007 Tobias Schwinger + + Use modification and distribution are subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +==============================================================================*/ + +#if !defined(BOOST_FUSION_FUNCTIONAL_GENERATION_MAKE_UNFUSED_HPP_INCLUDED) +#define BOOST_FUSION_FUNCTIONAL_GENERATION_MAKE_UNFUSED_HPP_INCLUDED + +#include + +#define BOOST_FUSION_CLASS_TPL_NAME unfused +#include + +#endif + diff --git a/include/boost/fusion/include/remove.hpp b/include/boost/fusion/include/remove.hpp index 7f0b4657..9f11d696 100644 --- a/include/boost/fusion/include/remove.hpp +++ b/include/boost/fusion/include/remove.hpp @@ -4,9 +4,9 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#if !defined(FUSION_INCLUDE_REMOVE_IF) -#define FUSION_INCLUDE_REMOVE_IF +#if !defined(FUSION_INCLUDE_REMOVE) +#define FUSION_INCLUDE_REMOVE -#include +#include #endif diff --git a/include/boost/fusion/iterator/iterator_facade.hpp b/include/boost/fusion/iterator/iterator_facade.hpp index f1720bdb..3e0a926f 100644 --- a/include/boost/fusion/iterator/iterator_facade.hpp +++ b/include/boost/fusion/iterator/iterator_facade.hpp @@ -1,7 +1,7 @@ /*============================================================================= Copyright (c) 2001-2006 Joel de Guzman - Distributed under the Boost Software License, Version 1.0. (See accompanying + Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(FUSION_ITERATOR_FACADE_09252006_1011) @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -44,6 +45,13 @@ namespace boost { namespace fusion { BOOST_MPL_ASSERT_NOT((traits::is_random_access)); }; + + // default implementation + template + struct distance : + distance_detail::linear_distance + { + }; }; }} diff --git a/include/boost/fusion/support/deduce.hpp b/include/boost/fusion/support/deduce.hpp index 37710ec1..3a7231bd 100644 --- a/include/boost/fusion/support/deduce.hpp +++ b/include/boost/fusion/support/deduce.hpp @@ -87,6 +87,18 @@ namespace boost { namespace fusion { namespace traits // Keep references on arrays, even if const + template + struct deduce + { + typedef T(&type)[N]; + }; + + template + struct deduce + { + typedef volatile T(&type)[N]; + }; + template struct deduce { diff --git a/include/boost/fusion/support/tag_of.hpp b/include/boost/fusion/support/tag_of.hpp index 282da411..a8e2ed07 100644 --- a/include/boost/fusion/support/tag_of.hpp +++ b/include/boost/fusion/support/tag_of.hpp @@ -85,11 +85,11 @@ namespace boost { namespace fusion { template struct tag_of - : mpl::if_< detail::is_mpl_sequence, + : mpl::if_< fusion::detail::is_mpl_sequence, mpl::identity, mpl::identity >::type { - BOOST_MPL_ASSERT_NOT((detail::is_specialized)); + BOOST_MPL_ASSERT_NOT((fusion::detail::is_specialized)); }; template diff --git a/include/boost/fusion/support/unused.hpp b/include/boost/fusion/support/unused.hpp index dc2014ec..c62b738a 100644 --- a/include/boost/fusion/support/unused.hpp +++ b/include/boost/fusion/support/unused.hpp @@ -1,7 +1,7 @@ /*============================================================================= Copyright (c) 2001-2006 Joel de Guzman - Distributed under the Boost Software License, Version 1.0. (See accompanying + Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(BOOST_FUSION_SUPPORT_UNUSED_20070305_1038) @@ -13,7 +13,10 @@ # pragma warning(disable: 4522) // multiple assignment operators specified warning #endif -namespace boost { namespace fusion { +#define BOOST_FUSION_UNUSED_HAS_IO + +namespace boost { namespace fusion +{ struct unused_type { unused_type() @@ -53,6 +56,26 @@ namespace boost { namespace fusion { }; unused_type const unused = unused_type(); + + namespace detail + { + struct unused_only + { + unused_only(unused_type const&) {} + }; + } + + template + inline Out& operator<<(Out& out, detail::unused_only const&) + { + return out; + } + + template + inline In& operator>>(In& in, unused_type&) + { + return in; + } }} #if defined(BOOST_MSVC) diff --git a/include/boost/fusion/view/ext_/segmented_iterator.hpp b/include/boost/fusion/view/ext_/segmented_iterator.hpp index 0a192bdc..b28182a4 100644 --- a/include/boost/fusion/view/ext_/segmented_iterator.hpp +++ b/include/boost/fusion/view/ext_/segmented_iterator.hpp @@ -327,8 +327,8 @@ namespace boost { namespace fusion typedef typename Cons::car_type car_type; typedef typename Cons::cdr_type cdr_type; - explicit segmented_iterator(Cons const &cons) - : cons_(cons) + explicit segmented_iterator(Cons const &c) + : cons_(c) {} cons_type const &cons() const { return this->cons_; };