1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
class MatrixException : public std::exception
{
private:
std::stringstream error;
public:
MatrixException(MException e, std::string file = "", int line = -1)
{
switch (e)
{
case invAccess:
error << "Access to matrix data was out of bounds"; break;
case invSet:
error << "Attempt to set matrix data was out of bounds"; break;
case wrongSize:
error << "Matrix operation was attempted with mismatched sizes"; break;
}
if (file.size()) error << " file: " << file; // Allows the user to use __FILE__
if (line != -1 ) error << " line: " << line; // Allows the user to use __LINE__
}
virtual const char* what() const throw()
{
return error.str().c_str(); // Error here:
}
};
|
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sstream(724): error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ios(176) : see declaration of 'std::basic_ios<_Elem,_Traits>::basic_ios'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> This diagnostic occurred in the compiler generated function 'std::basic_stringstream<_Elem,_Traits,_Alloc>::basic_stringstream(const std::basic_stringstream<_Elem,_Traits,_Alloc> &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Alloc=std::allocator<char>
1> ] |