-
Notifications
You must be signed in to change notification settings - Fork 121
Equality Framework
Writing comparison operators can be tedious. Using std::tie(member, ...) == std::tie(member, ...)
may help but is still a lot of boilerplate code that should be generated automatically (i.e. through C++ templates). Cista offers such code generation in the equal_to.h header file.
The cista::equal_to<T>
class works like std::equal_to<T>
with the difference that it can compare instances of type T
(fixed for std::equal_to<T>
) with any other type T1
. This comes in handy for lookup operations like hash_map::find()
where it is now possible to search for a std::string_view
in a cista::hash_map<std::string, int>
without actually constructing a std::string
. Thus, it saves (de)allocations with each lookup.
Different variants are checked in the following order:
- First, ...