18namespace sharg::detail
92 template <
typename id_type>
93 static bool empty(id_type
const &
id)
noexcept;
103 template <
typename id_type>
107 template <
typename id_type>
120struct hash<sharg::detail::id_pair>
127 return h1 ^ (
h2 << 1);
133namespace sharg::detail
136template <
typename id_type>
147template <
typename id_type>
151 return used_ids.
end();
160template <
typename id_type>
163 return find(used_ids,
id) != used_ids.
end();
A simple struct to store a short and a long identifier for an option.
Definition id_pair.hpp:25
bool empty() const noexcept
Returns true if both IDs are empty.
Definition id_pair.hpp:86
static bool contains(std::unordered_set< id_pair > const &used_ids, id_type const &id)
Checks whether an id is already contained in a set of used ids.
Definition id_pair.hpp:161
bool empty_long_id() const noexcept
Returns true if the long ID is empty.
Definition id_pair.hpp:80
~id_pair()=default
Defaulted.
std::string long_id
The long identifier for the option.
Definition id_pair.hpp:27
id_pair(id_pair const &)=default
Defaulted.
id_pair(std::string long_id)
Construct an id_pair from a long ID.
Definition id_pair.hpp:41
id_pair(id_pair &&)=default
Defaulted.
static auto find(std::unordered_set< id_pair > const &used_ids, id_type const &id)
Finds an id_pair in a set of used ids.
Definition id_pair.hpp:148
friend bool operator==(id_pair const &lhs, id_pair const &rhs)
Two id_pairs are equal if their short or long ID is equal. Empty IDs are not considered for equality....
Definition id_pair.hpp:51
friend bool operator==(id_pair const &lhs, char const &rhs)
Compares the given short ID with the short ID of the id_pair. Returns false if the id_pair's short ID...
Definition id_pair.hpp:60
bool empty_short_id() const noexcept
Returns true if the short ID is empty.
Definition id_pair.hpp:74
id_pair & operator=(id_pair const &)=default
Defaulted.
friend bool operator==(id_pair const &lhs, std::string const &rhs)
Compares the given long ID with the long ID of the id_pair. Returns false if the id_pair's long ID is...
Definition id_pair.hpp:68
id_pair & operator=(id_pair &&)=default
Defaulted.
id_pair()=default
Defaulted.
char short_id
The short identifier for the option.
Definition id_pair.hpp:26
id_pair(char const short_id, std::string long_id)
Construct an id_pair from a short and long ID.
Definition id_pair.hpp:45
id_pair(char const short_id)
Construct an id_pair from a short ID.
Definition id_pair.hpp:37
size_t operator()(sharg::detail::id_pair const &value) const noexcept
Computes the hash value for a given id_pair.
Definition id_pair.hpp:123