I have a problem with the following. I have a square and a square of the entire matrix for a line of matrix applied matrix. I have created rows to reach out to members like that matrix [A] [b] But the problem is with throwing exceptions, which should be in the format "Illegal index [E] [F]". I use the try-hold in the matrix overload [] and can throw the integer exceptions from the overload [] to the lines, but if the first case is correct, the second case will not solve and the other is wrong.
// matrix overload line & amp; Operator [] (unsigned inx) {return * rows [inx]; } // line overload double & amp; Operator [] (unsigned inx) {return item [inx]; }
should be in the exception format such as "invalid index [e] [ F] "
It seems very difficult to compare it!
If [f] is invalid, the matrix :: operator [] (e) has already ended that parameter is now available is not. So you have to pass this information in a line question at some point. here is a tip. // (member variable "int roe :: index" has been added ...) // matrix overload line & amp; Operator [] (unsigned inx) {rows [inks] - & gt; Setro Index (Inx); Return * rows [inx]; } // line overload double & amp; Operator [] (unsigned inx) {// You can now throw information about both inks and stored row index return items [inx]; } If [E] is invalid, line :: operator [] (f) is not asked Till now. This is an unknown value. This means that whenever [E] is invalid, then it should return something that can operator [] Still called before throwing. // (member variable "bool row :: isInvalid" has been added ...) // Matrix overload line & amp; Operator [] (unsigned inx) {row * result; If (inx is invalid) {// do not throw it yet! Stable rome dummy; Dummy.setInvalid (); Result = and dummy; } And {result = rows [inx]; } Results-> Setro index (inx); Return * results; } // line overload double & amp; Operator [] (unsigned inx) {// if-> If there is untrue truth, then the first index was bad. // If the inx is invalid, then the second index was bad. // Anyhow, we now have both indexes and can throw! Return items [inx]; }
No comments:
Post a Comment