template <typename T> void myswap(T a,T b) { T temp = a; a = b; b = temp; } int main() { int m(20),n(30); myswap(ref(m),ref(n)); //m is still 20 and n is still 30 } Why have not the values of m and n interchanged? Passing a value wrapped in std::ref to an INCREMENT function results in value change in the original variable (variable in the stack frame that calls INCREMENT function). Or, Is std::ref usage is restricted/limited?