llvm-project
75 строк · 1.8 Кб
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-exception
6//
7//===----------------------------------------------------------------------===//
8
9// <set>
10
11// class set
12
13// template <class InputIterator>
14// void insert(InputIterator first, InputIterator last);
15
16#include <set>17#include <cassert>18
19#include "test_macros.h"20#include "test_iterators.h"21#include "min_allocator.h"22
23int main(int, char**)24{
25{26typedef std::set<int> M;27typedef int V;28V ar[] =29{301,311,321,332,342,352,363,373,38339};40M m;41m.insert(cpp17_input_iterator<const V*>(ar),42cpp17_input_iterator<const V*>(ar + sizeof(ar)/sizeof(ar[0])));43assert(m.size() == 3);44assert(*m.begin() == 1);45assert(*std::next(m.begin()) == 2);46assert(*std::next(m.begin(), 2) == 3);47}48#if TEST_STD_VER >= 1149{50typedef std::set<int, std::less<int>, min_allocator<int>> M;51typedef int V;52V ar[] =53{541,551,561,572,582,592,603,613,62363};64M m;65m.insert(cpp17_input_iterator<const V*>(ar),66cpp17_input_iterator<const V*>(ar + sizeof(ar)/sizeof(ar[0])));67assert(m.size() == 3);68assert(*m.begin() == 1);69assert(*std::next(m.begin()) == 2);70assert(*std::next(m.begin(), 2) == 3);71}72#endif73
74return 0;75}
76