diff --git a/openvpn/common/options.hpp b/openvpn/common/options.hpp index e0fa8f09..82ddfc53 100644 --- a/openvpn/common/options.hpp +++ b/openvpn/common/options.hpp @@ -104,7 +104,7 @@ namespace openvpn { Option(T first, Args... args) { reserve(1 + sizeof...(args)); - from_list(first, args...); + from_list(std::move(first), std::forward(args)...); } static validate_status validate(const std::string& str, const size_t max_len) @@ -360,8 +360,8 @@ namespace openvpn { template void from_list(T first, Args... args) { - from_list(first); - from_list(args...); + from_list(std::move(first)); + from_list(std::forward(args)...); } volatile mutable bool touched_ = false; @@ -661,6 +661,18 @@ namespace openvpn { } }; + OptionList() + { + } + + template + OptionList(T first, Args... args) + { + reserve(1 + sizeof...(args)); + from_list(std::move(first), std::forward(args)...); + update_map(); + } + static OptionList parse_from_csv_static(const std::string& str, Limits* lim) { OptionList ret; @@ -1412,6 +1424,18 @@ namespace openvpn { OPENVPN_THROW(option_error, "line " << line_num << " is too long"); } + void from_list(Option opt) + { + push_back(std::move(opt)); + } + + template + void from_list(T first, Args... args) + { + from_list(std::move(first)); + from_list(std::forward(args)...); + } + IndexMap map_; };