Helios Engine 0.1.0
A modular ECS based data-oriented C++23 game engine
 
Loading...
Searching...
No Matches
helios::utils::StringEqual Struct Reference

Transparent equality comparator for string types. More...

#include <string_hash.hpp>

Public Types

using is_transparent = void
 Enables heterogeneous lookup.
 

Public Member Functions

constexpr bool operator() (std::string_view lhs, std::string_view rhs) const noexcept
 Compares two string-like objects for equality.
 
bool operator() (const std::string &lhs, std::string_view rhs) const noexcept
 Compares std::string with std::string_view.
 
bool operator() (std::string_view lhs, const std::string &rhs) const noexcept
 Compares std::string_view with std::string.
 
bool operator() (const std::string &lhs, const std::string &rhs) const noexcept
 Compares two std::string objects.
 
bool operator() (const std::string &lhs, const char *rhs) const noexcept
 Compares std::string with C-style string.
 
constexpr bool operator() (const char *lhs, std::string_view rhs) const noexcept
 Compares C-style string with std::string_view.
 
bool operator() (const char *lhs, const std::string &rhs) const noexcept
 Compares C-style string with std::string.
 
constexpr bool operator() (std::string_view lhs, const char *rhs) const noexcept
 Compares std::string_view with C-style string.
 

Detailed Description

Transparent equality comparator for string types.

Enables heterogeneous lookup in unordered containers, allowing comparisons between different string types without temporary allocations. Supports std::string, std::string_view, and const char*.

Definition at line 48 of file string_hash.hpp.

Member Typedef Documentation

◆ is_transparent

Enables heterogeneous lookup.

Definition at line 49 of file string_hash.hpp.

Member Function Documentation

◆ operator()() [1/8]

bool helios::utils::StringEqual::operator() ( const char *  lhs,
const std::string &  rhs 
) const
inlinenoexcept

Compares C-style string with std::string.

Parameters
lhsLeft-hand side C-style string
rhsRight-hand side string
Returns
True if strings are equal, false otherwise

Definition at line 107 of file string_hash.hpp.

107{ return lhs == rhs; }

◆ operator()() [2/8]

constexpr bool helios::utils::StringEqual::operator() ( const char *  lhs,
std::string_view  rhs 
) const
inlineconstexprnoexcept

Compares C-style string with std::string_view.

Parameters
lhsLeft-hand side C-style string
rhsRight-hand side string view
Returns
True if strings are equal, false otherwise

Definition at line 99 of file string_hash.hpp.

99{ return lhs == rhs; }

◆ operator()() [3/8]

bool helios::utils::StringEqual::operator() ( const std::string &  lhs,
const char *  rhs 
) const
inlinenoexcept

Compares std::string with C-style string.

Parameters
lhsLeft-hand side string
rhsRight-hand side C-style string
Returns
True if strings are equal, false otherwise

Definition at line 91 of file string_hash.hpp.

91{ return lhs == rhs; }

◆ operator()() [4/8]

bool helios::utils::StringEqual::operator() ( const std::string &  lhs,
const std::string &  rhs 
) const
inlinenoexcept

Compares two std::string objects.

Parameters
lhsLeft-hand side string
rhsRight-hand side string
Returns
True if strings are equal, false otherwise

Definition at line 83 of file string_hash.hpp.

83{ return lhs == rhs; }

◆ operator()() [5/8]

bool helios::utils::StringEqual::operator() ( const std::string &  lhs,
std::string_view  rhs 
) const
inlinenoexcept

Compares std::string with std::string_view.

Parameters
lhsLeft-hand side string
rhsRight-hand side string view
Returns
True if strings are equal, false otherwise

Definition at line 67 of file string_hash.hpp.

67{ return lhs == rhs; }

◆ operator()() [6/8]

constexpr bool helios::utils::StringEqual::operator() ( std::string_view  lhs,
const char *  rhs 
) const
inlineconstexprnoexcept

Compares std::string_view with C-style string.

Parameters
lhsLeft-hand side string view
rhsRight-hand side C-style string
Returns
True if strings are equal, false otherwise

Definition at line 115 of file string_hash.hpp.

115{ return lhs == rhs; }

◆ operator()() [7/8]

bool helios::utils::StringEqual::operator() ( std::string_view  lhs,
const std::string &  rhs 
) const
inlinenoexcept

Compares std::string_view with std::string.

Parameters
lhsLeft-hand side string view
rhsRight-hand side string
Returns
True if strings are equal, false otherwise

Definition at line 75 of file string_hash.hpp.

75{ return lhs == rhs; }

◆ operator()() [8/8]

constexpr bool helios::utils::StringEqual::operator() ( std::string_view  lhs,
std::string_view  rhs 
) const
inlineconstexprnoexcept

Compares two string-like objects for equality.

Parameters
lhsLeft-hand side string
rhsRight-hand side string
Returns
True if strings are equal, false otherwise

Definition at line 57 of file string_hash.hpp.

57 {
58 return lhs == rhs;
59 }