From 492f090b427490feda58b130eaab39731c3779cd Mon Sep 17 00:00:00 2001 From: Fernando Cacciola Date: Tue, 25 Feb 2003 14:23:57 +0000 Subject: [PATCH] Small fix: test for m_initialized removed from operators -> and * (there is an assert anyway) [SVN r17641] --- include/boost/optional.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/optional.hpp b/include/boost/optional.hpp index 1a82a64..7dbd9a6 100644 --- a/include/boost/optional.hpp +++ b/include/boost/optional.hpp @@ -182,14 +182,14 @@ class optional // Returns a pointer to the value if this is initialized, otherwise, // the behaviour is UNDEFINED // No-throw - T const* operator->() const { BOOST_ASSERT(m_initialized) ; return get() ; } - T* operator->() { BOOST_ASSERT(m_initialized) ; return get() ; } + T const* operator->() const { BOOST_ASSERT(m_initialized) ; return static_cast(m_storage.address()) ; } + T* operator->() { BOOST_ASSERT(m_initialized) ; return static_cast (m_storage.address()) ; } // Returns a reference to the value if this is initialized, otherwise, // the behaviour is UNDEFINED // No-throw - T const& operator *() const { BOOST_ASSERT(m_initialized) ; return *get() ; } - T& operator *() { BOOST_ASSERT(m_initialized) ; return *get() ; } + T const& operator *() const { BOOST_ASSERT(m_initialized) ; return *static_cast(m_storage.address()) ; } + T& operator *() { BOOST_ASSERT(m_initialized) ; return *static_cast (m_storage.address()) ; } // implicit conversion to "bool" // No-throw