Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
uni20::nifty_counter< Init, Exit > Class Template Reference

Runs shared initialization before namespace-scope users and shared cleanup after them. More...

#include <nifty_counter.hpp>

Public Member Functions

 nifty_counter () noexcept
 
 nifty_counter (nifty_counter &&)=delete
 
 nifty_counter (nifty_counter const &)=delete
 
nifty_counter & operator= (nifty_counter &&)=delete
 
nifty_counter & operator= (nifty_counter const &)=delete
 
 ~nifty_counter () noexcept
 

Detailed Description

template<auto Init, auto Exit = []() noexcept {}>
requires requires { { Init() } noexcept; { Exit() } noexcept; }
class uni20::nifty_counter< Init, Exit >

Runs shared initialization before namespace-scope users and shared cleanup after them.

Place one guard with internal linkage in every header that exposes state requiring ordered initialization. Named callback functions with external linkage ensure that all translation units instantiate the same counter. Header-local lambdas must not be used for that purpose because they can produce distinct counter specializations.

Template Parameters
InitNo-throw callable invoked when the first guard is constructed.
ExitNo-throw callable invoked when the last guard is destroyed.

Constructor & Destructor Documentation

◆ nifty_counter() [1/3]

template<auto Init, auto Exit = []() noexcept {}>
uni20::nifty_counter< Init, Exit >::nifty_counter ( )
inlinenoexcept

◆ nifty_counter() [2/3]

template<auto Init, auto Exit = []() noexcept {}>
uni20::nifty_counter< Init, Exit >::nifty_counter ( nifty_counter< Init, Exit > const &  )
delete

◆ nifty_counter() [3/3]

template<auto Init, auto Exit = []() noexcept {}>
uni20::nifty_counter< Init, Exit >::nifty_counter ( nifty_counter< Init, Exit > &&  )
delete

◆ ~nifty_counter()

template<auto Init, auto Exit = []() noexcept {}>
uni20::nifty_counter< Init, Exit >::~nifty_counter ( )
inlinenoexcept

Member Function Documentation

◆ operator=() [1/2]

template<auto Init, auto Exit = []() noexcept {}>
nifty_counter & uni20::nifty_counter< Init, Exit >::operator= ( nifty_counter< Init, Exit > &&  )
delete

◆ operator=() [2/2]

template<auto Init, auto Exit = []() noexcept {}>
nifty_counter & uni20::nifty_counter< Init, Exit >::operator= ( nifty_counter< Init, Exit > const &  )
delete

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