[libstdc++ patch] TR1 result_of implementation

Paolo Carlini pcarlini@suse.de
Mon Feb 28 05:08:00 GMT 2005


Douglas Gregor wrote:

>This patch adds support for result_of (section 3.4 of TR1). This is the 
>library-only solution that does not make sure of typeof. If we get a 
>reference-preserving typeof (or can fake it), we should consider replacing 
>this implementation with one that uses the reference-preserving typeof 
>directly.
>  
>
Yes, this issue - reference-preserving typeof - already surfaced a bit 
in the past, but I'm a little confused about the expected developments: 
is there someone actually working on it?!? Gaby should know better...

>All function object tests pass on i686-pc-linux-gnu; full test suite is 
>running right. Okay to commit if everything passes?
>  
>
You have my personal ok (of course wait 1-2 days for the other 
maintainers), modulo a curiosity:

>+   template<typename _Tp>
>+     class _Has_result_type_helper
>+     {
>+       template<typename _Up>
>+       struct _Wrap_type
>+       { };
>+ 
>+       template<typename _Up>
>+         static __sfinae_types::__one
>+         __test(_Wrap_type<typename _Up::result_type>*);
>+ 
>+       template<typename _Up>
>+         static __sfinae_types::__two __test(...);
>+ 
>+     public:
>+       static const bool __value = sizeof(__test<_Tp>(0)) == 1;
>+     };
>  
>
Is there something wrong with deriving from __sfinae_types, as I'm 
usually doing?!?

Also, watch-out for overlong lines, maybe you have got a couple...

Paolo.



More information about the Libstdc++ mailing list