Created
October 21, 2012 06:25
-
-
Save dilijev/3926120 to your computer and use it in GitHub Desktop.
DimensionException
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DimensionException : public std::exception { | |
private: | |
size_type _rowsA; | |
size_type _colsA; | |
size_type _rowsB; | |
size_type _colsB; | |
char _what[256]; | |
public: | |
DimensionException() | |
: exception() { | |
} | |
DimensionException(size_type rowsA, size_type colsA, size_type rowsB, | |
size_type colsB) | |
: _rowsA(rowsA), | |
_colsA(colsA), | |
_rowsB(rowsB), | |
_colsB(colsB) { | |
snprintf(_what, sizeof(_what), "Size of matrices did not match. " | |
"Found [%d x %d] and [%d x %d]", | |
_rowsA, _colsA, _rowsB, _colsB); | |
} | |
virtual const char* what() const throw () { | |
return _what; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment