Boost logo

Boost Users :

From: Daryle Walker (darylew_at_[hidden])
Date: 2005-10-13 12:32:37


On 10/13/05 4:16 AM, "Matthias Kaeppler" <noreply_at_[hidden]> wrote:

> 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?
[TRUNCATE question 2]

The comparison object for an associative container can be any function
(object) that can provide an ordering for two objects/values. It doesn't
have to be "less than". If it was like you said, then how could you store
stuff in reverse order (without using reverse iterators), use types without
relational operators (like complex numbers), use a specific field of a
composite object, use a complex mixture of a composite object's fields, or
use one criterion for one set and a different criterion for a different set
when both sets use the same element type?

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

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