On 22 August 2012 22:15, Onay Urfalioglu wrote: > > I wonder whether it is possible to overload the operator*() to have two > versions: > - one for all T_VECTOR - types having operator[] > - one for all T_VECTOR - types not having operator[] but providing say a > forward iterator, like std::list > > (This is just a toy requirement, I am aware that one can implement this in > other ways too...) > > You see I am painfully missing some C++11 concepts functionality here... Instead of your TransformationTrait (which defines a nested type) define a UnaryTypeTrait (which defines a boolean constant) for "has operator[]" and another UnaryTypeTrait for "has forward iterator" then selectively enable one overload with enable_if<has_index_operator<T>::value>::type and the other with enable_if<!has_index_operator<T>::value && has_forward_iterator<T>::value>::type. This is not the right list to learn how to do that though.