Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:07

0001 /* Copyright 2003-2013 Joaquin M Lopez Munoz.
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * http://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * See http://www.boost.org/libs/multi_index for library home page.
0007  */
0008 
0009 #ifndef BOOST_MULTI_INDEX_DETAIL_MODIFY_KEY_ADAPTOR_HPP
0010 #define BOOST_MULTI_INDEX_DETAIL_MODIFY_KEY_ADAPTOR_HPP
0011 
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015 
0016 namespace boost{
0017 
0018 namespace multi_index{
0019 
0020 namespace detail{
0021 
0022 /* Functional adaptor to resolve modify_key as a call to modify.
0023  * Preferred over compose_f_gx and stuff cause it eliminates problems
0024  * with references to references, dealing with function pointers, etc.
0025  */
0026 
0027 template<typename Fun,typename Value,typename KeyFromValue>
0028 struct modify_key_adaptor
0029 {
0030 
0031   modify_key_adaptor(Fun f_,KeyFromValue kfv_):f(f_),kfv(kfv_){}
0032 
0033   void operator()(Value& x)
0034   {
0035     f(kfv(x));
0036   }
0037 
0038 private:
0039   Fun          f;
0040   KeyFromValue kfv;
0041 };
0042 
0043 } /* namespace multi_index::detail */
0044 
0045 } /* namespace multi_index */
0046 
0047 } /* namespace boost */
0048 
0049 #endif