From 02df325492bff59972b6f4dc95f4d77a965b405f Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 12 Apr 2007 08:08:25 +0000 Subject: [PATCH 1/1] Added correct copy constructor. Surprisingly, the incorrect default copy constructor was never called so I didn't notice it was still callable. --- auto_handle.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/auto_handle.hpp b/auto_handle.hpp index b9d0b6b..64ccd97 100644 --- a/auto_handle.hpp +++ b/auto_handle.hpp @@ -1,5 +1,8 @@ -#ifndef INC_AUTO_HANDLE_H -#define INC_AUTO_HANDLE_H +// Copyright 2005 Ben Hutchings . +// See the file "COPYING" for licence details. + +#ifndef INC_AUTO_HANDLE_HPP +#define INC_AUTO_HANDLE_HPP // Like auto_ptr, but for arbitrary "handle" types. // The parameters are: @@ -25,6 +28,9 @@ public: explicit auto_handle(handle_type handle) : handle_(handle) {} + auto_handle(auto_handle & other) + : handle_(other.release()) + {} auto_handle(ref_type other) : handle_(other.release()) {} @@ -80,4 +86,4 @@ private: target_type & target_; }; -#endif // !INC_AUTO_HANDLE_H +#endif // !defined(INC_AUTO_HANDLE_HPP) -- 2.39.2