forked from hsutter/cppfront
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpure2-bounds-safety-span.cpp
More file actions
47 lines (29 loc) · 1.16 KB
/
pure2-bounds-safety-span.cpp
File metadata and controls
47 lines (29 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#define CPP2_INCLUDE_STD Yes
//=== Cpp2 type declarations ====================================================
#include "cpp2util.h"
#line 1 "pure2-bounds-safety-span.cpp2"
//=== Cpp2 type definitions and function declarations ===========================
#line 1 "pure2-bounds-safety-span.cpp2"
#line 2 "pure2-bounds-safety-span.cpp2"
[[nodiscard]] auto main() -> int;
#line 15 "pure2-bounds-safety-span.cpp2"
auto print_and_decorate(auto const& x) -> void;
#line 18 "pure2-bounds-safety-span.cpp2"
#line 1 "pure2-bounds-safety-span.cpp2"
//=== Cpp2 function definitions =================================================
#line 1 "pure2-bounds-safety-span.cpp2"
#line 2 "pure2-bounds-safety-span.cpp2"
[[nodiscard]] auto main() -> int
{
std::vector<std::string> words {"decorated", "hello", "world"};
std::span<std::string> s {words};
static_cast<void>(cpp2::move(words));
auto i {0};
for( ; cpp2::impl::cmp_less(i,CPP2_UFCS(ssize)(s)); ++i ) {
print_and_decorate(CPP2_ASSERT_IN_BOUNDS(s, i));
}
}
#line 15 "pure2-bounds-safety-span.cpp2"
auto print_and_decorate(auto const& x) -> void{
std::cout << ">> " << x << "\n";
}