Closed AndreyKulikov2022 closed 1 month ago
Thanks for the report. Reviewing this patch I've found that many containers don't support non move-assignable types when allocator support is appropiate. I created an issue with the general problem and resolved it adding required container changes and modified tests. See:
Thank you!
I am trying to move-assign one container to the other:
If
T
is neither move nor copy constructable, this code does not compile. However, it should and compiles forstd
containers, because it is possible to just pass memory ownership fromdeque2
todeque1
since their allocators are the same. The problem is that the choice between transferring resources or moving the elements one by one is written using ordinaryif
. The compiler generates the error when checking the second option even though it is not used. Withif constexpr
instead ofif
the statement is resolved at compile time and no error is generated.I propose changing
if
statements for flags known at compile time toif constexpr
usingBOOST_IF_CONSTEXPR
.