Rev | Line | |
---|
[857] | 1 | /* Copyright 2003-2005 Joaquín M López Muñoz.
|
---|
| 2 | * Distributed under the Boost Software License, Version 1.0.
|
---|
| 3 | * (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 4 | * http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 5 | *
|
---|
| 6 | * See http://www.boost.org/libs/multi_index for library home page.
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | #ifndef BOOST_MULTI_INDEX_DETAIL_MODIFY_KEY_ADAPTOR_HPP
|
---|
| 10 | #define BOOST_MULTI_INDEX_DETAIL_MODIFY_KEY_ADAPTOR_HPP
|
---|
| 11 |
|
---|
| 12 | #if defined(_MSC_VER)&&(_MSC_VER>=1200)
|
---|
| 13 | #pragma once
|
---|
| 14 | #endif
|
---|
| 15 |
|
---|
| 16 | namespace boost{
|
---|
| 17 |
|
---|
| 18 | namespace multi_index{
|
---|
| 19 |
|
---|
| 20 | namespace detail{
|
---|
| 21 |
|
---|
| 22 | /* Functional adaptor to resolve modify_key as a call to modify.
|
---|
| 23 | * Preferred over compose_f_gx and stuff cause it eliminates problems
|
---|
| 24 | * with references to references, dealing with function pointers, etc.
|
---|
| 25 | */
|
---|
| 26 |
|
---|
| 27 | template<typename Modifier,typename Value,typename KeyFromValue>
|
---|
| 28 | struct modify_key_adaptor
|
---|
| 29 | {
|
---|
| 30 |
|
---|
| 31 | modify_key_adaptor(Modifier mod_,KeyFromValue kfv_):mod(mod_),kfv(kfv_){}
|
---|
| 32 |
|
---|
| 33 | void operator()(Value& x)
|
---|
| 34 | {
|
---|
| 35 | mod(kfv(x));
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | private:
|
---|
| 39 | Modifier mod;
|
---|
| 40 | KeyFromValue kfv;
|
---|
| 41 | };
|
---|
| 42 |
|
---|
| 43 | } /* namespace multi_index::detail */
|
---|
| 44 |
|
---|
| 45 | } /* namespace multi_index */
|
---|
| 46 |
|
---|
| 47 | } /* namespace boost */
|
---|
| 48 |
|
---|
| 49 | #endif
|
---|
Note: See
TracBrowser
for help on using the repository browser.