exception.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // Boost.Pointer Container
  3. //
  4. // Copyright Thorsten Ottosen 2003-2005. Use, modification and
  5. // distribution is subject to the Boost Software License, Version
  6. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // For more information, see http://www.boost.org/libs/ptr_container/
  10. //
  11. #ifndef BOOST_PTR_CONTAINER_EXCEPTION_HPP
  12. #define BOOST_PTR_CONTAINER_EXCEPTION_HPP
  13. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  14. # pragma once
  15. #endif
  16. #include <exception>
  17. namespace boost
  18. {
  19. class bad_ptr_container_operation : public std::exception
  20. {
  21. const char* what_;
  22. public:
  23. bad_ptr_container_operation( const char* what ) : what_( what )
  24. { }
  25. virtual const char* what() const throw()
  26. {
  27. return what_;
  28. }
  29. };
  30. class bad_index : public bad_ptr_container_operation
  31. {
  32. public:
  33. bad_index( const char* what ) : bad_ptr_container_operation( what )
  34. { }
  35. };
  36. class bad_pointer : public bad_ptr_container_operation
  37. {
  38. public:
  39. bad_pointer() : bad_ptr_container_operation( "Null pointer not allowed in a pointer container!" )
  40. { }
  41. bad_pointer( const char* text ) : bad_ptr_container_operation( text )
  42. { }
  43. };
  44. }
  45. #endif