Benjamin Bannier created MESOS-5072:
---------------------------------------
Summary: Add variadic constructor for Option
Key: MESOS-5072
URL: https://issues.apache.org/jira/browse/MESOS-5072
Project: Mesos
Issue Type: Improvement
Components: stout
Reporter: Benjamin Bannier
Currently an {{Option<T>}} can be constructed from an {{U}} if in turn a {{T}}
is constructable from an {{U}}, e.g.,
{code}
// Construct a std::string from a string literal.
Option<string> s{"fnord"};
{code}
We should extend this to permit this kind of construct from more than one
parameter, i.e.,
{code}
// Construct a vector of strings from a string initializer list.
Option<vector<string>> v{"Browny", "Whitey", "Blacky"};
{code}
Currently users need to duplicate the type which e.g., poses the danger of
inadvertently type conversions,
{code}
Option<vector<string>> v{<vector<string>>{"Browny", "Whitey", "Blacky"}};
{code}
It seems just making the {{U}} in the respective {{Option}} constructor
variadic would already be enough to support this, but it would be highly
desirable to remove explicit, redundant types in existing constructions of
{{Options}} in the code base.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)