This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Use variadic templates for tr1::is_function


Hi again, Doug,

for the first time I'm looking into some details of result_of... and I have some basic curiosities. For example, is not at all clear to me why it doesn't work at all with plain functions (vs function pointers, etc.). Can you do a bit of popularization and explain why this kind of code path cannot be followed, in principle:

#include <type_traits>
#include <cassert>

template<typename>
 struct result_of;

template<typename _Res, typename... _ArgTypes>
 struct result_of<_Res(_ArgTypes...)>
 { typedef _Res type; };

int main()
{
 using std::is_same;
 assert( (is_same<result_of<int (double)>::type, int>::value) );
}

???

Naively, I suspect something is going wrong in the existing chain _Has_result_type -> _Weak_result_type...

Thanks,
Paolo.

PS: I know that probably most of this will be obsoleted by Decltype / auto, just if you have a couple of spare minutes...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]