I am trying to overload operator+(ptrdiff_t, It)
for a random access iterator, which is template class, inside a template class.
The following similar code refuses to work. But if make class B
not a template, it works.
template<typename T>
struct A
{
template<bool S>
struct B // random_access_iterator
{
//friend B operator+<>(T, B);
};
};
template<typename T, bool S>
typename A<T>::B<S> operator+(T a, typename A<T>::B<S> i) { return i; }
int main()
{
5 + A<int>::B<true>{}; // Why argument deduction/substitution failed?
return 0;
}