Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10770


Ignore:
Timestamp:
Nov 7, 2015, 2:42:14 PM (8 years ago)
Author:
landauf
Message:

made conversion to bool operators explicit

Location:
code/branches/cpp11_v2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/core/ClassTreeMask.h

    r10769 r10770  
    152152            ClassTreeMaskNode* operator*() const;
    153153            ClassTreeMaskNode* operator->() const;
    154             operator bool() const;
     154            explicit operator bool() const;
    155155            bool operator==(ClassTreeMaskNode* compare) const;
    156156            bool operator!=(ClassTreeMaskNode* compare) const;
     
    289289            inline bool operator!=(BaseObject* pointer) const { return (this->objectIterator_ && (*this->objectIterator_) != pointer) || (!this->objectIterator_ && pointer != nullptr); }
    290290            /// Returns true if the ClassTreeMaskObjectIterator hasn't already reached the end.
    291             inline operator bool() const { return (this->objectIterator_); }
     291            inline explicit operator bool() const { return this->objectIterator_.operator bool(); }
    292292            /// Returns the object the ClassTreeMaskObjectIterator currently points at.
    293293            inline BaseObject* operator*() const { return (*this->objectIterator_); }
  • code/branches/cpp11_v2/src/libraries/core/object/IteratorBase.h

    r10765 r10770  
    149149                @return True if the Iterator points to an existing object.
    150150            */
    151             inline operator bool() const
     151            inline explicit operator bool() const
    152152            {
    153153                return (this->element_ != nullptr);
  • code/branches/cpp11_v2/src/libraries/core/object/StrongPtr.h

    r10768 r10770  
    248248            }
    249249
    250             /// Returns true if the wrapped pointer is nullptr.
    251             inline bool operator!() const
    252             {
    253                 return (this->pointer_ == nullptr);
     250            /// Returns true if the pointer is not nullptr.
     251            inline explicit operator bool() const
     252            {
     253                return (this->pointer_ != nullptr);
    254254            }
    255255
  • code/branches/cpp11_v2/src/libraries/core/object/WeakPtr.h

    r10768 r10770  
    183183            }
    184184
    185             /// Returns true if the wrapped pointer is nullptr.
    186             inline bool operator!() const
    187             {
    188                 return (this->pointer_ == nullptr);
     185            /// Returns true if the pointer is not nullptr.
     186            inline explicit operator bool() const
     187            {
     188                return (this->pointer_ != nullptr);
    189189            }
    190190
  • code/branches/cpp11_v2/src/libraries/util/SharedPtr.h

    r10769 r10770  
    311311
    312312            /// Returns true if the pointer is not nullptr.
    313             inline operator bool() const
     313            inline explicit operator bool() const
    314314            {
    315315                return (this->pointer_ != nullptr);
  • code/branches/cpp11_v2/test/util/SharedPtrTest.cc

    r10769 r10770  
    145145        test = pointer;
    146146        EXPECT_EQ(pointer, test.get());
    147         EXPECT_TRUE(test);
     147        EXPECT_TRUE(static_cast<bool>(test));
    148148    }
    149149
Note: See TracChangeset for help on using the changeset viewer.