Created
January 11, 2015 19:40
-
-
Save SHyx0rmZ/0d6744bf7278ea8ba4de to your computer and use it in GitHub Desktop.
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
| namespace std { | |
| template <> | |
| struct default_delete<fstream> { | |
| void operator()(fstream *ptr) { | |
| if (ptr != nullptr && ptr->is_open()) { | |
| ptr->close(); | |
| } | |
| delete ptr; | |
| } | |
| }; | |
| template <> | |
| struct default_delete<ifstream> { | |
| void operator()(ifstream *ptr) { | |
| if (ptr != nullptr && ptr->is_open()) { | |
| ptr->close(); | |
| } | |
| delete ptr; | |
| } | |
| }; | |
| template <> | |
| struct default_delete<ofstream> { | |
| void operator()(ofstream *ptr) { | |
| if (ptr != nullptr && ptr->is_open()) { | |
| ptr->close(); | |
| } | |
| delete ptr; | |
| } | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment