Adobe Source Libraries  1.43
Classes | Functions
name_t and static_name_t

Classes

struct  static_name_t
 
struct  name_t
 
struct  promote< static_name_t >
 
struct  hash< adobe::name_t >
 
struct  hash< adobe::static_name_t >
 
struct  is_pod< adobe::name_t >
 

Functions

constexpr static_name_t operator""_name (const char *str, std::size_t n)
 

Detailed Description

Details
name_t is holding onto a std::unordered_map on the backside that maps from a name_t's hash to its string. When a name_t is constructed, its hash is used to find the unique string pointer common to all name_ts with that same string.
Although static_name_t and name_t are related, their hash values are quite different. static_name_t's hash is of its string, whereas name_t's hash is a reinterpret_cast of its unique string pointer in the underlying string map. Both hashes will point to the same unique string in the string map, making for very fast conversion from a static_name_t to a name_t.

Function Documentation

constexpr static_name_t operator""_name ( const char *  str,
std::size_t  n 
)

User defined literal to convert a compile-time string into a static_name_t. It has been defined in the adobe::literals namespace to avoid namespace pollution.

Example
using namespace adobe::literals;

adobe::static_name_t foo("foo"_name); // OK, creation via user defined literal
adobe::name_t        bar(foo); // OK, implicit promotion to a name_t
adobe::name_t        baz("baz"_name); // OK, creation and then promotion
The adobe namespace itself uses the literals namespace, so you do not need to specify using namespace adobe::literals if you are already using namespace adobe:
using namespace adobe;

static_name_t foo("foo"_name); // OK
name_t        bar("bar"_name); // OK

Definition at line 200 of file name.hpp.