Ask Your Question
1

What is the outcome of dereferencing Box<T> - does it provide a value or a reference?

asked 2021-07-18 11:00:00 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2022-10-22 20:00:00 +0000

huitzilopochtli gravatar image

When we dereference a Box<T> using the * operator, we get a value of type T. So, dereferencing a Box<T> provides a value, not a reference.

However, if the value of type T itself contains references, then we would get a reference to the contents of the Box<T> when we access those references from the dereferenced value.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-07-18 11:00:00 +0000

Seen: 9 times

Last updated: Oct 22 '22