From 68ba8898097cbac561fc2277a82074d468a25a33 Mon Sep 17 00:00:00 2001 From: bartosz_sobol Date: Thu, 27 Jun 2019 11:48:06 +0200 Subject: [PATCH] c++11 compatibility fix --- include/cxxopts.hpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index ad024a4..7e86365 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -1223,10 +1223,24 @@ namespace cxxopts struct Option { - std::string opts; - std::string desc; - std::shared_ptr value = ::cxxopts::value(); - std::string arg_help = ""; + Option + ( + const std::string& opts, + const std::string& desc, + const std::shared_ptr& value = ::cxxopts::value(), + const std::string& arg_help = "" + ) + : opts_(opts) + , desc_(desc) + , value_(value) + , arg_help_(arg_help) + { + } + + std::string opts_; + std::string desc_; + std::shared_ptr value_; + std::string arg_help_; }; class Options @@ -1544,7 +1558,7 @@ Options::add_options OptionAdder option_adder(*this, group); for (const auto &option: options) { - option_adder(option.opts, option.desc, option.value, option.arg_help); + option_adder(option.opts_, option.desc_, option.value_, option.arg_help_); } }