For two reasons
The symbol ^
is reserved for bit-wise xor operation
You may use std::pow
to achieve the same functionality.
The nice thing about C++ is that you can overload the operator
to do whatever you like it to do!
template< typename T >
T operator^( T x, T y ) {
return std::pow( x, y );
}
However take into account that when you do that, other people who know C++
and don't know you (and I believe there are quite a few of those) might have significant problems understanding your code!