13

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

Paul Merrill
  • 580
  • 4
  • 14

1 Answers1

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.

Karl von Moor
  • 8,484
  • 4
  • 40
  • 52
  • 8
    Ah. So, there's one difference. – gregg Sep 30 '10 at 14:56
  • 3
    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). – rvalue Sep 17 '12 at 02:23