brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 4054372 Raw
61 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 multiset12 13// size_type size() const;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::multiset<int> M;24    M m;25    assert(m.size() == 0);26    m.insert(M::value_type(2));27    assert(m.size() == 1);28    m.insert(M::value_type(1));29    assert(m.size() == 2);30    m.insert(M::value_type(2));31    assert(m.size() == 3);32    m.erase(m.begin());33    assert(m.size() == 2);34    m.erase(m.begin());35    assert(m.size() == 1);36    m.erase(m.begin());37    assert(m.size() == 0);38  }39#if TEST_STD_VER >= 1140  {41    typedef std::multiset<int, std::less<int>, min_allocator<int>> M;42    M m;43    assert(m.size() == 0);44    m.insert(M::value_type(2));45    assert(m.size() == 1);46    m.insert(M::value_type(1));47    assert(m.size() == 2);48    m.insert(M::value_type(2));49    assert(m.size() == 3);50    m.erase(m.begin());51    assert(m.size() == 2);52    m.erase(m.begin());53    assert(m.size() == 1);54    m.erase(m.begin());55    assert(m.size() == 0);56  }57#endif58 59  return 0;60}61