StormByte C++ Library 1.2.0
StormByte is a comprehensive, cross-platform C++ library aimed at easing system programming, configuration management, logging, and database handling tasks. This library provides a unified API that abstracts away the complexities and inconsistencies of different platforms (Windows, Linux).
Loading...
Searching...
No Matches
Functions | Variables
StormByte::Type::Detail Namespace Reference

Private helpers. More...

Functions

template<typename U >
requires TriviallyCopyable<U> && (sizeof(U) > 0)
constexpr U swap_endian (U val) noexcept
 Reverses the object-representation byte order of val.
 
template<typename VariantT , typename U , std::size_t... I>
constexpr bool variant_has_type_impl (std::index_sequence< I... > seq) noexcept
 Fold: is cv/ref-stripped U one of VariantT's alternatives?
 

Variables

template<typename T >
constexpr bool is_variant_v = false
 true when T is exactly std::variant<Ts...> after cv/ref strip.
 
template<typename VariantT , typename U >
constexpr bool variant_has_type_v
 Convenience wrapper around variant_has_type_impl.
 

Detailed Description

Private helpers.

Not a supported API.

Note
Other modules may call swap_endian. Do not depend on any other name in this namespace.

Function Documentation

◆ swap_endian()

template<typename U >
requires TriviallyCopyable<U> && (sizeof(U) > 0)
constexpr U StormByte::Type::Detail::swap_endian ( val)
constexprnoexcept

Reverses the object-representation byte order of val.

Template Parameters
UTrivially copyable value type.
Parameters
[in]valValue whose bytes are reversed.
Returns
val with endianness swapped.
Note
This always reverses bytes. Whether the caller should invoke it (host ≠ little-endian) is Serializable's job. Integrals go through std::byteswap; every other trivial type goes through std::bit_cast + reverse so float, enum and small POD structs stay defined.
Warning
Not a format detector. No BOM, no std::endian test.

◆ variant_has_type_impl()

template<typename VariantT , typename U , std::size_t... I>
constexpr bool StormByte::Type::Detail::variant_has_type_impl ( std::index_sequence< I... >  seq)
constexprnoexcept

Fold: is cv/ref-stripped U one of VariantT's alternatives?

Template Parameters
VariantTA std::variant<…> (already stripped by the caller).
UCandidate alternative.
IIndex pack over std::variant_size_v<VariantT>.
Parameters
[in]seqIndex sequence; unused except to expand I.
Returns
true if U matches any alternative.

Variable Documentation

◆ is_variant_v

template<typename T >
constexpr bool StormByte::Type::Detail::is_variant_v< std::variant< Ts... > > = false
constexpr

true when T is exactly std::variant<Ts...> after cv/ref strip.

Specialization for every std::variant alternative list.

Template Parameters
TType to test.

Partial specialization of a variable template — not SFINAE. Needed because there is no standard std::is_variant.

Template Parameters
TsVariant alternatives.

◆ variant_has_type_v

template<typename VariantT , typename U >
constexpr bool StormByte::Type::Detail::variant_has_type_v
constexpr
Initial value:
=
variant_has_type_impl<VariantT, U>(
std::make_index_sequence<std::variant_size_v<VariantT>>()
)

Convenience wrapper around variant_has_type_impl.

Template Parameters
VariantTA std::variant<…>.
UCandidate alternative.