nttlTraits Method - Square

Description
Given a value x, return x2.

Since squaring can often be done much faster than regular multiplication, it would be nice to be able to take advantage of this in algorithms that do a lot of squaring (e.g. fast exponentiation).   But there is no standard C++ operator for squaring.  This method provides a way to supply a squaring operation for the type T.  The default implementation for this method is regular multiplication, of course.

Signature
template<class T> T nttlTraits::Square( const T& x )
Parameters
Name Type Description
x T Some number.
Returns
( T )  x2.
Example
#include <nttl/nttlTraits.h>
...
nttlTraits<int> tr;
...
int x = 123;
int s = tr.Square( x );