On 4/3/19 3:08 PM, Andrzej Krzemienski via Boost wrote:
śr., 3 kwi 2019 o 23:28 Robert Ramey via Boost
So - simple proposal. Require that sum types have operator= deleted.
Interestingly, the current work on the language variant ( http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0095r2.html) goes into a somewhat similar direction. If types stored in the variant are unfriendly (strong guarantee cannot be offered) the assignment is implicitly declared as deleted. Users can still choose to define it and provide the implementation of their liking.
very interesting. I checked the link. Indeed, a cursory examination of
the link convinces me that your abstract is likely correct.
Still, it still requires that the user of the library object investigate
pretty deeply as to what the thing does behind the scenes - which is one
thing I'm always criticizing. One good thing about the current
proposals is that they "just work (usually)" as there are no special
rules to learn how to use them.
And of course whatever variant of variant I choose I can always just
make it const so it can't be changed after initialization.
So maybe it just needs one of the &rzej; blog posts: title - "non const
variant is code smell" and hope that it becomes a design pattern.
it also might be an interesting idea to create "safe_variant
Regards, &rzej;
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost