I'm trying to use concepts to do explicit specialization of some template method, but it isn't compiled on gcc or msvc, but can compile on clang... Who is right?
#include <type_traits>
template<typename T>
concept arithmetic = std::is_arithmetic_v<T> && !std::is_same_v<T, bool>;
template<typename T>
void foo(const T &value, int &result);
template<>
void foo(const arithmetic auto &value, int &result) {
}
The correct syntax is
template<arithmetic T>
void foo(const T &value, int &result){}
or
void foo(const arithmetic auto &value, int &result){}
So no template<> or template<arithmetic T>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With