exception.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. {
  15. struct BOOST_SYMBOL_VISIBLE bad_graph : public std::invalid_argument
  16. {
  17. bad_graph(const std::string& what_arg) : std::invalid_argument(what_arg) {}
  18. };
  19. struct BOOST_SYMBOL_VISIBLE not_a_dag : public bad_graph
  20. {
  21. not_a_dag() : bad_graph("The graph must be a DAG.") {}
  22. };
  23. struct BOOST_SYMBOL_VISIBLE negative_edge : public bad_graph
  24. {
  25. negative_edge()
  26. : bad_graph("The graph may not contain an edge with negative weight.")
  27. {
  28. }
  29. };
  30. struct BOOST_SYMBOL_VISIBLE negative_cycle : public bad_graph
  31. {
  32. negative_cycle() : bad_graph("The graph may not contain negative cycles.")
  33. {
  34. }
  35. };
  36. struct BOOST_SYMBOL_VISIBLE not_connected : public bad_graph
  37. {
  38. not_connected() : bad_graph("The graph must be connected.") {}
  39. };
  40. struct BOOST_SYMBOL_VISIBLE not_complete : public bad_graph
  41. {
  42. not_complete() : bad_graph("The graph must be complete.") {}
  43. };
  44. } // namespace boost
  45. #endif // BOOST_GRAPH_EXCEPTION_HPP