17 std::string out(s.begin(), s.end());
18 std::transform(out.begin(), out.end(), out.begin(),
19 [](
unsigned char c){ return std::toupper(c); });
38 explicit SymbolId(std::string name) : name_(
std::move(name)) {}
41 const std::string&
str()
const {
return name_; }
44 explicit operator const std::string&()
const {
return name_; }
47 bool empty()
const {
return name_.empty(); }
64 return std::hash<std::string>{}(
id.str());
Returns an uppercase copy of the input string.
friend bool operator==(const SymbolId &a, const SymbolId &b)
Case-insensitive equality comparison for SymbolId<Tag>.
friend bool operator!=(const SymbolId &a, const SymbolId &b)
SymbolId(std::string name)
Constructs an identifier from a string.
const std::string & str() const
Returns the underlying string.
SymbolId()=default
Constructs an empty identifier.
friend bool operator<(const SymbolId &a, const SymbolId &b)
Case-insensitive strict ordering for SymbolId<Tag>.
bool empty() const
Returns true if the identifier is empty.
Hash specialization for SymbolId<Tag>.
std::size_t operator()(const SymbolId< Tag > &id) const noexcept
std::string to_upper_copy(std::string_view s)
Returns an uppercase copy of the input string.