summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2019-02-04 13:47:26 +0100
committerGitHub <noreply@github.com>2019-02-04 13:47:26 +0100
commit1ee51876b4a997e9a4cb0e6dcef691b54675773d (patch)
treef4e1d23768cba2b4136fe5d9ee4945ebbeb00373
parent2ff840308390a5f2096623b52b478415e0df56e1 (diff)
parent35394a982271460aa8c9c1060ad1a3f7ad308c42 (diff)
Merge pull request #8351 from vespa-engine/toregge/simplify-variadic-template-usage-in-config-configkeyset
Simplify variadic template usage in config::ConfigKeySet.
-rw-r--r--config/src/vespa/config/retriever/configkeyset.h8
-rw-r--r--config/src/vespa/config/retriever/configkeyset.hpp16
2 files changed, 6 insertions, 18 deletions
diff --git a/config/src/vespa/config/retriever/configkeyset.h b/config/src/vespa/config/retriever/configkeyset.h
index 294b3eb7423..e0a77f50efb 100644
--- a/config/src/vespa/config/retriever/configkeyset.h
+++ b/config/src/vespa/config/retriever/configkeyset.h
@@ -31,14 +31,8 @@ public:
*/
ConfigKeySet & add(const ConfigKeySet & configKeySet);
private:
- template<typename... ConfigTypes>
- struct TypeTag {};
-
- template<typename ConfigType>
- void addImpl(const vespalib::string & configId, TypeTag<ConfigType>);
-
template<typename ConfigType, typename... ConfigTypes>
- void addImpl(const vespalib::string & configId, TypeTag<ConfigType, ConfigTypes...>);
+ void addImpl(const vespalib::string & configId);
};
} // namespace config
diff --git a/config/src/vespa/config/retriever/configkeyset.hpp b/config/src/vespa/config/retriever/configkeyset.hpp
index cfa43fdd8f0..60fcbf7d84a 100644
--- a/config/src/vespa/config/retriever/configkeyset.hpp
+++ b/config/src/vespa/config/retriever/configkeyset.hpp
@@ -7,24 +7,18 @@ template <typename... ConfigTypes>
ConfigKeySet &
ConfigKeySet::add(const vespalib::string & configId)
{
- addImpl(configId, TypeTag<ConfigTypes...>());
+ addImpl<ConfigTypes...>(configId);
return *this;
}
-template <typename ConfigType>
-void
-ConfigKeySet::addImpl(const vespalib::string & configId, TypeTag<ConfigType>)
-{
- insert(ConfigKey::create<ConfigType>(configId));
-}
-
template <typename ConfigType, typename... ConfigTypes>
void
-ConfigKeySet::addImpl(const vespalib::string & configId, TypeTag<ConfigType, ConfigTypes...>)
+ConfigKeySet::addImpl(const vespalib::string & configId)
{
insert(ConfigKey::create<ConfigType>(configId));
- addImpl(configId, TypeTag<ConfigTypes...>());
+ if constexpr(sizeof...(ConfigTypes) > 0) {
+ addImpl<ConfigTypes...>(configId);
+ }
}
-
}