やってない
error: invalid operandsof types
'int' and 'std::nullptr_t' to binary 'operator!='
if (__ptr != nullptr)
^
intとnullptrの比較ができずコンパイルエラーに
13.
どうしようもない
bool operator!=(int, std::nullptr_t)は宣言できない
boolmy::operator!=(int, std::nullptr_t)' must have an argument of
class or enumerated type
bool operator!=(int i, std::nullptr_t n);
^
もしハンドルが組み込み型じゃなくて、ユーザ定義型
だったらできるけど、そもそもなんでハンドルをnullptr
なんかと比較しなくちゃいけないの?
参考
N4189 Generic ScopeGuard and RAII Wrapper for the
Standard Library (Peter Sommerlad & Andrew L.Sandoval
2014)
Effective Modern C++ (Scott Meyers 2015)