Chris@16: // -- select_functions.hpp -- Boost Lambda Library -------------------------- Chris@16: Chris@16: // Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // For more information, see http://www.boost.org Chris@16: Chris@16: Chris@16: #ifndef BOOST_LAMBDA_SELECT_FUNCTIONS_HPP Chris@16: #define BOOST_LAMBDA_SELECT_FUNCTIONS_HPP Chris@16: Chris@16: namespace boost { Chris@16: namespace lambda { Chris@16: namespace detail { Chris@16: Chris@16: Chris@16: // select functions ------------------------------- Chris@16: template Chris@16: inline Any& select(Any& any, CALL_FORMAL_ARGS) { CALL_USE_ARGS; return any; } Chris@16: Chris@16: Chris@16: template Chris@16: inline typename Arg::template sig >::type Chris@16: select ( const lambda_functor& op, CALL_FORMAL_ARGS ) { Chris@16: return op.template call< Chris@16: typename Arg::template sig >::type Chris@16: >(CALL_ACTUAL_ARGS); Chris@16: } Chris@16: template Chris@16: inline typename Arg::template sig >::type Chris@16: select ( lambda_functor& op, CALL_FORMAL_ARGS) { Chris@16: return op.template call< Chris@16: typename Arg::template sig >::type Chris@16: >(CALL_ACTUAL_ARGS); Chris@16: } Chris@16: Chris@16: // ------------------------------------------------------------------------ Chris@16: // select functions where the return type is explicitly given Chris@16: // Note: on many functions, this return type is just discarded. Chris@16: // The select functions are inside a class template, and the return type Chris@16: // is a class template argument. Chris@16: // The first implementation used function templates with an explicitly Chris@16: // specified template parameter. Chris@16: // However, this resulted in ambiguous calls (at least with gcc 2.95.2 Chris@16: // and edg 2.44). Not sure whether the compilers were right or wrong. Chris@16: Chris@16: template struct r_select { Chris@16: Chris@16: // Any == RET Chris@16: template Chris@16: static Chris@16: inline RET go (Any& any, CALL_FORMAL_ARGS) { CALL_USE_ARGS; return any; } Chris@16: Chris@16: Chris@16: template Chris@16: static Chris@16: inline RET go (const lambda_functor& op, CALL_FORMAL_ARGS ) { Chris@16: return op.template call(CALL_ACTUAL_ARGS); Chris@16: } Chris@16: template Chris@16: static Chris@16: inline RET go (lambda_functor& op, CALL_FORMAL_ARGS ) { Chris@16: return op.template call(CALL_ACTUAL_ARGS); Chris@16: } Chris@16: }; Chris@16: Chris@16: } // namespace detail Chris@16: } // namespace lambda Chris@16: } // namespace boost Chris@16: Chris@16: #endif