Skip to content

Commit 0259307

Browse files
iterator ctor default test
1 parent 8e0ee54 commit 0259307

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
// REQUIRES: has-fblocks
10+
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
11+
12+
// constexpr iterator() = default;
13+
14+
#include <ranges>
15+
#include <type_traits>
16+
17+
#include "test_macros.h"
18+
19+
struct IntView : std::ranges::view_base {
20+
int* b_ = nullptr;
21+
int* e_ = nullptr;
22+
23+
constexpr IntView() = default;
24+
constexpr IntView(int* b, int* e) : b_(b), e_(e) {}
25+
26+
constexpr int* begin() const { return b_; }
27+
constexpr int* end() const { return e_; }
28+
};
29+
30+
static_assert(std::ranges::view<IntView>);
31+
static_assert(std::ranges::contiguous_range<IntView>);
32+
33+
constexpr bool test() {
34+
int buf1[] = {1, 2};
35+
int buf2[] = {3, 4};
36+
37+
std::ranges::concat_view<IntView, IntView> v(IntView{buf1, buf1 + 2}, IntView{buf2, buf2 + 2});
38+
using Iter = std::ranges::iterator_t<decltype(v)>;
39+
static_assert(std::default_initializable<Iter>);
40+
41+
return true;
42+
}
43+
44+
int main(int, char**) {
45+
test();
46+
static_assert(test());
47+
return 0;
48+
}

0 commit comments

Comments
 (0)