brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · f2c653b Raw
45 lines · c
1// -*- C++ -*-2//===----------------------------------------------------------------------===//3//4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.5// See https://llvm.org/LICENSE.txt for license information.6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCPP___ITERATOR_EMPTY_H11#define _LIBCPP___ITERATOR_EMPTY_H12 13#include <__config>14#include <initializer_list>15 16#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)17#  pragma GCC system_header18#endif19 20_LIBCPP_BEGIN_NAMESPACE_STD21 22#if _LIBCPP_STD_VER >= 1723 24template <class _Cont>25[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto26empty(const _Cont& __c) noexcept(noexcept(__c.empty())) -> decltype(__c.empty()) {27  return __c.empty();28}29 30template <class _Tp, size_t _Sz>31[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty(const _Tp (&)[_Sz]) noexcept {32  return false;33}34 35template <class _Ep>36[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty(initializer_list<_Ep> __il) noexcept {37  return __il.size() == 0;38}39 40#endif // _LIBCPP_STD_VER >= 1741 42_LIBCPP_END_NAMESPACE_STD43 44#endif // _LIBCPP___ITERATOR_EMPTY_H45