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