Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
StdCompat.h File Reference
#include "Stroika/Foundation/StroikaPreComp.h"
#include <bit>
#include <cmath>
#include <compare>
#include <cstdarg>
#include <ranges>
#include "StdCompat.inl"

Go to the source code of this file.

Namespaces

namespace  Stroika::Foundation
 
namespace  Stroika::Foundation::Common
 

Functions

template<class To , class From >
requires (sizeof (To) == sizeof (From) && std::is_trivially_copyable_v<From> && std::is_trivially_copyable_v<To>)
To Stroika::Foundation::Common::StdCompat::bit_cast (const From &src) noexcept
 
template<class T >
Stroika::Foundation::Common::StdCompat::byteswap (T n) noexcept
 
template<typename T >
constexpr bool Stroika::Foundation::Common::StdCompat::isinf (T v) noexcept
 
template<typename T >
constexpr bool Stroika::Foundation::Common::StdCompat::isnan (T v) noexcept
 

Detailed Description

The purpose of this module is to define any std c++ functions/classes etc - which may not be provided by the current std c++ library (often because not compiled with appropriate –std=... flag) - and/or because its an old compiler.

This doesn't strictly violate any rules about sticking stuff into namespace std - cuz we don't. That's why we use a separate namespace (that often just indirects to the namespace std - where the function/class is defined already).

Note
Code-Status: Beta

Definition in file StdCompat.h.

Function Documentation

◆ bit_cast()

template<class To , class From >
requires (sizeof (To) == sizeof (From) && std::is_trivially_copyable_v<From> && std::is_trivially_copyable_v<To>)
To Stroika::Foundation::Common::StdCompat::bit_cast ( const From &  src)
noexcept

Workaround absence of bit_cast in MacOS XCode 14 (which we support with Stroika v3)

Definition at line 106 of file StdCompat.h.

◆ byteswap()

template<class T >
T Stroika::Foundation::Common::StdCompat::byteswap ( n)
noexcept

Workaround absence of byteswap gcc up to version 12, and clang (up to 14).

Definition at line 124 of file StdCompat.h.

◆ isinf()

template<typename T >
constexpr bool Stroika::Foundation::Common::StdCompat::isinf ( v)
constexprnoexcept

workaround qCompilerAndStdLib_fpclasifyEtcOfInteger_Buggy

Definition at line 147 of file StdCompat.h.

◆ isnan()

template<typename T >
constexpr bool Stroika::Foundation::Common::StdCompat::isnan ( v)
constexprnoexcept

workaround qCompilerAndStdLib_fpclasifyEtcOfInteger_Buggy

Definition at line 168 of file StdCompat.h.