8#ifndef HPP_ALIB_BOXING_FUNCTIONDEFS
9#define HPP_ALIB_BOXING_FUNCTIONDEFS 1
11#if !defined(HPP_ALIB_BOXING_BOXING)
12# error "ALib sources with ending '.inl' must not be included from outside."
17namespace alib {
namespace boxing {
21 template<
typename TComparable>
24 if( !rhsBox.IsType<TComparable >() )
27 return self.Unbox<TComparable>() == rhsBox.Unbox<TComparable>();
30template<
typename TComparableP>
33 if( !rhsBox.IsType<TComparableP>() )
36 auto lhs= self .Unbox<TComparableP>();
37 auto rhs= rhsBox.Unbox<TComparableP>();
39 return rhs ==
nullptr;
47template<
typename TComparable>
50 if( !rhsBox.IsType<TComparable >() )
51 return std::type_index( self.TypeID() ) < std::type_index( rhsBox.TypeID() );
53 return self.Unbox<TComparable>() < rhsBox.Unbox<TComparable>();
56template<
typename TComparableP>
59 if( !rhsBox.IsType<TComparableP>() )
62 auto lhs= self .Unbox<TComparableP>();
63 auto rhs= rhsBox.Unbox<TComparableP>();
65 return rhs !=
nullptr;
79 "Hash function registered with type of wrong usage length")
81 size_t result= std::size_t(0x52a6937UL) - (N * 0x387e)
82 + std::size_t( self.
TypeID().hash_code() );
87 if constexpr( N <
sizeof(
uinteger ) )
89 & ((Bit1 << (N * 8) )- 1) ) * 92334534 )
95 if constexpr ( N ==
sizeof(
uinteger) )
102 & ((Bit1 << ((N -
sizeof(
uinteger)) * 8) )- 1) ) * 892112 )
110#if ALIB_STRINGS && !DOXYGEN
111template<
typename TChar,
typename TAllocator>
112template<
typename TAppendable>
116 target.template Append<NC>( self.
Unbox<TAppendable>() );
119template<
typename TChar,
typename TAllocator>
120template<
typename TAppendable>
124 auto pointer= self.
Unbox<TAppendable>();
126 target.template Append<NC>( *pointer );
130 target << self.
TypeID() <<
"(nullptr)";
132 target <<
"(nullptr)";
137template<
typename TChar,
typename TAllocator>
138template<
typename TAppendable>
141 target.template _<NC>( self.Unbox<std::reference_wrapper<TAppendable>>().get() );
unsigned int GetPlaceholderUsageLength() const
const std::type_info & TypeID() const
const Placeholder & Data() const
const TUnboxable Unbox() const
#define ALIB_WARNINGS_IGNORE_INTEGRAL_CONSTANT_OVERFLOW
#define ATMP_VOID_IF(Cond)
#define ALIB_WARNINGS_RESTORE
#define ALIB_ASSERT_ERROR(cond,...)
#define ATMP_T_IF(T, Cond)
lang::uinteger uinteger
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
static void WrappedAppendable(const Box &self, strings::TAString< TChar, TAllocator > &target)
static void Appendable(const Box &self, strings::TAString< TChar, TAllocator > &target)
static bool ComparableTypes(const Box &self, const Box &rhs)
static size_t UsePlaceholderBytes(const Box &self)
static bool ComparableTypes(const Box &self, const Box &rhs)
constexpr uinteger GetUInteger(int idx) const