You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
692 B
C++
30 lines
692 B
C++
// -*- c++ -*-
|
|
#pragma once
|
|
|
|
#include_next <iterator>
|
|
|
|
namespace std
|
|
{
|
|
|
|
template <typename T>
|
|
constexpr auto size(const T& t) -> decltype(t.size()) { return t.size(); }
|
|
|
|
template <typename T, size_t N>
|
|
constexpr size_t size(const T (&ary)[N]) noexcept { return N; }
|
|
|
|
|
|
template <typename C>
|
|
constexpr auto data(C& c) -> decltype(c.data()) { return c.data(); }
|
|
|
|
template <typename C>
|
|
constexpr auto data(const C& c) -> decltype(c.data()) { return c.data(); }
|
|
|
|
template <typename T, std::size_t N>
|
|
constexpr T* data(T (&array)[N]) noexcept { return array; }
|
|
|
|
template <typename E>
|
|
constexpr const E* data(std::initializer_list<E> il) noexcept
|
|
{ return il.begin(); }
|
|
|
|
}
|