8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
38static_assert(
sizeof(
alib::integer ) ==
sizeof(std::size_t ),
"Error in ALib type definitions" );
39static_assert(std::is_signed< alib::integer>::value == std::is_signed<std::ptrdiff_t >::value,
"Error in ALib type definitions" );
40static_assert(std::is_signed< alib::integer>::value != std::is_signed<std::size_t >::value,
"Error in ALib type definitions" );
41static_assert(std::is_signed<alib::uinteger>::value == std::is_signed<std::size_t >::value,
"Error in ALib type definitions" );
42static_assert(std::is_signed<alib::uinteger>::value != std::is_signed<std::ptrdiff_t >::value,
"Error in ALib type definitions" );
48#if ALIB_DEBUG && !DOXYGEN
53 extern long double LONGDOUBLE_WRITE_TEST_MEM[2];
54extern void dbgLongDoubleTrueLengthSet();
55extern bool dbgLongDoubleTrueLengthTest();
64 for(
integer i= 0; i < length ; ++i ) {
65 const Box& box= boxArray[i];
67 if( box.IsType<boxing::TBoxes<lang::HeapAllocator>*>() ) {
68 const auto* boxes= box.Unbox<boxing::TBoxes<lang::HeapAllocator>*>();
69 ctdFlattened+= flattenCount( boxes->data(),
integer(boxes->size()) );
73 if( box.IsType<boxing::TBoxes<MonoAllocator>*>() ) {
74 const auto* boxes= box.Unbox<boxing::TBoxes<MonoAllocator>*>();
75 ctdFlattened+= flattenCount( boxes->data(),
integer(boxes->size()) );
78 if( box.IsType<boxing::TBoxes<PoolAllocator>*>() ) {
79 const auto* boxes= box.Unbox<boxing::TBoxes<PoolAllocator>*>();
80 ctdFlattened+= flattenCount( boxes->data(),
integer(boxes->size()) );
85 if( box.IsArrayOf<
Box>() ) {
86 ctdFlattened+= flattenCount( box.UnboxArray<
Box>(), box.
UnboxLength() );
96template<
typename TAllocator>
97void flattenInsert(
typename TBoxes<TAllocator>::iterator& it,
const Box* boxArray,
integer length) {
98 for(
integer i= 0; i < length ; ++i ) {
99 const Box& box= boxArray[i];
101 if( box.IsType<boxing::TBoxes<lang::HeapAllocator>*>() ) {
102 const auto* boxes= box.Unbox<boxing::TBoxes<lang::HeapAllocator>*>();
103 flattenInsert<TAllocator>( it, boxes->data(),
integer(boxes->size()) );
107 if( box.IsType<boxing::TBoxes<MonoAllocator>*>() ) {
108 const auto* boxes= box.Unbox<boxing::TBoxes<MonoAllocator>*>();
109 flattenInsert<TAllocator>( it, boxes->data(),
integer(boxes->size()) );
112 if( box.IsType<boxing::TBoxes<PoolAllocator>*>() ) {
113 const auto* boxes= box.Unbox<boxing::TBoxes<PoolAllocator>*>();
114 flattenInsert<TAllocator>( it, boxes->data(),
integer(boxes->size()) );
119 if( box.IsArrayOf<
Box>() ) {
120 flattenInsert<TAllocator>( it, box.UnboxArray<
Box>(), box.
UnboxLength() );
124 new( &*it )
Box( box );
131template<
typename TAllocator>
134 integer ctdFlattened= flattenCount( boxArray, length );
137 auto it= vectorBase::insert(vectorBase::end(),
size_t(ctdFlattened),
Box() );
140 flattenInsert<TAllocator>( it, boxArray, length);
integer UnboxLength() const
void AddArray(const Box *boxArray, integer length)
#define ALIB_ASSERT(cond, domain)
This namespace implements internals of namespace alib::boxing.
lang::integer integer
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
lang::uinteger uinteger
Type alias in namespace alib.