I want to use t(rvalue reference) in a case of switch(T), but I get an error the value of 't' is not usable in a constant expression
. How to do it the right way.
#include <iostream>
using namespace std;
int main(){
int (&&t)=5;
int T{};
switch(T){
case t: // error in this case
cout<<t<<endl;
break;
default:
cout<<"default"<<endl;
break;
}
}