From 8b5dacc522d36775e52a3e63571867c4583b37b4 Mon Sep 17 00:00:00 2001 From: derfel Date: Fri, 17 Jan 2003 01:23:08 +0000 Subject: [PATCH] Changed functor operator bool to operator unspecified_bool_type using pointer to member function. git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@88 7ec92016-0320-0410-acc4-a06ded1c099a --- Borland/Functor.h | 6 ++++-- MSVC/1300/Functor.h | 6 ++++-- Reference/Functor.h | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Borland/Functor.h b/Borland/Functor.h index 646588f..47db375 100644 --- a/Borland/Functor.h +++ b/Borland/Functor.h @@ -762,9 +762,11 @@ namespace Loki : spImpl_(new MemFunHandler(p, memFn)) {} - operator bool() + typedef impl * (std::auto_ptr::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const { - return spImpl_.get() ? true : false; + return spImpl_.get() ? &std::auto_ptr::get : 0; } Functor& operator=(const Functor& rhs) diff --git a/MSVC/1300/Functor.h b/MSVC/1300/Functor.h index 18927d9..ba37f47 100644 --- a/MSVC/1300/Functor.h +++ b/MSVC/1300/Functor.h @@ -899,9 +899,11 @@ namespace Loki : spImpl_(new MemFunHandler(p, memFn)) {} - operator bool() + typedef impl * (std::auto_ptr::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const { - return spImpl_.get() ? true : false; + return spImpl_.get() ? &std::auto_ptr::get : 0; } Functor& operator=(const Functor& rhs) diff --git a/Reference/Functor.h b/Reference/Functor.h index f94bccd..42fcc78 100644 --- a/Reference/Functor.h +++ b/Reference/Functor.h @@ -762,9 +762,11 @@ namespace Loki : spImpl_(new MemFunHandler(p, memFn)) {} - operator bool() + typedef impl * (std::auto_ptr::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const { - return spImpl_.get() ? true : false; + return spImpl_.get() ? &std::auto_ptr::get : 0; } Functor& operator=(const Functor& rhs)