TuringSim
C++ framework to simulate abstract computing models
Namespaces | Classes | Functions
TuringSim::Utils Namespace Reference

The namespace for basic function, not specific to TuringSim. More...

Namespaces

 Debug
 The namespace for debug printers.
 

Classes

class  ArrayBuilder
 Build an array at compile time by applying a function. More...
 
class  Compare
 A class to compare values with a strong total order. The generic way use operator<. More...
 
struct  Compare< std::string >
 Specialization of Compare for string. More...
 
class  MessageException
 The Base class for all custom exceptions. More...
 
class  TaggedUidDispenserFactory
 Return a new UID dispenser at each invocation. More...
 
class  UidDispenser
 A dispenser of unique identifier. More...
 
class  UidDispenser< std::pair< Tag, UID > >
 A specialization that returns pairs made of a tag, and an integer UID. More...
 
class  Visitor
 Allows to easily build visitor for variant type from several callable objects, in particular lambda. More...
 

Functions

template<typename T >
int compare (const T &lhs, const T &rhs)
 To compare things. More...
 
template<typename CharT , typename Traits >
std::basic_ostream< CharT, Traits > & operator<< (std::basic_ostream< CharT, Traits > &os, const MessageException &e)
 Print a MessageException. More...
 
template<typename... Src, typename... Destination, typename Func >
constexpr void tuple_transform (std::tuple< Destination... > &destination, Func f, std::tuple< Src... > const &source)
 Apply f to each element of source and store the result into destination. More...
 
template<class... Ts>
 Visitor (Ts...) -> Visitor< Ts... >
 The deduction guide for Visitor, useless since C++20.
 

Detailed Description

The namespace for basic function, not specific to TuringSim.

Function Documentation

◆ compare()

template<typename T >
int TuringSim::Utils::compare ( const T &  lhs,
const T &  rhs 
)

To compare things.

Template Parameters
Tthe type of elements to compare.
Parameters
[in]lhsthe lhs element.
[in]rhsthe rhs element.
Returns
A negative value if lhs < rhs, 0 if lhs = rhs and a positive result if lhs > rhs.

Definition at line 47 of file compare.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator<<()

template<typename CharT , typename Traits >
std::basic_ostream<CharT, Traits>& TuringSim::Utils::operator<< ( std::basic_ostream< CharT, Traits > &  os,
const MessageException e 
)

Print a MessageException.

Template Parameters
CharTchar type.
Traitsstd::basic_ostream trait.
Parameters
[in,out]osthe stream.
[in]ethe exception to print.
Returns
the updated stream.

Definition at line 1 of file messageException.h.

◆ tuple_transform()

template<typename... Src, typename... Destination, typename Func >
constexpr void TuringSim::Utils::tuple_transform ( std::tuple< Destination... > &  destination,
Func  f,
std::tuple< Src... > const &  source 
)
constexpr

Apply f to each element of source and store the result into destination.

Template Parameters
Srcthe template parameter pack in the source tuple.
Destinationthe template parameter pack in the destination tuple.
Functhe type of the function to apply. It may be a generic function.
Parameters
[out]destinationthe tuple receiving the result.
[in]fthe function to apply.
[in]sourcethe source tuple.

Definition at line 28 of file tuple_transform.h.