- changed status to wontfix
Dynamically allocating StaticVector instances?
Issue #191
wontfix
Sorry if I am missing something obvious, just started to use blaze. For me the following code segfaults in the StaticVector copy constructor:
std::vector<blaze::StaticVector<float, 32>> vec;
for (auto i = 0u; i < 100; i++) vec.emplace_back();
Is this expected?
Comments (2)
-
-
Hi Антон!
The alignment requirements of a
StaticVector
data member are "inherited" by the containingstruct
. Therefore the solution will also work in this scenario. Unfortunately both the wiki and the tutorial are a little silent on this kind of issue. We should extend both to help users to avoid this kind of problem.Best regards,
Klaus!
- Log in to comment
Hi Антон!
Thanks for creating this issue. The problem is the default allocator of
std::vector
, which does not provide the right alignment for its data. In order to adhere to the alignment restrictions ofStaticVector
, please use ablaze::AlignedAllocator
:That will fix the problem.
Best regards,
Klaus!