diff --git a/include/boost/utility/detail/result_of_iterate.hpp b/include/boost/utility/detail/result_of_iterate.hpp
index 5cf30b6..29fcd78 100644
--- a/include/boost/utility/detail/result_of_iterate.hpp
+++ b/include/boost/utility/detail/result_of_iterate.hpp
@@ -38,7 +38,7 @@ struct tr1_result_of<boost/utility/result_of.hpp>
.
If your compiler's support for decltype
is
- adequate, result_of
automatically uses it to
- deduce the result type of your callable.
If your compiler supports decltype
,
+ then you can enable automatic result type deduction by
+ defining the macro BOOST_RESULT_OF_USE_DECLTYPE
,
+ as in the following example.
--#include <boost/utility/result_of.hpp> +#define BOOST_RESULT_OF_USE_DECLTYPE +#include <boost/utility/result_of.hpp> struct functor { template<class T> @@ -178,29 +180,21 @@ struct functor { typedef boost::result_of< functor(int) ->::type type; // type is int+>::type type;
You can test whether result_of
is using
- decltype
checking if the macro
- BOOST_RESULT_OF_USE_DECLTYPE
is defined after
- including result_of.hpp
. You can also force
- result_of
to use decltype
by
- defining BOOST_RESULT_OF_USE_DECLTYPE
prior
- to including result_of.hpp
.
If decltype
is not used,
+
If decltype
is not enabled,
then automatic result type deduction of function
objects is not possible. Instead, result_of
uses the following protocol to allow the programmer to
specify a type. When F
is a class type with a
member type result_type
,
result_of<F(T1, T2, ...,
- TN)>::type
is
+ TN)> is
F::result_type
. When F
does
not contain result_type
,
result_of<F(T1, T2, ...,
- TN)>::type
is F::result<F(T1,
+ TN)>
is F::result<F(T1,
T2, ..., TN)>::type
when
N > 0
or void
when N = 0
. Note that it is the
@@ -227,29 +221,22 @@ typedef boost::result_of<
typedef boost::result_of<
functor(int)
->::type type; // type is int
+>::type type;
-
If you are writing a reusable function object
- that should work with result_of
, for
- maximum portability, you might consider following
- the above protocol even if your compiler has
- proper decltype
support. If you do,
- take care to ensure that the
- result_type
and
- result<>
members accurately
- represent the return type of
- operator()
.
If you wish to continue to +
In a future
+ release, BOOST_RESULT_OF_USE_DECLTYPE
+ may be enabled by default on compilers that
+ support decltype
, so if you use the above
+ protocol please take care to ensure that
+ the result_type
+ and result<>
members accurately
+ represent the result type. If you wish to continue to
use the protocol on compilers that
support decltype
,
use boost::tr1_result_of
, which is also
defined
- in <boost/utility/result_of.hpp>
. You can also define the macro
- BOOST_RESULT_OF_USE_TR1
, which causes
- result_of
to use the convention described
- above instead of decltype
.
<boost/utility/result_of.hpp>
.
This implementation of result_of