Replace some const String& with StringView in option_manager.hh
This commit is contained in:
parent
1119d00a96
commit
f1a93a0e61
|
@ -211,7 +211,7 @@ public:
|
||||||
OptionsRegistry(OptionManager& global_manager) : m_global_manager(global_manager) {}
|
OptionsRegistry(OptionManager& global_manager) : m_global_manager(global_manager) {}
|
||||||
|
|
||||||
template<typename T, void (*validator)(const T&) = nullptr>
|
template<typename T, void (*validator)(const T&) = nullptr>
|
||||||
Option& declare_option(const String& name, const String& docstring,
|
Option& declare_option(StringView name, StringView docstring,
|
||||||
const T& value,
|
const T& value,
|
||||||
OptionFlags flags = OptionFlags::None)
|
OptionFlags flags = OptionFlags::None)
|
||||||
{
|
{
|
||||||
|
@ -223,7 +223,7 @@ public:
|
||||||
return **it;
|
return **it;
|
||||||
throw runtime_error(format("option '{}' already declared with different type or flags", name));
|
throw runtime_error(format("option '{}' already declared with different type or flags", name));
|
||||||
}
|
}
|
||||||
m_descs.emplace_back(new OptionDesc{name, docstring, flags});
|
m_descs.emplace_back(new OptionDesc{name.str(), docstring.str(), flags});
|
||||||
opts.emplace_back(new TypedCheckedOption<T, validator>{m_global_manager, *m_descs.back(), value});
|
opts.emplace_back(new TypedCheckedOption<T, validator>{m_global_manager, *m_descs.back(), value});
|
||||||
return *opts.back();
|
return *opts.back();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user