Skip to content

:suspect: ID, a compile-time string hasher and sequential ID generator (C++11)

License

Notifications You must be signed in to change notification settings

r-lyeh-archived/id

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

id

ID, a compile-time string hasher and sequential ID generator (C++11).

Features

  • Based on code by Stefan 'Tivolo' Reinalter.
  • Tiny, header-only, cross-platform.
  • No dependencies.
  • ZLIB/LibPNG licensed.

Cons

  • Modern C++11 compiler required, or optimizations enabled at least.

Sample

#include <iostream>
#include "id.hpp"

int main() {
    // generate compile-time hash ids
    std::cout << $id("HELLO_WORLD") << std::endl;
    std::cout << $id("PLAYER_1") << std::endl;

    // generate sequential ids
    std::cout << $id() << std::endl;
    std::cout << $id() << std::endl;

    // resetting sequential generator is allowed
    $id() = 0;
    std::cout << $id() << std::endl;
}

Changelog

  • v1.0.0 (2015/10/01)
    • Semantic versioning adherence

About

:suspect: ID, a compile-time string hasher and sequential ID generator (C++11)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages