Move constexpr compatible Array struct to meta.hh

This commit is contained in:
Maxime Coste 2017-05-17 20:20:31 +01:00
parent eec8239c78
commit a578c51baf
2 changed files with 12 additions and 11 deletions

View File

@ -6,17 +6,6 @@
namespace Kakoune namespace Kakoune
{ {
template<typename T, size_t N>
struct Array
{
constexpr size_t size() const { return N; }
constexpr const T& operator[](int i) const { return m_data[i]; }
constexpr const T* begin() const { return m_data; }
constexpr const T* end() const { return m_data+N; }
T m_data[N];
};
template<typename T> struct EnumDesc { T value; StringView name; }; template<typename T> struct EnumDesc { T value; StringView name; };
} }

View File

@ -9,6 +9,18 @@ inline namespace Meta
template<typename T> struct Type {}; template<typename T> struct Type {};
} }
template<typename T, size_t N>
struct Array
{
constexpr size_t size() const { return N; }
constexpr const T& operator[](int i) const { return m_data[i]; }
constexpr const T* begin() const { return m_data; }
constexpr const T* end() const { return m_data+N; }
T m_data[N];
};
} }
#endif // meta_hh_INCLUDED #endif // meta_hh_INCLUDED