18namespace sharg::detail
30 id_pair(id_pair
const &) =
default;
31 id_pair & operator=(id_pair
const &) =
default;
32 id_pair(id_pair &&) =
default;
33 id_pair & operator=(id_pair &&) =
default;
37 id_pair(
char const short_id) : short_id{short_id}
45 id_pair(
char const short_id,
std::string long_id) : short_id{short_id}, long_id{
std::
move(long_id)}
51 friend bool operator==(id_pair
const & lhs, id_pair
const & rhs)
53 return (!lhs.empty_short_id() && lhs.short_id == rhs.short_id)
54 || (!lhs.empty_long_id() && lhs.long_id == rhs.long_id);
60 friend bool operator==(id_pair
const & lhs,
char const & rhs)
62 return !lhs.empty_short_id() && lhs.short_id == rhs;
68 friend bool operator==(id_pair
const & lhs,
std::string const & rhs)
70 return !lhs.empty_long_id() && lhs.long_id == rhs;
74 bool empty_short_id() const noexcept
76 return empty(short_id);
80 bool empty_long_id() const noexcept
82 return empty(long_id);
86 bool empty() const noexcept
88 return empty_short_id() && empty_long_id();
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>
123 size_t operator()(sharg::detail::id_pair
const & value)
const noexcept
127 return h1 ^ (
h2 << 1);
133namespace sharg::detail
136template <
typename id_type>
137inline bool id_pair::empty(id_type
const &
id)
noexcept
147template <
typename id_type>
151 return used_ids.
end();
154 [&
id](id_pair
const & pair)
160template <
typename id_type>
163 return find(used_ids,
id) != used_ids.
end();