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 | // UNSUPPORTED: c++03, c++11, c++14, c++17 |
10 | |
11 | // constexpr counted_iterator() requires default_initializable<I> = default; |
12 | |
13 | #include <iterator> |
14 | |
15 | #include "test_macros.h" |
16 | #include "test_iterators.h" |
17 | |
18 | constexpr bool test() { |
19 | static_assert(!std::default_initializable<std::counted_iterator<cpp17_input_iterator<int*>>>); |
20 | static_assert( std::default_initializable<std::counted_iterator<forward_iterator<int*>>>); |
21 | |
22 | std::counted_iterator<forward_iterator<int*>> iter; |
23 | assert(iter.base() == forward_iterator<int*>()); |
24 | assert(iter.count() == 0); |
25 | |
26 | return true; |
27 | } |
28 | |
29 | int main(int, char**) { |
30 | test(); |
31 | static_assert(test()); |
32 | |
33 | return 0; |
34 | } |
35 | |