More on my result_type problem

I see from the source code that the transform range is calling make_transform_iterator
which takes two arguments, and that
"If Reference is use_default then the reference member of transform_iterator is
result_of

I see from the source code that the transform range is calling make_transform_iterator which takes two arguments, and that
"If Reference is use_default then the reference member of transform_iterator is result_of
::type." The documentation for result_of explains the need, and shows how to use a result template instead of a result_type simple type in this case. My code follow from the example:
struct ASCII_lower { // tell details to result_of template, since VS8 doesn't support decltype keyword. template <typename> struct result; template
struct result { typedef T type; }; template< typename CharT > CharT operator() (const CharT& ch) const { if (ch >= 'A' && ch <= 'Z') return ch+0x20; return ch; // unchanged } };
But, I still get an error that result_type is not found!
B:\boost/iterator/transform_iterator.hpp(42) : error C2039: 'result_type' : is not a member of 'vst::internal::ASCII_lower' B:\boost/mpl/eval_if.hpp(41) : see reference to class template instantiation 'boost::detail::function_object_result<UnaryFunc>' being compiled with [ UnaryFunc=vst::internal::ASCII_lower ] B:\boost/iterator/iterator_adaptor.hpp(172) : see reference to class template instantiation 'boost::mpl::eval_if
' being compiled with [ C=boost::is_sameboost::use_default,boost::use_default, F1=boost::detail::function_object_resultvst::internal::ASCII_lower, F2=boost::mpl::identityboost::use_default ]
It appears to be using function_object_result, not result_of as documented. And that is: template <class UnaryFunc> struct function_object_result { typedef typename UnaryFunc::result_type type; }; which simply turns result_type into type to make eval_if happy, and doesn't do anything fancier.
So, it doesn't work as documented, and neither provides another way of passing the parameter in (exposing more arguments from the underlying transform_iterator). Is that a bug, or what?
What version of boost are you using?
The following code compiles fine for me with 1.47. I know some of
the result_of support has been added recently, so it's possible
you're using an older version that does not contain these fixes.
#include

On 7/19/2011 2:55 AM, Nathan Ridge wrote:
What version of boost are you using?
1.46.1.
The following code compiles fine for me with 1.47. I know some of the result_of support has been added recently, so it's possible you're using an older version that does not contain these fixes.
That's good to know. I was also referring to the 1.46.1 documentation which claims to have been updated 2006-09-11. When I looked over the update notes to see if it was worth pestering the team to go through an update process, I didn't see any notes concerning the stuff I was using. But I didn't think to look deeper at components used internally by the main stuff, or things I wasn't using _yet_. I see this is listed as a bug fix or feature request, Ticket #1427. Thanks for pointing it out. —John
participants (2)
-
John M. Dlugosz
-
Nathan Ridge