// Copyright David Abrahams 2003. Permission to copy, use, // modify, sell and distribute this software is granted provided this // copyright notice appears in all copies. This software is provided // "as is" without express or implied warranty, and with no claim as // to its suitability for any purpose. #include #include #include using boost::implicit_cast; using boost::type; template type check_return(T) { return type(); } struct foo { foo(char const*) {} operator long() const { return 0; } }; typedef type long_type; typedef type foo_type; int main() { type x = check_return(boost::implicit_cast(1)); assert(boost::implicit_cast(1) == 1L); type f = check_return(boost::implicit_cast("hello")); type z = check_return(boost::implicit_cast(foo("hello"))); return 0; }