TEC
A lightweight C++ library enabling safe, efficient execution in multithreaded and concurrent systems.
Loading...
Searching...
No Matches
tec_guid.hpp File Reference

GUID generation utilities. More...

#include <random>
#include <array>
#include <cstdint>
#include <string>
#include <iomanip>
#include <sstream>
#include <cstring>
#include "tec/tec_def.hpp"

Go to the source code of this file.

Classes

struct  tec::guid::details::randgen
 Thread-local randomness. More...
 

Typedefs

using tec::uuid_t = std::array< std::uint8_t, 16 >
 16-byte GUID
 

Functions

uuid_t tec::guid::generate_v4 ()
 Generates 16-byte uuid_t version 4.
 
std::ostream & tec::guid::operator<< (std::ostream &os, const uuid_t &uuid)
 
std::string tec::guid::to_string (const uuid_t &uuid)
 Convert GUID to hex string (in lowercase).
 
std::string tec::guid::generate ()
 Generate new GUID as hex string (in lowercase).
 

Detailed Description

GUID generation utilities.

Date
2026-01-17

Function Documentation

◆ generate()

std::string tec::guid::generate ( )
inline

Generate new GUID as hex string (in lowercase).

#include "tec/tec_guid.hpp"
//...
for (int i = 0; i < 5; ++i) {
std::cout << tec::guid::generate() << "\n";
}
// Possible output.
// 12fb0aa8-3370-4b65-9ca2-796c6ea69da4
// be532f6d-2eac-4ecf-b732-14f95403f339
// 0ff569e1-9154-4a21-9ad3-36468fa35776
// ca9b0354-ed1d-44a4-b4fa-4d94c94ab129
// 715140cc-53ca-4264-8053-5c35da1a8f46
GUID generation utilities.