Last active
July 20, 2018 08:06
-
-
Save hexagit/df98bca83884e14dd0d2a139a217c9ab to your computer and use it in GitHub Desktop.
アクセス違反でゲームエンジンが落ちないようにしよう!スコープの開始と終了を出力する
This file contains 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
// スコープの開始と終了を出力する | |
struct PrintScope | |
{ | |
// コンストラクタ | |
PrintScope(const char* name) | |
: _Name(name) | |
{ | |
std::cout << _Indent << "Start " << _Name << std::endl; | |
_Indent.push_back(' '); | |
} | |
// デストラクタ | |
~PrintScope() | |
{ | |
_Indent.pop_back(); | |
std::cout << _Indent << "End " << _Name << std::endl; | |
} | |
const char* _Name; | |
static std::string _Indent; | |
}; | |
std::string PrintScope::_Indent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment