Differences between tr1::shared_ptr and boost::shared_ptr?
Asked Answered
H

1

13

Are there any difference between tr1::shared_ptr and boost::shared_ptr? If so, what?

Hanfurd answered 30/9, 2010 at 14:31 Comment(0)
I
20

No, the documentation of boost shared_ptr says:

This implementation conforms to the TR1 specification, with the only exception that it resides in namespace boost instead of std::tr1.

Injurious answered 30/9, 2010 at 14:37 Comment(2)
Ah. So, there's one difference.Floatplane
The implementations may differ while still conforming; Notably boost::shared_ptr's dereferencing operators use Boost.Assert to check for NULL (i.e. emptiness) before performing the dereference; while libc++'s std::shared_ptr has no such check. In the case you hit this error at runtime, one will mean an assertion failure, the other a segmentation fault (probably).Gigahertz

© 2022 - 2024 — McMap. All rights reserved.