12 line program... `main` is a nested function when trying to use redblacktree. Beginner error???
WhatMeWorry`
kheaser at gmail.com
Thu Jun 27 20:56:13 UTC 2024
import std.container : RedBlackTree;
int main()
{
struct Location {
int x;
int y;
}
struct Node{
this(Location loc, uint f) {
this.loc = loc;
this.f = f;
}
Location loc;
uint f;
}
auto priorityQueue = new RedBlackTree!(Node, "a.f < b.f", true);
// true: allowDuplicates
//
C:\D\dmd2\windows\bin64\..\..\src\phobos\std\container\rbtree.d(806): Error: `main` is
// a nested function and cannot be accessed from
// `std.container.rbtree.RedBlackTree!(Node, "a.f < b.f",
true).RedBlackTree.allocate`
return 0;
}
More information about the Digitalmars-d-learn
mailing list