maybe a simpler unique_ptr

This commit is contained in:
2023-01-14 20:00:55 -08:00
parent 0d3c9e3422
commit 6614e5e8ea
3 changed files with 7 additions and 25 deletions

View File

@@ -8,17 +8,7 @@
namespace aocpp {
class ConditionalDeleter {
bool should_delete_;
public:
ConditionalDeleter(bool should_delete) : should_delete_ {should_delete} {}
template <typename T>
auto operator()(T * pointer) -> void { if (should_delete_) { delete pointer; }}
};
auto Startup(int argc, char ** argv) -> std::unique_ptr<std::istream, ConditionalDeleter>;
auto Startup(int argc, char ** argv) -> std::unique_ptr<std::istream, void(*)(std::istream*)>;
}