13

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

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Ah. So, there's one difference.
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).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.