summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2020-12-29 11:06:08 +0100
committerGitHub <noreply@github.com>2020-12-29 11:06:08 +0100
commitc2f00a64703f28adb8dcb02ef4e737561aaa4bc2 (patch)
treec1f9b7f79dc417c993ecaf529d8f9229479e720a
parent69df3b31d6265c3225a897834034c78b6e5fdbf6 (diff)
downloadATCD-revert-1227-revert-995-unspecified-bool-type.tar.gz
Revert "Revert "Use unspecified_bool_type instead of bool.""revert-1227-revert-995-unspecified-bool-type
-rw-r--r--ACE/ace/Refcounted_Auto_Ptr.h6
-rw-r--r--ACE/ace/Refcounted_Auto_Ptr.inl4
2 files changed, 7 insertions, 3 deletions
diff --git a/ACE/ace/Refcounted_Auto_Ptr.h b/ACE/ace/Refcounted_Auto_Ptr.h
index b52872806ab..1bb10b6585b 100644
--- a/ACE/ace/Refcounted_Auto_Ptr.h
+++ b/ACE/ace/Refcounted_Auto_Ptr.h
@@ -44,6 +44,10 @@ template <class X, class ACE_LOCK> class ACE_Refcounted_Auto_Ptr;
template <class X, class ACE_LOCK>
class ACE_Refcounted_Auto_Ptr
{
+ /// Used to define a proper boolean conversion for "if (sp) ..."
+ static void unspecified_bool(ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>***){};
+ typedef void (*unspecified_bool_type)(ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>***);
+
public:
/// Constructor that initializes an ACE_Refcounted_Auto_Ptr to
/// the specified pointer value.
@@ -86,7 +90,7 @@ public:
bool operator !() const;
/// Check rep easily.
- operator bool () const;
+ operator unspecified_bool_type() const;
/// Releases the reference to the underlying representation object.
/// @retval The pointer value prior to releasing it.
diff --git a/ACE/ace/Refcounted_Auto_Ptr.inl b/ACE/ace/Refcounted_Auto_Ptr.inl
index 2c46bbb5d3f..0cd7925716c 100644
--- a/ACE/ace/Refcounted_Auto_Ptr.inl
+++ b/ACE/ace/Refcounted_Auto_Ptr.inl
@@ -128,9 +128,9 @@ ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator !() const
}
template<class X, class ACE_LOCK> inline
-ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator bool () const
+ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator unspecified_bool_type () const
{
- return this->rep_->get () != 0;
+ return this->rep_->get () != 0 ? unspecified_bool : 0;
}
template <class X, class ACE_LOCK> inline X*