X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=boost%2Fboost%2Fintrusive_ptr.hpp;h=cd1ac11fae4d9e5b023b673bc832dfb736cb6830;hb=94da7f7c835a9b2b45f9c8c2b1a5dd16683cc25b;hp=3b988a8f5ab71172d141c5b7a3e0dad01687efd3;hpb=e1644a68eb123c267a7ef2e651c66b788c38f03a;p=lyx.git diff --git a/boost/boost/intrusive_ptr.hpp b/boost/boost/intrusive_ptr.hpp index 3b988a8f5a..cd1ac11fae 100644 --- a/boost/boost/intrusive_ptr.hpp +++ b/boost/boost/intrusive_ptr.hpp @@ -6,14 +6,15 @@ // // Copyright (c) 2001, 2002 Peter Dimov // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. -// This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/smart_ptr/intrusive_ptr.html for documentation. // +#include + #ifdef BOOST_MSVC // moved here to work around VC++ compiler crash # pragma warning(push) # pragma warning(disable:4284) // odd return type for operator-> @@ -119,13 +120,32 @@ public: return p_; } - typedef T * (intrusive_ptr::*unspecified_bool_type) () const; +#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530) + + operator bool () const + { + return p_ != 0; + } + +#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + typedef T * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const // never throws + { + return p_ == 0? 0: &this_type::get; + } + +#else + + typedef T * this_type::*unspecified_bool_type; operator unspecified_bool_type () const { - return p_ == 0? 0: &intrusive_ptr::get; + return p_ == 0? 0: &this_type::p_; } +#endif + // operator! is a Borland-specific workaround bool operator! () const { @@ -154,22 +174,22 @@ template inline bool operator!=(intrusive_ptr const & a, in return a.get() != b.get(); } -template inline bool operator==(intrusive_ptr const & a, T * b) +template inline bool operator==(intrusive_ptr const & a, U * b) { return a.get() == b; } -template inline bool operator!=(intrusive_ptr const & a, T * b) +template inline bool operator!=(intrusive_ptr const & a, U * b) { return a.get() != b; } -template inline bool operator==(T * a, intrusive_ptr const & b) +template inline bool operator==(T * a, intrusive_ptr const & b) { return a == b.get(); } -template inline bool operator!=(T * a, intrusive_ptr const & b) +template inline bool operator!=(T * a, intrusive_ptr const & b) { return a != b.get(); } @@ -207,6 +227,11 @@ template intrusive_ptr static_pointer_cast(intrusive_ptr return static_cast(p.get()); } +template intrusive_ptr const_pointer_cast(intrusive_ptr const & p) +{ + return const_cast(p.get()); +} + template intrusive_ptr dynamic_pointer_cast(intrusive_ptr const & p) { return dynamic_cast(p.get()); @@ -224,7 +249,10 @@ template std::ostream & operator<< (std::ostream & os, intrusive_ptr #else -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200 && __SGI_STL_PORT) +// in STLport's no-iostreams mode no iostream symbols can be used +#ifndef _STLP_NO_IOSTREAMS + +# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) // MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL using std::basic_ostream; template basic_ostream & operator<< (basic_ostream & os, intrusive_ptr const & p) @@ -236,7 +264,9 @@ template std::basic_ostream & operator<< (std:: return os; } -#endif +#endif // _STLP_NO_IOSTREAMS + +#endif // __GNUC__ < 3 } // namespace boost