4

Consider the following code:

#include <iostream>

template <class T>
T v;

template <>
double v<char> = 123.456; // ???

int main() {
    std::cout << v<int> << " " << v<char> << "\n";
}

Why I'm allowed (gcc, clang) to specialize template variable for char type as double? What's the correct syntax for variable template specialization?

αλεχολυτ
  • 4,792
  • 1
  • 35
  • 71

0 Answers0