bad_weak_ptr.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED
  2. #define BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED
  3. // MS compatible compilers support #pragma once
  4. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  5. # pragma once
  6. #endif
  7. //
  8. // boost/smart_ptr/bad_weak_ptr.hpp
  9. //
  10. // Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
  11. //
  12. // Distributed under the Boost Software License, Version 1.0. (See
  13. // accompanying file LICENSE_1_0.txt or copy at
  14. // http://www.boost.org/LICENSE_1_0.txt)
  15. //
  16. #include <boost/config.hpp>
  17. #include <exception>
  18. #ifdef BOOST_BORLANDC
  19. # pragma warn -8026 // Functions with excep. spec. are not expanded inline
  20. #endif
  21. namespace boost
  22. {
  23. // The standard library that comes with Borland C++ 5.5.1, 5.6.4
  24. // defines std::exception and its members as having C calling
  25. // convention (-pc). When the definition of bad_weak_ptr
  26. // is compiled with -ps, the compiler issues an error.
  27. // Hence, the temporary #pragma option -pc below.
  28. #if defined(BOOST_BORLANDC) && BOOST_BORLANDC <= 0x564
  29. # pragma option push -pc
  30. #endif
  31. #if defined(BOOST_CLANG)
  32. // Intel C++ on Mac defines __clang__ but doesn't support the pragma
  33. # pragma clang diagnostic push
  34. # pragma clang diagnostic ignored "-Wweak-vtables"
  35. #endif
  36. class bad_weak_ptr: public std::exception
  37. {
  38. public:
  39. char const * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE
  40. {
  41. return "tr1::bad_weak_ptr";
  42. }
  43. };
  44. #if defined(BOOST_CLANG)
  45. # pragma clang diagnostic pop
  46. #endif
  47. #if defined(BOOST_BORLANDC) && BOOST_BORLANDC <= 0x564
  48. # pragma option pop
  49. #endif
  50. } // namespace boost
  51. #ifdef BOOST_BORLANDC
  52. # pragma warn .8026 // Functions with excep. spec. are not expanded inline
  53. #endif
  54. #endif // #ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED