diff --git a/types.hpp b/types.hpp index 55e28795..b0948c44 100644 --- a/types.hpp +++ b/types.hpp @@ -36,7 +36,37 @@ elems (const T &t) { return t.size (); } -//----------------------------------------------------------------------------- +/////////////////////////////////////////////////////////////////////////////// +// analogue of std::data for use until we get proper c++17 support +namespace util { + template + auto + data (T &t) + { return t.data (); } + + //------------------------------------------------------------------------- + template + auto + data (const T &t) + { return t.data (); } + + + //------------------------------------------------------------------------- + template + constexpr T* + data (T (&t)[N]) + { return &t[0]; } + + + //------------------------------------------------------------------------- + template + constexpr const T* + data (const T (&t)[N]) + { return &t[0]; } +} + + +/////////////////////////////////////////////////////////////////////////////// template T first (T a) {