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



On Apr 10, 2007, at 2:14 PM, Paolo Carlini wrote:


Doug Gregor wrote:

I'm terrible at declarator syntax :)

:)


Anyway, this works fine:

typedef int (*F)(double); // F is the type of a function object. It happens to be a function pointer

std::result_of<F(double)>::type // resolves to "int"

Yes, that works fine, I know. Something I do *not* understand, however, is why this does not work, what is so different about it:


typedef int (F)(double);

std::result_of<F(double)>::type

Maybe I'm missing something, seems certainly useful to me and implementable...

That doesn't work because one can't return a function from a function. Of course, one can't have an object with function type (an object can have reference-to-function or pointer-to-function type), so this language limitation isn't a real implementation for result_of.


	Cheers,
	Doug


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