merge from trunk

[SVN r56178]
This commit is contained in:
Joel de Guzman
2009-09-14 07:40:39 +00:00
parent ea5ea7f001
commit 2f8b91828b
22 changed files with 295 additions and 51 deletions

View File

@ -14,6 +14,9 @@
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/or.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/tuple/tuple.hpp>
namespace boost { namespace fusion
@ -91,6 +94,39 @@ namespace boost { namespace fusion
return type(iter.cons.get_tail());
}
};
template <typename I1, typename I2>
struct distance;
// detail
template <typename I1, typename I2>
struct lazy_next_distance
{
typedef
typename mpl::plus<
mpl::int_<1>,
typename distance<
typename next<I1>::type,
I2
>::type
>::type type;
};
template <typename I1, typename I2>
struct distance
{
typedef typename mpl::eval_if<
boost::is_same<I1, I2>,
mpl::int_<0>,
lazy_next_distance<I1, I2>
>::type type;
static type
call(I1 const&, I2 const&)
{
return type();
}
};
};
template <typename Null>

View File

@ -108,7 +108,7 @@ namespace boost { namespace fusion { namespace detail
template <typename It, typename F>
static bool call(It const& it, F f)
{
return false;
return true;
}
};

View File

@ -14,6 +14,7 @@
#include <boost/fusion/algorithm/transformation/filter_if.hpp>
#include <boost/fusion/algorithm/transformation/insert.hpp>
#include <boost/fusion/algorithm/transformation/insert_range.hpp>
#include <boost/fusion/algorithm/transformation/join.hpp>
#include <boost/fusion/algorithm/transformation/pop_back.hpp>
#include <boost/fusion/algorithm/transformation/pop_front.hpp>
#include <boost/fusion/algorithm/transformation/push_back.hpp>
@ -24,5 +25,6 @@
#include <boost/fusion/algorithm/transformation/replace_if.hpp>
#include <boost/fusion/algorithm/transformation/reverse.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/fusion/algorithm/transformation/zip.hpp>
#endif

View File

@ -16,7 +16,7 @@ namespace boost { namespace fusion
template <typename Sequence>
struct clear
{
typedef vector0 type;
typedef vector0<> type;
};
}
@ -24,7 +24,7 @@ namespace boost { namespace fusion
inline typename result_of::clear<Sequence const>::type
clear(Sequence const& seq)
{
return vector0();
return vector0<>();
}
}}

View File

@ -12,6 +12,7 @@
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
#include <boost/mpl/minus.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/type_traits/is_const.hpp>
namespace boost { namespace fusion {

View File

@ -32,14 +32,14 @@ namespace boost { namespace fusion
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<BOOST_PP_ENUM_PARAMS(N, T)>
#endif
{
typedef vector<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)> type;
typedef BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)> type;
};
}
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
inline vector<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
inline BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
make_vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
{
return vector<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>(
return BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>(
BOOST_PP_ENUM_PARAMS(N, _));
}

View File

@ -31,14 +31,14 @@ namespace boost { namespace fusion { namespace detail
template <typename Iterator>
struct apply
{
typedef vector<> type;
typedef vector0<> type;
};
template <typename Iterator>
static typename apply<Iterator>::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<BOOST_PP_ENUM_PARAMS(N, T)> type;
typedef BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> type;
};
template <typename Iterator>

View File

@ -48,7 +48,7 @@ namespace boost { namespace fusion { namespace detail
template <>
struct vector_n_chooser<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, void_ BOOST_PP_INTERCEPT)>
{
typedef vector0 type;
typedef vector0<> type;
};
#define BOOST_PP_FILENAME_1 \

View File

@ -56,7 +56,7 @@ namespace boost { namespace fusion
template <typename Sequence>
vector(Sequence const& rhs)
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1500)
: vec(ctor_helper(rhs, is_base_of<vector, Sequence>())) {}
#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_)
{

View File

@ -39,7 +39,8 @@ namespace boost { namespace fusion
struct fusion_sequence_tag;
struct random_access_traversal_tag;
struct vector0 : sequence_base<vector0>
template <typename Dummy = void>
struct vector0 : sequence_base<vector0<Dummy> >
{
typedef mpl::vector0<> types;
typedef vector_tag fusion_tag;

View File

@ -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 <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/container/vector/detail/deref_impl.hpp>
#include <boost/fusion/container/vector/detail/value_of_impl.hpp>
@ -42,5 +47,9 @@ namespace boost { namespace fusion
};
}}
#if defined (BOOST_MSVC)
# pragma warning(pop)
#endif
#endif

View File

@ -11,8 +11,6 @@
#include <boost/fusion/functional/adapter/fused.hpp>
#include <boost/fusion/functional/adapter/fused_procedure.hpp>
#include <boost/fusion/functional/adapter/fused_function_object.hpp>
#include <boost/fusion/functional/adapter/unfused_generic.hpp>
#include <boost/fusion/functional/adapter/unfused_lvalue_args.hpp>
#include <boost/fusion/functional/adapter/unfused_rvalue_args.hpp>
#include <boost/fusion/functional/adapter/unfused.hpp>
#include <boost/fusion/functional/adapter/unfused_typed.hpp>
#endif

View File

@ -11,29 +11,16 @@
# include <boost/fusion/container/vector/limits.hpp>
# 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

View File

@ -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 <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/functional/adapter/limits.hpp>
#include <boost/fusion/functional/adapter/detail/access.hpp>
namespace boost { namespace fusion
{
template <class Function, bool AllowNullary = true>
class unfused;
//----- ---- --- -- - - - -
template <class Function>
class unfused<Function,true>
: public unfused<Function,false>
{
typedef typename detail::qf_c<Function>::type function_c;
typedef typename detail::qf<Function>::type function;
typedef typename detail::call_param<Function>::type func_const_fwd_t;
public:
using unfused<Function,false>::operator();
inline explicit unfused(func_const_fwd_t f = function())
: unfused<Function,false>(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 Function> class unfused<Function,false>
{
protected:
Function fnc_transformed;
typedef typename detail::qf_c<Function>::type function_c;
typedef typename detail::qf<Function>::type function;
typedef typename detail::call_param<Function>::type func_const_fwd_t;
public:
inline explicit unfused(func_const_fwd_t f = function())
: fnc_transformed(f)
{ }
template <typename Sig>
struct result;
#define BOOST_PP_FILENAME_1 \
<boost/fusion/functional/adapter/unfused.hpp>
#define BOOST_PP_ITERATION_LIMITS \
(1,BOOST_FUSION_UNFUSED_MAX_ARITY)
#include BOOST_PP_ITERATE()
};
}}
namespace boost
{
template<class F>
struct result_of< boost::fusion::unfused<F> const () >
{
typedef typename boost::fusion::unfused<F>::call_const_0_result type;
};
template<class F>
struct result_of< boost::fusion::unfused<F>() >
{
typedef typename boost::fusion::unfused<F>::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 <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) >
: boost::result_of< function_c(
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
typename detail::mref<T,>::type BOOST_PP_INTERCEPT) > & )>
{ };
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
struct result< Self(BOOST_PP_ENUM_PARAMS(N,T)) >
: boost::result_of< function(
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
typename detail::mref<T,>::type BOOST_PP_INTERCEPT) > & )>
{ };
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
inline typename boost::result_of<function_c(BOOST_PP_CAT(fusion::vector,N)
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> & )>::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const
{
BOOST_PP_CAT(fusion::vector,N)<
BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) >
arg(BOOST_PP_ENUM_PARAMS(N,a));
return this->fnc_transformed(arg);
}
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
inline typename boost::result_of<function(BOOST_PP_CAT(fusion::vector,N)
<BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> & )>::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a))
{
BOOST_PP_CAT(fusion::vector,N)<
BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) >
arg(BOOST_PP_ENUM_PARAMS(N,a));
return this->fnc_transformed(arg);
}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)
#endif

View File

@ -12,8 +12,6 @@
#include <boost/fusion/functional/generation/make_fused.hpp>
#include <boost/fusion/functional/generation/make_fused_procedure.hpp>
#include <boost/fusion/functional/generation/make_fused_function_object.hpp>
#include <boost/fusion/functional/generation/make_unfused_generic.hpp>
#include <boost/fusion/functional/generation/make_unfused_lvalue_args.hpp>
#include <boost/fusion/functional/generation/make_unfused_rvalue_args.hpp>
#include <boost/fusion/functional/generation/make_unfused.hpp>
#endif

View File

@ -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 <boost/fusion/functional/adapter/unfused.hpp>
#define BOOST_FUSION_CLASS_TPL_NAME unfused
#include <boost/fusion/functional/generation/detail/gen_make_adapter.hpp>
#endif

View File

@ -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 <boost/fusion/algorithm/transformation/remove_if.hpp>
#include <boost/fusion/algorithm/transformation/remove.hpp>
#endif

View File

@ -9,6 +9,7 @@
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/iterator/detail/advance.hpp>
#include <boost/fusion/iterator/detail/distance.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/assert.hpp>
@ -44,6 +45,13 @@ namespace boost { namespace fusion
{
BOOST_MPL_ASSERT_NOT((traits::is_random_access<Iterator>));
};
// default implementation
template <typename First, typename Last>
struct distance :
distance_detail::linear_distance<First, Last>
{
};
};
}}

View File

@ -87,6 +87,18 @@ namespace boost { namespace fusion { namespace traits
// Keep references on arrays, even if const
template <typename T, int N>
struct deduce<T(&)[N]>
{
typedef T(&type)[N];
};
template <typename T, int N>
struct deduce<volatile T(&)[N]>
{
typedef volatile T(&type)[N];
};
template <typename T, int N>
struct deduce<const T(&)[N]>
{

View File

@ -85,11 +85,11 @@ namespace boost { namespace fusion
{
template <typename Sequence, typename Active>
struct tag_of
: mpl::if_< detail::is_mpl_sequence<Sequence>,
: mpl::if_< fusion::detail::is_mpl_sequence<Sequence>,
mpl::identity<mpl_sequence_tag>,
mpl::identity<non_fusion_tag> >::type
{
BOOST_MPL_ASSERT_NOT((detail::is_specialized<Sequence>));
BOOST_MPL_ASSERT_NOT((fusion::detail::is_specialized<Sequence>));
};
template <typename Sequence>

View File

@ -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 <typename Out>
inline Out& operator<<(Out& out, detail::unused_only const&)
{
return out;
}
template <typename In>
inline In& operator>>(In& in, unused_type&)
{
return in;
}
}}
#if defined(BOOST_MSVC)

View File

@ -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_; };