
Paul Smith wrote:
It is a heuristic. Just because something is no-throw doesn't necessarily mean that it's cheap.
Well, if the variant picks the first such type, the user can place his preference first in the list.
Still, there's no need to supress move construction in the absence of a no-throw default constructible type.
No, you could still keep the current behavior. Incidentally, now that I think of it, the first implementation strategy in http://www.boost.org/doc/libs/1_52_0/doc/html/variant/design.html#variant.de... is possible when the target type has a nothrow move constructor. You could move-construct the temporary backup, destroy the target and if the copy fails, move-construct it back. So the assignment would go along the following lines: - if the types are the same, assign - if the source type has a nothrow copy* constructor, use it - if the target type has a nothrow move constructor, use it - if there is a nothrow-default-constructible type, use it - otherwise, do the heap backup thing * For move assignment, change copy* to move