mirror of
https://github.com/matrix-construct/construct
synced 2025-01-19 11:01:54 +01:00
ircd: Add these participating size() and data() overloads for C arrays.
This commit is contained in:
parent
03dea97bb2
commit
6b287f958c
1 changed files with 36 additions and 0 deletions
|
@ -383,6 +383,42 @@ size(std::ostream &s)
|
||||||
return ret;
|
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>
|
template<class T>
|
||||||
auto
|
auto
|
||||||
|
|
Loading…
Add table
Reference in a new issue