-
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..) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Values are stored as |
Beta Was this translation helpful? Give feedback.
Values are stored as
basic_any<0u>
s. The0u
there 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.