Boost logo

Boost Users :

From: Thorsten Ottosen (tottosen_at_[hidden])
Date: 2006-02-09 18:20:59


Bill Buklis wrote:
> Nevermind. I see you did put the predicate in your message. Thanks. Somehow
> I missed it when reading it.
>
> bool predicate( const std::pair<const std::string,void*>& p )
> {
> return p.first.size() > 3;
> }
>
> This does work correctly. Thanks.

HTH

> Out of curiosity, if nothing else, is there a corresponding typedef that
> would match this? std::map would use value_type. What would be the
> equivalent for the ptr_map/void-ptr-map? Of course, depending on the length
> and indirection, it may be better anyway to explicitly list it out as the
> std::pair.

The current docs are a bit weak in this matter. But

   ptr_map<Key,T>::value_type is T*

   ptr_vector<T>::value_type is T*

The fact that you cannot use the normal iterator to access the key in
an algorithm is of course bad when you need it, but I still feel that
the design in general is OK given the domain.

There is no nested typedef right now that would give you the value-type
of the void-ptr-map used internally, though you are guaranteed that it
is std::map<Key,void*>.

I could thus add another pair of typedefs for this case. How does

void_ptr_map_reference
void_ptr_map_const_reference

sound? Is it worth the effort?

-Thorsten


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