Update of /cvsroot/boost/boost/boost/fusion/functional/adapter
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22471
Modified Files:
unfused_generic.hpp unfused_lvalue_args.hpp
unfused_rvalue_args.hpp unfused_typed.hpp
Log Message:
makes unfused_* work exclusively through boost::result_of
Index: unfused_generic.hpp
===================================================================
RCS file:
/cvsroot/boost/boost/boost/fusion/functional/adapter/unfused_generic.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- unfused_generic.hpp 12 Jul 2007 15:57:18 -0000 1.5
+++ unfused_generic.hpp 13 Jul 2007 14:08:35 -0000 1.6
@@ -23,7 +23,9 @@
#include <boost/fusion/functional/adapter/limits.hpp>
#include <boost/fusion/functional/adapter/detail/access.hpp>
-#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>
+
+#include <boost/utility/result_of.hpp>
+#include <boost/type_traits/remove_reference.hpp>
namespace boost { namespace fusion
{
@@ -35,16 +37,9 @@
template <class Function>
class unfused_generic
- : public detail::nullary_call_base<unfused_generic<Function>, Function>
{
Function fnc_transformed;
- template <class D, class F, bool EC, bool E>
- friend struct detail::nullary_call_base;
-
- typedef detail::nullary_call_base<
- fusion::unfused_generic<Function>, Function > base;
-
typedef typename remove_const<typename
boost::remove_reference<Function>::type>::type function;
typedef typename detail::call_param<Function>::type func_const_fwd_t;
@@ -54,34 +49,39 @@
: fnc_transformed(f)
{ }
- using base::operator();
-
template <typename Sig>
- struct result
- { };
+ struct result;
- template <class Self>
- struct result< Self const () >
- : base::call_const_0_result_class
- { };
+ typedef typename boost::result_of<
+ function const (fusion::vector0 &) >::type call_const_0_result;
- template <class Self>
- struct result< Self() >
- : base::call_0_result_class
- { };
+ inline call_const_0_result operator()() const
+ {
+ fusion::vector0 arg;
+ return this->fnc_transformed(arg);
+ }
+
+ typedef typename boost::result_of<
+ function (fusion::vector0 &) >::type call_0_result;
+
+ inline call_0_result operator()()
+ {
+ fusion::vector0 arg;
+ return this->fnc_transformed(arg);
+ }
#define BOOST_FUSION_CODE(tpl_params,arg_types,params,args)
\
template <tpl_params>
\
- inline typename function::template result<function const (
\
- BOOST_PP_CAT(fusion::vector,N)<arg_types>)>::type
\
+ inline typename boost::result_of<function const (
\
+ 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<function(
\
- BOOST_PP_CAT(fusion::vector,N)<arg_types>)>::type
\
+ inline typename boost::result_of<function(
\
+ BOOST_PP_CAT(fusion::vector,N)<arg_types> & )>::type
\
operator()(params)
\
{
\
BOOST_PP_CAT(fusion::vector,N)<arg_types> arg(args);
\
@@ -130,24 +130,24 @@
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
struct result
< Self const (BOOST_PP_ENUM_PARAMS(N,T)) >
- : function::template result<function const (
+ : boost::result_of<function const (
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
- typename detail::gref<T,>::type BOOST_PP_INTERCEPT) >)>
+ typename detail::gref<T,>::type BOOST_PP_INTERCEPT) > & )>
{ };
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
struct result
< Self(BOOST_PP_ENUM_PARAMS(N,T)) >
- : 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::result_of<function (
+ BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
+ typename detail::gref<T,>::type BOOST_PP_INTERCEPT) > & )>
{ };
#endif
#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1400))
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
- inline typename function::template result<function const(
- BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)>)>::type
+ inline typename boost::result_of<function const(
+ BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)> &
)>::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a)) const
{
BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)>
@@ -155,8 +155,8 @@
return this->fnc_transformed(arg);
}
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
- inline typename function::template result<function(
- BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)>)>::type
+ inline typename boost::result_of<function(
+ BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)> &
)>::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a))
{
BOOST_PP_CAT(fusion::vector,N)<BOOST_PP_ENUM_PARAMS(N,PT)>
Index: unfused_lvalue_args.hpp
===================================================================
RCS file:
/cvsroot/boost/boost/boost/fusion/functional/adapter/unfused_lvalue_args.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- unfused_lvalue_args.hpp 12 Jul 2007 15:57:18 -0000 1.4
+++ unfused_lvalue_args.hpp 13 Jul 2007 14:08:35 -0000 1.5
@@ -22,7 +22,6 @@
#include <boost/fusion/functional/adapter/limits.hpp>
#include <boost/fusion/functional/adapter/detail/access.hpp>
-#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>
namespace boost { namespace fusion
{
@@ -33,17 +32,9 @@
struct void_;
template <class Function> class unfused_lvalue_args
- : public detail::nullary_call_base
- <unfused_lvalue_args<Function>, Function>
{
Function fnc_transformed;
- template <class D, class F, bool EC, bool E>
- friend struct detail::nullary_call_base;
-
- typedef detail::nullary_call_base<
- fusion::unfused_lvalue_args<Function>, Function > base;
-
typedef typename remove_const<typename
boost::remove_reference<Function>::type>::type function;
typedef typename detail::call_param<Function>::type func_const_fwd_t;
@@ -53,21 +44,26 @@
: fnc_transformed(f)
{ }
- using base::operator();
-
template <typename Sig>
- struct result
- { };
+ struct result;
- template <class Self>
- struct result< Self const () >
- : base::call_const_0_result_class
- { };
+ typedef typename boost::result_of<
+ function const (fusion::vector0 &) >::type call_const_0_result;
- template <class Self>
- struct result< Self() >
- : base::call_0_result_class
- { };
+ inline call_const_0_result operator()() const
+ {
+ fusion::vector0 arg;
+ return this->fnc_transformed(arg);
+ }
+
+ typedef typename boost::result_of<
+ function (fusion::vector0 &) >::type call_0_result;
+
+ inline call_0_result operator()()
+ {
+ fusion::vector0 arg;
+ return this->fnc_transformed(arg);
+ }
#define BOOST_PP_FILENAME_1 \
<boost/fusion/functional/adapter/unfused_lvalue_args.hpp>
@@ -102,21 +98,21 @@
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) >
- : function::template result< function const (
+ : boost::result_of< function const (
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
- typename detail::mref<T,>::type BOOST_PP_INTERCEPT) >)>
+ 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)) >
- : function::template result< function (
+ : boost::result_of< function (
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
- typename detail::mref<T,>::type BOOST_PP_INTERCEPT) >)>
+ typename detail::mref<T,>::type BOOST_PP_INTERCEPT) > & )>
{ };
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
- inline typename function::template
result<function(BOOST_PP_CAT(fusion::vector,N)
- <BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)>)>::type
+ 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)) const
{
BOOST_PP_CAT(fusion::vector,N)<
@@ -126,8 +122,8 @@
}
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
- inline typename function::template
result<function(BOOST_PP_CAT(fusion::vector,N)
- <BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)>)>::type
+ 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)<
Index: unfused_rvalue_args.hpp
===================================================================
RCS file:
/cvsroot/boost/boost/boost/fusion/functional/adapter/unfused_rvalue_args.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- unfused_rvalue_args.hpp 12 Jul 2007 15:57:18 -0000 1.4
+++ unfused_rvalue_args.hpp 13 Jul 2007 14:08:35 -0000 1.5
@@ -22,7 +22,6 @@
#include <boost/fusion/functional/adapter/limits.hpp>
#include <boost/fusion/functional/adapter/detail/access.hpp>
-#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>
namespace boost { namespace fusion
{
@@ -33,17 +32,9 @@
struct void_;
template <class Function> class unfused_rvalue_args
- : public detail::nullary_call_base
- <unfused_rvalue_args<Function>, Function>
{
Function fnc_transformed;
- template <class D, class F, bool EC, bool E>
- friend struct detail::nullary_call_base;
-
- typedef detail::nullary_call_base<
- fusion::unfused_rvalue_args<Function>, Function > base;
-
typedef typename remove_const<typename
boost::remove_reference<Function>::type>::type function;
typedef typename detail::call_param<Function>::type func_const_fwd_t;
@@ -53,21 +44,26 @@
: fnc_transformed(f)
{ }
- using base::operator();
-
template <typename Sig>
- struct result
- { };
+ struct result;
- template <class Self>
- struct result< Self const () >
- : base::call_const_0_result_class
- { };
+ typedef typename boost::result_of<
+ function const (fusion::vector0 &) >::type call_const_0_result;
- template <class Self>
- struct result< Self() >
- : base::call_0_result_class
- { };
+ inline call_const_0_result operator()() const
+ {
+ fusion::vector0 arg;
+ return this->fnc_transformed(arg);
+ }
+
+ typedef typename boost::result_of<
+ function (fusion::vector0 &) >::type call_0_result;
+
+ inline call_0_result operator()()
+ {
+ fusion::vector0 arg;
+ return this->fnc_transformed(arg);
+ }
#define BOOST_PP_FILENAME_1 \
<boost/fusion/functional/adapter/unfused_rvalue_args.hpp>
@@ -102,21 +98,21 @@
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) >
- : function::template result< function const (
+ : boost::result_of< function const (
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
- typename detail::cref<T,>::type BOOST_PP_INTERCEPT) >)>
+ typename detail::cref<T,>::type BOOST_PP_INTERCEPT) > & )>
{ };
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
struct result< Self (BOOST_PP_ENUM_PARAMS(N,T)) >
- : function::template result< function (
+ : boost::result_of< function (
BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
- typename detail::cref<T,>::type BOOST_PP_INTERCEPT) >)>
+ typename detail::cref<T,>::type BOOST_PP_INTERCEPT) > & )>
{ };
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
- inline typename function::template
result<function(BOOST_PP_CAT(fusion::vector,N)
- <BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&
BOOST_PP_INTERCEPT)>)>::type
+ inline typename
boost::result_of<function(BOOST_PP_CAT(fusion::vector,N)
+ <BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)> &
)>::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a)) const
{
BOOST_PP_CAT(fusion::vector,N)<
@@ -126,8 +122,8 @@
}
template <BOOST_PP_ENUM_PARAMS(N,typename T)>
- inline typename function::template
result<function(BOOST_PP_CAT(fusion::vector,N)
- <BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&
BOOST_PP_INTERCEPT)>)>::type
+ inline typename
boost::result_of<function(BOOST_PP_CAT(fusion::vector,N)
+ <BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)> &
)>::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a))
{
BOOST_PP_CAT(fusion::vector,N)<
Index: unfused_typed.hpp
===================================================================
RCS file:
/cvsroot/boost/boost/boost/fusion/functional/adapter/unfused_typed.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- unfused_typed.hpp 12 Jul 2007 15:57:18 -0000 1.6
+++ unfused_typed.hpp 13 Jul 2007 14:08:35 -0000 1.7
@@ -19,6 +19,8 @@
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
+#include <boost/utility/result_of.hpp>
+
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
@@ -30,8 +32,7 @@
#include <boost/fusion/algorithm/transformation/pop_back.hpp>
#include <boost/fusion/functional/adapter/limits.hpp>
-#include <boost/fusion/functional/adapter/detail/has_type.hpp>
-#include <boost/fusion/functional/adapter/detail/nullary_call_base.hpp>
+#include <boost/fusion/functional/adapter/detail/access.hpp>
namespace boost { namespace fusion
@@ -44,59 +45,26 @@
namespace detail
{
template <class Derived, class Function, class Sequence,
- long Arity, bool EnableCallOp>
+ long Arity = result_of::size<Sequence>::value >
struct unfused_typed_impl;
-
- template <class Derived, class Function, class Sequence,
- class NextSeq = typename result_of::pop_back<Sequence>::type >
- struct unfused_typed_next_base
- {
- // type of the next base class
- typedef unfused_typed_impl
- < Derived, Function, NextSeq, result_of::size<NextSeq>::value,
- has_type< typename Function::template result<Function(
- typename result_of::as_vector<NextSeq>::type)> >::value
- >
- type;
- };
-
- template <class Derived, class Function, class Sequence, long Arity>
- struct unfused_typed_impl<Derived,Function,Sequence,Arity,false>
- : unfused_typed_next_base<Derived,Function,Sequence>::type
- { };
-
- template <class Derived, class Function, class Sequence>
- struct unfused_typed_impl<Derived,Function,Sequence,0,false>
- : nullary_call_base<Derived,Function,false>
- { };
-
- template <class Derived, class Function, class Sequence>
- struct unfused_typed_impl<Derived,Function,Sequence,0,true>
- : nullary_call_base<Derived,Function,true>
- { };
-
}
template <class Function, class Sequence>
class unfused_typed
- : public detail::unfused_typed_next_base
- < unfused_typed<Function,Sequence>,
- typename remove_const<typename
remove_reference<Function>::type>::type, Sequence, Sequence
- >::type
+ : public detail::unfused_typed_impl
+ < unfused_typed<Function,Sequence>, typename
detail::uncr<Function>::type,
+ Sequence >
{
Function fnc_transformed;
- template <class D, class F, class S, long A, bool EO>
- friend struct detail::unfused_typed_impl;
-
- template <class D, class F, bool EC, bool E>
- friend struct detail::nullary_call_base;
-
- typedef typename remove_const<typename
boost::remove_reference<Function>::type>::type function;
+ typedef typename detail::uncr<Function>::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;
+ typedef typename detail::unfused_typed_impl<
+ unfused_typed<Function,Sequence>,function,Sequence > base;
+
+ template <class D, class F, class S, long A>
+ friend struct detail::unfused_typed_impl;
public:
@@ -105,19 +73,43 @@
{ }
template <typename Sig>
- struct result
- { };
+ struct result;
+ };
- template <class Self>
- struct result< Self const () >
- : base::call_const_0_result_class
- { };
+ namespace detail
+ {
+ template <class Derived, class Function, class Sequence>
+ struct unfused_typed_impl<Derived,Function,Sequence,0>
+ {
+ typedef fusion::vector0 arg_vector_t;
- template <class Self>
- struct result< Self() >
- : base::call_0_result_class
- { };
- };
+ public:
+
+ typedef typename boost::result_of<
+ Function const (arg_vector_t &) > call_const_0_result;
+
+ typedef typename boost::result_of<
+ Function(arg_vector_t &) > call_0_result;
+
+ inline typename boost::result_of<
+ Function const (arg_vector_t &) >::type
+ operator()() const
+ {
+ arg_vector_t arg;
+ return static_cast<Derived const
*>(this)->fnc_transformed(arg);
+ }
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+ inline typename boost::result_of<
+ Function (arg_vector_t &) >::type
+ operator()()
+ {
+ arg_vector_t arg;
+ return static_cast<Derived *>(this)->fnc_transformed(arg);
+ }
+#endif
+ };
+ }
#define BOOST_PP_FILENAME_1
<boost/fusion/functional/adapter/unfused_typed.hpp>
#define BOOST_PP_ITERATION_LIMITS (1,BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY)
@@ -129,14 +121,12 @@
{
template<class F, class Seq>
struct result_of< boost::fusion::unfused_typed<F,Seq> const () >
- {
- typedef typename
boost::fusion::unfused_typed<F,Seq>::call_const_0_result type;
- };
+ : boost::fusion::unfused_typed<F,Seq>::call_const_0_result
+ { };
template<class F, class Seq>
struct result_of< boost::fusion::unfused_typed<F,Seq>() >
- {
- typedef typename boost::fusion::unfused_typed<F,Seq>::call_0_result
type;
- };
+ : boost::fusion::unfused_typed<F,Seq>::call_0_result
+ { };
}
@@ -153,29 +143,31 @@
{
template <class Derived, class Function, class Sequence>
- struct unfused_typed_impl<Derived,Function,Sequence,N,true>
- : unfused_typed_next_base<Derived,Function,Sequence>::type
+ struct unfused_typed_impl<Derived,Function,Sequence,N>
+ : unfused_typed_impl<Derived,Function,
+ typename result_of::pop_back<Sequence>::type, BOOST_PP_DEC(N) >
{
- private:
- typedef typename unfused_typed_next_base<
- Derived,Function,Sequence>::type base;
-
- typedef typename remove_const<typename
remove_reference<Function>::type>::type function;
typedef typename result_of::as_vector<Sequence>::type arg_vector_t;
protected:
- typedef typename function::
- template result<function const (arg_vector_t)>
BOOST_PP_CAT(rc,N);
- typedef typename function::
- template result<function(arg_vector_t)> BOOST_PP_CAT(r,N);
+
+ typedef typename boost::result_of<
+ Function const (arg_vector_t &) > BOOST_PP_CAT(rc,N);
+
+ typedef typename boost::result_of<
+ Function(arg_vector_t &) > BOOST_PP_CAT(r,N);
+
public:
- using base::operator();
+ using unfused_typed_impl< Derived,Function,
+ typename result_of::pop_back<Sequence>::type, BOOST_PP_DEC(N)
+ >::operator();
#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<function const
(arg_vector_t)>::type
+ inline typename boost::result_of<
+ Function const (arg_vector_t &) >::type
operator()(BOOST_PP_ENUM(N,M,arg_vector_t)) const
{
arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a));
@@ -183,7 +175,8 @@
}
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
- inline typename function::template
result<function(arg_vector_t)>::type
+ inline typename boost::result_of<
+ Function (arg_vector_t &) >::type
operator()(BOOST_PP_ENUM(N,M,arg_vector_t))
{
arg_vector_t arg(BOOST_PP_ENUM_PARAMS(N,a));
@@ -196,6 +189,7 @@
} // namespace detail
+#if N > 0
template <class Function, class Sequence>
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
struct unfused_typed<Function,Sequence>::result<
@@ -203,13 +197,14 @@
: BOOST_PP_CAT(base::rc,N)
{ };
-#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+# if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
template <class Function, class Sequence>
template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
struct unfused_typed<Function,Sequence>::result<
Self (BOOST_PP_ENUM_PARAMS(N,T)) >
: BOOST_PP_CAT(base::r,N)
{ };
+# endif
#endif
#undef 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