Update of /cvsroot/boost/boost/boost/fusion/functional/adapter/detail
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7555/adapter/detail
Modified Files:
nullary_call_base.hpp
Log Message:
completes boost::result_of-based result type computation
Index: nullary_call_base.hpp
===================================================================
RCS file:
/cvsroot/boost/boost/boost/fusion/functional/adapter/detail/nullary_call_base.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- nullary_call_base.hpp 11 Jun 2007 21:09:44 -0000 1.3
+++ nullary_call_base.hpp 12 Jul 2007 09:07:36 -0000 1.4
@@ -26,43 +26,101 @@
template<typename Function>
struct get_result_spec
{
- typedef typename remove_const<typename
remove_reference<Function>::type>::type function;
- typedef typename function::template result<function(fusion::vector0)>
type;
+ private:
+ typedef typename boost::remove_const<
+ typename boost::remove_reference<Function>::type>::type function;
+
+ typedef fusion::vector0 arg;
+ public:
+ typedef typename function::template result<function(arg)>
call_0_result;
+ typedef typename function::template result<function const (arg)>
+ call_const_0_result;
};
- template <class Derived, class Function, bool Enable = detail::has_type<
- typename get_result_spec<Function>::type>::value>
+ template <class Derived, class Function,
+ bool EnableConst = detail::has_type<
+ typename get_result_spec<Function>::call_const_0_result>::value,
+ bool Enable = detail::has_type<
+ typename get_result_spec<Function>::call_0_result>::value>
struct nullary_call_base
{
- template <typename T> inline void operator()(T reserved::*) const { }
protected:
- typedef boost::blank r0;
+ typedef typename get_result_spec<Function>::call_const_0_result
+ call_const_0_result_class;
+
+ typedef typename get_result_spec<Function>::call_0_result
+ call_0_result_class;
+ public:
+ typedef typename call_const_0_result_class::type
+ call_const_0_result;
+
+ inline call_const_0_result operator()() const
+ {
+ fusion::vector0 arg;
+ return static_cast<Derived const *>(this)->fnc_transformed(arg);
+ }
+
+ typedef typename get_result_spec<Function>::call_0_result::type
+ call_0_result;
+
+ inline call_0_result operator()()
+ {
+ fusion::vector0 arg;
+ return static_cast<Derived *>(this)->fnc_transformed(arg);
+ }
};
- template <class Derived, class Function>
- struct nullary_call_base<Derived,Function,true>
+ template <class Derived, class Function>
+ struct nullary_call_base<Derived, Function, true, false>
{
- private:
- typedef typename remove_const<typename
remove_reference<Function>::type>::type function;
protected:
- typedef typename function::template result<function(vector0)> r0;
+ typedef typename get_result_spec<Function>::call_const_0_result
+ call_const_0_result_class;
+
+ typedef typename boost::blank call_0_result_class;
public:
+ typedef typename call_const_0_result_class::type
+ call_const_0_result, call_0_result;
- inline typename r0::type
- operator()() const
+ inline call_const_0_result operator()() const
{
fusion::vector0 arg;
return static_cast<Derived const *>(this)->fnc_transformed(arg);
}
+ };
- inline typename r0::type
- operator()()
+ template <class Derived, class Function>
+ struct nullary_call_base<Derived, Function, false, true>
+ {
+ protected:
+ typedef typename boost::blank call_const_0_result_class;
+
+ typedef typename get_result_spec<Function>::call_0_result
+ call_0_result_class;
+ public:
+ typedef void call_const_0_result;
+ typedef typename call_0_result_class::type call_0_result;
+
+ inline call_const_0_result operator()()
{
fusion::vector0 arg;
return static_cast<Derived *>(this)->fnc_transformed(arg);
}
};
+ template <class Derived, class Function>
+ struct nullary_call_base<Derived, Function, false, false>
+ {
+ protected:
+ typedef boost::blank call_0_result_class;
+ typedef boost::blank call_const_0_result_class;
+ public:
+ typedef void call_0_result;
+ typedef void call_const_0_result;
+
+ template <typename T> inline void operator()(T reserved::*) const { }
+ };
+
}}}
#endif
-------------------------------------------------------------------------
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