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];
54 extern void dbgLongDoubleTrueLengthSet();
55 extern bool dbgLongDoubleTrueLengthTest();
65 for(
integer i= 0; i < length ; ++i )
67 const Box& box= boxArray[i];
69 if( box.IsType<boxing::TBoxes<lang::HeapAllocator>*>() )
71 const auto* boxes= box.Unbox<boxing::TBoxes<lang::HeapAllocator>*>();
72 ctdFlattened+= flattenCount( boxes->data(),
integer(boxes->size()) );
76 if( box.IsType<boxing::TBoxes<MonoAllocator>*>() )
78 const auto* boxes= box.Unbox<boxing::TBoxes<MonoAllocator>*>();
79 ctdFlattened+= flattenCount( boxes->data(),
integer(boxes->size()) );
82 if( box.IsType<boxing::TBoxes<PoolAllocator>*>() )
84 const auto* boxes= box.Unbox<boxing::TBoxes<PoolAllocator>*>();
85 ctdFlattened+= flattenCount( boxes->data(),
integer(boxes->size()) );
90 if( box.IsArrayOf<
Box>() )
92 ctdFlattened+= flattenCount( box.UnboxArray<
Box>(), box.
UnboxLength() );
102template<
typename TAllocator>
103void flattenInsert(
typename TBoxes<TAllocator>::iterator& it,
const Box* boxArray,
integer length)
105 for(
integer i= 0; i < length ; ++i )
107 const Box& box= boxArray[i];
109 if( box.IsType<boxing::TBoxes<lang::HeapAllocator>*>() )
111 const auto* boxes= box.Unbox<boxing::TBoxes<lang::HeapAllocator>*>();
112 flattenInsert<TAllocator>( it, boxes->data(),
integer(boxes->size()) );
116 if( box.IsType<boxing::TBoxes<MonoAllocator>*>() )
118 const auto* boxes= box.Unbox<boxing::TBoxes<MonoAllocator>*>();
119 flattenInsert<TAllocator>( it, boxes->data(),
integer(boxes->size()) );
122 if( box.IsType<boxing::TBoxes<PoolAllocator>*>() )
124 const auto* boxes= box.Unbox<boxing::TBoxes<PoolAllocator>*>();
125 flattenInsert<TAllocator>( it, boxes->data(),
integer(boxes->size()) );
130 if( box.IsArrayOf<
Box>() )
132 flattenInsert<TAllocator>( it, box.UnboxArray<
Box>(), box.
UnboxLength() );
136 new( &*it )
Box( box );
144template<
typename TAllocator>
148 integer ctdFlattened= flattenCount( boxArray, length );
151 auto it= vectorBase::insert(vectorBase::end(),
size_t(ctdFlattened),
Box() );
154 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.