|
Boost Users : |
From: Matthias Kaeppler (noreply_at_[hidden])
Date: 2005-10-13 03:16:06
Hello,
I have two questions regarding the proper use of boost::shared_ptr; both
actually arose after reading
http://www.boost.org/libs/smart_ptr/example/shared_ptr_example.cpp
1. In order for some class to work with std::set, you have to supply an
operator with "less than" semantics. Why are you instead declaring a
"greater than" operator?
2. In your examples, sometimes you're passing a shared_ptr by value, and
sometimes by reference-to-const. Which is the better practice? Usually,
common pointers are passed by value, but since in shared_ptr a reference
counting mechanism keeps track of the copies, maybe it's better to pass
it by reference whenever possible?
Thanks in advance,
Matthias Kaeppler
-- Matthias Kaeppler | Tel: +49 631 3405805 Gerhart-Hauptmann-Str. 16a | Mob: +49 176 20108693 D-67663 Kaiserslautern | E-Mail: matthias at finitestate dot org
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net