Le 09/12/14 20:59, Joaquin M Lopez Munoz a écrit :
Vicente J. Botet Escriba
writes: Le 09/12/14 09:41, Joaquin M Lopez Munoz a écrit :
Vicente J. Botet Escriba
writes: * The move constructor is not noexcept.
An implementation using vector
should avoid this last issue. Or just a pointer to array, which is somewhat more efficient. Why not. Well, on second thought this is not that easy. Moving from a to b must leave a in a *valid* position, which here means that either you must allocate a new array for a (which makes moving non-noexcept) or assign it a null pointer and deal with the situation in the rest of the interface, which is a kind of a bummer --for instance, as having size()==N is an invariant of the class, even const functions such as cbegin() or cend() need to check for null pointer and allocate accordingly, becoming non-nonexcept, thread unsafe and whatnot. So, I think your deign shouldn't try to be move-aware, much as std::array is not either.
I'm one of those that think that the single things we are able to do with a moved variable is reassigning and destroying :(. Vicente