I have a template function like this:
template <typename T> void MyClass::setData(const std::string& name, const T& value)
{
...
// if the template type is a vector of strings, add instead of overwrite
if constexpr (std::is_same_v<T, std::vector<std::string>>)
{
auto temp = someData.get<T>(name);
temp.insert(temp.end(), value.begin(), value.end());
someData.set(name, temp);
}
// otherwise just set data
else
{
someData.set(name, value);
}
...
}
What I want now is to check if T
is any std::vector<>
, not just for strings. How do I do that?