anotherim-desktop/plugins/windows-notification/api/include/make_array.hpp

16 lines
312 B
C++
Raw Normal View History

#ifndef MAKE_ARRAY_HPP
#define MAKE_ARRAY_HPP
#include <array>
#include <algorithm>
template<std::size_t N>
inline auto make_array(const char (&from_literal)[N]) noexcept
{
2021-03-19 21:43:00 +00:00
static_assert(N);
std::array<char,N-1> a;
std::copy(+from_literal, from_literal+a.size(), a.begin());
return a;
}
#endif