Nix
2.26.3
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
comparator.hh
Go to the documentation of this file.
1
#pragma once
3
4
#define GENERATE_ONE_CMP(PRE, RET, QUAL, COMPARATOR, MY_TYPE, ...) \
5
PRE RET QUAL operator COMPARATOR(const MY_TYPE & other) const noexcept { \
6
__VA_OPT__(const MY_TYPE * me = this;) \
7
auto fields1 = std::tie( __VA_ARGS__ ); \
8
__VA_OPT__(me = &other;) \
9
auto fields2 = std::tie( __VA_ARGS__ ); \
10
return fields1 COMPARATOR fields2; \
11
}
12
#define GENERATE_EQUAL(prefix, qualification, my_type, args...) \
13
GENERATE_ONE_CMP(prefix, bool, qualification, ==, my_type, args)
14
#define GENERATE_SPACESHIP(prefix, ret, qualification, my_type, args...) \
15
GENERATE_ONE_CMP(prefix, ret, qualification, <=>, my_type, args)
16
38
#define GENERATE_CMP(args...) \
39
GENERATE_EQUAL(,,args) \
40
GENERATE_SPACESHIP(,auto,,args)
41
48
#define GENERATE_CMP_EXT(prefix, ret, my_type, args...) \
49
GENERATE_EQUAL(prefix, my_type ::, my_type, args) \
50
GENERATE_SPACESHIP(prefix, ret, my_type ::, my_type, args)
src
libutil
comparator.hh
Generated by
1.13.2