Lowecase didn't prove to be better, because Doxygen cannot implicitly
link to it and it collides with non-type template parameters and private
variables.
Loop unrolling is better to leave up to the compiler, as it will do it
automatically and it doesn't add any maintenance burden. Constexpr
addition, multiplication etc. of Vector would be nice, but will that be
really useful? Maybe once if at all?
Now all possible cases are properly handled (row vector * column vector,
column vector * row vector, ...). All operators taking arbitrary type as
argument (element-wise multiplication) now have std::enable_if only for
numerical types.
Currently moved only non-square functionality from Matrix there. Also
static constant members such as row/column count and size are now
lowercase, as they are variables, not types.
NumericType is corresponding numeric type with size at least the same as
int. It is used in debug operators for Matrix and Vector to prevent
printing chars as characters.
If the type isn't already floating-point, FloatingPointType is
corresponding larger type with sufficient size for normalization of
given integral type.
Also updated type traits for long types, they are now subclassed either
from int or long long based on sizeof(long).
It's now less confusing ("length squared" looks like it's even heavier
than length), but on the other hand it's not so obvious that these two
functions come together.
On the other hand everything of this is done at runtime, so it's less
performant than the previous version, mainly when used in loops. When
the result is declared as constexpr, it is done at compile time, just
like the previous version.
I don't know which version to keep, so there will be both until a good
decision.
It was clashing with the default "initializer-list" constructor, which
is constexpr. This constructor is also explicit, which makes it
impossible to e.g. return Vector<1, T> from function without explicitly
specifying name , while for Vector<2, T> it works:
return {1, 2}; // works for Vector<2, int>
return {1}; // doesn't work for Vector<1, int>
Doxygen produces some false-positive warnings for Matrix and Vector
classes, but the generated documentation is fine. Worked around the
warnings by using @copybrief and @copydetails instead of @copydoc.
C++ allows creating arrays with initializer lists shorter than array
length, but for vectors and matrices it will be error prone and hard to
debug. Removed deleted constructor, as it is now catched with
static_assert as well. Also this was possible before (and wasn't catched
with the deleted constructor), now isn't:
Matrix<2, int> a(1, 2);
Each function which returned e.g. Vector<size, T> was in subclasses
overloaded with function returning e.g. Vector3<T>, so the user is able
to use subclass-specific functions. It was nightmare to maintain and it
cluttered the documentation a lot.
Long-standing TODO. It is better to have size first, because it is more
significant than type (e.g. because there are Vector4<T> specializations
and not VectorT<4> specializations). It is also IMHO easier for user to
distinguish/read the type than before:
Vector<float, 4> -> Vector4<float> // before
Vector<4, float> -> Vector4<float> // now