2
0
mirror of https://github.com/boostorg/compute.git synced 2026-01-27 18:52:15 +00:00

Replace usages of result_of() with tr1_result_of()

This fixes a bug in which boost::result_of() would return the
wrong result type for a function due to the new implementation
using decltype instead of the result_of protocol on compilers
that sufficently support C++11 (such as clang >= 3.2).

Now, boost::tr1_result_of() is used to explicitly request that
the result_of protocol be used even when decltype is supported
by the compiler.
This commit is contained in:
Kyle Lutz
2013-04-10 19:55:58 -04:00
parent 430a76bb6c
commit 6fdffd8a2b
7 changed files with 21 additions and 15 deletions

View File

@@ -33,7 +33,7 @@ inline void inplace_reduce(Iterator first,
std::iterator_traits<Iterator>::value_type
value_type;
typedef typename
boost::result_of<BinaryFunction(value_type, value_type)>::type
boost::tr1_result_of<BinaryFunction(value_type, value_type)>::type
result_type;
size_t input_size = iterator_range_size(first, last);

View File

@@ -41,7 +41,7 @@ size_t reduce(InputIterator first,
std::iterator_traits<InputIterator>::value_type
input_type;
typedef typename
boost::result_of<BinaryFunction(input_type, input_type)>::type
boost::tr1_result_of<BinaryFunction(input_type, input_type)>::type
result_type;
const context &context = queue.get_context();
@@ -120,7 +120,7 @@ size_t reduce(InputIterator first,
template<class InputIterator, class BinaryFunction>
inline vector<
typename boost::result_of<
typename boost::tr1_result_of<
BinaryFunction(
typename std::iterator_traits<InputIterator>::value_type,
typename std::iterator_traits<InputIterator>::value_type
@@ -137,7 +137,7 @@ block_reduce(InputIterator first,
std::iterator_traits<InputIterator>::value_type
input_type;
typedef typename
boost::result_of<BinaryFunction(input_type, input_type)>::type
boost::tr1_result_of<BinaryFunction(input_type, input_type)>::type
result_type;
const context &context = queue.get_context();
@@ -163,7 +163,7 @@ inline T reduce(InputIterator first,
std::iterator_traits<InputIterator>::value_type
input_type;
typedef typename
boost::result_of<BinaryFunction(input_type, input_type)>::type
boost::tr1_result_of<BinaryFunction(input_type, input_type)>::type
result_type;
size_t count = detail::iterator_range_size(first, last);

View File

@@ -39,7 +39,9 @@ struct make_adjacent_transform_iterator_value_type
{
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
typedef typename boost::result_of<BinaryFunction(value_type, value_type)>::type type;
typedef typename
boost::tr1_result_of<BinaryFunction(value_type, value_type)>::type
type;
};
// helper class which defines the iterator_adaptor super-class

View File

@@ -40,7 +40,9 @@ struct make_binary_transform_iterator_value_type
typedef typename std::iterator_traits<InputIterator1>::value_type value_type1;
typedef typename std::iterator_traits<InputIterator2>::value_type value_type2;
typedef typename boost::result_of<BinaryFunction(value_type1, value_type2)>::type type;
typedef typename
boost::tr1_result_of<BinaryFunction(value_type1, value_type2)>::type
type;
};
// helper class which defines the iterator_facade super-class

View File

@@ -37,16 +37,16 @@ class function_input_iterator_base
public:
typedef ::boost::iterator_facade<
::boost::compute::function_input_iterator<Function>,
typename ::boost::result_of<Function()>::type,
typename ::boost::tr1_result_of<Function()>::type,
::std::random_access_iterator_tag,
typename ::boost::result_of<Function()>::type
typename ::boost::tr1_result_of<Function()>::type
> type;
};
template<class Function>
struct function_input_iterator_expr
{
typedef typename ::boost::result_of<Function()>::type result_type;
typedef typename ::boost::tr1_result_of<Function()>::type result_type;
function_input_iterator_expr(const Function &function)
: m_function(function)

View File

@@ -41,7 +41,7 @@ struct make_transform_iterator_value_type
{
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
typedef typename boost::result_of<UnaryFunction(value_type)>::type type;
typedef typename boost::tr1_result_of<UnaryFunction(value_type)>::type type;
};
// helper class which defines the iterator_adaptor super-class

View File

@@ -214,7 +214,7 @@ namespace detail {
template<class Expr, class Arg>
struct invoked_unary_expression
{
typedef typename ::boost::result_of<Expr(Arg)>::type result_type;
typedef typename ::boost::tr1_result_of<Expr(Arg)>::type result_type;
invoked_unary_expression(const std::string &expr, const Arg &arg)
: m_expr(expr),
@@ -256,7 +256,7 @@ operator<<(boost::compute::detail::meta_kernel &kernel,
template<class Expr, class Arg1, class Arg2>
struct invoked_binary_expression
{
typedef typename ::boost::result_of<Expr(Arg1, Arg2)>::type result_type;
typedef typename ::boost::tr1_result_of<Expr(Arg1, Arg2)>::type result_type;
invoked_binary_expression(const std::string &expr,
const Arg1 &arg1,
@@ -357,11 +357,13 @@ struct expression : proto::extends<Expr, expression<Expr>, domain>
};
::boost::compute::detail::meta_kernel_variable<
typename ::boost::result_of<expression<Expr>()>::type
typename ::boost::tr1_result_of<expression<Expr>()>::type
>
operator()() const
{
typedef typename ::boost::result_of<expression<Expr>()>::type result_type;
typedef typename
::boost::tr1_result_of<expression<Expr>()>::type
result_type;
context ctx;
proto::eval(*this, ctx);