brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · a53b6a8 Raw
47 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// <set>10 11// class set12 13// void clear() noexcept;14 15#include <set>16#include <cassert>17 18#include "test_macros.h"19#include "min_allocator.h"20 21int main(int, char**) {22  {23    typedef std::set<int> M;24    typedef int V;25    V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};26    M m(ar, ar + sizeof(ar) / sizeof(ar[0]));27    assert(m.size() == 8);28    ASSERT_NOEXCEPT(m.clear());29    m.clear();30    assert(m.size() == 0);31  }32#if TEST_STD_VER >= 1133  {34    typedef std::set<int, std::less<int>, min_allocator<int>> M;35    typedef int V;36    V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};37    M m(ar, ar + sizeof(ar) / sizeof(ar[0]));38    assert(m.size() == 8);39    ASSERT_NOEXCEPT(m.clear());40    m.clear();41    assert(m.size() == 0);42  }43#endif44 45  return 0;46}47