The boost cast library used to have an implicit_cast template, which
was stricken because it didn't work and was wrong. However, since
then, I've often found that I needed such a beast. Usually this need
arises when I want to induce a conversion to something that might be a
built-in type, for which constructor syntax actually does a C-style
cast:

        T(x)  // watch out if T is a pointer!


Here's what I think might be a correct implementation:

     template <class T, class U> T implicit_cast(U const& x) { return x; }
     template <class T, class U> T implicit_cast(U& x) { return x; }


Thoughts?

-- 
                       David Abrahams
   [EMAIL PROTECTED] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to