Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:39:09

0001 // -- select_functions.hpp -- Boost Lambda Library --------------------------
0002 
0003 // Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
0004 //
0005 // Distributed under the Boost Software License, Version 1.0. (See
0006 // accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // For more information, see http://www.boost.org
0010 
0011 
0012 #ifndef BOOST_LAMBDA_SELECT_FUNCTIONS_HPP
0013 #define BOOST_LAMBDA_SELECT_FUNCTIONS_HPP
0014 
0015 namespace boost { 
0016 namespace lambda {
0017 namespace detail {
0018 
0019 
0020 // select functions -------------------------------
0021 template<class Any, CALL_TEMPLATE_ARGS>
0022 inline Any& select(Any& any, CALL_FORMAL_ARGS) { CALL_USE_ARGS; return any; }
0023 
0024 
0025 template<class Arg, CALL_TEMPLATE_ARGS>
0026 inline typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type
0027 select ( const lambda_functor<Arg>& op, CALL_FORMAL_ARGS ) { 
0028   return op.template call<
0029     typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type
0030   >(CALL_ACTUAL_ARGS); 
0031 }
0032 template<class Arg, CALL_TEMPLATE_ARGS>
0033 inline typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type
0034 select ( lambda_functor<Arg>& op, CALL_FORMAL_ARGS) { 
0035   return op.template call<
0036     typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type
0037   >(CALL_ACTUAL_ARGS); 
0038 }
0039 
0040 // ------------------------------------------------------------------------
0041 // select functions where the return type is explicitly given
0042 // Note: on many functions, this return type is just discarded.
0043 // The select functions are inside a class template, and the return type
0044 // is a class template argument.
0045 // The first implementation used function templates with an explicitly 
0046 // specified template parameter.
0047 // However, this resulted in ambiguous calls (at least with gcc 2.95.2 
0048 // and edg 2.44). Not sure whether the compilers were right or wrong. 
0049   
0050 template<class RET> struct r_select {
0051 
0052 // Any == RET
0053   template<class Any, CALL_TEMPLATE_ARGS>
0054   static 
0055   inline RET go (Any& any, CALL_FORMAL_ARGS) { CALL_USE_ARGS; return any; }
0056 
0057 
0058   template<class Arg, CALL_TEMPLATE_ARGS> 
0059   static 
0060   inline RET go (const lambda_functor<Arg>& op, CALL_FORMAL_ARGS ) {
0061     return op.template call<RET>(CALL_ACTUAL_ARGS); 
0062   }
0063   template<class Arg, CALL_TEMPLATE_ARGS> 
0064   static 
0065   inline RET go (lambda_functor<Arg>& op, CALL_FORMAL_ARGS ) { 
0066     return op.template call<RET>(CALL_ACTUAL_ARGS); 
0067   }
0068 };
0069    
0070 } // namespace detail
0071 } // namespace lambda
0072 } // namespace boost
0073 
0074 #endif