GEGELATI

Loading...
Searching...
No Matches
genericComparator.h
1
2#ifndef GENERIC_COMPARATOR_H
3#define GENERIC_COMPARATOR_H
4
5 template <typename T>
7 struct UniqueLess
8{
9
13 using is_transparent = void;
14
18 bool operator()(const std::unique_ptr<T>& a,
19 const std::unique_ptr<T>& b) const
20 {
21 return *a < *b;
22 }
23
28 bool operator()(const std::unique_ptr<T>& a, const T* b) const
29 {
30 return *a < *b;
31 }
32
37 bool operator()(const T* a, const std::unique_ptr<T>& b) const
38 {
39 return *a < *b;
40 }
41};
42
43#endif
UniqueLess
A comparator for unique_ptr that compares the pointed-to values.
Definition genericComparator.h:8
UniqueLess::operator()
bool operator()(const std::unique_ptr< T > &a, const T *b) const
Compare a unique_ptr and a raw pointer by comparing the pointed-to values.
Definition genericComparator.h:28
UniqueLess::is_transparent
void is_transparent
Type alias to signal that this comparator is transparent.
Definition genericComparator.h:13
UniqueLess::operator()
bool operator()(const std::unique_ptr< T > &a, const std::unique_ptr< T > &b) const
Compare two unique_ptr by comparing the pointed-to values.
Definition genericComparator.h:18
UniqueLess::operator()
bool operator()(const T *a, const std::unique_ptr< T > &b) const
Compare a raw pointer and a unique_ptr by comparing the pointed-to values.
Definition genericComparator.h:37