I'd like to use enable_if/disable_if with a meta-function that
determines whether a given multi-index container has a given tagged
index.
But I'm not having success writing has_index, even looking at
BMI's own index<Tag> meta-function :(
Does anyone know how to implement it? Below how I'd like to use it. Thanks, --DD
struct ByName {};
template <class BMI> struct VCursor {
virtual void filter_by_name(const string& name) {
do_filter_by_name(name);
}
private:
void do_filter_by_name(
const string& name,
typename boost::enable_if >::type* /*dummy*/ = 0
) {
typedef typename BMI::template index<ByName>::type index_type;
...
}
void do_filter_by_name(
const string& name,
typename boost::disable_if >::type* /*dummy*/ = 0
) {
throw "no name index";
}
};