Dev Essential
Loading...
Searching...
No Matches
core functionality

Namespaces

namespace  a_util
 Serves as the root component, with common functionality documented in core functionality.
 
namespace  a_util::experimental
 Serves as component for features which are considered experimental.
 

Classes

class  a_util::experimental::NullaryDelegate< ReturnType >
 
class  a_util::experimental::UnaryDelegate< ReturnType, ParamType >
 
class  a_util::ScopeGuard< F >
 
struct  a_util::underlying_type_or_type< T, bool >
 Retrieves the underlying type if T is an enum, otherwise the type itself. More...
 
struct  a_util::underlying_type_or_type< T, true >
 Retrieves the underlying type of the enum type T. More...
 
struct  a_util::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 a_util::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.
 
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 a_util::scopeExit (F &&f)
 
template<typename T>
void a_util::maybe_unused (T &&)
 

Variables

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

Detailed Description

Fundamental types, classes, functions and macros - applicable using

#include <a_util/base.h>

Typedef Documentation

◆ underlying_type_or_type_t

template<class T, bool is_enum = std::is_enum_v<T>>
using a_util::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

Function Documentation

◆ maybe_unused()

template<typename T>
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

◆ scopeExit()

template<class F>
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)
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

Variable Documentation

◆ is_explicitly_convertible_to_v

template<class T, class U>
bool a_util::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