- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As far as I can tell, C++0X lambdas on Intel 11.1 Windows do not support the result_type protocols used by result_of (i.e. a nested result_type or a nested result template). See the following code:
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. I'll update this thread when we have a resolution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It looks like you areusing the std::tr1::result_of from the standard C++ library (their example isnt complete sinceyou dont have an #include of but I think I recreated an example). It looks like thecode doesnt meet the requirements for use with result_of, i.e. look at http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1454.html where it says the following below. The lambda/function object has neither a result_type nor a nested result member class template. This is exactly what the diagnostic I am seeing says, i.e.
F:/Program Files/Microsoft Visual Studio 10.0/VC/include/xxresult(28): error: class "lambda [](double)->double" has no member "result"
The result_of class template follows the existing practice. It defines a namespace-level class template (result_of) that determines the return type of a function object given the argument types to be passed to that function object, and defines two methods for retrieving the function call operator return type from the function object type: the first uses result_type, for backward compatibility with simple function objects, and the second uses a nested result member class template, for use with more powerful function objects.
I see similar errors from the MSVC++ 2010 compiler.
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.
I think that what I was thinking is that the lambda functors should provide a nested result_type to interface properly with the result_of template? result_of works for both functors and functions and I think is intended to be a uniform way to get at the return type. Since lambdas are currently monomorphic, it seems plausible (and maybe consistent with the C++0X standard? But there I could be completely wrong) for them to play better with this part of the standard library.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for looking at this.
Perhaps you are right and it is not required... but since so much code is written (in the STL and otherwise) to use the nested typedef of result_type for functors, isn't it a practical requirement for lambdas? And since they are monomoprhic, couldn't the compiler just generate the nested typedef for this with the result_type it already knows? Just a thought as I have had to run through hoops to get the lambdas to work in code that works with every other function and functor type.
Thanks,
Jesse
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks as always Judith.
-Jesse

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page