Go to the documentation of this file.
16 #include <string_view>
17 #include <unordered_set>
34 operator std::string()
const {
return *
m_s; }
35 operator std::string_view()
const {
return *
m_s; }
37 bool operator==( std::string_view other )
const {
return *
m_s == other; }
46 const std::string*
m_s;
48 static const std::string*
get( std::string_view
s ) {
49 if (
s.empty() ) {
return {}; }
50 return &*(
storage.emplace(
s ).first );
53 static std::unordered_set<std::string>
storage;
69 m_hash = std::hash<std::string_view>()(
s );
73 if (
auto pos =
s.find(
'.' ); pos != std::string_view::npos ) {
74 m_chunks.emplace_back(
s.substr( 0, pos ) );
75 s.remove_prefix( pos + 1 );
84 std::string
str()
const {
86 std::string
s{ *it++ };
94 operator std::string()
const {
return str(); }
107 struct std::hash<
Gaudi::Details::PropertyId> {
friend bool operator==(const PropertyId &lhs, const PropertyId &rhs)
PropertyId(const std::string &s)
bool operator==(std::string_view other) const
PropertyId(std::string_view s)
static std::unordered_set< std::string > storage
bool operator==(const SharedString &other) const
AttribStringParser::Iterator begin(const AttribStringParser &parser)
static const std::string * get(std::string_view s)
std::size_t operator()(Gaudi::Details::PropertyId const &s) const noexcept
SharedString(std::string_view s={})
Create a new SharedString checking if the value is already in the shared storage otherwise adding it.
std::size_t hash() const noexcept
std::vector< SharedString > m_chunks
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
bool operator==(const T &other) const
Helper to record a property identifier as a sequence of SharedString instances.
std::string wrapper for static strings where identical values actually share the memory.
bool operator==(const PropertyId &lhs, const PropertyId &rhs)