I have the following function:
inline auto iterateSomething(obj & o)
{
auto iterators = baseIterator(o);
auto tranformer = boost::bind(transofrmToSomething, _1, o);
typedef boost::transform_iterator<decltype(tranformer), decltype(iterators.first)> iterator_t;
iterator_t begin(iterators.first, tranformer);
iterator_t end(iterators.second, tranformer);
return std::make_pair(begin, end);
}
As you can see I don't know the return value and even if I put int there and later copy the type from the error message, its a really long type...
Is there a way to specify the return type as the type of the only return in the function? is there any workaround not involving a huge type in the return type?
I think you should do what Raymond Chen suggested in a comment:
Move the typedefs outside the function. Then you can use it to declare the return type.
If Raymond posts an answer it should be accepted in preference to mine--I'm posting this so that bitmask's answer is not the only one, since I think it is a cure worse than the disease.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With