|
Does anyone know if the T& returned by registry.ctx().get() will remain at the same location in memory over time as new items are emplaced? (i.e., if I can safely keep a reference around and capture it in lambdas for handling later events, assuming I don't erase it from the registry manually..) |
Answered by
skypjack
Jun 2, 2025
Replies: 1 comment
|
Values are stored as |
0 replies
Answer selected by
furrz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Values are stored as
basic_any<0u>s. The0uthere is the size of the internal buffer of thebasic_any. That is, it forces a memory allocation, because there is no built-in buffer to avoid it. So, yeah, references should remain stable until you erase the variable or destroy the registry.