I am having a problem trying to decide if a Widget instance in a Box is the same as a Widget instance I have a reference to. Rust allows this with expressions such as:

if control_window.main_box.get_children()[0] == control_window.label {

I tried:

if (mainBox.getChildren().first() == label) {

but this is failing. There appear to be no examples of getChildren use in the GtkD demos. Trawling the Web let me to https://github.com/gtkd-developers/GtkD/issues/138 where Gerald ended up asking:

Just out of curiosity, if you want to know if two widgets are equal (i.e wrap the same GTK3 widget), is the best practice to compare the pointer returned from getWidgetStruct or getStruct? I assume if the pointers are the same the GTK3 widget is the same even if different D objects are wrapping them?

I guess I should find out what Gerald ended up doing as I think the problem I have is exactly the one he had.