Hi everybody,
I have this boost::multi_index container (I'm very very happy with
boost::multi_index!):
typedef multi_index_container<
CacheEntry,
indexed_by <
ordered_unique<
composite_key<
CacheEntry,
member,
member
>,
composite_key_compare >
>,
sequenced<>
>
cache_t;
For details on CacheEntry, see
http://wiki.powerdns.com/cgi-bin/trac.fcgi/browser/trunk/pdns/pdns/recursor_...
What I want to do is use a compatible key ('char *') to search only on
d_qname.
I've tried:
struct string_char_comp
{
bool operator()(const char* x, const tuple& )const
{
return false; // bogus, just compile testing
}
bool operator()(const tuple&, const char* x )const
{
return false;
}
};
Followed by:
cache_t d_cache;
// ...
d_cachecache=d_cache.equal_range(qname.c_str(), string_char_comp());
But this doesn't compile with famously huge template errors (I've shortened
boost::multi_index to bi::):
ord_index_ops.hpp:87: error: no match for call to `(const string_char_comp)
(bi::composite_key_result,
&MemRecursorCache::CacheEntry::d_qname>,
bi::member, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> >, const char* const&)'
These errors make me wonder if what I want is even possible - unless I make
my comparison function accept a composite_key_result with lots of bi
internals in it.
Joaquin?
--
http://www.PowerDNS.com Open source, database driven DNS Software
http://netherlabs.nl Open and Closed source services