I've got a quick code piece:
#include<iostream>
using namespace std;
enum class A:int {
u=1,
v=2,
w=3
};
template<A value>
int nextEnum(){
return value+1;
}
int main() {
nextEnum<A::u>();
return 0;
}
It fails to compile:
clang++ testenum.cpp -std=c++11
testenum.cpp:10:17: error: invalid operands to binary expression ('A' and 'int')
return value+1;
Well, I've declared A as "int" enum, why it fails to "+" with int? How to fix it?
Aucun commentaire:
Enregistrer un commentaire