Adobe Source Libraries 2.0.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
static_name_t Class Reference

Utility wrapper to construct name_t with strings of static storage duration. More...

#include <adobe/name.hpp>

Public Member Functions

 operator bool () const
std::size_t hash () const
 Return the hash value of the name_t.

Friends

struct name_t
bool operator== (const static_name_t &x, const static_name_t &y)
bool operator!= (const static_name_t &x, const static_name_t &y)
bool operator< (const static_name_t &x, const static_name_t &y)
constexpr static_name_t literals::operator""_name (const char *str, std::size_t n)
std::ostream & operator<< (std::ostream &s, const static_name_t &name)

Detailed Description

A compile-time precursor to name_t.

This type is especially useful for setting up keys in advance, as work is done at compile-time to make conversion from a static_name_t to a name_t to be faster than creating a name_t at runtime. static_name_t does no work at runtime, instead leveraging c++11's constexpr feature to precompute token string hash values for immediate insertion into the underlying name table.

Note
You cannot create a static_name_t any way other than through the user defined literal. They can only be created at compile-time.
Complexity Guarantee(s)
The first time a static_name_t with a particular string is converted to a name_t is a O(log N) operation. Thereafter conversion of that same literal from a static_name_t to a name_t is on average O(1).
Promotes To
name_t
Promotes To
adobe::name_t

Definition at line 135 of file name.hpp.

Member Function Documentation

◆ operator bool()

operator bool ( ) const
explicit
Returns
false iff the instance is equal to the empty string.
Complexity Guarantee(s)
O(1)

◆ hash()

std::size_t hash ( ) const
Returns
hash value of the name_t

Definition at line 155 of file name.hpp.

◆ name_t

friend struct name_t
friend

Definition at line 162 of file name.hpp.

◆ operator==

bool operator== ( const static_name_t & x,
const static_name_t & y )
friend

Definition at line 145 of file name.hpp.

◆ operator!=

bool operator!= ( const static_name_t & x,
const static_name_t & y )
friend

Definition at line 149 of file name.hpp.

◆ operator<

bool operator< ( const static_name_t & x,
const static_name_t & y )
friend

◆ literals::operator""_name

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

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const static_name_t & name )
friend