exception.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Copyright 2016-2017 Joaquin M Lopez Munoz.
  2. * Distributed under the Boost Software License, Version 1.0.
  3. * (See accompanying file LICENSE_1_0.txt or copy at
  4. * http://www.boost.org/LICENSE_1_0.txt)
  5. *
  6. * See http://www.boost.org/libs/poly_collection for library home page.
  7. */
  8. #ifndef BOOST_POLY_COLLECTION_EXCEPTION_HPP
  9. #define BOOST_POLY_COLLECTION_EXCEPTION_HPP
  10. #if defined(_MSC_VER)
  11. #pragma once
  12. #endif
  13. #include <stdexcept>
  14. #include <typeinfo>
  15. namespace boost{
  16. namespace poly_collection{
  17. struct unregistered_type:std::logic_error
  18. {
  19. unregistered_type(const std::type_info& info):
  20. std::logic_error{"type not registered"},
  21. pinfo{&info}
  22. {}
  23. const std::type_info* pinfo;
  24. };
  25. struct not_copy_constructible:std::logic_error
  26. {
  27. not_copy_constructible(const std::type_info& info):
  28. std::logic_error{"type is not copy constructible"},
  29. pinfo{&info}
  30. {}
  31. const std::type_info* pinfo;
  32. };
  33. struct not_equality_comparable:std::logic_error
  34. {
  35. not_equality_comparable(const std::type_info& info):
  36. std::logic_error{"type does not support equality comparison"},
  37. pinfo{&info}
  38. {}
  39. const std::type_info* pinfo;
  40. };
  41. } /* namespace poly_collection */
  42. } /* namespace boost */
  43. #endif