blob: 8bf1e1295eda4c46cc80f7897ba0066e321086c4 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Chandler Carruth57b08b02019-01-19 10:56:40 +00003// 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-exception
Howard Hinnant3e519522010-05-11 19:42:16 +00006//
7//===----------------------------------------------------------------------===//
8
9// <set>
10
11// class set
12
13// bool empty() const;
14
15#include <set>
16#include <cassert>
17
Marshall Clow7fc6a552019-05-31 18:35:30 +000018#include "test_macros.h"
Marshall Clowe34f6f62013-11-26 20:58:02 +000019#include "min_allocator.h"
Howard Hinnant07d3ecc2013-06-19 21:29:40 +000020
JF Bastien2df59c52019-02-04 20:31:13 +000021int main(int, char**)
Howard Hinnant3e519522010-05-11 19:42:16 +000022{
Howard Hinnant07d3ecc2013-06-19 21:29:40 +000023 {
Howard Hinnant3e519522010-05-11 19:42:16 +000024 typedef std::set<int> M;
25 M m;
26 assert(m.empty());
27 m.insert(M::value_type(1));
28 assert(!m.empty());
29 m.clear();
30 assert(m.empty());
Howard Hinnant07d3ecc2013-06-19 21:29:40 +000031 }
Eric Fiselierf2f2a632016-06-14 21:31:42 +000032#if TEST_STD_VER >= 11
Howard Hinnant07d3ecc2013-06-19 21:29:40 +000033 {
34 typedef std::set<int, std::less<int>, min_allocator<int>> M;
35 M m;
36 assert(m.empty());
37 m.insert(M::value_type(1));
38 assert(!m.empty());
39 m.clear();
40 assert(m.empty());
41 }
42#endif
JF Bastien2df59c52019-02-04 20:31:13 +000043
44 return 0;
Howard Hinnant3e519522010-05-11 19:42:16 +000045}