0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-29 08:54:02 +01:00

ircd: Add these participating size() and data() overloads for C arrays.

This commit is contained in:
Jason Volk 2017-12-12 13:18:44 -07:00
parent 03dea97bb2
commit 6b287f958c

View file

@ -383,6 +383,42 @@ size(std::ostream &s)
return ret;
}
template<size_t SIZE>
constexpr size_t
size(const char (&buf)[SIZE])
{
return SIZE;
}
template<size_t SIZE>
constexpr size_t
size(const std::array<const char, SIZE> &buf)
{
return SIZE;
}
template<size_t SIZE>
constexpr size_t
size(const std::array<char, SIZE> &buf)
{
return SIZE;
}
template<size_t SIZE>
constexpr const char *
data(const char (&buf)[SIZE])
{
return buf;
}
template<size_t SIZE>
constexpr char *
data(char (&buf)[SIZE])
{
return buf;
}
template<class T>
auto