tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
empty.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_ITERATOR_EMPTY_HPP
5#define TETL_ITERATOR_EMPTY_HPP
6
7#include <etl/_cstddef/size_t.hpp>
8#include <etl/_utility/ignore_unused.hpp>
9
10namespace etl {
11
12/// Returns whether the given container is empty.
13/// \ingroup iterator
14
15template <typename C>
16constexpr auto empty(C const& c) noexcept(noexcept(c.empty())) -> decltype(c.empty())
17{
18 return c.empty();
19}
20
21/// Returns whether the given container is empty.
22/// \ingroup iterator
23template <typename T, size_t N>
24constexpr auto empty(T (&array)[N]) noexcept -> bool
25{
26 etl::ignore_unused(&array);
27 return false;
28}
29
30} // namespace etl
31
32#endif // TETL_ITERATOR_EMPTY_HPP
constexpr auto empty(C const &c) noexcept(noexcept(c.empty())) -> decltype(c.empty())
Returns whether the given container is empty.
Definition empty.hpp:16
constexpr auto empty(T(&array)[N]) noexcept -> bool
Returns whether the given container is empty.
Definition empty.hpp:24
Definition adjacent_find.hpp:9