Hello,
I am using the enable_if construct to disable an operator() template member
function of a templated variant visitor:
template <typename iter_t>
class iterator_compare_visitor_ : public boost::static_visitor<bool> {
public:
iterator_compare_visitor_(const iter_t& to_compare_to)
: to_compare_to_(to_compare_to)
{}
template <typename variant_iter_t>
typename std::enable_if< boost::mpl::contains::value, bool >::type
operator()(const variant_iter_t& it) const
{
return std::is_same::value &&
it==to_compare_to_;
}
template <typename variant_iter_t>
typename std::enable_if< boost::mpl::contains::value, bool >::type
operator()(const variant_iter_t& it) const
{
return std::is_same::value &&
it==to_compare_to_.base();
}
private:
const iter_t& to_compare_to_;
};
The compilation fails in msvc2010 with:
error C2039: 'type' : is not a member of 'std::tr1::enable_if<_Test,_Type>'
1> with
1> [
1> _Test=false,
1> _Type=bool
1> ]
in this case, iter_t is not contained in const_reverse_iterators_t and so
the 2nd operator() should not be enabled.
Rds,
MM