forked from boostorg/smart_ptr
Comparison operators against a raw pointer now accept different types
[SVN r31110]
This commit is contained in:
@ -174,22 +174,22 @@ template<class T, class U> inline bool operator!=(intrusive_ptr<T> const & a, in
|
|||||||
return a.get() != b.get();
|
return a.get() != b.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator==(intrusive_ptr<T> const & a, T * b)
|
template<class T, class U> inline bool operator==(intrusive_ptr<T> const & a, U * b)
|
||||||
{
|
{
|
||||||
return a.get() == b;
|
return a.get() == b;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator!=(intrusive_ptr<T> const & a, T * b)
|
template<class T, class U> inline bool operator!=(intrusive_ptr<T> const & a, U * b)
|
||||||
{
|
{
|
||||||
return a.get() != b;
|
return a.get() != b;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator==(T * a, intrusive_ptr<T> const & b)
|
template<class T, class U> inline bool operator==(T * a, intrusive_ptr<U> const & b)
|
||||||
{
|
{
|
||||||
return a == b.get();
|
return a == b.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator!=(T * a, intrusive_ptr<T> const & b)
|
template<class T, class U> inline bool operator!=(T * a, intrusive_ptr<U> const & b)
|
||||||
{
|
{
|
||||||
return a != b.get();
|
return a != b.get();
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
</head>
|
</head>
|
||||||
<body text="#000000" bgColor="#ffffff">
|
<body text="#000000" bgColor="#ffffff">
|
||||||
<h1><IMG height="86" alt="boost.png (6897 bytes)" src="../../boost.png" width="277" align="middle">intrusive_ptr
|
<h1><A href="../.."><IMG height="86" alt="boost.png (6897 bytes)" src="../../boost.png" width="277" align="middle"
|
||||||
class template</h1>
|
border="0"></A>intrusive_ptr class template</h1>
|
||||||
<p>
|
<p>
|
||||||
<A href="#Introduction">Introduction</A><br>
|
<A href="#Introduction">Introduction</A><br>
|
||||||
<A href="#Synopsis">Synopsis</A><br>
|
<A href="#Synopsis">Synopsis</A><br>
|
||||||
@ -31,11 +31,11 @@
|
|||||||
<P>The main reasons to use <STRONG>intrusive_ptr</STRONG> are:</P>
|
<P>The main reasons to use <STRONG>intrusive_ptr</STRONG> are:</P>
|
||||||
<UL>
|
<UL>
|
||||||
<LI>
|
<LI>
|
||||||
Some existing frameworks or OSes provide objects with embedded reference
|
Some existing frameworks or OSes provide objects with embedded reference
|
||||||
counts;</LI>
|
counts;
|
||||||
<LI>
|
<LI>
|
||||||
The memory footprint of <STRONG>intrusive_ptr</STRONG> is the same as the
|
The memory footprint of <STRONG>intrusive_ptr</STRONG>
|
||||||
corresponding raw pointer;</LI>
|
is the same as the corresponding raw pointer;
|
||||||
<LI>
|
<LI>
|
||||||
<STRONG>intrusive_ptr<T></STRONG> can be constructed from an arbitrary
|
<STRONG>intrusive_ptr<T></STRONG> can be constructed from an arbitrary
|
||||||
raw pointer of type <STRONG>T *</STRONG>.</LI></UL>
|
raw pointer of type <STRONG>T *</STRONG>.</LI></UL>
|
||||||
@ -196,26 +196,26 @@ intrusive_ptr & operator=(T * r);</pre>
|
|||||||
<p><b>Returns:</b> <code>a.get() != b.get()</code>.</p>
|
<p><b>Returns:</b> <code>a.get() != b.get()</code>.</p>
|
||||||
<p><b>Throws:</b> nothing.</p>
|
<p><b>Throws:</b> nothing.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<pre>template<class T>
|
<pre>template<class T, class U>
|
||||||
bool operator==(intrusive_ptr<T> const & a, T * b); // never throws</pre>
|
bool operator==(intrusive_ptr<T> const & a, U * b); // never throws</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> <code>a.get() == b</code>.</p>
|
<p><b>Returns:</b> <code>a.get() == b</code>.</p>
|
||||||
<p><b>Throws:</b> nothing.</p>
|
<p><b>Throws:</b> nothing.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<pre>template<class T>
|
<pre>template<class T, class U>
|
||||||
bool operator!=(intrusive_ptr<T> const & a, T * b); // never throws</pre>
|
bool operator!=(intrusive_ptr<T> const & a, U * b); // never throws</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> <code>a.get() != b</code>.</p>
|
<p><b>Returns:</b> <code>a.get() != b</code>.</p>
|
||||||
<p><b>Throws:</b> nothing.</p>
|
<p><b>Throws:</b> nothing.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<pre>template<class T>
|
<pre>template<class T, class U>
|
||||||
bool operator==(T * a, intrusive_ptr<T> const & b); // never throws</pre>
|
bool operator==(T * a, intrusive_ptr<U> const & b); // never throws</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> <code>a == b.get()</code>.</p>
|
<p><b>Returns:</b> <code>a == b.get()</code>.</p>
|
||||||
<p><b>Throws:</b> nothing.</p>
|
<p><b>Throws:</b> nothing.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<pre>template<class T>
|
<pre>template<class T, class U>
|
||||||
bool operator!=(T * a, intrusive_ptr<T> const & b); // never throws</pre>
|
bool operator!=(T * a, intrusive_ptr<U> const & b); // never throws</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> <code>a != b.get()</code>.</p>
|
<p><b>Returns:</b> <code>a != b.get()</code>.</p>
|
||||||
<p><b>Throws:</b> nothing.</p>
|
<p><b>Throws:</b> nothing.</p>
|
||||||
@ -278,9 +278,9 @@ intrusive_ptr & operator=(T * r);</pre>
|
|||||||
<p>
|
<p>
|
||||||
$Date$</p>
|
$Date$</p>
|
||||||
<p>
|
<p>
|
||||||
<small>Copyright <20> 2003 Peter Dimov. Permission to copy, use, modify, sell and
|
<small>Copyright <20> 2003-2005 Peter Dimov. Permission to copy, use, modify, sell and
|
||||||
distribute this document is granted provided this copyright notice appears in
|
distribute this document is granted provided this copyright notice appears 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>
|
||||||
|
Reference in New Issue
Block a user