You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the feature/dynamic branch it is possible to construct a dynamic::variable by passing a variable::array_type (aka std::vector<variable>.) I want to change this to used named constructors instead.
std::variable<variable> values;
variable data = variable::array(values.begin(), values.end());
The reason for this change is that the current code can lead to surprising results. While working on adding support for operator<< I encountered an infinite recursion because operator<<(variable) was invoked when given a std::vector<variable>.
I could have solved the recursion by adding an overload for std::vector<variable> but that would preclude users from adding their own. Notice that operator<<(variable) simply forwards to operator<< of the underlying type, so the default behaviour of operator<<(std::vector<variable>) should be a compiler error (unless a custom overload exists.) It is not used for serialization.
All of the above also applies to variable::map_type.
Any objections?
The text was updated successfully, but these errors were encountered:
On the feature/dynamic branch it is possible to construct a
dynamic::variable
by passing avariable::array_type
(akastd::vector<variable>
.) I want to change this to used named constructors instead.For example, the following code:
should be changed into:
The reason for this change is that the current code can lead to surprising results. While working on adding support for
operator<<
I encountered an infinite recursion becauseoperator<<(variable)
was invoked when given astd::vector<variable>
.I could have solved the recursion by adding an overload for
std::vector<variable>
but that would preclude users from adding their own. Notice thatoperator<<(variable)
simply forwards tooperator<<
of the underlying type, so the default behaviour ofoperator<<(std::vector<variable>)
should be a compiler error (unless a custom overload exists.) It is not used for serialization.All of the above also applies to
variable::map_type
.Any objections?
The text was updated successfully, but these errors were encountered: