#pragma once #include #include #include class Ex : public std::exception { public: Ex() : exception{}, mSS{ std::make_shared() }, mStr{} { } Ex( char const* str ) : Ex{} { *mSS << str; } template Ex& operator<<( T const& t ) { *mSS << t; return *this; } char const* what() const noexcept override { mStr = mSS->str(); return mStr.c_str(); } private: std::shared_ptr mSS; mutable std::string mStr; }; class EmulationViolation : public Ex { public: EmulationViolation() : Ex{} { } EmulationViolation( char const* str ) : Ex{ str } { } };