source: NonGTP/Boost/boost/multi_index/detail/value_compare.hpp @ 857

Revision 857, 1.2 KB checked in by igarcia, 19 years ago (diff)
Line 
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_VALUE_COMPARE_HPP
10#define BOOST_MULTI_INDEX_DETAIL_VALUE_COMPARE_HPP
11
12#if defined(_MSC_VER)&&(_MSC_VER>=1200)
13#pragma once
14#endif
15
16#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
17#include <boost/call_traits.hpp>
18#include <functional>
19
20namespace boost{
21
22namespace multi_index{
23
24namespace detail{
25
26template<typename Value,typename KeyFromValue,typename Compare>
27struct value_comparison:std::binary_function<Value,Value,bool>
28{
29  value_comparison(KeyFromValue key_=KeyFromValue(),Compare comp_=Compare()):
30    key(key_),comp(comp_)
31  {
32  }
33
34  bool operator()(
35    typename call_traits<Value>::param_type x,
36    typename call_traits<Value>::param_type y)
37  {
38    return comp(key(x),key(y));
39  }
40
41private:
42  KeyFromValue key;
43  Compare      comp;
44};
45
46} /* namespace multi_index::detail */
47
48} /* namespace multi_index */
49
50} /* namespace boost */
51
52#endif
Note: See TracBrowser for help on using the repository browser.