diff -r 273333700685 -r 4119185b56ca src/basics.h --- a/src/basics.h Sat Jan 28 13:32:55 2017 +0200 +++ b/src/basics.h Sat Jan 28 13:49:09 2017 +0200 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include "macros.h" @@ -212,3 +213,23 @@ double getRadialPoint(int segment, int divisions, double(*func)(double)); QVector makeCircle(int segments, int divisions, double radius); + +// +// Get the amount of elements in something. +// +template +int length(T(&)[N]) +{ + return N; +} + +static inline int length(const QString& string) +{ + return string.size(); +} + +template +int length(const QVector& vector) +{ + return vector.size(); +}