18namespace alib {
namespace boxing {
20#if ALIB_DEBUG && !DOXYGEN
24 extern long double dbgLongDoubleWriteTestMem[2];
25 long double dbgLongDoubleWriteTestMem[2];
26 extern void dbgLongDoubleTrueLengthSet();
27 void dbgLongDoubleTrueLengthSet()
31 extern bool dbgLongDoubleTrueLengthTest();
32 bool dbgLongDoubleTrueLengthTest()
34 const char* mem=
reinterpret_cast<const char*
>( dbgLongDoubleWriteTestMem );
47 for(
integer i= 0; i < length ; ++i )
49 const Box& box= boxArray[i];
51 if( box.IsType<boxing::TBoxes<lang::HeapAllocator>*>() )
53 const auto* boxes= box.Unbox<boxing::TBoxes<lang::HeapAllocator>*>();
54 ctdFlattened+= flattenCount( boxes->data(),
static_cast<integer>(boxes->size()) );
58 if( box.IsType<boxing::TBoxes<MonoAllocator>*>() )
60 const auto* boxes= box.Unbox<boxing::TBoxes<MonoAllocator>*>();
61 ctdFlattened+= flattenCount( boxes->data(),
static_cast<integer>(boxes->size()) );
64 if( box.IsType<boxing::TBoxes<PoolAllocator>*>() )
66 const auto* boxes= box.Unbox<boxing::TBoxes<PoolAllocator>*>();
67 ctdFlattened+= flattenCount( boxes->data(),
static_cast<integer>(boxes->size()) );
72 if( box.IsArrayOf<
Box>() )
74 ctdFlattened+= flattenCount( box.UnboxArray<
Box>(), box.
UnboxLength() );
84template<
typename TAllocator>
85void flattenInsert(
typename TBoxes<TAllocator>::iterator& it,
const Box* boxArray,
integer length)
87 for(
integer i= 0; i < length ; ++i )
89 const Box& box= boxArray[i];
91 if( box.IsType<boxing::TBoxes<lang::HeapAllocator>*>() )
93 const auto* boxes= box.Unbox<boxing::TBoxes<lang::HeapAllocator>*>();
94 flattenInsert<TAllocator>( it, boxes->data(),
static_cast<integer>(boxes->size()) );
98 if( box.IsType<boxing::TBoxes<MonoAllocator>*>() )
100 const auto* boxes= box.Unbox<boxing::TBoxes<MonoAllocator>*>();
101 flattenInsert<TAllocator>( it, boxes->data(),
static_cast<integer>(boxes->size()) );
104 if( box.IsType<boxing::TBoxes<PoolAllocator>*>() )
106 const auto* boxes= box.Unbox<boxing::TBoxes<PoolAllocator>*>();
107 flattenInsert<TAllocator>( it, boxes->data(),
static_cast<integer>(boxes->size()) );
112 if( box.IsArrayOf<
Box>() )
114 flattenInsert<TAllocator>( it, box.UnboxArray<
Box>(), box.
UnboxLength() );
118 new( &*it )
Box( box );
126template<
typename TAllocator>
130 integer ctdFlattened= flattenCount( boxArray, length );
133 auto it= vectorBase::insert(vectorBase::end(),
size_t(ctdFlattened),
Box() );
136 flattenInsert<TAllocator>( it, boxArray, length);
integer UnboxLength() const
void AddArray(const Box *boxArray, integer length)
#define ALIB_WARNINGS_RESTORE
#define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE
#define ALIB_ASSERT(cond)
#define ALIB_SIZEOF_LONGDOUBLE_REPORTED
#define ALIB_SIZEOF_LONGDOUBLE_WRITTEN
boxing::Box Box
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.