I asked a question about using a lambda to achieve something similar earlier but wasn't able to get this working so I've tried approach the problem using a functor instead. This is probably neater anyway in the sense that it doesn't involve constructing std::function
objects and is closer to the example case set out in the documentation.
Here is a simple setup that illustrates my problem:
#include <boost/range/adaptor/transformed.hpp>
#include <vector>
// some structure
template <typename T>
struct MyStruct
{
MyStruct(T t)
{
}
};
template <typename T>
struct Converter
{
using return_type = MyStruct<T>;
return_type operator()(const T& value)
{
return return_type(value);
}
};
int main(int argc, const char* argv[])
{
std::vector<int> vec {1, 2, 3};
auto val = vec | boost::adaptors::transformed(Converter<int>());
return 0;
}
When I try to compile this I am getting the following error message:
/home/user/packages/boost/mpl/eval_if.hpp:38:31: error: no type named ‘type’ in ‘
boost::mpl::eval_if<boost::is_same<boost::use_default, boost::use_default>, boost::result_of<const Converter<int>(int&)>, boost::mpl::identity<boost::use_default> >::f_ {aka struct boost::result_of<const Converter<int>(int&)>}
’
I'm not sure what to make of this. I can't spot any errors in the code. Any ideas?