-3

this code can work in c++17, but I get error in c++11.

template <class T>
constexpr auto is_ref_counted_directly = !std::is_same<int, T>::value;

Could you give me some help, thanks.
my env: gcc 4.8.5, c++11.

lo chan
  • 1
  • 1
  • Why the "c" tag? Please, as a new user here, start with the [tour] and read [ask]. – Ulrich Eckhardt Mar 08 '22 at 07:00
  • `c11` `c17` doesn't have template afaict. do you mean `c++11` `c++17`? – apple apple Mar 08 '22 at 07:02
  • There is no way this will work with any version of C: you are using C++ concepts like classes, templates and namespaces which simply do not exist in C. [C code is *mostly* C++ compatible](https://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B) but the other way is not the case. – Simon Doppler Mar 08 '22 at 07:04
  • thanks for your reminder, I will modify this question – lo chan Mar 08 '22 at 07:07

1 Answers1

0

Variable template need at least c++14, so it would not work in c++11


gcc 4.8.5 seems not support c++14 btw

apple apple
  • 10,292
  • 2
  • 16
  • 36
  • thanks for your reply, I try to use a function template with a static local variable, which return this variable. – lo chan Mar 08 '22 at 07:21