jaulib v1.3.6
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
C++ Language Utilities

C++ language utilities, language feature alignment, type trails, data alignment and intrinsics. More...

Classes

class  jau::enums::enum_info< EnumType, Vargs >
 Enumeration info template class including iterator (enum_iterator) More...
 
class  jau::enums::enum_iterator< EnumType, Vargs >
 Enumeration iterator, see enum_info. More...
 
struct  jau::has_builtin_bit_cast_t< Dummy_type >
 Convenience type trait for __has_builtin(__builtin_bit_cast). More...
 
struct  jau::has_member_of_pointer< C, typename >
 Checker for member of pointer '->' operator with convertible pointer return, no arguments. More...
 
struct  jau::has_member_of_pointer< C, typename std::enable_if_t< std::is_pointer_v< decltype(std::declval< C >().operator->())> > >
 
struct  jau::is_container_memmove_compliant< class, class >
 template< class T > is_container_memmove_compliant<T>::value compile-time Type Trait, determining whether the given template class claims to be container memmove compliant, see @Ref darray_memmove. More...
 
struct  jau::is_container_memmove_compliant< T, std::void_t< typename T::container_memmove_compliant > >
 template< class T > is_container_memmove_compliant<T>::value compile-time Type Trait, determining whether the given template class claims to be container memmove compliant, see @Ref darray_memmove. More...
 
struct  jau::is_enforcing_secmem< class, class >
 template< class T > is_enforcing_secmem<T>::value compile-time Type Trait, determining whether the given template class enforces secmem, see @Ref darray_secmem. More...
 
struct  jau::is_enforcing_secmem< T, std::void_t< typename T::enforce_secmem > >
 template< class T > is_enforcing_secmem<T>::value compile-time Type Trait, determining whether the given template class enforces secmem, see @Ref darray_secmem. More...
 
struct  jau::enums::is_enum_info< class, class >
 template< class T > is_enum_info<T>::value compile-time Type Trait, determining whether the given template class is a enum_info type. More...
 
struct  jau::enums::is_enum_info< T, std::void_t< typename T::enum_info_tag > >
 template< class T > is_enum_info<T>::value compile-time Type Trait, determining whether the given template class is a enum_info type. More...
 
struct  jau::is_rtti_available_t< _Dummy >
 Template type trait evaluating std::true_type{} if RTTI is available, otherwise std::false_type{}. More...
 
struct  jau::enums::NameTable< Vargs >
 
struct  jau::packed_t< T >
 Support aligned memory transfer from and to potentially unaligned memory. More...
 
struct  jau::type_cue< T >
 Helper, allowing simple access to compile time typename and Type traits information, see jau::type_name_cue to setup typename's string representation. More...
 
class  jau::type_info
 Generic type information using either Runtime type information (RTTI) or Compile time type information (CTTI) More...
 
struct  jau::type_name_cue< T >
 Helper, allowing simple access and provision of a typename string representation at compile time, see jau::type_cue for usage. More...
 
struct  jau::enums::ValueTable< E, N >
 

Macros

#define __attrdecl_no_optimize__
 
#define __attrdef_no_optimize__
 
#define __packed   __attribute__ ((packed))
 packed: lead out macro, requires packed lead in as well.
 
#define __restrict_cxx__
 Wrap C++ extension __restrict__ covering C99's restrict feature keyword.
 
#define consteval_cxx20   constexpr
 consteval qualifier replacement for C++20 consteval.
 
#define constexpr_atomic   constexpr_cxx23
 Used when designed to declare a function constexpr, but prohibited by its specific implementation.
 
#define constexpr_cxx20   inline
 constexpr qualifier replacement for C++20 constexpr.
 
#define constexpr_cxx23   inline
 
#define constexpr_cxx26   inline
 
#define constexpr_non_literal_var   constexpr_cxx23
 Used when designed to declare a function constexpr, but prohibited by its specific implementation.
 
#define constinit_cxx20   constexpr
 constinit qualifier replacement for C++20 constinit.
 
#define final_opt   final
 Optional generic usage of final keyword w/o negative performance impact.
 
#define JAU_APPEND_BITSTR(U, V, M)
 
#define JAU_ENUM_CASE_LONG(type, name)
 
#define JAU_ENUM_CASE_SHORT(type, name)
 
#define JAU_ENUM_TYPE_VALUE(type, name)
 
#define JAU_ENUM_VALUE(type, name)
 
#define JAU_EXPAND(...)
 
#define JAU_EXPAND1(...)
 
#define JAU_EXPAND2(...)
 
#define JAU_EXPAND3(...)
 
#define JAU_EXPAND4(...)
 
#define JAU_FOR_EACH(macro, type, ...)
 
#define JAU_FOR_EACH_AGAIN()
 
#define JAU_FOR_EACH_HELPER(macro, type, a1, ...)
 
#define JAU_FOR_EACH_LIST(macro, type, ...)
 
#define JAU_FOR_EACH_LIST_AGAIN()
 
#define JAU_FOR_EACH_LIST_HELPER(macro, type, a1, ...)
 
#define JAU_FOR_EACH_VALUE(macro, type, value, ...)
 
#define JAU_FOR_EACH_VALUE_AGAIN()
 
#define JAU_FOR_EACH_VALUE_HELPER(macro, type, value, a1, ...)
 
#define JAU_MAKE_BITFIELD_ENUM_STRING(type, ...)
 
#define JAU_MAKE_BITFIELD_ENUM_STRING2(type, stype, ...)
 
#define JAU_MAKE_ENUM_INFO(type, ...)
 
#define JAU_MAKE_ENUM_INFO2(type, stype, ...)
 
#define JAU_MAKE_ENUM_STRING(type, ...)
 
#define JAU_MAKE_ENUM_STRING_SUB(type, stype, ...)
 
#define JAU_PARENS   ()
 
#define JAU_TYPENAME_CUE(A)
 
#define JAU_TYPENAME_CUE_ALL(A)
 
#define METHOD_CHECKER(checker, name, ret, args)
 Checker for member function with convertible return type and accepting given arguments.
 
#define METHOD_CHECKER_ANY(name, fn, args)
 Checker for member function accepting given arguments.
 
#define METHOD_CHECKER_STRICT_RET(name, fn, ret, args)
 Checker for member function with exact retutn type and accepting given arguments.
 
#define MTYPE_CHECKER(checker, name)
 Checker for member with given name and convertible type.
 
#define MTYPE_CHECKER_ANY(checker, name)
 Checker for member with given name and any type.
 
#define MTYPE_CHECKER_STRICT(checker, name)
 Checker for member with given name and exact type.
 
#define packed__
 packed__: lead in macro, requires __packed lead out as well.
 
#define PRAGMA_DISABLE_WARNING_CPP
 
#define PRAGMA_DISABLE_WARNING_FORMAT_NONLITERAL
 
#define PRAGMA_DISABLE_WARNING_FORMAT_OVERFLOW
 
#define PRAGMA_DISABLE_WARNING_INT_OVERFLOW
 
#define PRAGMA_DISABLE_WARNING_MULTICHAR
 
#define PRAGMA_DISABLE_WARNING_NULL_DEREFERENCE
 
#define PRAGMA_DISABLE_WARNING_PEDANTIC
 
#define PRAGMA_DISABLE_WARNING_PMF_CONVERSIONS
 
#define PRAGMA_DISABLE_WARNING_POP
 
#define PRAGMA_DISABLE_WARNING_PUSH
 
#define PRAGMA_DISABLE_WARNING_RESTRICT
 
#define PRAGMA_DISABLE_WARNING_STRINGOP_OVERFLOW
 
#define PRAGMA_DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER
 
#define PRAGMA_DISABLE_WARNING_UNREFERENCED_FUNCTION
 
#define PRAGMA_DISABLE_WARNING_ZERO_LENGTH_ARRAY
 

Typedefs

template<typename... Ts>
using jau::first_type = std::tuple_element_t<0, std::tuple<Ts...>>
 
template<typename... Ts>
using jau::is_all_same = std::conjunction<std::is_same<first_type<Ts...>, Ts>...>
 

Enumerations

enum class  jau::Bool : bool { jau::Bool::False = false , jau::Bool::True = true }
 Boolean type without implicit conversion, safe for function parameter. More...
 
enum class  jau::type_info_flags_t : uint16_t { jau::type_info_flags_t::none = 0 , jau::type_info_flags_t::obj = 1 << 0 , jau::type_info_flags_t::sig = 1 << 1 }
 
enum class  jau::TypeTraitGroup : uint8_t {
  jau::TypeTraitGroup::NONE = 0b00000000 , jau::TypeTraitGroup::PRIMARY_TYPE_CAT = 0b00000001 , jau::TypeTraitGroup::TYPE_PROPERTIES = 0b00000010 , jau::TypeTraitGroup::COMPOSITE_TYPE_CAT = 0b00000100 ,
  jau::TypeTraitGroup::SUPPORTED_OPERATIONS = 0b00001000 , jau::TypeTraitGroup::ALL = 0b11111111
}
 Enumerating the different groups of type traits. More...
 

Functions

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr void jau::enums::append_bitstr (std::string &out, E mask, E bit, const std::string &bitstr, bool &comma)
 
template<class Dest, class Source>
constexpr std::enable_if_t< sizeof(Dest)==sizeof(Source) &&std::is_trivially_copyable_v< Dest > &&std::is_trivially_copyable_v< Source >, Dest > jau::bit_cast (const Source &src) noexcept
 C++20 bit_cast<>(arg) implementation for C++17.
 
template<typename UnaryFunc>
void jau::callNotOptimize (UnaryFunc f) __attrdef_no_optimize__
 Simple unary function wrapper which ensures function call to happen in order and not optimized away.
 
template<typename T>
constexpr const char * jau::ctti_name () noexcept
 Returns the type name of given type T using template Compile Time Type Information (CTTI) only with static constant storage duration.
 
template<typename R, typename L, typename... A>
constexpr const char * jau::ctti_name () noexcept
 Returns the type name of given function types R(*L)(A...) using template Compile Time Type Information (CTTI) only with static constant storage duration.
 
std::string jau::demangle_name (const char *mangled_name) noexcept
 Returns the demangled given mangled_name if successful, otherwise the mangled_name.
 
template<typename E, E V>
consteval_cxx20 const char * jau::enums::enum_funcname () noexcept
 clang + gcc
 
constexpr Bool jau::False () noexcept
 
template<auto... Vargs>
consteval_cxx20 NameTable< Vargs... > jau::enums::get_names () noexcept
 
template<typename... Args>
constexpr ValueTable< std::common_type_t< Args... >, sizeof...(Args)> jau::enums::get_values (Args... args) noexcept
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr bool jau::enums::has_any (const E mask, const E bits) noexcept
 
consteval_cxx20 bool jau::has_builtin_bit_cast () noexcept
 Query whether __builtin_bit_cast(Dest_type, arg) is available via __has_builtin(__builtin_bit_cast).
 
consteval_cxx20 bool jau::is_builtin_int128_available () noexcept
 
consteval_cxx20 bool jau::is_cxx17 () noexcept
 Returns true if compiled with >= C++17.
 
consteval_cxx20 bool jau::is_cxx20 () noexcept
 Returns true if compiled with >= C++20.
 
consteval_cxx20 bool jau::is_cxx23 () noexcept
 Returns true if compiled with >= C++23.
 
consteval_cxx20 bool jau::is_cxx26 () noexcept
 Returns true if compiled with >= C++26.
 
consteval_cxx20 bool jau::is_debug_enabled () noexcept
 Returns true if compiled with debug information and w/o optimization, i.e.
 
template<auto V, std::enable_if_t< std::is_enum_v< decltype(V)> > * = nullptr>
consteval_cxx20 bool jau::enums::is_enum () noexcept
 
consteval_cxx20 bool jau::is_rtti_available () noexcept
 Returns true if compiled with RTTI available.
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr bool jau::enums::is_set (const E mask, const E bits) noexcept
 
constexpr bool jau::isTypeTraitBitSet (const TypeTraitGroup mask, const TypeTraitGroup bit) noexcept
 
 jau::JAU_MAKE_BITFIELD_ENUM_STRING (type_info_flags_t, obj, sig)
 
template<auto V, std::enable_if_t< std::is_enum_v< decltype(V)> > * = nullptr>
consteval_cxx20 std::string_view jau::enums::long_name () noexcept
 
template<typename T>
jau::type_info jau::make_ctti (bool identity_instance=false) noexcept
 Constructs a jau::type_info instance based on given type T using template Compile Time Type Information (CTTI) only.
 
template<typename R, typename L, typename... A>
jau::type_info jau::make_ctti (bool identity_instance=false) noexcept
 Constructs a jau::type_info instance based on given function types R(*L)(A...) using template Compile Time Type Information (CTTI) only via RTTI's `typeid(L) if available or jau::ctti_name<R, L, A...>() otherwise.
 
template<auto V, std::enable_if_t< std::is_enum_v< decltype(V)> > * = nullptr>
consteval_cxx20 std::string_view jau::enums::name () noexcept
 
constexpr std::string_view jau::name (const Bool v) noexcept
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr std::underlying_type_t< E > jau::enums::number (const E v) noexcept
 
constexpr uint8_t jau::number (const TypeTraitGroup rhs) noexcept
 
constexpr Bool jau::operator! (const Bool rhs) noexcept
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr bool jau::enums::operator!= (const E lhs, const E rhs) noexcept
 
constexpr bool jau::operator!= (const TypeTraitGroup lhs, const TypeTraitGroup rhs) noexcept
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr E jau::enums::operator& (const E lhs, const E rhs) noexcept
 
constexpr Bool jau::operator& (const Bool lhs, const Bool rhs) noexcept
 
constexpr TypeTraitGroup jau::operator& (const TypeTraitGroup lhs, const TypeTraitGroup rhs) noexcept
 
constexpr Bool jau::operator&& (const Bool lhs, const Bool rhs) noexcept
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr E & jau::enums::operator&= (E &lhs, const E rhs) noexcept
 
constexpr Booljau::operator&= (Bool &lhs, const Bool rhs) noexcept
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr std::underlying_type_t< E > jau::enums::operator* (const E v) noexcept
 
constexpr bool jau::operator* (const Bool rhs) noexcept
 
template<typename enum_info_t, std::enable_if_t< is_enum_info< enum_info_t >::value > * = nullptr>
std::ostream & jau::enums::operator<< (std::ostream &os, const enum_info_t &v)
 
template<typename T, std::enable_if_t< std::is_enum_v< T > > * = nullptr>
std::ostream & jau::enums::operator<< (std::ostream &os, const T v)
 
std::ostream & jau::operator<< (std::ostream &out, const Bool c)
 
std::ostream & jau::operator<< (std::ostream &out, const type_info &v)
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr bool jau::enums::operator== (const E lhs, const E rhs) noexcept
 
constexpr bool jau::operator== (const Bool lhs, const Bool rhs) noexcept
 
constexpr bool jau::operator== (const TypeTraitGroup lhs, const TypeTraitGroup rhs) noexcept
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr E jau::enums::operator^ (const E lhs, const E rhs) noexcept
 
constexpr Bool jau::operator^ (const Bool lhs, const Bool rhs) noexcept
 
constexpr TypeTraitGroup jau::operator^ (const TypeTraitGroup lhs, const TypeTraitGroup rhs) noexcept
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr E & jau::enums::operator^= (E &lhs, const E rhs) noexcept
 
constexpr Booljau::operator^= (Bool &lhs, const Bool rhs) noexcept
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr E jau::enums::operator| (const E lhs, const E rhs) noexcept
 
constexpr Bool jau::operator| (const Bool lhs, const Bool rhs) noexcept
 
constexpr TypeTraitGroup jau::operator| (const TypeTraitGroup lhs, const TypeTraitGroup rhs) noexcept
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr E & jau::enums::operator|= (E &lhs, const E rhs) noexcept
 
constexpr Booljau::operator|= (Bool &lhs, const Bool rhs) noexcept
 
constexpr Bool jau::operator|| (const Bool lhs, const Bool rhs) noexcept
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr E jau::enums::operator~ (const E rhs) noexcept
 
template<class Dest, class Source>
constexpr std::enable_if_t< sizeof(Dest)==sizeof(Source) &&std::is_pointer_v< Source > &&std::is_pointer_v< Dest >, Dest > jau::pointer_cast (const Source &src) noexcept
 A constexpr pointer cast implementation for C++17, inspired by C++20 bit_cast<>(arg).
 
template<typename T>
const jau::type_infojau::static_ctti () noexcept
 Returns a static global reference of make_ctti<T>(true) w/ identity instance.
 
template<typename R, typename L, typename... A>
const jau::type_infojau::static_ctti () noexcept
 Returns a static global reference of make_ctti<R, L, A...>(true) w/ identity instance.
 
constexpr std::string jau::to_string (const Bool v) noexcept
 
constexpr Bool jau::True () noexcept
 
template<typename T>
const char * jau::type_name () noexcept
 Returns the type name of given type T using template Compile Time Type Information (CTTI) only via RTTI's typeid(T).name() if available or jau::ctti_name<T>() otherwise.
 
template<typename R, typename L, typename... A>
const char * jau::type_name () noexcept
 Returns the type name of given function types R(*L)(A...) using template Compile Time Type Information (CTTI) only via RTTI's typeid(L).name() if available or jau::ctti_name<R, L, A...>() otherwise.
 
constexpr bool jau::value (const Bool rhs) noexcept
 
template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
constexpr E & jau::enums::write (E &store, const E bits, bool set) noexcept
 If set==true, sets the bits in store, i.e.
 

Variables

template<typename Dummy_type>
constexpr bool jau::has_builtin_bit_cast_v = has_builtin_bit_cast_t<Dummy_type>::value
 Value access of has_builtin_bit_cast type trait for convenience .
 
template<typename _Tp>
constexpr bool jau::has_member_of_pointer_v = has_member_of_pointer<_Tp>::value
 
template<typename _Tp>
constexpr bool jau::has_to_string_v = has_to_string<_Tp>::value
 
template<typename _Tp>
constexpr bool jau::has_toString_v = has_toString<_Tp>::value
 
template<typename... Ts>
constexpr bool jau::is_all_same_v = is_all_same<Ts...>::value
 
template<typename T>
constexpr bool jau::is_container_memmove_compliant_v = is_container_memmove_compliant<T>::value
 
template<typename T>
constexpr bool jau::is_enforcing_secmem_v = is_enforcing_secmem<T>::value
 
template<typename _Dummy>
constexpr bool jau::is_rtti_available_v = is_rtti_available_t<_Dummy>::value
 Template type trait helper evaluating true if RTTI is available, otherwise false.
 

Detailed Description

C++ language utilities, language feature alignment, type trails, data alignment and intrinsics.

Used predefined __cplusplus macro identifier for C++ language specs:

Used predefined macros denoting the compiler:

Further infos:

Macro Definition Documentation

◆ consteval_cxx20

#define consteval_cxx20   constexpr

consteval qualifier replacement for C++20 consteval.

A consteval specifier implies inline. At most one of the constexpr, consteval, and constinit specifiers is allowed to appear within the same sequence of declaration specifiers. ... An immediate function is a constexpr function, and must satisfy the requirements applicable to constexpr functions or constexpr constructors, as the case may be.

Evaluated using the alternative qualifier constexpr for C++ < 20, as it is almost contained within consteval but lacks the immediate function constraint.

Evaluated as consteval for C++20.

Definition at line 85 of file cpp_lang_util.hpp.

◆ constinit_cxx20

#define constinit_cxx20   constexpr

constinit qualifier replacement for C++20 constinit.

constinit cannot be used together with constexpr or consteval. When the declared variable is a reference, constinit is equivalent to constexpr. When the declared variable is an object, constexpr mandates that the object must have static initialization and constant destruction and makes the object const-qualified, however, constinit does not mandate constant destruction and const-qualification.

Evaluated using the alternative qualifier constexpr for C++ < 20, as it is almost contained within constinit but lacks the loosening of not mandating constant destruction and const-qualification.
FIXME: Due to the above, this replacement might not be suitable: TBD!

Evaluated as constinit for C++20.

Definition at line 142 of file cpp_lang_util.hpp.

◆ constexpr_cxx20

#define constexpr_cxx20   inline

constexpr qualifier replacement for C++20 constexpr.

A constexpr specifier used in a function or static member variable (since C++17) declaration implies inline.

Evaluated using the alternative qualifier inline for C++ < 20, as it is implied for constexpr functions or static member variables, see above.

Evaluated as constexpr for C++20, i.e. std::string literals, virtual functions, etc.

Definition at line 161 of file cpp_lang_util.hpp.

◆ constexpr_cxx23

#define constexpr_cxx23   inline

Definition at line 167 of file cpp_lang_util.hpp.

◆ constexpr_cxx26

#define constexpr_cxx26   inline

Definition at line 173 of file cpp_lang_util.hpp.

◆ constexpr_non_literal_var

#define constexpr_non_literal_var   constexpr_cxx23

Used when designed to declare a function constexpr, but prohibited by its specific implementation.

Evaluated using the alternative qualifier inline for C++ < 23, as it is implied for constexpr functions or static member variables, see constexpr_cxx23.

Here it but uses non-literal variables, such as std::lock_guard etc. As these can't be evaluated at compile time, the standard does not allow using constexpr here.

Empty until standard defines otherwise.

See also
constexpr_cxx23

Definition at line 194 of file cpp_lang_util.hpp.

◆ constexpr_atomic

#define constexpr_atomic   constexpr_cxx23

Used when designed to declare a function constexpr, but prohibited by its specific implementation.

Evaluated using the alternative qualifier inline for C++ < 23, as it is implied for constexpr functions or static member variables, see constexpr_cxx23.

Here it uses thread-safety related measures like atomic storage or mutex locks, which are non-literal variables and hence prohibit the use of constexpr.

See also
constexpr_cxx23
constexpr_non_literal_var

Definition at line 211 of file cpp_lang_util.hpp.

◆ __restrict_cxx__

#define __restrict_cxx__

Wrap C++ extension __restrict__ covering C99's restrict feature keyword.

Definition at line 223 of file cpp_lang_util.hpp.

◆ final_opt

#define final_opt   final

Optional generic usage of final keyword w/o negative performance impact.

(Enabled, OK?)

Definition at line 269 of file cpp_lang_util.hpp.

◆ __attrdecl_no_optimize__

#define __attrdecl_no_optimize__

Definition at line 431 of file cpp_lang_util.hpp.

◆ __attrdef_no_optimize__

#define __attrdef_no_optimize__

Definition at line 432 of file cpp_lang_util.hpp.

◆ PRAGMA_DISABLE_WARNING_PUSH

#define PRAGMA_DISABLE_WARNING_PUSH

Definition at line 85 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_POP

#define PRAGMA_DISABLE_WARNING_POP

Definition at line 86 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER

#define PRAGMA_DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER

Definition at line 87 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_UNREFERENCED_FUNCTION

#define PRAGMA_DISABLE_WARNING_UNREFERENCED_FUNCTION

Definition at line 88 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_CPP

#define PRAGMA_DISABLE_WARNING_CPP

Definition at line 89 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_MULTICHAR

#define PRAGMA_DISABLE_WARNING_MULTICHAR

Definition at line 90 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_NULL_DEREFERENCE

#define PRAGMA_DISABLE_WARNING_NULL_DEREFERENCE

Definition at line 91 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_FORMAT_OVERFLOW

#define PRAGMA_DISABLE_WARNING_FORMAT_OVERFLOW

Definition at line 92 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_FORMAT_NONLITERAL

#define PRAGMA_DISABLE_WARNING_FORMAT_NONLITERAL

Definition at line 93 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_PMF_CONVERSIONS

#define PRAGMA_DISABLE_WARNING_PMF_CONVERSIONS

Definition at line 94 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_STRINGOP_OVERFLOW

#define PRAGMA_DISABLE_WARNING_STRINGOP_OVERFLOW

Definition at line 95 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_INT_OVERFLOW

#define PRAGMA_DISABLE_WARNING_INT_OVERFLOW

Definition at line 96 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_RESTRICT

#define PRAGMA_DISABLE_WARNING_RESTRICT

Definition at line 97 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_PEDANTIC

#define PRAGMA_DISABLE_WARNING_PEDANTIC

Definition at line 98 of file cpp_pragma.hpp.

◆ PRAGMA_DISABLE_WARNING_ZERO_LENGTH_ARRAY

#define PRAGMA_DISABLE_WARNING_ZERO_LENGTH_ARRAY

Definition at line 99 of file cpp_pragma.hpp.

◆ JAU_PARENS

#define JAU_PARENS   ()

Definition at line 576 of file enum_util.hpp.

◆ JAU_EXPAND

#define JAU_EXPAND ( ...)
Value:
#define JAU_EXPAND4(...)

Definition at line 578 of file enum_util.hpp.

◆ JAU_EXPAND4

#define JAU_EXPAND4 ( ...)
Value:
#define JAU_EXPAND3(...)

Definition at line 579 of file enum_util.hpp.

◆ JAU_EXPAND3

#define JAU_EXPAND3 ( ...)
Value:
#define JAU_EXPAND2(...)

Definition at line 580 of file enum_util.hpp.

◆ JAU_EXPAND2

#define JAU_EXPAND2 ( ...)
Value:
#define JAU_EXPAND1(...)

Definition at line 581 of file enum_util.hpp.

◆ JAU_EXPAND1

#define JAU_EXPAND1 ( ...)
Value:
__VA_ARGS__

Definition at line 582 of file enum_util.hpp.

◆ JAU_FOR_EACH

#define JAU_FOR_EACH ( macro,
type,
... )
Value:
__VA_OPT__(JAU_EXPAND(JAU_FOR_EACH_HELPER(macro, type, __VA_ARGS__)))
#define JAU_EXPAND(...)
#define JAU_FOR_EACH_HELPER(macro, type, a1,...)

Definition at line 584 of file enum_util.hpp.

◆ JAU_FOR_EACH_HELPER

#define JAU_FOR_EACH_HELPER ( macro,
type,
a1,
... )
Value:
macro(type, a1) \
__VA_OPT__(JAU_FOR_EACH_AGAIN JAU_PARENS (macro, type, __VA_ARGS__))
#define JAU_PARENS
#define JAU_FOR_EACH_AGAIN()

Definition at line 586 of file enum_util.hpp.

◆ JAU_FOR_EACH_AGAIN

#define JAU_FOR_EACH_AGAIN ( )
Value:

Definition at line 589 of file enum_util.hpp.

◆ JAU_ENUM_CASE_SHORT

#define JAU_ENUM_CASE_SHORT ( type,
name )
Value:
case type::name: return #name;

Definition at line 591 of file enum_util.hpp.

◆ JAU_ENUM_CASE_LONG

#define JAU_ENUM_CASE_LONG ( type,
name )
Value:
case type::name: return #type "::" #name;

Definition at line 592 of file enum_util.hpp.

◆ JAU_FOR_EACH_LIST

#define JAU_FOR_EACH_LIST ( macro,
type,
... )
Value:
__VA_OPT__(JAU_EXPAND(JAU_FOR_EACH_LIST_HELPER(macro, type, __VA_ARGS__)))
#define JAU_FOR_EACH_LIST_HELPER(macro, type, a1,...)

Definition at line 594 of file enum_util.hpp.

◆ JAU_FOR_EACH_LIST_HELPER

#define JAU_FOR_EACH_LIST_HELPER ( macro,
type,
a1,
... )
Value:
macro(type, a1) \
__VA_OPT__(, JAU_FOR_EACH_LIST_AGAIN JAU_PARENS (macro, type, __VA_ARGS__))
#define JAU_FOR_EACH_LIST_AGAIN()

Definition at line 596 of file enum_util.hpp.

◆ JAU_FOR_EACH_LIST_AGAIN

#define JAU_FOR_EACH_LIST_AGAIN ( )
Value:

Definition at line 599 of file enum_util.hpp.

◆ JAU_ENUM_TYPE_VALUE

#define JAU_ENUM_TYPE_VALUE ( type,
name )
Value:
type::name

Definition at line 601 of file enum_util.hpp.

◆ JAU_ENUM_VALUE

#define JAU_ENUM_VALUE ( type,
name )
Value:
name

Definition at line 602 of file enum_util.hpp.

◆ JAU_FOR_EACH_VALUE

#define JAU_FOR_EACH_VALUE ( macro,
type,
value,
... )
Value:
__VA_OPT__(JAU_EXPAND(JAU_FOR_EACH_VALUE_HELPER(macro, type, value, __VA_ARGS__)))
#define JAU_FOR_EACH_VALUE_HELPER(macro, type, value, a1,...)

Definition at line 604 of file enum_util.hpp.

◆ JAU_FOR_EACH_VALUE_HELPER

#define JAU_FOR_EACH_VALUE_HELPER ( macro,
type,
value,
a1,
... )
Value:
macro(type, a1, value) \
__VA_OPT__(JAU_FOR_EACH_VALUE_AGAIN JAU_PARENS (macro, type, value, __VA_ARGS__))
#define JAU_FOR_EACH_VALUE_AGAIN()

Definition at line 606 of file enum_util.hpp.

◆ JAU_FOR_EACH_VALUE_AGAIN

#define JAU_FOR_EACH_VALUE_AGAIN ( )
Value:

Definition at line 609 of file enum_util.hpp.

◆ JAU_MAKE_ENUM_STRING

#define JAU_MAKE_ENUM_STRING ( type,
... )
Value:
JAU_MAKE_ENUM_STRING_SUB(type, type, __VA_ARGS__) \
\
constexpr std::string \
to_string(const type e) \
{ return std::string(name(e)); } \
#define JAU_MAKE_ENUM_STRING_SUB(type, stype,...)

Definition at line 611 of file enum_util.hpp.

◆ JAU_APPEND_BITSTR

#define JAU_APPEND_BITSTR ( U,
V,
M )
Value:
jau::enums::append_bitstr(out, M, U::V, #V, comma);
constexpr void append_bitstr(std::string &out, E mask, E bit, const std::string &bitstr, bool &comma)

Definition at line 618 of file enum_util.hpp.

◆ JAU_MAKE_BITFIELD_ENUM_STRING

#define JAU_MAKE_BITFIELD_ENUM_STRING ( type,
... )
Value:
JAU_MAKE_ENUM_STRING_SUB(type, type, __VA_ARGS__) \
\
inline std::string \
to_string(const type mask) { \
std::string out("["); \
bool comma = false; \
JAU_FOR_EACH_VALUE(JAU_APPEND_BITSTR, type, mask, __VA_ARGS__); \
out.append("]"); \
return out; \
} \
#define JAU_APPEND_BITSTR(U, V, M)

Definition at line 620 of file enum_util.hpp.

◆ JAU_MAKE_BITFIELD_ENUM_STRING2

#define JAU_MAKE_BITFIELD_ENUM_STRING2 ( type,
stype,
... )
Value:
JAU_MAKE_ENUM_STRING_SUB(type, stype, __VA_ARGS__) \
\
inline std::string \
to_string(const type mask) { \
std::string out("["); \
bool comma = false; \
JAU_FOR_EACH_VALUE(JAU_APPEND_BITSTR, type, mask, __VA_ARGS__); \
out.append("]"); \
return out; \
} \

Definition at line 632 of file enum_util.hpp.

◆ JAU_MAKE_ENUM_STRING_SUB

#define JAU_MAKE_ENUM_STRING_SUB ( type,
stype,
... )
Value:
constexpr std::string_view \
long_name(const type v) noexcept \
{ \
switch (v) { \
JAU_FOR_EACH(JAU_ENUM_CASE_LONG, type, __VA_ARGS__) \
default: \
return "undef " #stype; \
} \
} \
constexpr std::string_view \
name(const type v) noexcept \
{ \
switch (v) { \
JAU_FOR_EACH(JAU_ENUM_CASE_SHORT, type, __VA_ARGS__) \
default: \
return "undef"; \
} \
} \
constexpr std::string_view \
type_name(const type) noexcept \
{ \
return #stype; \
} \
#define JAU_ENUM_CASE_SHORT(type, name)
#define JAU_ENUM_CASE_LONG(type, name)

Definition at line 645 of file enum_util.hpp.

◆ JAU_MAKE_ENUM_INFO

#define JAU_MAKE_ENUM_INFO ( type,
... )
Value:
JAU_MAKE_ENUM_INFO2(type, type, __VA_ARGS__) \
#define JAU_MAKE_ENUM_INFO2(type, stype,...)

Definition at line 670 of file enum_util.hpp.

◆ JAU_MAKE_ENUM_INFO2

#define JAU_MAKE_ENUM_INFO2 ( type,
stype,
... )
Value:
typedef jau::enums::enum_info<type, JAU_FOR_EACH_LIST(JAU_ENUM_TYPE_VALUE, type, __VA_ARGS__)> stype##_info_t; \
Enumeration info template class including iterator (enum_iterator)
#define JAU_FOR_EACH_LIST(macro, type,...)
#define JAU_ENUM_TYPE_VALUE(type, name)

Definition at line 673 of file enum_util.hpp.

◆ packed__

#define packed__

packed__: lead in macro, requires __packed lead out as well.

Consider using __pack(...).

Definition at line 39 of file packed_attribute.hpp.

◆ __packed

#define __packed   __attribute__ ((packed))

packed: lead out macro, requires packed lead in as well.

Consider using __pack(...).

Definition at line 48 of file packed_attribute.hpp.

◆ JAU_TYPENAME_CUE

#define JAU_TYPENAME_CUE ( A)
Value:
template<> struct jau::type_name_cue<A> { static const char * name() { return #A; } };
Helper, allowing simple access and provision of a typename string representation at compile time,...

Definition at line 249 of file type_traits_queries.hpp.

◆ JAU_TYPENAME_CUE_ALL

#define JAU_TYPENAME_CUE_ALL ( A)
Value:
Examples
test_cow_iterator_01.cpp.

Definition at line 250 of file type_traits_queries.hpp.

◆ MTYPE_CHECKER

#define MTYPE_CHECKER ( checker,
name )
Value:
template<class C, typename T, typename = void> struct checker : std::false_type {}; \
template<class C, typename T> struct checker<C, T, typename std::enable_if_t< \
std::is_convertible_v<decltype(C::name), T>>> : std::true_type {}
STL namespace.

Checker for member with given name and convertible type.

Examples
test_type_traits_queries01.cpp.

Definition at line 341 of file type_traits_queries.hpp.

◆ MTYPE_CHECKER_STRICT

#define MTYPE_CHECKER_STRICT ( checker,
name )
Value:
template<class C, typename T, typename = void> struct checker : std::false_type {}; \
template<class C, typename T> struct checker<C, T, typename std::enable_if_t< \
std::is_same_v<decltype(C::name), T>>> : std::true_type {}

Checker for member with given name and exact type.

Examples
test_type_traits_queries01.cpp.

Definition at line 347 of file type_traits_queries.hpp.

◆ MTYPE_CHECKER_ANY

#define MTYPE_CHECKER_ANY ( checker,
name )
Value:
template<class C, typename = void> struct checker : std::false_type {}; \
template<class C> struct checker<C, typename std::enable_if_t< \
!std::is_same_v<decltype(C::name)*, void>>> : std::true_type {}

Checker for member with given name and any type.

Examples
test_type_traits_queries01.cpp.

Definition at line 353 of file type_traits_queries.hpp.

◆ METHOD_CHECKER

#define METHOD_CHECKER ( checker,
name,
ret,
args )
Value:
template<class C, typename=void> struct checker : std::false_type {}; \
template<class C> struct checker<C, typename std::enable_if_t< \
std::is_convertible_v<decltype(std::declval<C>().name args), ret>>> : std::true_type {};

Checker for member function with convertible return type and accepting given arguments.

Examples
test_type_traits_queries01.cpp.

Definition at line 359 of file type_traits_queries.hpp.

◆ METHOD_CHECKER_STRICT_RET

#define METHOD_CHECKER_STRICT_RET ( name,
fn,
ret,
args )
Value:
template<class C, typename=void> struct name : std::false_type {}; \
template<class C> struct name<C, typename std::enable_if_t< \
std::is_same_v<decltype(std::declval<C>().fn args), ret>>> : std::true_type {};

Checker for member function with exact retutn type and accepting given arguments.

Definition at line 365 of file type_traits_queries.hpp.

◆ METHOD_CHECKER_ANY

#define METHOD_CHECKER_ANY ( name,
fn,
args )
Value:
template<class C, typename=void> struct name : std::false_type {}; \
template<class C> struct name<C, typename std::enable_if_t< \
!std::is_same_v<decltype(std::declval<C>().fn args)*, void>>> : std::true_type {};

Checker for member function accepting given arguments.

Definition at line 371 of file type_traits_queries.hpp.

Typedef Documentation

◆ first_type

template<typename... Ts>
using jau::first_type = std::tuple_element_t<0, std::tuple<Ts...>>

Definition at line 293 of file type_traits_queries.hpp.

◆ is_all_same

template<typename... Ts>
using jau::is_all_same = std::conjunction<std::is_same<first_type<Ts...>, Ts>...>

Definition at line 296 of file type_traits_queries.hpp.

Enumeration Type Documentation

◆ Bool

enum class jau::Bool : bool
strong

Boolean type without implicit conversion, safe for function parameter.

Enumerator
False 
True 

Definition at line 446 of file cpp_lang_util.hpp.

◆ type_info_flags_t

enum class jau::type_info_flags_t : uint16_t
strong
Enumerator
none 
obj 
sig 

Definition at line 154 of file type_info.hpp.

◆ TypeTraitGroup

enum class jau::TypeTraitGroup : uint8_t
strong

Enumerating the different groups of type traits.

Enumerator
NONE 

NONE.

PRIMARY_TYPE_CAT 

PRIMARY_TYPE_CAT.

TYPE_PROPERTIES 

TYPE_PROPERTIES.

COMPOSITE_TYPE_CAT 

COMPOSITE_TYPE_CAT.

SUPPORTED_OPERATIONS 

SUPPORTED_OPERATIONS.

ALL 

ALL.

Definition at line 53 of file type_traits_queries.hpp.

Function Documentation

◆ is_cxx17()

consteval_cxx20 bool jau::is_cxx17 ( )
noexcept

Returns true if compiled with >= C++17.

Definition at line 89 of file cpp_lang_util.hpp.

◆ is_cxx20()

consteval_cxx20 bool jau::is_cxx20 ( )
noexcept

Returns true if compiled with >= C++20.

Definition at line 97 of file cpp_lang_util.hpp.

◆ is_cxx23()

consteval_cxx20 bool jau::is_cxx23 ( )
noexcept

Returns true if compiled with >= C++23.

Definition at line 105 of file cpp_lang_util.hpp.

◆ is_cxx26()

consteval_cxx20 bool jau::is_cxx26 ( )
noexcept

Returns true if compiled with >= C++26.

Definition at line 113 of file cpp_lang_util.hpp.

◆ demangle_name()

std::string jau::demangle_name ( const char * mangled_name)
noexcept

Returns the demangled given mangled_name if successful, otherwise the mangled_name.

Implementation utilizes the cross-vendor C++ ABI abi::__cxa_demangle() as supported at least on on gcc and clang.

May be used to demangle the result of jau::type_name() or jau::type_info::name() if jau::type_info::rtti_available == true, i.e. RTTI typeif(T) symbols are being used.

See also gcc libstdc++ FAQ, Chapter 28.

Further, implementation also checks whether the mangled_name results from jau::ctti_name<T>() and cleans up the known gcc and clang variant of JAU_PRETTY_FUNCTION.

Parameters
mangled_namemangled name

Definition at line 57 of file debug.cpp.

Here is the caller graph for this function:

◆ has_builtin_bit_cast()

consteval_cxx20 bool jau::has_builtin_bit_cast ( )
noexcept

Query whether __builtin_bit_cast(Dest_type, arg) is available via __has_builtin(__builtin_bit_cast).


Availability of __builtin_bit_cast(Dest_type, arg)

Reflecting my manual platform tests using test_basictypeconv.cpp

Compiler Version Architecture Available
GCC 8.3.0 amd64, arm64, arm32 no
GCC 10.2.1 amd64 no
GCC 12.2.0 amd64 yes
clang 9.0.1 amd64, arm64 yes
clang 11.0.1 amd64 yes
Returns
true if query subject is available, otherwise not.
See also
has_builtin_bit_cast_t
bit_cast()
pointer_cast()

Definition at line 323 of file cpp_lang_util.hpp.

Here is the caller graph for this function:

◆ pointer_cast()

template<class Dest, class Source>
std::enable_if_t< sizeof(Dest)==sizeof(Source) &&std::is_pointer_v< Source > &&std::is_pointer_v< Dest >, Dest > jau::pointer_cast ( const Source & src)
constexprnoexcept

A constexpr pointer cast implementation for C++17, inspired by C++20 bit_cast<>(arg).

If is_builtin_bit_cast_available() evaluates true, implementation uses __builtin_bit_cast(Dest, src).

Otherwise a simple reinterpret_cast<Dest>(src) is utilized, which officially is questionable to deliver a constexpr.

Template Parameters
Destthe target pointer type
Sourcethe source pointer argument type
Parameters
srcthe pointer to convert to Dest pointer type
Returns
the converted Dest pointer type value
See also
jau::has_builtin_bit_cast
is_builtin_bit_cast_available()
bit_cast()

Definition at line 356 of file cpp_lang_util.hpp.

Here is the caller graph for this function:

◆ bit_cast()

template<class Dest, class Source>
std::enable_if_t< sizeof(Dest)==sizeof(Source) &&std::is_trivially_copyable_v< Dest > &&std::is_trivially_copyable_v< Source >, Dest > jau::bit_cast ( const Source & src)
constexprnoexcept

C++20 bit_cast<>(arg) implementation for C++17.

Utilizing native bit_cast if is_builtin_bit_cast_available(), otherwise pointer_cast<const packed_t<Dest>*>( &src )->store.

Template Parameters
Destthe target type
Sourcethe source argument type
Parameters
srcthe value to convert to Dest type
Returns
the converted Dest type value
See also
jau::has_builtin_bit_cast
is_builtin_bit_cast_available()
pointer_cast()

Definition at line 386 of file cpp_lang_util.hpp.

Here is the caller graph for this function:

◆ is_builtin_int128_available()

consteval_cxx20 bool jau::is_builtin_int128_available ( )
noexcept

Definition at line 395 of file cpp_lang_util.hpp.

Here is the caller graph for this function:

◆ is_debug_enabled()

consteval_cxx20 bool jau::is_debug_enabled ( )
noexcept

Returns true if compiled with debug information and w/o optimization, i.e.

not defined(NDEBUG) && !defined(DEBUG).

Definition at line 415 of file cpp_lang_util.hpp.

Here is the caller graph for this function:

◆ callNotOptimize()

template<typename UnaryFunc>
void jau::callNotOptimize ( UnaryFunc f)
inline

Simple unary function wrapper which ensures function call to happen in order and not optimized away.

Definition at line 439 of file cpp_lang_util.hpp.

◆ True()

Bool jau::True ( )
constexprnoexcept

Definition at line 450 of file cpp_lang_util.hpp.

Here is the caller graph for this function:

◆ False()

Bool jau::False ( )
constexprnoexcept

Definition at line 451 of file cpp_lang_util.hpp.

Here is the caller graph for this function:

◆ value()

bool jau::value ( const Bool rhs)
constexprnoexcept

Definition at line 453 of file cpp_lang_util.hpp.

Here is the caller graph for this function:

◆ operator*() [1/2]

bool jau::operator* ( const Bool rhs)
constexprnoexcept

Definition at line 456 of file cpp_lang_util.hpp.

◆ operator!()

Bool jau::operator! ( const Bool rhs)
constexprnoexcept

Definition at line 459 of file cpp_lang_util.hpp.

◆ operator&&()

Bool jau::operator&& ( const Bool lhs,
const Bool rhs )
constexprnoexcept

Definition at line 462 of file cpp_lang_util.hpp.

◆ operator||()

Bool jau::operator|| ( const Bool lhs,
const Bool rhs )
constexprnoexcept

Definition at line 465 of file cpp_lang_util.hpp.

◆ operator^() [1/3]

Bool jau::operator^ ( const Bool lhs,
const Bool rhs )
constexprnoexcept

Definition at line 468 of file cpp_lang_util.hpp.

◆ operator|() [1/3]

Bool jau::operator| ( const Bool lhs,
const Bool rhs )
constexprnoexcept

Definition at line 471 of file cpp_lang_util.hpp.

◆ operator&() [1/3]

Bool jau::operator& ( const Bool lhs,
const Bool rhs )
constexprnoexcept

Definition at line 474 of file cpp_lang_util.hpp.

◆ operator|=() [1/2]

Bool & jau::operator|= ( Bool & lhs,
const Bool rhs )
constexprnoexcept

Definition at line 477 of file cpp_lang_util.hpp.

◆ operator&=() [1/2]

Bool & jau::operator&= ( Bool & lhs,
const Bool rhs )
constexprnoexcept

Definition at line 481 of file cpp_lang_util.hpp.

◆ operator^=() [1/2]

Bool & jau::operator^= ( Bool & lhs,
const Bool rhs )
constexprnoexcept

Definition at line 485 of file cpp_lang_util.hpp.

◆ operator==() [1/3]

bool jau::operator== ( const Bool lhs,
const Bool rhs )
constexprnoexcept

Definition at line 489 of file cpp_lang_util.hpp.

◆ name() [1/2]

std::string_view jau::name ( const Bool v)
constexprnoexcept

Definition at line 492 of file cpp_lang_util.hpp.

Here is the caller graph for this function:

◆ to_string()

std::string jau::to_string ( const Bool v)
constexprnoexcept

Definition at line 499 of file cpp_lang_util.hpp.

◆ operator<<() [1/4]

std::ostream & jau::operator<< ( std::ostream & out,
const Bool c )
inline

Definition at line 500 of file cpp_lang_util.hpp.

◆ enum_funcname()

template<typename E, E V>
consteval_cxx20 const char * jau::enums::enum_funcname ( )
noexcept

clang + gcc

Definition at line 77 of file enum_util.hpp.

Here is the caller graph for this function:

◆ is_enum()

template<auto V, std::enable_if_t< std::is_enum_v< decltype(V)> > * = nullptr>
consteval_cxx20 bool jau::enums::is_enum ( )
noexcept

Definition at line 84 of file enum_util.hpp.

Here is the caller graph for this function:

◆ long_name()

template<auto V, std::enable_if_t< std::is_enum_v< decltype(V)> > * = nullptr>
consteval_cxx20 std::string_view jau::enums::long_name ( )
noexcept

Definition at line 99 of file enum_util.hpp.

Here is the caller graph for this function:

◆ name() [2/2]

template<auto V, std::enable_if_t< std::is_enum_v< decltype(V)> > * = nullptr>
consteval_cxx20 std::string_view jau::enums::name ( )
noexcept

Definition at line 119 of file enum_util.hpp.

Here is the caller graph for this function:

◆ get_names()

template<auto... Vargs>
consteval_cxx20 NameTable< Vargs... > jau::enums::get_names ( )
noexcept

Definition at line 150 of file enum_util.hpp.

Here is the caller graph for this function:

◆ get_values()

template<typename... Args>
ValueTable< std::common_type_t< Args... >, sizeof...(Args)> jau::enums::get_values ( Args... args)
constexprnoexcept

Definition at line 160 of file enum_util.hpp.

Here is the caller graph for this function:

◆ number() [1/2]

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
std::underlying_type_t< E > jau::enums::number ( const E v)
constexprnoexcept

Definition at line 166 of file enum_util.hpp.

Here is the caller graph for this function:

◆ operator*() [2/2]

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
std::underlying_type_t< E > jau::enums::operator* ( const E v)
constexprnoexcept

Definition at line 170 of file enum_util.hpp.

◆ operator~()

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
E jau::enums::operator~ ( const E rhs)
constexprnoexcept

Definition at line 173 of file enum_util.hpp.

◆ operator^() [2/3]

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
E jau::enums::operator^ ( const E lhs,
const E rhs )
constexprnoexcept

Definition at line 178 of file enum_util.hpp.

◆ operator|() [2/3]

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
E jau::enums::operator| ( const E lhs,
const E rhs )
constexprnoexcept

Definition at line 183 of file enum_util.hpp.

◆ operator&() [2/3]

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
E jau::enums::operator& ( const E lhs,
const E rhs )
constexprnoexcept

Definition at line 188 of file enum_util.hpp.

◆ operator|=() [2/2]

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
E & jau::enums::operator|= ( E & lhs,
const E rhs )
constexprnoexcept

Definition at line 193 of file enum_util.hpp.

◆ operator&=() [2/2]

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
E & jau::enums::operator&= ( E & lhs,
const E rhs )
constexprnoexcept

Definition at line 198 of file enum_util.hpp.

◆ write()

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
E & jau::enums::write ( E & store,
const E bits,
bool set )
constexprnoexcept

If set==true, sets the bits in store, i.e.

equivalent to store |= bits operation.

Otherwise clears the bits in store, i.e. equivalent to store &= ~bits operation.

Returns store reference.

Definition at line 210 of file enum_util.hpp.

Here is the caller graph for this function:

◆ operator^=() [2/2]

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
E & jau::enums::operator^= ( E & lhs,
const E rhs )
constexprnoexcept

Definition at line 219 of file enum_util.hpp.

◆ operator==() [2/3]

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
bool jau::enums::operator== ( const E lhs,
const E rhs )
constexprnoexcept

Definition at line 224 of file enum_util.hpp.

◆ operator!=() [1/2]

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
bool jau::enums::operator!= ( const E lhs,
const E rhs )
constexprnoexcept

Definition at line 229 of file enum_util.hpp.

◆ is_set()

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
bool jau::enums::is_set ( const E mask,
const E bits )
constexprnoexcept

Definition at line 234 of file enum_util.hpp.

Here is the caller graph for this function:

◆ has_any()

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
bool jau::enums::has_any ( const E mask,
const E bits )
constexprnoexcept

Definition at line 239 of file enum_util.hpp.

Here is the caller graph for this function:

◆ append_bitstr()

template<typename E, std::enable_if_t< std::is_enum_v< E > > * = nullptr>
void jau::enums::append_bitstr ( std::string & out,
E mask,
E bit,
const std::string & bitstr,
bool & comma )
constexpr

Definition at line 244 of file enum_util.hpp.

◆ operator<<() [2/4]

template<typename T, std::enable_if_t< std::is_enum_v< T > > * = nullptr>
std::ostream & jau::enums::operator<< ( std::ostream & os,
const T v )
inline

Definition at line 253 of file enum_util.hpp.

◆ operator<<() [3/4]

template<typename enum_info_t, std::enable_if_t< is_enum_info< enum_info_t >::value > * = nullptr>
std::ostream & jau::enums::operator<< ( std::ostream & os,
const enum_info_t & v )
inline

Definition at line 335 of file enum_util.hpp.

◆ is_rtti_available()

consteval_cxx20 bool jau::is_rtti_available ( )
noexcept

Returns true if compiled with RTTI available.

Examples
test_functional.hpp, and test_functional_perf.hpp.

Definition at line 88 of file type_info.hpp.

Here is the caller graph for this function:

◆ ctti_name() [1/2]

template<typename T>
const char * jau::ctti_name ( )
constexprnoexcept

Returns the type name of given type T using template Compile Time Type Information (CTTI) only with static constant storage duration.

Template Parameters
Tthe type
Returns
instance of jau::type_info
See also
jau::make_ctti<T>
ctti_name_lambda
Examples
test_functional.hpp.

Definition at line 108 of file type_info.hpp.

Here is the caller graph for this function:

◆ ctti_name() [2/2]

template<typename R, typename L, typename... A>
const char * jau::ctti_name ( )
constexprnoexcept

Returns the type name of given function types R(*L)(A...) using template Compile Time Type Information (CTTI) only with static constant storage duration.

Limitations

Non unique function pointer type names with same prototype

With RTTI or wihout, c-alike function pointer type names like int(*)(int) do not expose their source location like lambda functions do. Hence they can't be used to compare code identity, but lambda functions can be used.

Non unique lambda type names without RTTI using gcc or non clang compiler

Due to the lack of standardized Compile-Time Type Information (CTTI), we rely on the non-standardized macro extensions

  • __PRETTY_FUNCTION__
    • clang produces a unique tag using filename and line number, compatible.
    • gcc produces a non-unique tag using the parent function of the lambda location and its too brief signature, not fully compatible.
  • __FUNCSIG__
    • msvc++ not tested
  • Any other compiler is not supported yet

Due to these restrictions, not using RTTI on gcc or non clang compiler will erroneously mistake different lambda functions defined within one function and using same function prototype R<A...> to be the same.

jau::type_info::limited_lambda_id exposes the potential limitation.

Template Parameters
Rfunction return type
Lmain function type, e.g. a lambda type.
Afunction argument types
Returns
instance of jau::type_info
See also
jau::make_ctti<R, L, A...>
ctti_name_type
jau::type_info::limited_lambda_id

Definition at line 150 of file type_info.hpp.

◆ JAU_MAKE_BITFIELD_ENUM_STRING()

jau::JAU_MAKE_BITFIELD_ENUM_STRING ( type_info_flags_t ,
obj ,
sig  )

◆ operator<<() [4/4]

std::ostream & jau::operator<< ( std::ostream & out,
const type_info & v )
inline

Definition at line 370 of file type_info.hpp.

◆ make_ctti() [1/2]

template<typename T>
jau::type_info jau::make_ctti ( bool identity_instance = false)
noexcept

Constructs a jau::type_info instance based on given type T using template Compile Time Type Information (CTTI) only.

This construction function either uses typeid(T) if jau::type_info::rtti_available == true or jau::ctti_name<T>() otherwise.

Template Parameters
Ttype for which the type_info is generated
Returns
instance of jau::type_info
See also
jau::ctti_name<T>

Definition at line 387 of file type_info.hpp.

Here is the caller graph for this function:

◆ static_ctti() [1/2]

template<typename T>
const jau::type_info & jau::static_ctti ( )
noexcept

Returns a static global reference of make_ctti<T>(true) w/ identity instance.

Definition at line 397 of file type_info.hpp.

Here is the caller graph for this function:

◆ make_ctti() [2/2]

template<typename R, typename L, typename... A>
jau::type_info jau::make_ctti ( bool identity_instance = false)
noexcept

Constructs a jau::type_info instance based on given function types R(*L)(A...) using template Compile Time Type Information (CTTI) only via RTTI's `typeid(L) if available or jau::ctti_name<R, L, A...>() otherwise.

This construction function either uses typeid(L) if jau::type_info::rtti_available == true or jau::ctti_name<R, L, A...>() otherwise.

Template Parameters
Rfunction return type used for type_info in case of jau::type_info::rtti_available == false
Lmain function type for which the type_info is generated, e.g. a lambda type.
Afunction argument types used for type_info in case of jau::type_info::rtti_available == false
Returns
instance of jau::type_info
See also
jau::ctti_name<R, L, A...>

Definition at line 418 of file type_info.hpp.

◆ static_ctti() [2/2]

template<typename R, typename L, typename... A>
const jau::type_info & jau::static_ctti ( )
noexcept

Returns a static global reference of make_ctti<R, L, A...>(true) w/ identity instance.

Definition at line 428 of file type_info.hpp.

◆ type_name() [1/2]

template<typename T>
const char * jau::type_name ( )
noexcept

Returns the type name of given type T using template Compile Time Type Information (CTTI) only via RTTI's typeid(T).name() if available or jau::ctti_name<T>() otherwise.

Template Parameters
Ttype for which the type_info is generated
Returns
type name
See also
jau::ctti_name<T>

Definition at line 443 of file type_info.hpp.

Here is the caller graph for this function:

◆ type_name() [2/2]

template<typename R, typename L, typename... A>
const char * jau::type_name ( )
noexcept

Returns the type name of given function types R(*L)(A...) using template Compile Time Type Information (CTTI) only via RTTI's typeid(L).name() if available or jau::ctti_name<R, L, A...>() otherwise.

Template Parameters
Rfunction return type used for type_info in case of jau::type_info::rtti_available == false
Lmain function type for which the type_info is generated, e.g. a lambda type.
Afunction argument types used for type_info in case of jau::type_info::rtti_available == false
Returns
type name
See also
jau::ctti_name<R, L, A...>

Definition at line 463 of file type_info.hpp.

◆ number() [2/2]

uint8_t jau::number ( const TypeTraitGroup rhs)
constexprnoexcept

Definition at line 61 of file type_traits_queries.hpp.

◆ operator^() [3/3]

TypeTraitGroup jau::operator^ ( const TypeTraitGroup lhs,
const TypeTraitGroup rhs )
constexprnoexcept

Definition at line 64 of file type_traits_queries.hpp.

◆ operator|() [3/3]

TypeTraitGroup jau::operator| ( const TypeTraitGroup lhs,
const TypeTraitGroup rhs )
constexprnoexcept

Definition at line 67 of file type_traits_queries.hpp.

◆ operator&() [3/3]

TypeTraitGroup jau::operator& ( const TypeTraitGroup lhs,
const TypeTraitGroup rhs )
constexprnoexcept

Definition at line 70 of file type_traits_queries.hpp.

◆ operator==() [3/3]

bool jau::operator== ( const TypeTraitGroup lhs,
const TypeTraitGroup rhs )
constexprnoexcept

Definition at line 73 of file type_traits_queries.hpp.

◆ operator!=() [2/2]

bool jau::operator!= ( const TypeTraitGroup lhs,
const TypeTraitGroup rhs )
constexprnoexcept

Definition at line 76 of file type_traits_queries.hpp.

◆ isTypeTraitBitSet()

bool jau::isTypeTraitBitSet ( const TypeTraitGroup mask,
const TypeTraitGroup bit )
constexprnoexcept

Definition at line 79 of file type_traits_queries.hpp.

Here is the caller graph for this function:

Variable Documentation

◆ has_builtin_bit_cast_v

template<typename Dummy_type>
bool jau::has_builtin_bit_cast_v = has_builtin_bit_cast_t<Dummy_type>::value
constexpr

Value access of has_builtin_bit_cast type trait for convenience .

Template Parameters
Dummy_typejust to make template SFINAE happy
See also
has_builtin_bit_cast

Definition at line 298 of file cpp_lang_util.hpp.

◆ is_rtti_available_v

template<typename _Dummy>
bool jau::is_rtti_available_v = is_rtti_available_t<_Dummy>::value
inlineconstexpr

Template type trait helper evaluating true if RTTI is available, otherwise false.

Template Parameters
_Dummyunused dummy type to satisfy SFINAE

Definition at line 85 of file type_info.hpp.

◆ is_container_memmove_compliant_v

template<typename T>
bool jau::is_container_memmove_compliant_v = is_container_memmove_compliant<T>::value
inlineconstexpr

Definition at line 274 of file type_traits_queries.hpp.

◆ is_enforcing_secmem_v

template<typename T>
bool jau::is_enforcing_secmem_v = is_enforcing_secmem<T>::value
inlineconstexpr

Definition at line 290 of file type_traits_queries.hpp.

◆ is_all_same_v

template<typename... Ts>
bool jau::is_all_same_v = is_all_same<Ts...>::value
inlineconstexpr

Definition at line 299 of file type_traits_queries.hpp.

◆ has_toString_v

template<typename _Tp>
bool jau::has_toString_v = has_toString<_Tp>::value
inlineconstexpr

Definition at line 377 of file type_traits_queries.hpp.

◆ has_to_string_v

template<typename _Tp>
bool jau::has_to_string_v = has_to_string<_Tp>::value
inlineconstexpr

Definition at line 380 of file type_traits_queries.hpp.

◆ has_member_of_pointer_v

template<typename _Tp>
bool jau::has_member_of_pointer_v = has_member_of_pointer<_Tp>::value
inlineconstexpr

Definition at line 389 of file type_traits_queries.hpp.