mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
32 lines
470 B
Plaintext
32 lines
470 B
Plaintext
// #target: macos-x64
|
|
module test;
|
|
import std::io;
|
|
import std::math;
|
|
import std::collections::priorityqueue;
|
|
|
|
def FooPriorityQueue = PriorityQueueMax{Foo};
|
|
|
|
fn void main()
|
|
{
|
|
|
|
FooPriorityQueue agh;
|
|
agh.push((Foo) { 3 });
|
|
agh.push((Foo) { 101 });
|
|
agh.push({ 10 });
|
|
while (try f = agh.pop()) io::printf("%s\n", f.x);
|
|
}
|
|
|
|
struct Foo
|
|
{
|
|
int x;
|
|
}
|
|
|
|
fn bool Foo.less(Foo* x, Foo y) @inline
|
|
{
|
|
return x.x < y.x;
|
|
}
|
|
|
|
/* #expect: test.ll
|
|
|
|
%PrivatePriorityQueue = type { %List }
|