|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-05-16 09:40:52
Gennaro Prota <gennaro_prota_at_[hidden]> writes:
> Hi,
>
> I was grep'ing for my name in the boost repository in order to update
> any old license reference and found the following definition in
> implicit_cast.hpp:
>
> // Macro for when you need a constant expression (Gennaro Prota)
> #define BOOST_IMPLICIT_CAST(dst_type, expr) \
> ( sizeof( implicit_cast<dst_type>(expr) ) \
> , \
> static_cast<dst_type>(expr) \
> )
>
> This wasn't the form I submitted though, as the comma operator isn't
> allowed in a constant expression and I remember pointing out on this
> list that this was a case where it would be useful :) Maybe the above
> was simply copied from this post:
>
> http://lists.boost.org/MailArchives/boost/msg42102.php
>
> where I was saying that it *doesn't* work and that I had to use the
> check_helper<> template.
So, should I just remove it? Looking back at that thread, I'm
surprised I included it in this header because I don't think I ever
really understood what you were saying.
I don't think there's an alternative to using the comma operator that
will work both when dst_type is a dependent type in a template and
when it is not dependent, because of differences in the need for
"typename".
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk