[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cannot pass objects of non-POD type
From: |
Jonathan Turkanis |
Subject: |
Re: cannot pass objects of non-POD type |
Date: |
Wed, 13 Oct 2004 16:03:43 -0600 |
"Michael Kurz" <mkurz@move-multimedia.com> wrote in message
news:416d77cc$1@e-post.inode.at...
>
> "Rolf Magnus" <ramagnus@t-online.de> schrieb im Newsbeitrag
> news:ckjkea$u28$05$1@news.t-online.com...
> > Vijay wrote:
> >
> > Don't pass non-PODs through variable argument lists. Or more general,
> > don't
> > use variable argument lists at all. They already were dangerous in C, but
> > in C++, they are also pretty much useless.
> >
>
> I would not say so, even without bothering with printf(...) and friends,
> look at
> the Loki::Conversion<T1, T2> implementation of Adrei Alexandrescu, where he
> shows how nice you can use
>
> SomeType1 Test(...) as a kind of catch all type function. (only at
> compiletime of course)
True, this trick is used all over Boost Type Traits (and the rest of Boost) and
I think Andrei is largely responsible. But these functions are never actually
invoked.
Furthermore, IIRC, Andrei's original implementation was actually non-conforming
because it passed user-defined types through ellipses. In order to get a
completely conforming implementation you have to jump through a few more hoops.
See http://www.boost.org/boost/type_traits/is_convertible.hpp.
Jonathan