aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2019-02-01 20:31:22 +0100
committerTor Egge <Tor.Egge@broadpark.no>2019-02-01 20:31:22 +0100
commit35394a982271460aa8c9c1060ad1a3f7ad308c42 (patch)
treedbb49dffc59c2665823fdfd299944978dc6b851c /config
parentd9070fb24b751eabd0b10ae7ed83a6122ca0975e (diff)
Simplify variadic template usage in config::ConfigKeySet.
Diffstat (limited to 'config')
-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);
+ }
}
-
}