sl@0: // -- Boost Lambda Library - actions.hpp ---------------------------------- sl@0: 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 www.boost.org sl@0: sl@0: // ---------------------------------------------------------------- sl@0: sl@0: #ifndef BOOST_LAMBDA_ACTIONS_HPP sl@0: #define BOOST_LAMBDA_ACTIONS_HPP sl@0: sl@0: namespace boost { sl@0: namespace lambda { sl@0: sl@0: sl@0: sl@0: template class action; sl@0: sl@0: // these need to be defined here, since the corresponding lambda sl@0: // functions are members of lambda_functor classes sl@0: sl@0: class assignment_action {}; sl@0: class subscript_action {}; sl@0: sl@0: template class other_action; sl@0: sl@0: // action for specifying the explicit return type sl@0: template class explicit_return_type_action {}; sl@0: sl@0: // action for preventing the expansion of a lambda expression sl@0: struct protect_action {}; sl@0: sl@0: // must be defined here, comma is a special case sl@0: struct comma_action {}; sl@0: sl@0: sl@0: // actions, for which the existence of protect is checked in return type sl@0: // deduction. sl@0: sl@0: template struct is_protectable { sl@0: BOOST_STATIC_CONSTANT(bool, value = false); sl@0: }; sl@0: sl@0: // NOTE: comma action is protectable. Other protectable actions sl@0: // are listed in operator_actions.hpp sl@0: sl@0: template<> struct is_protectable > { sl@0: BOOST_STATIC_CONSTANT(bool, value = true); sl@0: }; sl@0: sl@0: sl@0: namespace detail { sl@0: sl@0: // this type is used in return type deductions to signal that deduction sl@0: // did not find a result. It does not necessarily mean an error, it commonly sl@0: // means that something else should be tried. sl@0: class unspecified {}; sl@0: } sl@0: sl@0: // function action is a special case: bind functions can be called with sl@0: // the return type specialized explicitly e.g. bind(foo); sl@0: // If this call syntax is used, the return type is stored in the latter sl@0: // argument of function_action template. Otherwise the argument gets the type sl@0: // 'unspecified'. sl@0: // This argument is only relevant in the return type deduction code sl@0: template sl@0: class function_action {}; sl@0: sl@0: template class function_action<1, T> { sl@0: public: sl@0: template sl@0: static RET apply(A1& a1) { sl@0: return function_adaptor::type>:: sl@0: template apply(a1); sl@0: } sl@0: }; sl@0: sl@0: template class function_action<2, T> { sl@0: public: sl@0: template sl@0: static RET apply(A1& a1, A2& a2) { sl@0: return function_adaptor::type>:: sl@0: template apply(a1, a2); sl@0: } sl@0: }; sl@0: sl@0: template class function_action<3, T> { sl@0: public: sl@0: template sl@0: static RET apply(A1& a1, A2& a2, A3& a3) { sl@0: return function_adaptor::type>:: sl@0: template apply(a1, a2, a3); sl@0: } sl@0: }; sl@0: sl@0: template class function_action<4, T> { sl@0: public: sl@0: template sl@0: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4) { sl@0: return function_adaptor::type>:: sl@0: template apply(a1, a2, a3, a4); sl@0: } sl@0: }; sl@0: sl@0: template class function_action<5, T> { sl@0: public: sl@0: template sl@0: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { sl@0: return function_adaptor::type>:: sl@0: template apply(a1, a2, a3, a4, a5); sl@0: } sl@0: }; sl@0: sl@0: template class function_action<6, T> { sl@0: public: sl@0: template sl@0: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { sl@0: return function_adaptor::type>:: sl@0: template apply(a1, a2, a3, a4, a5, a6); sl@0: } sl@0: }; sl@0: sl@0: template class function_action<7, T> { sl@0: public: sl@0: template sl@0: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { sl@0: return function_adaptor::type>:: sl@0: template apply(a1, a2, a3, a4, a5, a6, a7); sl@0: } sl@0: }; sl@0: sl@0: template class function_action<8, T> { sl@0: public: sl@0: template sl@0: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, sl@0: A8& a8) { sl@0: return function_adaptor::type>:: sl@0: template apply(a1, a2, a3, a4, a5, a6, a7, a8); sl@0: } sl@0: }; sl@0: sl@0: template class function_action<9, T> { sl@0: public: sl@0: template sl@0: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, sl@0: A8& a8, A9& a9) { sl@0: return function_adaptor::type>:: sl@0: template apply(a1, a2, a3, a4, a5, a6, a7, a8, a9); sl@0: } sl@0: }; sl@0: sl@0: template class function_action<10, T> { sl@0: public: sl@0: template sl@0: static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, sl@0: A8& a8, A9& a9, A10& a10) { sl@0: return function_adaptor::type>:: sl@0: template apply(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); sl@0: } sl@0: }; sl@0: sl@0: } // namespace lambda sl@0: } // namespace boost sl@0: sl@0: #endif