Skip to content

Commit

Permalink
feat: ufcs ranges sort example
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Sep 23, 2024
1 parent 3343ded commit e15dcde
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/ufcs-ranges-sort/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# cpp2b cache directory
.cache/cpp2
4 changes: 4 additions & 0 deletions examples/ufcs-ranges-sort/build.cpp2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import cpp2b.build;

build: (inout b: cpp2b::build) -> void = {
}
10 changes: 10 additions & 0 deletions examples/ufcs-ranges-sort/ufcs-ranges-sort.cpp2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
main: () = {
a: std::array = (3, 1, 2);
a.std::ranges::sort();
for a do (n) {
std::println("{}", n);
}
assert(a[0] == 1);
assert(a[1] == 2);
assert(a[2] == 3);
}

0 comments on commit e15dcde

Please sign in to comment.