2014-03-14 10:22 GMT+04:00 feverzsj <feverzsj@hotmail.com>: <...>
why not supply a interface like:
Val& v = var.assign(val);
for simplity, and the unnecessary "get" is also elimited.
Such interface is not common for C++. Most programmers are used to the following: class_name& class_name::operator=(const class_name&); or class_name& class_name::operator=(const class_internal&); While you propose to implement `class_internal& class_name::operator=(const class_internal&);` This may be surprising for some users: boost::variant<Val,...> var; boost::variant<Val,...>& var2 = var = val; Code from the example above will have different behavior on different compilers (GCC won't compile it, MSVC will compile it but &var2 != &var1). This does not look good. -- Best regards, Antony Polukhin