I'm learning C++ and have a little problem with template specialization. I need to call Variable.Set() a lot so, I made the function take in references so it doesn't spend a lot of time copying the string. But then the problem I have is Variable.Set<int>(5); causes error because the parameter is an rvalue and I don't know the solution for this.
error C2664: 'void Variable::Set(int &)': cannot convert argument 1 from 'int' to 'int &'
void main()
{
    Variable var;
    var.Set<int>(5);
}
struct Variable
{
    int integer;
    float floating;
    std::string string;
    template<typename T> void   Set(T& v);
    template<> void             Set<int> (int& v) { integer = v; }
    template<> void             Set<float> (float& v) { floating = v; }
    template<> void             Set<std::string> (std::string& v) { string = v; }
};
 
     
    