Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
spatial_value_compare.hpp
1 // -*- C++ -*-
2 //
3 // Copyright Sylvain Bougerel 2009 - 2013.
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file COPYING or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 
13 #ifndef SPATIAL_VALUE_COMPARE_HPP
14 #define SPATIAL_VALUE_COMPARE_HPP
15 
16 #include "../spatial.hpp"
17 
18 namespace spatial
19 {
20  namespace details
21  {
37  template <typename Value, typename KeyCompare>
38  struct ValueCompare : private KeyCompare
39  {
42  explicit ValueCompare(const KeyCompare& x) : KeyCompare(x) { }
43 
45  ValueCompare() : KeyCompare() { }
46 
56  bool operator()(dimension_type dim, const Value& a, const Value& b) const
57  {
58  return KeyCompare::operator()(dim, a.first, b.first);
59  }
60  };
61 
62  } // namespace details
63 } // namespace spatial
64 
65 
66 #endif // SPATIAL_VALUE_COMPARE_HPP
bool operator()(dimension_type dim, const Value &a, const Value &b) const
Compare 2 values a and b with the comparison operator provided by KeyCompare.
ValueCompare(const KeyCompare &x)
Comparator being initilized with a value to copy into the interal comparison function.
Value compare functor for container storing pairs of (Key, Mapped) types, such as in spatial::point_m...
std::size_t dimension_type
Defines the type for the dimension as being a size.
Definition: spatial.hpp:71
The main namespace used in the library.
Definition: algorithm.hpp:23
ValueCompare()
Unintialized comparator.