Boost logo

Boost :

Subject: [boost] [ICL] interval_map::find(const domain_type_comparable&) instead of interval_map::find(const domain_type&)
From: Denis (comp.lib.boost.devel_at_[hidden])
Date: 2011-05-22 06:34:23


Hi Joachim

One small note about Icl maps.

I think would be useful to make interval_map::find()'s function accept any
type comparable to map's key.
For example, the key type is std::string and the user want to search using a
0-terminated string or a string defined as arbitrary pointer and a length.
Then the user will have to allocate the temporary string only to pass it to
interval_map::find()

You may argue that the std::map works same way.
But there is the difference.
If I want to do the trick above, I can use boost::multi_index or at
least instead of std::map<std::string, ValueT> I can define
something like std::map<tuple<const char*, size_t>, tuple<std::string,
ValueT>> with key's const char* and size_t pointing to the data hosted in
value.

This is not possible with interval_map, where the values can be joined


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk