
on Wed Oct 31 2007, "Ovanes Markarian"
Ok! Thanks! I got it... The problem is, that I thought that SFINAE would work from the template class in the template function which does not depend on the argument.
is_const is a member of the traits_class which this type is derived from... Pretty much like:
template<class T> struct traits_class { // some type calcs here typedef ... result_type; enum { is_const = false }; };
template<class T> struct traits_class<const T> { // some type calcs here typedef ... result_type; enum { is_const = true }; };
template<class T> struct some_class : traits_class<T> {
template<class LookUpType_> typename boost::disable_if_c
::type at(LookUpType_ const& key) { return has_key(view_, key); //has key is some external function, which receives the result_type from the view_ } };
My idea was to enable only result_type at(LookUpType_ const& key) const; if T is const
OR enable non-const version. result_type at(LookUpType_ const& key); if T is not const
On the other hand Compiler does this for me automatically if T is const (but if T is non-const I would like to disable the const access).
Anyway in that case I thought SFINAE should work, but it did not. Do I really need a type to be a template param of the member function, even if the class is a template itself?
No, it needs to be _dependent_ on a template parameter of the member
function. Here's an evil trick you can use:
template