I'm making a kind of wrapper for easily using 2d arrays(not exactly). So to access an element I'm overloading the '()' operator. But if the indices passed are out of bounds I'm doing this to get myself out of trouble.
Code:
Type& operator()(unsigned long col, unsigned long row) throw(const char*);
It is technicaly alright because I throw an exception when something bad happened but I've read that using exceptions to jump around the code and using them too much esp for escaping from bottlenecks is bad practice.
Can someone suggest another way by which
1) I can make the user know that some thing bad happened, and
2) return a phony reference when operator is used as LValue?
And is this habit a bad practice that should be discontinued?