brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 806a04c Raw
55 lines · cpp
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//===----------------------------------------------------------------------===//8 9// <vector>10 11// class vector12 13// bool empty() const noexcept;14 15#include <vector>16#include <cassert>17 18#include "test_macros.h"19#include "min_allocator.h"20 21TEST_CONSTEXPR_CXX20 bool tests() {22  {23    typedef std::vector<bool> C;24    C c;25    ASSERT_NOEXCEPT(c.empty());26    assert(c.empty());27    c.push_back(false);28    assert(!c.empty());29    c.clear();30    assert(c.empty());31  }32#if TEST_STD_VER >= 1133  {34    typedef std::vector<bool, min_allocator<bool>> C;35    C c;36    ASSERT_NOEXCEPT(c.empty());37    assert(c.empty());38    c.push_back(false);39    assert(!c.empty());40    c.clear();41    assert(c.empty());42  }43#endif44 45  return true;46}47 48int main(int, char**) {49  tests();50#if TEST_STD_VER > 1751  static_assert(tests());52#endif53  return 0;54}55