exception.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //=======================================================================
  2. // Copyright 2002 Indiana University.
  3. // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
  4. //
  5. // Distributed under the Boost Software License, Version 1.0. (See
  6. // accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //=======================================================================
  9. #ifndef BOOST_GRAPH_EXCEPTION_HPP
  10. #define BOOST_GRAPH_EXCEPTION_HPP
  11. #include <stdexcept>
  12. #include <string>
  13. namespace boost {
  14. struct BOOST_SYMBOL_VISIBLE bad_graph : public std::invalid_argument {
  15. bad_graph(const std::string& what_arg)
  16. : std::invalid_argument(what_arg) { }
  17. };
  18. struct BOOST_SYMBOL_VISIBLE not_a_dag : public bad_graph {
  19. not_a_dag()
  20. : bad_graph("The graph must be a DAG.")
  21. { }
  22. };
  23. struct BOOST_SYMBOL_VISIBLE negative_edge : public bad_graph {
  24. negative_edge()
  25. : bad_graph("The graph may not contain an edge with negative weight.")
  26. { }
  27. };
  28. struct BOOST_SYMBOL_VISIBLE negative_cycle : public bad_graph {
  29. negative_cycle()
  30. : bad_graph("The graph may not contain negative cycles.")
  31. { }
  32. };
  33. struct BOOST_SYMBOL_VISIBLE not_connected : public bad_graph {
  34. not_connected()
  35. : bad_graph("The graph must be connected.")
  36. { }
  37. };
  38. struct BOOST_SYMBOL_VISIBLE not_complete : public bad_graph {
  39. not_complete()
  40. : bad_graph("The graph must be complete.")
  41. { }
  42. };
  43. } // namespace boost
  44. #endif // BOOST_GRAPH_EXCEPTION_HPP