Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
smart_ptr_keys.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
5#ifndef INKSCAPE_UTIL_SMART_PTR_KEYS_H
6#define INKSCAPE_UTIL_SMART_PTR_KEYS_H
7
8#include <functional> // for std::hash
9
10template <typename T>
12{
13 using is_transparent = void;
14
15 template <typename U>
16 size_t operator()(U const &u) const
17 {
18 return std::hash<T const *>{}(&*u);
19 }
20};
21
22template <typename T>
24{
25 using is_transparent = void;
26
27 template <typename U, typename V>
28 bool operator()(U const &u, V const &v) const
29 {
30 using Tp = T const *;
31 return Tp{&*u} < Tp{&*v};
32 }
33};
34
35template <typename T>
37{
38 using is_transparent = void;
39
40 template <typename U, typename V>
41 bool operator()(U const &u, V const &v) const
42 {
43 using Tp = T const *;
44 return Tp{&*u} == Tp{&*v};
45 }
46};
47
48#endif // INKSCAPE_UTIL_SMART_PTR_KEYS_H
bool operator()(U const &u, V const &v) const
size_t operator()(U const &u) const
bool operator()(U const &u, V const &v) const