Skip to content

declare__identifier_8h

Timur Chikichev edited this page Nov 9, 2021 · 3 revisions

Indoor-Positioning-And-Navigation-Algorithms/include/navigine/navigation-core/declare_identifier.h

Defines

Name
DECLARE_IDENTIFIER(IdentifierType)

Macros Documentation

define DECLARE_IDENTIFIER

#define DECLARE_IDENTIFIER(
    IdentifierType
)
struct IdentifierType { \
    std::string value; \
    inline IdentifierType() = default; \
    inline explicit IdentifierType(const std::string& value): value(value) {} \
    inline bool isValid() const { return !value.empty(); } \
    inline bool operator<  (const IdentifierType& _id)const { return value < _id.value; } \
    inline bool operator!= (const IdentifierType& _id)const { return value != _id.value; } \
    inline bool operator== (const IdentifierType& _id)const { return value == _id.value; } \
}; \
\
struct Hasher##IdentifierType \
{ \
  std::size_t operator()(const IdentifierType& k) const \
  { \
    return std::hash<std::string>()(k.value); \
  } \
};

Updated on 2021-11-09 at 15:07:06 +0300

Clone this wiki locally