From 121b4ca9ca0fdf4d46c296ffc0372beca80b1cb6 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Wed, 15 Jun 2016 16:33:14 +0300 Subject: [core] Added mbgl::util::convert helper function Converts a given std::array into another using a different (convertible) type. --- include/mbgl/util/convert.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 include/mbgl/util/convert.hpp (limited to 'include/mbgl/util/convert.hpp') diff --git a/include/mbgl/util/convert.hpp b/include/mbgl/util/convert.hpp new file mode 100644 index 0000000000..c2b3d9950d --- /dev/null +++ b/include/mbgl/util/convert.hpp @@ -0,0 +1,17 @@ +#include +#include +#include + +namespace mbgl { +namespace util { + +template::value>> +constexpr std::array convert(const std::array&from) { + std::array to {}; + std::copy(std::begin(from), std::end(from), std::begin(to)); + return to; +} + +} // namespace util +} // namespace mbgl -- cgit v1.2.1