Sen API
Sen Libraries
Loading...
Searching...
No Matches
sen::std_util Namespace Reference

Namespaces

namespace  impl
namespace  detail

Classes

struct  ReportPolicyAssertion
struct  ReportPolicyTrace
struct  ReportPolicyLog
struct  ReportPolicyIgnore
struct  IsInstantiationOf
struct  IsInstantiationOf< Template, Template< Args... > >

Typedefs

template<typename... FwdArgs>
using move_only_function = detail::MoveOnlyFunctionImpl<FwdArgs...>

Functions

template<class To, class From>
std::enable_if_t< sizeof(To)==sizeof(From) &&std::is_trivially_copyable_v< From > &&std::is_trivially_copyable_v< To >, To > bit_cast (const From &src) noexcept
template<typename ToType, typename ReportPolicy = ReportPolicyAssertion, typename FromType>
ToType checkedConversion (FromType from)
 Safely convert between two different integral types. If the value stored in from cannot be represented in ToType, the value is truncated.
template<typename ToType, typename ReportPolicy = ReportPolicyIgnore, typename FromType>
ToType ignoredLossyConversion (FromType from)
 Safely convert between two different integral types. If the value stored in from cannot be represented in ToType, the value is truncated.
template<class T, class U>
constexpr bool cmp_equal (T t, U u) noexcept
template<class T, class U>
constexpr bool cmp_not_equal (T t, U u) noexcept
template<class T, class U>
constexpr bool cmp_less (T t, U u) noexcept
template<class T, class U>
constexpr bool cmp_greater (T t, U u) noexcept
template<class T, class U>
constexpr bool cmp_less_equal (T t, U u) noexcept
template<class T, class U>
constexpr bool cmp_greater_equal (T t, U u) noexcept
std::string fromU8string (const std::string &s)
std::string fromU8string (std::string &&s)
const char * castToCharPtr (const char *cp)

Variables

template<template< typename... > class Template, typename T>
constexpr bool isInstantiationOfV = IsInstantiationOf<Template, T>::value

Typedef Documentation

◆ move_only_function

template<typename... FwdArgs>
using sen::std_util::move_only_function = detail::MoveOnlyFunctionImpl<FwdArgs...>

Function Documentation

◆ bit_cast()

template<class To, class From>
std::enable_if_t< sizeof(To)==sizeof(From) &&std::is_trivially_copyable_v< From > &&std::is_trivially_copyable_v< To >, To > sen::std_util::bit_cast ( const From & src)
noexcept

◆ checkedConversion()

template<typename ToType, typename ReportPolicy = ReportPolicyAssertion, typename FromType>
ToType sen::std_util::checkedConversion ( FromType from)
nodiscard

Safely convert between two different integral types. If the value stored in from cannot be represented in ToType, the value is truncated.

note: by default, this function asserts when a truncation is necessary

Template Parameters
ToTypeoutput type
ReportPolicypolicy type that specifies how truncation should be reported
FromTypeinput type
Parameters
[in]fromvalue that should be converted to ToType
Returns
from value represented as ToType, possibly truncated within the range of ToType

◆ ignoredLossyConversion()

template<typename ToType, typename ReportPolicy = ReportPolicyIgnore, typename FromType>
ToType sen::std_util::ignoredLossyConversion ( FromType from)
nodiscard

Safely convert between two different integral types. If the value stored in from cannot be represented in ToType, the value is truncated.

note: by default, this function ignores truncation errors

Template Parameters
ToTypeoutput type
ReportPolicypolicy type that specifies how truncation should be reported
FromTypeinput type
Parameters
[in]fromvalue that should be converted to ToType
Returns
from value represented as ToType, possibly truncated within the range of ToType

◆ cmp_equal()

template<class T, class U>
bool sen::std_util::cmp_equal ( T t,
U u )
constexprnoexcept

◆ cmp_not_equal()

template<class T, class U>
bool sen::std_util::cmp_not_equal ( T t,
U u )
constexprnoexcept

◆ cmp_less()

template<class T, class U>
bool sen::std_util::cmp_less ( T t,
U u )
constexprnoexcept

◆ cmp_greater()

template<class T, class U>
bool sen::std_util::cmp_greater ( T t,
U u )
constexprnoexcept

◆ cmp_less_equal()

template<class T, class U>
bool sen::std_util::cmp_less_equal ( T t,
U u )
constexprnoexcept

◆ cmp_greater_equal()

template<class T, class U>
bool sen::std_util::cmp_greater_equal ( T t,
U u )
constexprnoexcept

◆ fromU8string() [1/2]

std::string sen::std_util::fromU8string ( const std::string & s)
inline

◆ fromU8string() [2/2]

std::string sen::std_util::fromU8string ( std::string && s)
inline

◆ castToCharPtr()

const char * sen::std_util::castToCharPtr ( const char * cp)
inline

Variable Documentation

◆ isInstantiationOfV

template<template< typename... > class Template, typename T>
bool sen::std_util::isInstantiationOfV = IsInstantiationOf<Template, T>::value
constexpr