if constexpr instead of disallowed member specialization

This commit is contained in:
Thomas Krijnen
2023-11-15 12:33:26 +01:00
parent c2b527b832
commit d5fbc72537
+4 -5
View File
@@ -191,13 +191,12 @@
template <typename T> template <typename T>
PyObject* operator()(const T& t) { PyObject* operator()(const T& t) {
return pythonize(t); if constexpr (std::is_same_v<std::remove_cv_t<std::remove_reference_t<T>>, std::set<int>>) {
}
template <>
PyObject* operator()(const std::set<int>& t) {
std::vector<int> vs(t.begin(), t.end()); std::vector<int> vs(t.begin(), t.end());
return pythonize_vector(vs); return pythonize_vector(vs);
} else {
return pythonize(t);
}
} }
}; };