Path: blob/main/contrib/llvm-project/libcxx/include/__iterator/empty.h
35234 views
// -*- C++ -*-1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___ITERATOR_EMPTY_H10#define _LIBCPP___ITERATOR_EMPTY_H1112#include <__config>13#include <cstddef>14#include <initializer_list>1516#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)17# pragma GCC system_header18#endif1920_LIBCPP_BEGIN_NAMESPACE_STD2122#if _LIBCPP_STD_VER >= 172324template <class _Cont>25[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto26empty(const _Cont& __c) noexcept(noexcept(__c.empty())) -> decltype(__c.empty()) {27return __c.empty();28}2930template <class _Tp, size_t _Sz>31[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty(const _Tp (&)[_Sz]) noexcept {32return false;33}3435template <class _Ep>36[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty(initializer_list<_Ep> __il) noexcept {37return __il.size() == 0;38}3940#endif // _LIBCPP_STD_VER >= 174142_LIBCPP_END_NAMESPACE_STD4344#endif // _LIBCPP___ITERATOR_EMPTY_H454647