Re: [Boost-users] [multi_index] const_mem_fun with an inherited member function
Hello Joaquin, Thank you for your response.
2. I think that the code won't work as expected: const_mem_fun has some overloads of operator() in order to support chained pointers (http://tinyurl.com/9cd2v) that will hide the implicit conversion from const tuple<int>& to const tuple<int>::inherited&. Could you please try to insert some element in my_tuple_container_type? My hunch is that you'll get a compiler error about tuple<int> not having operator*. Please report back.
You're right; the code fails to compile and for the reason you give.
remains. My suggestion is that you simply provide a user-defined key extractor like this (uncompiled, beware typos): template
struct tuple_member_extractor { typedef typename boost::tuples::element ::type result_type; const result_type& operator()(const Tuple& t)const { return boost::tuples::get<N>(t); } };
Hope this helps; I'd appreciate if you reported on the success/failure of this approach.
Your suggestion worked without any changes (runtime tested it with a few toy calls to insert()/find() ). However, if instead of invoking the global get<>() function template, I try to call the member function template, return t.get<N>(); I get this compile error: error: invalid use of member (did you forget the '&' ?) Do you know if this code should compile? If not, is there a way to call a member function template in this context without relying on a global function wrapper? Thanks, Matt
participants (1)
-
Matt Steele