We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e0e376a commit 1be01b7Copy full SHA for 1be01b7
examples/usertype_var.cpp
@@ -32,10 +32,14 @@ int main() {
32
// number is its own memory: was passed by value
33
// So does not change
34
35
- assert(lua["test"]["ref_number"] == 25);
+ assert(lua["test"]["ref_number"] == 542);
36
// ref_number is just test::number
37
// passed through std::ref
38
// so, it holds a reference
39
+ // which can be updated
40
+ // be careful about referencing local variables,
41
+ // if they go out of scope but are still reference
42
+ // you'll suffer dangling reference bugs!
43
44
return 0;
45
}
0 commit comments