Bug 1120796 - Part 2: Replace ConvertibleToBool hackarounds with explicit bool operators. r=Waldo
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Tue, 03 Feb 2015 18:52:36 +0200
changeset 227241 de42116d5ef3aa8a26c1a601675786faa9bb5179
parent 227240 b5adb9f9867a26f73cc9c94d66e6a20f548f0b06
child 227242 5fc092347f17567d1c9a5e40b395965621a7f997
push id55062
push userbirunthan@mohanathas.com
push dateTue, 03 Feb 2015 16:53:10 +0000
treeherdermozilla-inbound@de42116d5ef3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs1120796
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1120796 - Part 2: Replace ConvertibleToBool hackarounds with explicit bool operators. r=Waldo
image/src/imgFrame.h
js/public/Debug.h
js/public/HashTable.h
js/public/HeapAPI.h
js/public/UbiNode.h
js/src/ds/InlineMap.h
js/src/gc/GCInternals.h
js/src/jshashutil.h
js/src/vm/ArrayBufferObject.h
js/src/vm/Debugger.h
js/src/vm/StructuredClone.cpp
mfbt/Maybe.h
mfbt/Range.h
mfbt/RangedPtr.h
mfbt/UniquePtr.h
--- a/image/src/imgFrame.h
+++ b/image/src/imgFrame.h
@@ -381,20 +381,16 @@ private: // data
 
 /**
  * A reference to an imgFrame that holds the imgFrame's surface in memory,
  * allowing drawing. If you have a DrawableFrameRef |ref| and |if (ref)| returns
  * true, then calls to Draw() and GetSurface() are guaranteed to succeed.
  */
 class DrawableFrameRef MOZ_FINAL
 {
-  // Implementation details for safe boolean conversion.
-  typedef void (DrawableFrameRef::* ConvertibleToBool)(float*****, double*****);
-  void nonNull(float*****, double*****) {}
-
 public:
   DrawableFrameRef() { }
 
   explicit DrawableFrameRef(imgFrame* aFrame)
     : mFrame(aFrame)
     , mRef(aFrame->mVBuf)
   {
     if (mRef.WasBufferPurged()) {
@@ -411,20 +407,17 @@ public:
   DrawableFrameRef& operator=(DrawableFrameRef&& aOther)
   {
     MOZ_ASSERT(this != &aOther, "Self-moves are prohibited");
     mFrame = aOther.mFrame.forget();
     mRef = Move(aOther.mRef);
     return *this;
   }
 
-  operator ConvertibleToBool() const
-  {
-    return bool(mFrame) ? &DrawableFrameRef::nonNull : 0;
-  }
+  explicit operator bool() const { return bool(mFrame); }
 
   imgFrame* operator->()
   {
     MOZ_ASSERT(mFrame);
     return mFrame;
   }
 
   const imgFrame* operator->() const
@@ -456,20 +449,16 @@ private:
  * is also guaranteed by a valid RawAccessFrameRef.
  *
  * This may be considerably more expensive than is necessary just for drawing,
  * so only use this when you need to read or write the raw underlying image data
  * that the imgFrame holds.
  */
 class RawAccessFrameRef MOZ_FINAL
 {
-  // Implementation details for safe boolean conversion.
-  typedef void (RawAccessFrameRef::* ConvertibleToBool)(float*****, double*****);
-  void nonNull(float*****, double*****) {}
-
 public:
   RawAccessFrameRef() { }
 
   explicit RawAccessFrameRef(imgFrame* aFrame)
     : mFrame(aFrame)
   {
     MOZ_ASSERT(mFrame, "Need a frame");
 
@@ -498,20 +487,17 @@ public:
       mFrame->UnlockImageData();
     }
 
     mFrame = aOther.mFrame.forget();
 
     return *this;
   }
 
-  operator ConvertibleToBool() const
-  {
-    return bool(mFrame) ? &RawAccessFrameRef::nonNull : 0;
-  }
+  explicit operator bool() const { return bool(mFrame); }
 
   imgFrame* operator->()
   {
     MOZ_ASSERT(mFrame);
     return mFrame.get();
   }
 
   const imgFrame* operator->() const
--- a/js/public/Debug.h
+++ b/js/public/Debug.h
@@ -137,18 +137,16 @@ class Builder {
 
   protected:
     // A reference to a trusted object or value. At the moment, we only use it
     // with JSObject *.
     template<typename T>
     class BuiltThing {
         friend class BuilderOrigin;
 
-        void nonNull() {}
-
       protected:
         // The Builder to which this trusted thing belongs.
         Builder &owner;
 
         // A rooted reference to our value.
         PersistentRooted<T> value;
 
         BuiltThing(JSContext *cx, Builder &owner_, T value_ = js::GCMethods<T>::initial())
@@ -165,20 +163,19 @@ class Builder {
         BuiltThing(const BuiltThing &rhs) : owner(rhs.owner), value(rhs.value) { }
         BuiltThing &operator=(const BuiltThing &rhs) {
             MOZ_ASSERT(&owner == &rhs.owner);
             owner.assertBuilt(rhs.value);
             value = rhs.value;
             return *this;
         }
 
-        typedef void (BuiltThing::* ConvertibleToBool)();
-        operator ConvertibleToBool() const {
-            // If we ever instantiate BuiltThink<Value>, this might not suffice.
-            return value ? &BuiltThing::nonNull : 0;
+        explicit operator bool() const {
+            // If we ever instantiate BuiltThing<Value>, this might not suffice.
+            return value;
         }
 
       private:
         BuiltThing() = delete;
     };
 
   public:
     // A reference to a trusted object, possibly null. Instances of Object are
@@ -216,18 +213,17 @@ class Builder {
         // If |value| is another trusted object, store it directly as the
         // property's value.
         //
         // On error, report the problem on cx and return false.
         bool defineProperty(JSContext *cx, const char *name, JS::HandleValue value);
         bool defineProperty(JSContext *cx, const char *name, JS::HandleObject value);
         bool defineProperty(JSContext *cx, const char *name, Object &value);
 
-        using Base::ConvertibleToBool;
-        using Base::operator ConvertibleToBool;
+        using Base::operator bool;
     };
 
     // Build an empty object for direct use by debugger code, owned by this
     // Builder. If an error occurs, report it on cx and return a false Object.
     Object newObject(JSContext *cx);
 
   protected:
     Builder(JSContext *cx, js::Debugger *debugger);
--- a/js/public/HashTable.h
+++ b/js/public/HashTable.h
@@ -205,17 +205,17 @@ class HashMap
 
     // If |generation()| is the same before and after a HashMap operation,
     // pointers into the table remain valid.
     uint32_t generation() const                       { return impl.generation(); }
 
     /************************************************** Shorthand operations */
 
     bool has(const Lookup &l) const {
-        return impl.lookup(l) != nullptr;
+        return impl.lookup(l).found();
     }
 
     // Overwrite existing value with v. Return false on oom.
     template<typename KeyInput, typename ValueInput>
     bool put(KeyInput &&k, ValueInput &&v) {
         AddPtr p = lookupForAdd(k);
         if (p) {
             p->value() = mozilla::Forward<ValueInput>(v);
@@ -436,17 +436,17 @@ class HashSet
 
     // If |generation()| is the same before and after a HashSet operation,
     // pointers into the table remain valid.
     uint32_t generation() const                       { return impl.generation(); }
 
     /************************************************** Shorthand operations */
 
     bool has(const Lookup &l) const {
-        return impl.lookup(l) != nullptr;
+        return impl.lookup(l).found();
     }
 
     // Add |u| if it is not present already. Return false on oom.
     template <typename U>
     bool put(U &&u) {
         AddPtr p = lookupForAdd(u);
         return p ? true : add(p, mozilla::Forward<U>(u));
     }
@@ -762,18 +762,16 @@ class HashTable : private AllocPolicy
 
     // A nullable pointer to a hash table element. A Ptr |p| can be tested
     // either explicitly |if (p.found()) p->...| or using boolean conversion
     // |if (p) p->...|. Ptr objects must not be used after any mutating hash
     // table operations unless |generation()| is tested.
     class Ptr
     {
         friend class HashTable;
-        typedef void (Ptr::* ConvertibleToBool)();
-        void nonNull() {}
 
         Entry *entry_;
 #ifdef JS_DEBUG
         const HashTable *table_;
         uint32_t generation;
 #endif
 
       protected:
@@ -795,18 +793,18 @@ class HashTable : private AllocPolicy
 
         bool found() const {
 #ifdef JS_DEBUG
             MOZ_ASSERT(generation == table_->generation());
 #endif
             return entry_->isLive();
         }
 
-        operator ConvertibleToBool() const {
-            return found() ? &Ptr::nonNull : 0;
+        explicit operator bool() const {
+            return found();
         }
 
         bool operator==(const Ptr &rhs) const {
             MOZ_ASSERT(found() && rhs.found());
             return entry_ == rhs.entry_;
         }
 
         bool operator!=(const Ptr &rhs) const {
--- a/js/public/HeapAPI.h
+++ b/js/public/HeapAPI.h
@@ -148,19 +148,16 @@ struct Zone
 
 // A GC pointer, tagged with the trace kind.
 //
 // In general, a GC pointer should be stored with an exact type. This class
 // is for use when that is not possible because a single pointer must point
 // to several kinds of GC thing.
 class JS_FRIEND_API(GCCellPtr)
 {
-    typedef void (GCCellPtr::* ConvertibleToBool)();
-    void nonNull() {}
-
   public:
     // Construction from a void* and trace kind.
     GCCellPtr(void *gcthing, JSGCTraceKind traceKind) : ptr(checkedCast(gcthing, traceKind)) {}
 
     // Construction from an explicit type.
     explicit GCCellPtr(JSObject *obj) : ptr(checkedCast(obj, JSTRACE_OBJECT)) { }
     explicit GCCellPtr(JSFunction *fun) : ptr(checkedCast(fun, JSTRACE_OBJECT)) { }
     explicit GCCellPtr(JSString *str) : ptr(checkedCast(str, JSTRACE_STRING)) { }
@@ -174,19 +171,19 @@ class JS_FRIEND_API(GCCellPtr)
     JSGCTraceKind kind() const {
         JSGCTraceKind traceKind = JSGCTraceKind(ptr & JSTRACE_OUTOFLINE);
         if (traceKind != JSTRACE_OUTOFLINE)
             return traceKind;
         return outOfLineKind();
     }
 
     // Allow GCCellPtr to be used in a boolean context.
-    operator ConvertibleToBool() const {
+    explicit operator bool() const {
         MOZ_ASSERT(bool(asCell()) == (kind() != JSTRACE_NULL));
-        return asCell() ? &GCCellPtr::nonNull : 0;
+        return asCell();
     }
 
     // Simplify checks to the kind.
     bool isObject() const { return kind() == JSTRACE_OBJECT; }
     bool isScript() const { return kind() == JSTRACE_SCRIPT; }
     bool isString() const { return kind() == JSTRACE_STRING; }
     bool isSymbol() const { return kind() == JSTRACE_SYMBOL; }
     bool isShape() const { return kind() == JSTRACE_SHAPE; }
--- a/js/public/UbiNode.h
+++ b/js/public/UbiNode.h
@@ -245,19 +245,16 @@ class Node {
 
     template<typename T>
     void construct(T *ptr) {
         static_assert(sizeof(Concrete<T>) == sizeof(*base()),
                       "ubi::Base specializations must be the same size as ubi::Base");
         Concrete<T>::construct(base(), ptr);
     }
 
-    typedef void (Node::* ConvertibleToBool)();
-    void nonNull() {}
-
   public:
     Node() { construct<void>(nullptr); }
 
     template<typename T>
     Node(T *ptr) {
         construct(ptr);
     }
     template<typename T>
@@ -299,18 +296,18 @@ class Node {
     Node &operator=(const Node &rhs) {
         memcpy(storage.u.mBytes, rhs.storage.u.mBytes, sizeof(storage.u));
         return *this;
     }
 
     bool operator==(const Node &rhs) const { return *base() == *rhs.base(); }
     bool operator!=(const Node &rhs) const { return *base() != *rhs.base(); }
 
-    operator ConvertibleToBool() const {
-        return base()->ptr ? &Node::nonNull : 0;
+    explicit operator bool() const {
+        return base()->ptr != nullptr;
     }
 
     template<typename T>
     bool is() const {
         return base()->typeName() == Concrete<T>::concreteTypeName;
     }
 
     template<typename T>
--- a/js/src/ds/InlineMap.h
+++ b/js/src/ds/InlineMap.h
@@ -98,18 +98,16 @@ class InlineMap
     class Ptr
     {
         friend class InlineMap;
 
         WordMapPtr  mapPtr;
         InlineElem  *inlPtr;
         bool        isInlinePtr;
 
-        typedef Ptr ******* ConvertibleToBool;
-
         explicit Ptr(WordMapPtr p) : mapPtr(p), isInlinePtr(false) {}
         explicit Ptr(InlineElem *ie) : inlPtr(ie), isInlinePtr(true) {}
         void operator==(const Ptr &other);
 
       public:
         /* Leaves Ptr uninitialized. */
         Ptr() {
 #ifdef DEBUG
@@ -119,18 +117,18 @@ class InlineMap
         }
 
         /* Default copy constructor works for this structure. */
 
         bool found() const {
             return isInlinePtr ? bool(inlPtr) : mapPtr.found();
         }
 
-        operator ConvertibleToBool() const {
-            return ConvertibleToBool(found());
+        explicit operator bool() const {
+            return found();
         }
 
         K &key() {
             MOZ_ASSERT(found());
             return isInlinePtr ? inlPtr->key : mapPtr->key();
         }
 
         V &value() {
@@ -152,27 +150,25 @@ class InlineMap
         AddPtr(InlineElem *ptr, bool found)
           : inlAddPtr(ptr), isInlinePtr(true), inlPtrFound(found)
         {}
 
         explicit AddPtr(const WordMapAddPtr &p) : mapAddPtr(p), isInlinePtr(false) {}
 
         void operator==(const AddPtr &other);
 
-        typedef AddPtr ******* ConvertibleToBool;
-
       public:
         AddPtr() {}
 
         bool found() const {
             return isInlinePtr ? inlPtrFound : mapAddPtr.found();
         }
 
-        operator ConvertibleToBool() const {
-            return found() ? ConvertibleToBool(1) : ConvertibleToBool(0);
+        explicit operator bool() const {
+            return found();
         }
 
         V &value() {
             MOZ_ASSERT(found());
             if (isInlinePtr)
                 return inlAddPtr->value;
             return mapAddPtr->value();
         }
--- a/js/src/gc/GCInternals.h
+++ b/js/src/gc/GCInternals.h
@@ -69,21 +69,18 @@ class IncrementalSafety
     const char *reason_;
 
     explicit IncrementalSafety(const char *reason) : reason_(reason) {}
 
   public:
     static IncrementalSafety Safe() { return IncrementalSafety(nullptr); }
     static IncrementalSafety Unsafe(const char *reason) { return IncrementalSafety(reason); }
 
-    typedef void (IncrementalSafety::* ConvertibleToBool)();
-    void nonNull() {}
-
-    operator ConvertibleToBool() const {
-        return reason_ == nullptr ? &IncrementalSafety::nonNull : 0;
+    explicit operator bool() const {
+        return reason_ == nullptr;
     }
 
     const char *reason() {
         MOZ_ASSERT(reason_);
         return reason_;
     }
 };
 
--- a/js/src/jshashutil.h
+++ b/js/src/jshashutil.h
@@ -31,21 +31,19 @@ struct DependentAddPtr
     template <class KeyInput, class ValueInput>
     bool add(const ExclusiveContext *cx, T &table, const KeyInput &key, const ValueInput &value) {
         bool gcHappened = originalGcNumber != cx->zone()->gcNumber();
         if (gcHappened)
             addPtr = table.lookupForAdd(key);
         return table.relookupOrAdd(addPtr, key, value);
     }
 
-    typedef void (DependentAddPtr::* ConvertibleToBool)();
-    void nonNull() {}
 
     bool found() const                 { return addPtr.found(); }
-    operator ConvertibleToBool() const { return found() ? &DependentAddPtr::nonNull : 0; }
+    explicit operator bool() const     { return found(); }
     const Entry &operator*() const     { return *addPtr; }
     const Entry *operator->() const    { return &*addPtr; }
 
   private:
     AddPtr addPtr ;
     const uint64_t originalGcNumber;
 
     DependentAddPtr() = delete;
--- a/js/src/vm/ArrayBufferObject.h
+++ b/js/src/vm/ArrayBufferObject.h
@@ -166,19 +166,16 @@ class ArrayBufferObject : public ArrayBu
   public:
 
     class BufferContents {
         uint8_t *data_;
         BufferKind kind_;
 
         friend class ArrayBufferObject;
 
-        typedef void (BufferContents::* ConvertibleToBool)();
-        void nonNull() {}
-
         BufferContents(uint8_t *data, BufferKind kind) : data_(data), kind_(kind) {
             MOZ_ASSERT((kind_ & ~KIND_MASK) == 0);
         }
 
       public:
 
         template<BufferKind Kind>
         static BufferContents create(void *data)
@@ -189,17 +186,17 @@ class ArrayBufferObject : public ArrayBu
         static BufferContents createPlain(void *data)
         {
             return BufferContents(static_cast<uint8_t*>(data), PLAIN);
         }
 
         uint8_t *data() const { return data_; }
         BufferKind kind() const { return kind_; }
 
-        operator ConvertibleToBool() const { return data_ ? &BufferContents::nonNull : nullptr; }
+        explicit operator bool() const { return data_ != nullptr; }
     };
 
     static const Class class_;
 
     static const Class protoClass;
     static const JSFunctionSpec jsfuncs[];
     static const JSFunctionSpec jsstaticfuncs[];
 
--- a/js/src/vm/Debugger.h
+++ b/js/src/vm/Debugger.h
@@ -123,18 +123,18 @@ class DebuggerWeakMap : private WeakMap<
             if (key != e.front().key())
                 e.rekeyFront(key);
             key.unsafeSet(nullptr);
         }
     }
 
     bool hasKeyInZone(JS::Zone *zone) {
         CountMap::Ptr p = zoneCounts.lookup(zone);
-        MOZ_ASSERT_IF(p, p->value() > 0);
-        return p;
+        MOZ_ASSERT_IF(p.found(), p->value() > 0);
+        return p.found();
     }
 
   private:
     /* Override sweep method to also update our edge cache. */
     void sweep() {
         for (Enum e(*static_cast<Base *>(this)); !e.empty(); e.popFront()) {
             Key k(e.front().key());
             if (gc::IsAboutToBeFinalized(&k)) {
--- a/js/src/vm/StructuredClone.cpp
+++ b/js/src/vm/StructuredClone.cpp
@@ -899,17 +899,17 @@ JSStructuredCloneWriter::writeSharedType
     return out.write(tarr->byteOffset());
 }
 
 bool
 JSStructuredCloneWriter::startObject(HandleObject obj, bool *backref)
 {
     /* Handle cycles in the object graph. */
     CloneMemory::AddPtr p = memory.lookupForAdd(obj);
-    if ((*backref = p))
+    if ((*backref = p.found()))
         return out.writePair(SCTAG_BACK_REFERENCE_OBJECT, p->value());
     if (!memory.add(p, obj, memory.count()))
         return false;
 
     if (memory.count() == UINT32_MAX) {
         JS_ReportErrorNumber(context(), js_GetErrorMessage, nullptr,
                              JSMSG_NEED_DIET, "object graph to serialize");
         return false;
--- a/mfbt/Maybe.h
+++ b/mfbt/Maybe.h
@@ -77,19 +77,16 @@ struct Nothing { };
  *
  * N.B. GCC has missed optimizations with Maybe in the past and may generate
  * extra branches/loads/stores. Use with caution on hot paths; it's not known
  * whether or not this is still a problem.
  */
 template<class T>
 class Maybe
 {
-  typedef void (Maybe::* ConvertibleToBool)(float*****, double*****);
-  void nonNull(float*****, double*****) {}
-
   bool mIsSome;
   AlignedStorage2<T> mStorage;
 
 public:
   typedef T ValueType;
 
   Maybe() : mIsSome(false) { }
   ~Maybe() { reset(); }
@@ -149,17 +146,17 @@ public:
     } else {
       reset();
     }
 
     return *this;
   }
 
   /* Methods that check whether this Maybe contains a value */
-  operator ConvertibleToBool() const { return mIsSome ? &Maybe::nonNull : 0; }
+  explicit operator bool() const { return isSome(); }
   bool isSome() const { return mIsSome; }
   bool isNothing() const { return !mIsSome; }
 
   /* Returns the contents of this Maybe<T> by value. Unsafe unless |isSome()|. */
   T value() const
   {
     MOZ_ASSERT(mIsSome);
     return ref();
--- a/mfbt/Range.h
+++ b/mfbt/Range.h
@@ -15,30 +15,27 @@ namespace mozilla {
 
 // Range<T> is a tuple containing a pointer and a length.
 template <typename T>
 class Range
 {
   const RangedPtr<T> mStart;
   const RangedPtr<T> mEnd;
 
-  typedef void (Range::* ConvertibleToBool)();
-  void nonNull() {}
-
 public:
   Range() : mStart(nullptr, 0), mEnd(nullptr, 0) {}
   Range(T* aPtr, size_t aLength)
     : mStart(aPtr, aPtr, aPtr + aLength),
       mEnd(aPtr + aLength, aPtr, aPtr + aLength)
   {}
 
   RangedPtr<T> start() const { return mStart; }
   RangedPtr<T> end() const { return mEnd; }
   size_t length() const { return mEnd - mStart; }
 
   T& operator[](size_t aOffset) const { return mStart[aOffset]; }
 
-  operator ConvertibleToBool() const { return mStart ? &Range::nonNull : 0; }
+  explicit operator bool() const { return mStart != nullptr; }
 };
 
 } // namespace mozilla
 
 #endif /* mozilla_Range_h */
--- a/mfbt/RangedPtr.h
+++ b/mfbt/RangedPtr.h
@@ -44,19 +44,16 @@ class RangedPtr
 {
   T* mPtr;
 
 #ifdef DEBUG
   T* const mRangeStart;
   T* const mRangeEnd;
 #endif
 
-  typedef void (RangedPtr::* ConvertibleToBool)();
-  void nonNull() {}
-
   void checkSanity()
   {
     MOZ_ASSERT(mRangeStart <= mPtr);
     MOZ_ASSERT(mPtr <= mRangeEnd);
   }
 
   /* Creates a new pointer for |aPtr|, restricted to this pointer's range. */
   RangedPtr<T> create(T* aPtr) const
@@ -113,17 +110,17 @@ public:
     , mRangeStart(aArr), mRangeEnd(aArr + N)
 #endif
   {
     checkSanity();
   }
 
   T* get() const { return mPtr; }
 
-  operator ConvertibleToBool() const { return mPtr ? &RangedPtr::nonNull : 0; }
+  explicit operator bool() const { return mPtr != nullptr; }
 
   /*
    * You can only assign one RangedPtr into another if the two pointers have
    * the same valid range:
    *
    *   char arr1[] = "hi";
    *   char arr2[] = "bye";
    *   RangedPtr<char> p1(arr1, 2);
--- a/mfbt/UniquePtr.h
+++ b/mfbt/UniquePtr.h
@@ -281,31 +281,23 @@ public:
 
   T& operator*() const { return *get(); }
   Pointer operator->() const
   {
     MOZ_ASSERT(get(), "dereferencing a UniquePtr containing nullptr");
     return get();
   }
 
+  explicit operator bool() const { return get() != nullptr; }
+
   Pointer get() const { return ptr(); }
 
   DeleterType& getDeleter() { return del(); }
   const DeleterType& getDeleter() const { return del(); }
 
-private:
-  typedef void (UniquePtr::* ConvertibleToBool)(double, char);
-  void nonNull(double, char) {}
-
-public:
-  operator ConvertibleToBool() const
-  {
-    return get() != nullptr ? &UniquePtr::nonNull : nullptr;
-  }
-
   Pointer release()
   {
     Pointer p = ptr();
     ptr() = nullptr;
     return p;
   }
 
   void reset(Pointer aPtr = Pointer())
@@ -428,32 +420,24 @@ public:
   }
 
   UniquePtr& operator=(decltype(nullptr))
   {
     reset();
     return *this;
   }
 
+  explicit operator bool() const { return get() != nullptr; }
+
   T& operator[](decltype(sizeof(int)) aIndex) const { return get()[aIndex]; }
   Pointer get() const { return mTuple.first(); }
 
   DeleterType& getDeleter() { return mTuple.second(); }
   const DeleterType& getDeleter() const { return mTuple.second(); }
 
-private:
-  typedef void (UniquePtr::* ConvertibleToBool)(double, char);
-  void nonNull(double, char) {}
-
-public:
-  operator ConvertibleToBool() const
-  {
-    return get() != nullptr ? &UniquePtr::nonNull : nullptr;
-  }
-
   Pointer release()
   {
     Pointer p = mTuple.first();
     mTuple.first() = nullptr;
     return p;
   }
 
   void reset(Pointer aPtr = Pointer())