sl@0: // - casts.hpp -- BLambda Library ------------- sl@0: // sl@0: // Copyright (C) 2000 Gary Powell (powellg@amazon.com) sl@0: // Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi) sl@0: // sl@0: // Distributed under the Boost Software License, Version 1.0. (See sl@0: // accompanying file LICENSE_1_0.txt or copy at sl@0: // http://www.boost.org/LICENSE_1_0.txt) sl@0: // sl@0: // For more information, see http://www.boost.org sl@0: sl@0: // ----------------------------------------------- sl@0: sl@0: #if !defined(BOOST_LAMBDA_CASTS_HPP) sl@0: #define BOOST_LAMBDA_CASTS_HPP sl@0: sl@0: #include sl@0: sl@0: namespace boost { sl@0: namespace lambda { sl@0: sl@0: template class cast_action; sl@0: sl@0: template class static_cast_action; sl@0: template class dynamic_cast_action; sl@0: template class const_cast_action; sl@0: template class reinterpret_cast_action; sl@0: sl@0: class typeid_action; sl@0: class sizeof_action; sl@0: sl@0: // Cast actions sl@0: sl@0: template class cast_action > sl@0: { sl@0: public: sl@0: template sl@0: static RET apply(Arg1 &a1) { sl@0: return static_cast(a1); sl@0: } sl@0: }; sl@0: sl@0: template class cast_action > { sl@0: public: sl@0: template sl@0: static RET apply(Arg1 &a1) { sl@0: return dynamic_cast(a1); sl@0: } sl@0: }; sl@0: sl@0: template class cast_action > { sl@0: public: sl@0: template sl@0: static RET apply(Arg1 &a1) { sl@0: return const_cast(a1); sl@0: } sl@0: }; sl@0: sl@0: template class cast_action > { sl@0: public: sl@0: template sl@0: static RET apply(Arg1 &a1) { sl@0: return reinterpret_cast(a1); sl@0: } sl@0: }; sl@0: sl@0: // typedid action sl@0: class typeid_action { sl@0: public: sl@0: template sl@0: static RET apply(Arg1 &a1) { sl@0: return typeid(a1); sl@0: } sl@0: }; sl@0: sl@0: // sizeof action sl@0: class sizeof_action sl@0: { sl@0: public: sl@0: template sl@0: static RET apply(Arg1 &a1) { sl@0: return sizeof(a1); sl@0: } sl@0: }; sl@0: sl@0: sl@0: // return types of casting lambda_functors (all "T" type.) sl@0: sl@0: template