index_out_of_range.hpp 901 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef BOOST_METAPARSE_V1_ERROR_INDEX_OUT_OF_RANGE_HPP
  2. #define BOOST_METAPARSE_V1_ERROR_INDEX_OUT_OF_RANGE_HPP
  3. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. #include <iostream>
  8. #include <string>
  9. #include <sstream>
  10. namespace boost
  11. {
  12. namespace metaparse
  13. {
  14. namespace v1
  15. {
  16. namespace error
  17. {
  18. template <int From, int To, int N>
  19. struct index_out_of_range
  20. {
  21. typedef index_out_of_range type;
  22. static std::string get_value()
  23. {
  24. std::ostringstream s;
  25. s
  26. << "index (" << N << ") out of range ["
  27. << From << "-" << To << "]";
  28. return s.str();
  29. }
  30. };
  31. }
  32. }
  33. }
  34. }
  35. #endif