From 75afed7f174047d39cd5cf991a98ab3593a5472e Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 14 Feb 2003 16:20:01 +0000 Subject: [PATCH] Made operator()s const. [SVN r17411] --- checked_delete.html | 22 +++++++++++----------- include/boost/checked_delete.hpp | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/checked_delete.html b/checked_delete.html index bd7753e..4af2ae7 100644 --- a/checked_delete.html +++ b/checked_delete.html @@ -23,8 +23,8 @@ function templates, checked_delete and checked_array_delete, and two class templates, checked_deleter and checked_array_deleter.

-

The C++ Standard allows, in 5.3.5/5, pointers to incomplete class types to - be deleted with a delete-expression. When the class has a non-trivial +

The C++ Standard allows, in 5.3.5/5, pointers to incomplete class types to be + deleted with a delete-expression. When the class has a non-trivial destructor, or a class-specific operator delete, the behavior is undefined. Some compilers issue a warning when an incomplete type is deleted, but unfortunately, not all do, and programmers sometimes ignore or disable @@ -75,10 +75,10 @@ template<class T> struct checked_deleter { typedef void result_type; typedef T * argument_type; - void operator()(T * p); + void operator()(T * p) const; }; -

void checked_deleter<T>::operator()(T * p);

+

void checked_deleter<T>::operator()(T * p) const;

Requires: T must be a complete type. The expression delete p @@ -94,10 +94,10 @@ template<class T> struct checked_array_deleter { typedef void result_type; typedef T * argument_type; - void operator()(T * p); + void operator()(T * p) const; }; -

void checked_array_deleter<T>::operator()(T * p);

+

void checked_array_deleter<T>::operator()(T * p) const;

Requires: T must be a complete type. The expression delete [] p @@ -111,14 +111,14 @@ template<class T> struct checked_array_deleter

The function templates checked_delete and checked_array_delete were originally part of <boost/utility.hpp>, and the - documentation acknowledged Beman Dawes, Dave Abrahams, Vladimir Prus, - Rainer Deyke, John Maddock, and others as contributors. + documentation acknowledged Beman Dawes, Dave Abrahams, Vladimir Prus, Rainer + Deyke, John Maddock, and others as contributors.


- Copyright © 2002 by Peter Dimov. Permission to copy, use, modify, sell - and distribute this document is granted provided this copyright notice appears - in all copies. This document is provided "as is" without express or implied + Copyright © 2002 by Peter Dimov. Permission to copy, use, modify, sell and + distribute this document is granted provided this copyright notice appears in + all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.

diff --git a/include/boost/checked_delete.hpp b/include/boost/checked_delete.hpp index 223b4b5..aa8a7a5 100644 --- a/include/boost/checked_delete.hpp +++ b/include/boost/checked_delete.hpp @@ -9,7 +9,7 @@ // boost/checked_delete.hpp // // Copyright (c) 1999, 2000, 2001, 2002 boost.org -// Copyright (c) 2002 Peter Dimov +// Copyright (c) 2002, 2003 Peter Dimov // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. @@ -41,7 +41,7 @@ template struct checked_deleter typedef void result_type; typedef T * argument_type; - void operator()(T * x) + void operator()(T * x) const { checked_delete(x); } @@ -52,7 +52,7 @@ template struct checked_array_deleter typedef void result_type; typedef T * argument_type; - void operator()(T * x) + void operator()(T * x) const { checked_array_delete(x); }