1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
13 // template <class InputIterator>
14 // set(InputIterator first, InputIterator last,
15 // const value_compare& comp, const allocator_type& a);
17 // template <class InputIterator>
18 // set(InputIterator first, InputIterator last,
19 // const allocator_type& a);
24 #include "test_macros.h"
25 #include "test_iterators.h"
26 #include "../../../test_compare.h"
27 #include "test_allocator.h"
45 typedef test_less
<V
> C
;
46 typedef test_allocator
<V
> A
;
47 std::set
<V
, C
, A
> m(cpp17_input_iterator
<const V
*>(ar
),
48 cpp17_input_iterator
<const V
*>(ar
+sizeof(ar
)/sizeof(ar
[0])),
50 assert(m
.value_comp() == C(5));
51 assert(m
.get_allocator() == A(7));
52 assert(m
.size() == 3);
53 assert(std::distance(m
.begin(), m
.end()) == 3);
54 assert(*m
.begin() == 1);
55 assert(*std::next(m
.begin()) == 2);
56 assert(*std::next(m
.begin(), 2) == 3);
73 typedef test_allocator
<V
> A
;
74 typedef test_less
<int> C
;
76 std::set
<V
, C
, A
> m(ar
, ar
+sizeof(ar
)/sizeof(ar
[0]), a
);
78 assert(m
.size() == 3);
79 assert(std::distance(m
.begin(), m
.end()) == 3);
80 assert(*m
.begin() == 1);
81 assert(*std::next(m
.begin()) == 2);
82 assert(*std::next(m
.begin(), 2) == 3);
83 assert(m
.get_allocator() == a
);