[typeof] on TPL suffix

TPL suffixes are sometimes inconvenient. I implemented a wrapper that derives from BOOST_TYPEOF(wrap(something)) in emulation mode. The wrap function is template<class T> mpl::identity<T> wrap(T&); It's somewhat similar to BOOST_TYPEOF_NESTED_TYPEDEF but not a replacement for it. Is there any interest in my idea? BTW, BOOST_TYPEOF_NESTED_TYPEDEF cannot be used at function/block scope but this fact is not documented. -- Alexander Nasonov http://nasonov.blogspot.com Good manners will open doors that the best education cannot. -- Clarence Thomas -- This quote is generated by: /usr/pkg/bin/curl -L http://tinyurl.com/veusy \ | sed -e 's/^document\.write(.//' -e 's/.);$/ --/' \ -e 's/<[^>]*>//g' -e 's/^More quotes from //' \ | fmt | tee ~/.signature-quote

"Alexander Nasonov" <alnsn@yandex.ru> wrote
TPL suffixes are sometimes inconvenient. I implemented a wrapper that derives from BOOST_TYPEOF(wrap(something)) in emulation mode.
The wrap function is
template<class T> mpl::identity<T> wrap(T&);
It's somewhat similar to BOOST_TYPEOF_NESTED_TYPEDEF but not a replacement for it. Is there any interest in my idea?
Only if you can prove that it works on all the compilers ;-) My attempts to remove _TPL by using mpl::identity (and a few other indirection ways), immediately after Boost.Typeof acceptance, resulted in ICE on one of older compilers -- I think it was GCC 3.3, debug mode only, windows.
BTW, BOOST_TYPEOF_NESTED_TYPEDEF cannot be used at function/block scope but this fact is not documented.
I think Peder was going to do this at some point... Peder? Regards, Arkadiy

Arkadiy Vertleyb wrote:
Only if you can prove that it works on all the compilers ;-)
It works on many popular compilers. I'm preparing a new version of scope_exit which is based on this trick. I compiled it successfully on vc8, gcc 3.4 and intel-linux 8.1. -- Alexander Nasonov http://nasonov.blogspot.com Christmas is the one time of year when people of all religions come together to worship Santa Claus. -- Bart Simpson -- This quote is generated by: /usr/pkg/bin/curl -L http://tinyurl.com/veusy \ | sed -e 's/^document\.write(.//' -e 's/.);$/ --/' \ -e 's/<[^>]*>//g' -e 's/^More quotes from //' \ | fmt | tee ~/.signature-quote

"Alexander Nasonov" <alnsn@yandex.ru> wrote
Arkadiy Vertleyb wrote:
Only if you can prove that it works on all the compilers ;-)
It works on many popular compilers. I'm preparing a new version of scope_exit which is based on this trick. I compiled it successfully on vc8, gcc 3.4 and intel-linux 8.1.
It seems that gcc 3.3.3 (debug mode) is the problem. This is from an email we exchanged with Peder: On 6/6/05, Arkadiy Vertleyb <vertleyb@hotmail.com> wrote:
Looks like my problems are related to GCC 3.3.3 (which we probably want to support). This GCC version can't stand if __typeof__() is wrapped into anything while inside a template:
typedef mpl::identity<__typeof__(1 + 0.5)>::type type; // OK
template<class T> class A { typedef __typeof__(1 + 0.5) type; // OK typedef mpl::identity<__typeof__(1 + 0.5)>::type type; // ICE };
GCC 3.4.2 seem to be fine with this.
Thoughts?
How about: template<typename T> mpl::identity<T> make(const T&)
__typeof__(make(expr))::type ?
Nope -- I tried this too :-(
Since this was an interface issue, we could not change it unless we can implement it on _ALL_ supported compilers... So we gave up :-( Regards, Arkadiy

2007/2/2, Arkadiy Vertleyb <vertleyb@hotmail.com>:
"Alexander Nasonov" <alnsn@yandex.ru> wrote
TPL suffixes are sometimes inconvenient. I implemented a wrapper that derives from BOOST_TYPEOF(wrap(something)) in emulation mode.
The wrap function is
template<class T> mpl::identity<T> wrap(T&);
It's somewhat similar to BOOST_TYPEOF_NESTED_TYPEDEF but not a replacement for it. Is there any interest in my idea?
Only if you can prove that it works on all the compilers ;-)
My attempts to remove _TPL by using mpl::identity (and a few other indirection ways), immediately after Boost.Typeof acceptance, resulted in ICE on one of older compilers -- I think it was GCC 3.3, debug mode only, windows.
BTW, BOOST_TYPEOF_NESTED_TYPEDEF cannot be used at function/block scope but this fact is not documented.
I think Peder was going to do this at some point... Peder?
Oh, sorry. Forgot. Done now. Peder.
Regards, Arkadiy
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (3)
-
Alexander Nasonov
-
Arkadiy Vertleyb
-
Peder Holt