Double Brakets in a vector of vector matrix.

i know it might have been talked about before but i didn't understand much from the explanations before and will be glad if someone can explain again

my template looks like this

template<typename T,int r,int c>
class Matrix

with std::vector<std::vector<T> > Mat; serving as a privet member

i managed to overload the () with not much trouble but when it comes to [][] i am stumped and stuck on that for more then a day now so any help will be much appriciated
Hi,

There is no such operator [][]

http://en.cppreference.com/w/cpp/language/operators

Maybe you can overload [] with 2 arguments?
> Maybe you can overload [] with 2 arguments?
no, you can't.
It is not possible to change the precedence, grouping, or number of operands of operators.



http://en.cppreference.com/w/cpp/language/operators
See «Array subscript operator»
@ne555

Thanks :+) ++ThingsLearnt;

I see from your link that it is possible to have multiple arguments with operator()

Regards :+)
Last edited on
Topic archived. No new replies allowed.