summaryrefslogtreecommitdiff
path: root/include/mbgl/util/convert.hpp
blob: c2b3d9950de9a1b28785384b08e53eaa42c4186e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <array>
#include <type_traits>
#include <utility>

namespace mbgl {
namespace util {

template<typename To, typename From, std::size_t Size,
         typename = std::enable_if_t<std::is_convertible<From, To>::value>>
constexpr std::array<To, Size> convert(const std::array<From, Size>&from) {
    std::array<To, Size> to {};
    std::copy(std::begin(from), std::end(from), std::begin(to));
    return to;
}

} // namespace util
} // namespace mbgl