diff options
author | Max Kellermann <max@musicpd.org> | 2018-07-17 20:16:12 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-07-17 20:27:46 +0200 |
commit | af33a9f4b8d656cd403ec9a087a436ad7bf3a594 (patch) | |
tree | 11c568474fc98f89b34dc7f4517329da03b8f5b4 /src/config | |
parent | e9a45708916da57dddc0cfff00c7e06ff3c47fb6 (diff) |
config/Block: allow moving name and value
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/Block.hxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/config/Block.hxx b/src/config/Block.hxx index 95157b694..01a41febf 100644 --- a/src/config/Block.hxx +++ b/src/config/Block.hxx @@ -40,9 +40,11 @@ struct BlockParam { */ mutable bool used = false; + template<typename N, typename V> gcc_nonnull_all - BlockParam(const char *_name, const char *_value, int _line=-1) - :name(_name), value(_value), line(_line) {} + BlockParam(N &&_name, V &&_value, int _line=-1) noexcept + :name(std::forward<N>(_name)), value(std::forward<V>(_value)), + line(_line) {} int GetIntValue() const; @@ -92,10 +94,12 @@ struct ConfigBlock { return block_params.empty(); } + template<typename N, typename V> gcc_nonnull_all - void AddBlockParam(const char *_name, const char *_value, - int _line=-1) { - block_params.emplace_back(_name, _value, _line); + void AddBlockParam(N &&_name, V &&_value, int _line=-1) noexcept { + block_params.emplace_back(std::forward<N>(_name), + std::forward<V>(_value), + _line); } gcc_nonnull_all gcc_pure |