ADTF  3.18.2
core functionality

Fundamental types, classes, functions and macros - applicable using

#include <a_util/base.h> More...

Classes

class  NullaryDelegate< ReturnType >
 General delegate template: encapsulates a function or a method without a parameter. More...
 
class  UnaryDelegate< ReturnType, ParamType >
 General function template: encapsulates a function or a method with a single parameter. More...
 
class  ScopeGuard< F >
 Scope guard executing a callable object of type F on scope exit. More...
 
struct  underlying_type_or_type< T, bool >
 Retrieves the underlying type if T is an enum, otherwise the type itself. More...
 
struct  underlying_type_or_type< T, true >
 Retrieves the underlying type of the enum type T. More...
 
struct  is_explicitly_convertible_to< T, U >
 Checks if there is an explicitly defined conversion from U to T. More...
 

Typedefs

template<class T , bool is_enum = std::is_enum_v<T>>
using underlying_type_or_type_t = typename underlying_type_or_type< T, is_enum >::type
 Retrieves the underlying type if T is an enum, otherwise the type itself. More...
 
typedef void * handle_t
 Type of a handle value.
 
typedef const void * const_handle_t
 Type of a const handle value.
 
typedef std::int64_t timestamp_t
 Type of a timestamp value. If not otherwise stated, always in microseconds.
 
typedef std::atomic< timestamp_tatomic_timestamp_t
 Type of an atomic timestamp_t.
 

Functions

template<class F >
auto scopeExit (F &&f)
 Creates a scope guard executing callable f on scope exit. More...
 
template<typename T >
void maybe_unused (T &&)
 Mimics C++17 attribute maybe_unused to silence compiler warnings on potentially unused enitities. More...
 

Variables

template<class T , class U >
constexpr bool is_explicitly_convertible_to_v = is_explicitly_convertible_to<T, U>::value
 Helper variable template for is_explicitly_convertible_to. More...
 

Detailed Description

Fundamental types, classes, functions and macros - applicable using

#include <a_util/base.h>

Typedef Documentation

◆ underlying_type_or_type_t

using underlying_type_or_type_t = typename underlying_type_or_type<T, is_enum>::type

Retrieves the underlying type if T is an enum, otherwise the type itself.

Template Parameters
TThe type tor retrieve the underlying type from
is_enumvalue to determine if T is an enum

Definition at line 89 of file type_traits.h.

Function Documentation

◆ maybe_unused()

void a_util::maybe_unused ( T &&  )

Mimics C++17 attribute maybe_unused to silence compiler warnings on potentially unused enitities.

Template Parameters
TType of the potentially unused entity
See also
https://en.cppreference.com/w/cpp/language/attributes/maybe_unused

Definition at line 51 of file workspace/conan/dev_essential/1.3.3/dw/stable/package/37682420cd166e229516a41c8d6a139a0b13e1e1/include/a_util/base/types.h.

Referenced by Result::Result(), and a_util::result::operator==().

◆ scopeExit()

auto a_util::scopeExit ( F &&  f)
inline

Creates a scope guard executing callable f on scope exit.

Usage example:

{
auto needs_cleanup = create_something();
auto onexit = scopeExit([&]() { cleanup(needs_cleanup); });
could_throw();
}
auto scopeExit(F &&f)
Creates a scope guard executing callable f on scope exit.
Definition: scopeguard.h:128

This can help simplify C-style resource handling and control flow for exception handling.

Parameters
[in]fThe callable object to execute.
Returns
An instance of ScopeGuard

Definition at line 128 of file scopeguard.h.

Variable Documentation

◆ is_explicitly_convertible_to_v

constexpr bool is_explicitly_convertible_to_v = is_explicitly_convertible_to<T, U>::value
constexpr

Helper variable template for is_explicitly_convertible_to.

Template Parameters
TThe to type
UThe from type
Author
Hunter Kohler here: https://stackoverflow.com/a/71563534

Definition at line 139 of file type_traits.h.