|
| StringKey () |
| Default constructor from empty string.
|
|
| StringKey (const char *key) |
| constructor from plain C-string, perform hashing
|
|
| StringKey (std::string_view key) |
| constructor from std::string_view, perform hashing
|
|
| StringKey (std::string key) |
| constructor from std::string, perform hashing
|
|
const std::string & | str () const |
| the actual string
|
|
| operator const std::string & () const |
| implicit cast to std::string
|
|
| operator std::string_view () const |
| implicit cast to std::string_view
|
|
bool | empty () const |
| empty key?
|
|
bool | operator! () const |
| empty key?
|
|
bool | operator== (const StringKey &) const =default |
| Compiler generated equality operator first comparing hash, then string (see below)
|
|
auto | operator<=> (const StringKey &) const =default |
| Compiler generated spaceship operator first comparing hash, then string (see below)
|
|
bool | operator== (const char *rhs) const |
| Comparison to other string-like types.
|
|
bool | operator== (std::string_view rhs) const |
|
bool | operator== (const std::string &rhs) const |
|
std::size_t | __hash__ () const |
| the actual access to the hash
|
|
const std::string & | __str__ () const |
| the representation of the object
|
|
std::string | __repr__ () const |
| the representation of the object
|
|
bool | __eq__ (const StringKey &right) const |
| equality operator for python
|
|
bool | __eq__ (std::string_view right) const |
| equality operators for python
|
|
bool | __neq__ (const StringKey &right) const |
| non-equality operator for python
|
|
bool | __neq__ (const std::string_view right) const |
| non-equality operator for python
|
|
std::string | toString () const |
| string representation (for properties)
|
|
Helper class for efficient "key" access for strings.
Multiple lookups of the same key can be speed up by using a pre-computed key:
std::map<StringKey, double> m = {...};
auto i1 = m.find ( key ) ;
auto i2 = m_find( "SomeLongKey" );
Helper class for efficient "key" access for strings.
The class also supports heterogeneous lookups without the need to construct a temporary StringKey object:
std::unordered_set<Gaudi::StringKey, Gaudi::StringKeyHash, std::equal_to<>> s = {...};
s.contains("foo");
- Attention
- NEVER use the actual hash value for anything stored in files, as it is not guaranteed that the hashing scheme will remain the same.
- Author
- Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
-
Gerhard Raven (based on stringKey)
-
Frank Winklmeier
- Date
- 2009-04-08
Definition at line 66 of file StringKey.h.