Made operator()s const.

[SVN r17411]
This commit is contained in:
Peter Dimov 2003-02-14 16:20:01 +00:00
parent 1d7066aee1
commit 75afed7f17
2 changed files with 14 additions and 14 deletions

View File

@ -23,8 +23,8 @@
function templates, <STRONG>checked_delete</STRONG> and <STRONG>checked_array_delete</STRONG>, function templates, <STRONG>checked_delete</STRONG> and <STRONG>checked_array_delete</STRONG>,
and two class templates, <STRONG>checked_deleter</STRONG> and <STRONG>checked_array_deleter</STRONG>. and two class templates, <STRONG>checked_deleter</STRONG> and <STRONG>checked_array_deleter</STRONG>.
</p> </p>
<P>The C++ Standard allows, in 5.3.5/5, pointers to incomplete class types to <P>The C++ Standard allows, in 5.3.5/5, pointers to incomplete class types to be
be deleted with a <EM>delete-expression</EM>. When the class has a non-trivial deleted with a <EM>delete-expression</EM>. When the class has a non-trivial
destructor, or a class-specific operator delete, the behavior is undefined. destructor, or a class-specific operator delete, the behavior is undefined.
Some compilers issue a warning when an incomplete type is deleted, but Some compilers issue a warning when an incomplete type is deleted, but
unfortunately, not all do, and programmers sometimes ignore or disable unfortunately, not all do, and programmers sometimes ignore or disable
@ -75,10 +75,10 @@ template&lt;class T&gt; struct checked_deleter
{ {
typedef void result_type; typedef void result_type;
typedef T * argument_type; typedef T * argument_type;
void operator()(T * p); void operator()(T * p) const;
}; };
</pre> </pre>
<h4>void checked_deleter&lt;T&gt;::operator()(T * p);</h4> <h4>void checked_deleter&lt;T&gt;::operator()(T * p) const;</h4>
<blockquote> <blockquote>
<p> <p>
<b>Requires:</b> <b>T</b> must be a complete type. The expression <tt>delete p</tt> <b>Requires:</b> <b>T</b> must be a complete type. The expression <tt>delete p</tt>
@ -94,10 +94,10 @@ template&lt;class T&gt; struct checked_array_deleter
{ {
typedef void result_type; typedef void result_type;
typedef T * argument_type; typedef T * argument_type;
void operator()(T * p); void operator()(T * p) const;
}; };
</pre> </pre>
<h4>void checked_array_deleter&lt;T&gt;::operator()(T * p);</h4> <h4>void checked_array_deleter&lt;T&gt;::operator()(T * p) const;</h4>
<blockquote> <blockquote>
<p> <p>
<b>Requires:</b> <b>T</b> must be a complete type. The expression <tt>delete [] p</tt> <b>Requires:</b> <b>T</b> must be a complete type. The expression <tt>delete [] p</tt>
@ -111,14 +111,14 @@ template&lt;class T&gt; struct checked_array_deleter
<p> <p>
The function templates <STRONG>checked_delete</STRONG> and <STRONG>checked_array_delete</STRONG> The function templates <STRONG>checked_delete</STRONG> and <STRONG>checked_array_delete</STRONG>
were originally part of <STRONG>&lt;boost/utility.hpp&gt;</STRONG>, and the were originally part of <STRONG>&lt;boost/utility.hpp&gt;</STRONG>, and the
documentation acknowledged Beman Dawes, Dave Abrahams, Vladimir Prus, documentation acknowledged Beman Dawes, Dave Abrahams, Vladimir Prus, Rainer
Rainer Deyke, John Maddock, and others as contributors. Deyke, John Maddock, and others as contributors.
</p> </p>
<p> <p>
<br> <br>
<small>Copyright © 2002 by Peter Dimov. Permission to copy, use, modify, sell <small>Copyright © 2002 by Peter Dimov. Permission to copy, use, modify, sell and
and distribute this document is granted provided this copyright notice appears distribute this document is granted provided this copyright notice appears in
in all copies. This document is provided "as is" without express or implied all copies. This document is provided "as is" without express or implied
warranty, and with no claim as to its suitability for any purpose.</small></p> warranty, and with no claim as to its suitability for any purpose.</small></p>
</body> </body>
</html> </html>

View File

@ -9,7 +9,7 @@
// boost/checked_delete.hpp // boost/checked_delete.hpp
// //
// Copyright (c) 1999, 2000, 2001, 2002 boost.org // 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 // Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies. // is granted provided this copyright notice appears in all copies.
@ -41,7 +41,7 @@ template<class T> struct checked_deleter
typedef void result_type; typedef void result_type;
typedef T * argument_type; typedef T * argument_type;
void operator()(T * x) void operator()(T * x) const
{ {
checked_delete(x); checked_delete(x);
} }
@ -52,7 +52,7 @@ template<class T> struct checked_array_deleter
typedef void result_type; typedef void result_type;
typedef T * argument_type; typedef T * argument_type;
void operator()(T * x) void operator()(T * x) const
{ {
checked_array_delete(x); checked_array_delete(x);
} }