alfC a écrit :
smart_assign(A)=B; // takes care of eventual resize. Used instead of A=B (which may fail), (both A and B are of type multi_array
for example.) that was my way arround not being able to redefine operator=; but I am not sure if it is a good idea yet and whether it is a real improvement over just something like 'smart_assign(A, B);';
Tossing my few cents as I dealt with such shenanigans a lot of time. In my own multi-array like class, I faced this dilemma. What I did was using template boost::parameters to specify policy on allocation in the type and had the user make choice between throwing, static_asserting, silently reallocating, preserving order etc Why not using such policies ? I know it involves drastically changing multi_array interface but maybe it's worth the hassle. Just let the default parameters be the old multi_array semantic.