jaulib v1.3.6
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
cpp_lang_util.hpp File Reference
#include <type_traits>
#include <string>
#include <cstring>
#include <ostream>
#include <jau/packed_attribute.hpp>
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_t< Dummy_type >
 Convenience type trait for __has_builtin(__builtin_bit_cast). More...
 

Namespaces

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

Macros

#define __attrdecl_no_optimize__
 
#define __attrdef_no_optimize__
 
#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.
 

Enumerations

enum class  jau::Bool : bool { jau::Bool::False = false , jau::Bool::True = true }
 Boolean type without implicit conversion, safe for function parameter. 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.
 
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.
 
std::string jau::demangle_name (const char *mangled_name) noexcept
 Returns the demangled given mangled_name if successful, otherwise the mangled_name.
 
constexpr Bool jau::False () 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.
 
constexpr std::string_view jau::name (const Bool v) noexcept
 
constexpr Bool jau::operator! (const Bool rhs) noexcept
 
constexpr Bool jau::operator& (const Bool lhs, const Bool rhs) noexcept
 
constexpr Bool jau::operator&& (const Bool lhs, const Bool rhs) noexcept
 
constexpr Booljau::operator&= (Bool &lhs, const Bool rhs) noexcept
 
constexpr bool jau::operator* (const Bool rhs) noexcept
 
std::ostream & jau::operator<< (std::ostream &out, const Bool c)
 
constexpr bool jau::operator== (const Bool lhs, const Bool rhs) noexcept
 
constexpr Bool jau::operator^ (const Bool lhs, const Bool rhs) noexcept
 
constexpr Booljau::operator^= (Bool &lhs, const Bool rhs) noexcept
 
constexpr Bool jau::operator| (const Bool lhs, const Bool rhs) noexcept
 
constexpr Booljau::operator|= (Bool &lhs, const Bool rhs) noexcept
 
constexpr Bool jau::operator|| (const Bool lhs, const Bool 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).
 
constexpr std::string jau::to_string (const Bool v) noexcept
 
constexpr Bool jau::True () noexcept
 
constexpr bool jau::value (const Bool rhs) noexcept
 

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 .