Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Classes | Namespaces | Macros | Functions | Variables
cpp_lang_util.hpp File Reference
#include <type_traits>
#include <typeinfo>
#include <string>
#include <cstring>
Include dependency graph for cpp_lang_util.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  jau::has_builtin_bit_cast< Dummy_type >
 Convenience type trait for __has_builtin(__builtin_bit_cast). More...
 
struct  jau::is_rtti_available_t< _Dummy >
 Template type trait evaluating std::true_type{} if RTTI is available, otherwise std::false_type{}. More...
 
class  jau::type_info
 Generic type information using either Runtime type information (RTTI) or Compile time type information (CTTI) More...
 

Namespaces

namespace  jau
 __pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
 
namespace  jau::impl
 

Macros

#define __builtin_bit_cast(Dest_type, Value_arg)   0
 Dummy definition in the absence of this builtin function as required to have this compilation unit compile clean. More...
 
#define __restrict_cxx__
 Wrap C++ extension __restrict__ covering C99's restrict feature keyword. More...
 
#define consteval_cxx20   constexpr
 consteval qualifier replacement for C++20 consteval. More...
 
#define constexpr_atomic   inline
 Used when designed to declare a function constexpr, but prohibited by its specific implementation. More...
 
#define constexpr_cxx20   inline
 constexpr qualifier replacement for C++20 constexpr. More...
 
#define constexpr_cxx23   inline
 
#define constexpr_cxx26   inline
 
#define constexpr_non_literal_var   inline
 Used when designed to declare a function constexpr, but prohibited by its specific implementation. More...
 
#define constinit_cxx20   constexpr
 constinit qualifier replacement for C++20 constinit. More...
 

Functions

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. More...
 
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. More...
 
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. More...
 
std::string jau::demangle_name (const char *mangled_name) noexcept
 Returns the demangled given mangled_name if successful, otherwise the mangled_name. More...
 
template<class Dummy_type >
consteval_cxx20 bool jau::impl::has_builtin_bit_cast_impl (std::enable_if_t< !has_builtin_bit_cast_v< Dummy_type >, bool >=true) noexcept
 
template<class Dummy_type >
consteval_cxx20 bool jau::impl::has_builtin_bit_cast_impl (std::enable_if_t< has_builtin_bit_cast_v< Dummy_type >, bool >=true) noexcept
 
consteval_cxx20 bool jau::is_builtin_bit_cast_available () noexcept
 Query whether __builtin_bit_cast(Dest_type, arg) is available, using jau::has_builtin_bit_cast. More...
 
consteval_cxx20 bool jau::is_builtin_int128_available () noexcept
 
consteval_cxx20 bool jau::is_cxx17 () noexcept
 Returns true if compiled with >= C++17. More...
 
consteval_cxx20 bool jau::is_cxx20 () noexcept
 Returns true if compiled with >= C++20. More...
 
consteval_cxx20 bool jau::is_cxx23 () noexcept
 Returns true if compiled with >= C++23. More...
 
consteval_cxx20 bool jau::is_cxx26 () noexcept
 Returns true if compiled with >= C++26. More...
 
consteval_cxx20 bool jau::is_debug_enabled () noexcept
 Returns true if compiled with debug information and w/o optimization, i.e. More...
 
consteval_cxx20 bool jau::is_rtti_available () noexcept
 Returns true if compiled with RTTI available. More...
 
template<typename T >
jau::type_info jau::make_ctti () noexcept
 Constructs a jau::type_info instance based on given type T using template Compile Time Type Information (CTTI) only. More...
 
template<typename R , typename L , typename... A>
jau::type_info jau::make_ctti () 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. More...
 
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). More...
 
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. More...
 
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. More...
 

Variables

template<typename Dummy_type >
constexpr bool jau::has_builtin_bit_cast_v = has_builtin_bit_cast<Dummy_type>::value
 Value access of has_builtin_bit_cast type trait for convenience . More...
 
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. More...