Update of /cvsroot/boost/boost/boost/fusion/functional/adapter
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5109/functional/adapter
Modified Files:
fused.hpp fused_function_object.hpp unfused_generic.hpp
unfused_lvalue_args.hpp unfused_rvalue_args.hpp
unfused_typed.hpp
Log Message:
result_of and polymorphic function obj compatibility
Index: fused.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/fusion/functional/adapter/fused.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- fused.hpp 15 Feb 2007 22:41:45 -0000 1.1
+++ fused.hpp 11 Jun 2007 07:01:02 -0000 1.2
@@ -62,17 +62,16 @@
return fusion::invoke<func_fwd_t>(this->fnc_transformed,s);
}
- template <class Seq>
- struct result
+ template<typename T>
+ struct result;
+
+ template <typename Func, class Seq>
+ struct result<fused<Func>(Seq)>
: result_of::invoke<Function,Seq>
{ };
};
}}
-#define BOOST_FUSION_CLASS_TPL_PARAMS typename F
-#define BOOST_FUSION_CLASS_TPL_SPEC fusion::fused<F>
-#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>
-
#endif
Index: fused_function_object.hpp
===================================================================
RCS file:
/cvsroot/boost/boost/boost/fusion/functional/adapter/fused_function_object.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- fused_function_object.hpp 15 Feb 2007 22:41:45 -0000 1.1
+++ fused_function_object.hpp 11 Jun 2007 07:01:02 -0000 1.2
@@ -67,17 +67,16 @@
func_fwd_t >(this->fnc_transformed,s);
}
- template <class Seq>
- struct result
- : result_of::invoke_function_object<Function,Seq>
+ template<typename T>
+ struct result;
+
+ template <typename Seq>
+ struct result<fused_function_object(Seq)>
+ : result_of::invoke_function_object<Function, Seq>
{ };
};
}}
-#define BOOST_FUSION_CLASS_TPL_PARAMS typename F
-#define BOOST_FUSION_CLASS_TPL_SPEC fusion::fused_function_object<F>
-#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>
-
#endif
Index: unfused_generic.hpp
===================================================================
RCS file:
/cvsroot/boost/boost/boost/fusion/functional/adapter/unfused_generic.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- unfused_generic.hpp 15 Feb 2007 22:41:45 -0000 1.1
+++ unfused_generic.hpp 11 Jun 2007 07:01:02 -0000 1.2
@@ -33,7 +33,8 @@
struct void_;
- template <class Function> class unfused_generic
+ template <class Function>
+ class unfused_generic
: public detail::nullary_call_base<unfused_generic<Function>, Function>
{
Function fnc_transformed;
@@ -44,7 +45,7 @@
typedef detail::nullary_call_base<
fusion::unfused_generic<Function>, Function > base;
- typedef typename boost::remove_reference<Function>::type function;
+ typedef typename remove_const<typename
boost::remove_reference<Function>::type>::type function;
typedef typename detail::call_param<Function>::type func_const_fwd_t;
public:
@@ -55,32 +56,26 @@
using base::operator();
- template <
- BOOST_PP_ENUM_BINARY_PARAMS(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY,
- typename T, = fusion::void_ BOOST_PP_INTERCEPT),
- class _ = fusion::void_
- >
+ template <typename T>
struct result;
- template <class _>
- struct result<
- BOOST_PP_ENUM_PARAMS(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY,
- fusion::void_ BOOST_PP_INTERCEPT),_>
+ template <typename Func>
+ struct result<unfused_generic<Func>()>
: base::r0
{ };
#define BOOST_FUSION_CODE(tpl_params,arg_types,params,args)
\
template <tpl_params>
\
- inline typename function::template result<
\
- BOOST_PP_CAT(fusion::vector,N)<arg_types> >::type
\
+ inline typename function::template result<function(
\
+ BOOST_PP_CAT(fusion::vector,N)<arg_types>)>::type
\
operator()(params) const
\
{
\
BOOST_PP_CAT(fusion::vector,N)<arg_types> arg(args);
\
return this->fnc_transformed(arg);
\
}
\
template <tpl_params>
\
- inline typename function::template result<
\
- BOOST_PP_CAT(fusion::vector,N)<arg_types> >::type
\
+ inline typename function::template result<function(
\
+ BOOST_PP_CAT(fusion::vector,N)<arg_types>)>::type
\
operator()(params)
\
{
\
BOOST_PP_CAT(fusion::vector,N)<arg_types> arg(args);
\
@@ -100,10 +95,14 @@
};
}}
-#define BOOST_FUSION_CLASS_TPL_PARAMS class F
-#define BOOST_FUSION_CLASS_TPL_SPEC fusion::unfused_generic<F>
-#define BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY
-#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>
+namespace boost {
+ template<typename Func>
+ struct result_of<boost::fusion::unfused_generic<Func>()>
+ {
+ typedef boost::fusion::unfused_generic<Func> function;
+ typedef typename function::template result<function()>::type type;
+ };
+}
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_GENERIC_HPP_INCLUDED
#else // defined(BOOST_PP_IS_ITERATING)
@@ -116,17 +115,12 @@
#include <boost/fusion/functional/adapter/detail/pt_def.hpp>
#if BOOST_PP_SLOT_1() == 0
- template <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
+ template <typename Func, BOOST_PP_ENUM_PARAMS(N,typename T)>
struct result
-#if N < BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY
- < BOOST_PP_ENUM_PARAMS(N,T),
- BOOST_PP_ENUM_PARAMS(
- BOOST_PP_SUB(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY,N),
- fusion::void_ BOOST_PP_INTERCEPT), _ >
-#endif
- : function::template result< BOOST_PP_CAT(fusion::vector,N)<
+ <unfused_generic<Func>(BOOST_PP_ENUM_PARAMS(N,T))>
+ : function::template
result<function(BOOST_PP_CAT(fusion::vector,N)<
BOOST_PP_ENUM_BINARY_PARAMS(N,typename detail::gref<T,>::type
- BOOST_PP_INTERCEPT) > >
+ BOOST_PP_INTERCEPT) >)>
{ };
#endif
Index: unfused_lvalue_args.hpp
===================================================================
RCS file:
/cvsroot/boost/boost/boost/fusion/functional/adapter/unfused_lvalue_args.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- unfused_lvalue_args.hpp 15 Feb 2007 22:41:45 -0000 1.1
+++ unfused_lvalue_args.hpp 11 Jun 2007 07:01:02 -0000 1.2
@@ -16,6 +16,7 @@
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/remove_const.hpp>
#include <boost/fusion/sequence/container/vector/vector.hpp>
@@ -43,7 +44,7 @@
typedef detail::nullary_call_base<
fusion::unfused_lvalue_args<Function>, Function > base;
- typedef typename boost::remove_reference<Function>::type function;
+ typedef typename remove_const<typename
boost::remove_reference<Function>::type>::type function;
typedef typename detail::call_param<Function>::type func_const_fwd_t;
public:
@@ -54,17 +55,11 @@
using base::operator();
- template <
- BOOST_PP_ENUM_BINARY_PARAMS(
- BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY,
- typename T, = fusion::void_ BOOST_PP_INTERCEPT ),
- class _ = fusion::void_ >
+ template <typename T>
struct result;
- template <typename _>
- struct result<BOOST_PP_ENUM_PARAMS(
- BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY,
- fusion::void_ BOOST_PP_INTERCEPT ), _ >
+ template <typename Func>
+ struct result<unfused_lvalue_args<Func>()>
: base::r0
{ };
@@ -76,10 +71,14 @@
};
}}
-#define BOOST_FUSION_CLASS_TPL_PARAMS class F
-#define BOOST_FUSION_CLASS_TPL_SPEC fusion::unfused_lvalue_args<F>
-#define BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY
-#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>
+namespace boost {
+ template<typename Func>
+ struct result_of<boost::fusion::unfused_lvalue_args<Func>()>
+ {
+ typedef boost::fusion::unfused_lvalue_args<Func> function;
+ typedef typename function::template result<function()>::type type;
+ };
+}
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_LVALUE_ARGS_HPP_INCLUDED
#else // defined(BOOST_PP_IS_ITERATING)
@@ -90,22 +89,17 @@
////////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
- template <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
+ template <typename Func, BOOST_PP_ENUM_PARAMS(N,typename T)>
struct result
-#if N < BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY
- < BOOST_PP_ENUM_PARAMS(N,T),
- BOOST_PP_ENUM_PARAMS(
- BOOST_PP_SUB(BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY,N),
- fusion::void_ BOOST_PP_INTERCEPT), _ >
-#endif
- : function::template result< BOOST_PP_CAT(fusion::vector,N)<
+ <Func(BOOST_PP_ENUM_PARAMS(N,T))>
+ : function::template result<
function(BOOST_PP_CAT(fusion::vector,N)<
BOOST_PP_ENUM_BINARY_PARAMS(N,typename detail::mref<T,>::type
- BOOST_PP_INTERCEPT) > >
+ BOOST_PP_INTERCEPT) >)>
{ };
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
- inline typename function::template
result<BOOST_PP_CAT(fusion::vector,N)
- <BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> >::type
+ inline typename function::template
result<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)) const
{
BOOST_PP_CAT(fusion::vector,N)<
@@ -115,8 +109,8 @@
}
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
- inline typename function::template
result<BOOST_PP_CAT(fusion::vector,N)
- <BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)> >::type
+ inline typename function::template
result<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)<
Index: unfused_rvalue_args.hpp
===================================================================
RCS file:
/cvsroot/boost/boost/boost/fusion/functional/adapter/unfused_rvalue_args.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- unfused_rvalue_args.hpp 15 Feb 2007 22:41:45 -0000 1.1
+++ unfused_rvalue_args.hpp 11 Jun 2007 07:01:02 -0000 1.2
@@ -16,6 +16,7 @@
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/remove_const.hpp>
#include <boost/fusion/sequence/container/vector/vector.hpp>
@@ -43,7 +44,7 @@
typedef detail::nullary_call_base<
fusion::unfused_rvalue_args<Function>, Function > base;
- typedef typename boost::remove_reference<Function>::type function;
+ typedef typename remove_const<typename
boost::remove_reference<Function>::type>::type function;
typedef typename detail::call_param<Function>::type func_const_fwd_t;
public:
@@ -54,17 +55,11 @@
using base::operator();
- template <
- BOOST_PP_ENUM_BINARY_PARAMS(
- BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY,
- typename T, = fusion::void_ BOOST_PP_INTERCEPT ),
- class _ = fusion::void_ >
+ template <typename T>
struct result;
- template <typename _>
- struct result<BOOST_PP_ENUM_PARAMS(
- BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY,
- fusion::void_ BOOST_PP_INTERCEPT),_>
+ template <typename Func>
+ struct result<unfused_rvalue_args<Func>()>
: base::r0
{ };
@@ -76,10 +71,14 @@
};
}}
-#define BOOST_FUSION_CLASS_TPL_PARAMS class F
-#define BOOST_FUSION_CLASS_TPL_SPEC fusion::unfused_rvalue_args<F>
-#define BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_RVALUE_ARG_MAX_ARITY
-#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>
+namespace boost {
+ template<typename Func>
+ struct result_of<boost::fusion::unfused_rvalue_args<Func>()>
+ {
+ typedef boost::fusion::unfused_rvalue_args<Func> function;
+ typedef typename function::template result<function()>::type type;
+ };
+}
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_RVALUE_ARGS_HPP_INCLUDED
#else // defined(BOOST_PP_IS_ITERATING)
@@ -90,22 +89,16 @@
////////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
- template <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
- struct result
-#if N < BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY
- < BOOST_PP_ENUM_PARAMS(N,T),
- BOOST_PP_ENUM_PARAMS(
- BOOST_PP_SUB(BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY,N),
- fusion::void_ BOOST_PP_INTERCEPT), _ >
-#endif
- : function::template result< BOOST_PP_CAT(fusion::vector,N)<
+ template <typename Func, BOOST_PP_ENUM_PARAMS(N,typename T)>
+ struct result<Func(BOOST_PP_ENUM_PARAMS(N,T))>
+ : function::template result<function(
BOOST_PP_CAT(fusion::vector,N)<
BOOST_PP_ENUM_BINARY_PARAMS(N,typename detail::cref<T,>::type
- BOOST_PP_INTERCEPT) > >
+ BOOST_PP_INTERCEPT) >)>
{ };
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
- inline typename function::template
result<BOOST_PP_CAT(fusion::vector,N)
- <BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)>
>::type
+ inline typename function::template
result<function(BOOST_PP_CAT(fusion::vector,N)
+ <BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&
BOOST_PP_INTERCEPT)>)>::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a)) const
{
BOOST_PP_CAT(fusion::vector,N)<
@@ -115,8 +108,8 @@
}
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
- inline typename function::template
result<BOOST_PP_CAT(fusion::vector,N)
- <BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)>
>::type
+ inline typename function::template
result<function(BOOST_PP_CAT(fusion::vector,N)
+ <BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&
BOOST_PP_INTERCEPT)>)>::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a))
{
BOOST_PP_CAT(fusion::vector,N)<
Index: unfused_typed.hpp
===================================================================
RCS file:
/cvsroot/boost/boost/boost/fusion/functional/adapter/unfused_typed.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- unfused_typed.hpp 26 Mar 2007 19:58:44 -0000 1.3
+++ unfused_typed.hpp 11 Jun 2007 07:01:02 -0000 1.4
@@ -20,6 +20,7 @@
#include <boost/detail/workaround.hpp>
#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/remove_const.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
@@ -53,8 +54,8 @@
// type of the next base class
typedef unfused_typed_impl
< Derived, Function, NextSeq, result_of::size<NextSeq>::value,
- has_type< typename Function::template result<
- typename result_of::as_vector<NextSeq>::type > >::value
+ has_type< typename Function::template result<Function(
+ typename result_of::as_vector<NextSeq>::type)> >::value
>
type;
};
@@ -80,7 +81,7 @@
class unfused_typed
: public detail::unfused_typed_next_base
< unfused_typed<Function,Sequence>,
- typename remove_reference<Function>::type, Sequence, Sequence
+ typename remove_const<typename
remove_reference<Function>::type>::type, Sequence, Sequence
>::type
{
Function fnc_transformed;
@@ -91,11 +92,11 @@
template <class D, class F, bool E>
friend struct detail::nullary_call_base;
- typedef typename boost::remove_reference<Function>::type function;
+ typedef typename remove_const<typename
boost::remove_reference<Function>::type>::type function;
typedef typename detail::call_param<Function>::type func_const_fwd_t;
typedef typename detail::unfused_typed_next_base<unfused_typed<
- Function,Sequence>,function,Sequence,Sequence>::type base;
+ function, Sequence>,function,Sequence,Sequence>::type base;
public:
@@ -103,17 +104,11 @@
: fnc_transformed(f)
{ }
- template <
- BOOST_PP_ENUM_BINARY_PARAMS(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY,
- typename T, = fusion::void_ BOOST_PP_INTERCEPT),
- class _ = fusion::void_
- >
+ template <typename T>
struct result;
- template <typename _>
- struct result<
- BOOST_PP_ENUM_PARAMS(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY,
- fusion::void_ BOOST_PP_INTERCEPT),_>
+ template <typename Func, typename Seq>
+ struct result<unfused_typed<Func, Seq>()>
: base::r0
{ };
};
@@ -124,10 +119,14 @@
}}
-#define BOOST_FUSION_CLASS_TPL_PARAMS class F, class S
-#define BOOST_FUSION_CLASS_TPL_SPEC fusion::unfused_typed<F,S>
-#define BOOST_FUSION_FUNC_OBJ_ARITY BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY
-#include <boost/fusion/functional/adapter/detail/gen_result_of_spec.hpp>
+namespace boost {
+ template<typename Func, typename Seq>
+ struct result_of<boost::fusion::unfused_typed<Func, Seq>()>
+ {
+ typedef boost::fusion::unfused_typed<Func, Seq> function;
+ typedef typename function::template result<function()>::type type;
+ };
+}
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_TYPED_HPP_INCLUDED
#else // defined(BOOST_PP_IS_ITERATING)
@@ -149,6 +148,8 @@
typedef typename unfused_typed_next_base<
Derived,Function,Sequence>::type base;
+ typedef typename remove_const<typename
remove_reference<Function>::type>::type function;
+
// Notes:
// - conversion to fusion::vector might not be perfect (there is
// currently no "inrinsic converting ctor" that would allow us
@@ -161,13 +162,13 @@
using base::operator();
- typedef typename Function::
- template result<arg_vector_t> BOOST_PP_CAT(r,N);
+ typedef typename function::
+ template result<function(arg_vector_t)> BOOST_PP_CAT(r,N);
#define M(z,i,s)
\
typename call_param<typename result_of::value_at_c<s,i>::type>::type a##i
- inline typename Function::template result<arg_vector_t>::type
+ inline typename function::template
result<function(arg_vector_t)>::type
operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) const
{
arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a));
@@ -175,7 +176,7 @@
}
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
- inline typename Function::template result<arg_vector_t>::type
+ inline typename function::template
result<function(arg_vector_t)>::type
operator()(BOOST_PP_ENUM(N,M,arg_vector_t))
{
arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a));
@@ -189,14 +190,9 @@
} // namespace detail
template <class Function, class Sequence>
- template <BOOST_PP_ENUM_PARAMS(N,typename T), class _>
+ template <typename Func, BOOST_PP_ENUM_PARAMS(N,typename T)>
struct unfused_typed<Function,Sequence>::result
-#if N < BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY
- < BOOST_PP_ENUM_PARAMS(N,T),
- BOOST_PP_ENUM_PARAMS(
- BOOST_PP_SUB(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY,N),
- fusion::void_ BOOST_PP_INTERCEPT), _ >
-#endif
+ <Func(BOOST_PP_ENUM_PARAMS(N,T))>
: BOOST_PP_CAT(base::r,N)
{ };
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs