qxLib
Classes | Public Member Functions | List of all members
qx::string_pool< nSize > Class Template Reference

Fixed-size atomic string pool. More...

#include <string_pool.h>

Classes

struct  item
 

Public Member Functions

item acquire ()
 Acquire a string from the pool. More...
 
void release (string sValue, int nIndex)
 Return a string back to the pool. More...
 

Detailed Description

template<size_t nSize = 32>
class qx::string_pool< nSize >

Fixed-size atomic string pool.

Template Parameters
nSize- pool size
Author
Khrapov
Date
18.01.2026

Definition at line 33 of file string_pool.h.

Member Function Documentation

◆ acquire()

template<size_t nSize>
string_pool< nSize >::item qx::string_pool< nSize >::acquire

Acquire a string from the pool.

Return values
-If a free slot exists, returns it (moved) and its index, otherwise returns a fresh string with nIndex = nFreeString.

Definition at line 33 of file string_pool.inl.

◆ release()

template<size_t nSize>
void qx::string_pool< nSize >::release ( string  sValue,
int  nIndex 
)

Return a string back to the pool.

If nIndex == nFreeString, it is ignored.

Parameters
sValue- a string that does not necessarily have to be from this pool
nIndex- an index of previously acquired string

Definition at line 58 of file string_pool.inl.


The documentation for this class was generated from the following files: