unpaired.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef BOOST_METAPARSE_V1_ERROR_UNPAIRED_HPP
  2. #define BOOST_METAPARSE_V1_ERROR_UNPAIRED_HPP
  3. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
  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 <boost/mpl/vector.hpp>
  8. #include <iostream>
  9. #include <string>
  10. #include <sstream>
  11. namespace boost
  12. {
  13. namespace metaparse
  14. {
  15. namespace v1
  16. {
  17. namespace error
  18. {
  19. template <int Line, int Col, class Msg = boost::mpl::na>
  20. struct unpaired
  21. {
  22. typedef unpaired type;
  23. static std::string get_value()
  24. {
  25. std::ostringstream s;
  26. s << Msg::get_value() << " (see " << Line << ":" << Col << ")";
  27. return s.str();
  28. }
  29. };
  30. template <int Line, int Col>
  31. struct unpaired<Line, Col, boost::mpl::na>
  32. {
  33. typedef unpaired type;
  34. template <class Msg = boost::mpl::na>
  35. struct apply : unpaired<Line, Col, Msg> {};
  36. };
  37. }
  38. }
  39. }
  40. }
  41. #endif