4#ifndef TETL_ITERATOR_SIZE_HPP
5#define TETL_ITERATOR_SIZE_HPP
7#include <etl/_cstddef/ptrdiff_t.hpp>
8#include <etl/_cstddef/size_t.hpp>
9#include <etl/_type_traits/common_type.hpp>
10#include <etl/_type_traits/make_signed.hpp>
11#include <etl/_utility/ignore_unused.hpp>
19constexpr auto size(C
const& c)
noexcept(
noexcept(
c.
size())) ->
decltype(c.size())
25template <
typename T, size_t N>
26constexpr auto size(T
const (&array)[N])
noexcept -> size_t
28 etl::ignore_unused(&array[0]);
34constexpr auto ssize(C
const& c) -> common_type_t<ptrdiff_t, make_signed_t<
decltype(c.size())>>
36 using R = common_type_t<ptrdiff_t, make_signed_t<
decltype(c.size())>>;
37 return static_cast<R>(c.size());
41template <
typename T, ptrdiff_t N>
42constexpr auto ssize(T
const (&array)[
static_cast<size_t>(N)])
noexcept -> ptrdiff_t
47 etl::ignore_unused(&array[0]);
constexpr auto size(T const (&array)[N]) noexcept -> size_t
Definition size.hpp:26
constexpr auto ssize(T const (&array)[static_cast< size_t >(N)]) noexcept -> ptrdiff_t
Definition size.hpp:42
constexpr auto ssize(C const &c) -> common_type_t< ptrdiff_t, make_signed_t< decltype(c.size())> >
Definition size.hpp:34
constexpr auto size(C const &c) noexcept(noexcept(c.size())) -> decltype(c.size())
Returns the size of the given container c or array array. Returns c.size(), converted to the return t...
Definition size.hpp:19
Definition adjacent_find.hpp:9