visit.hpp 1011 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/json
  8. //
  9. #ifndef BOOST_JSON_VISIT_HPP
  10. #define BOOST_JSON_VISIT_HPP
  11. #include <boost/json/detail/config.hpp>
  12. #include <boost/json/value.hpp>
  13. #include <type_traits>
  14. #include <utility>
  15. BOOST_JSON_NS_BEGIN
  16. /** Invoke a function object with the contents of a @ref value
  17. @return The value returned by Visitor.
  18. @param v The visitation function to invoke
  19. @param jv The value to visit.
  20. */
  21. /** @{ */
  22. template<class Visitor>
  23. auto
  24. visit(
  25. Visitor&& v,
  26. value& jv) -> decltype(
  27. std::declval<Visitor>()(nullptr));
  28. template<class Visitor>
  29. auto
  30. visit(
  31. Visitor &&v,
  32. value const &jv) -> decltype(
  33. std::declval<Visitor>()(nullptr));
  34. /** @} */
  35. BOOST_JSON_NS_END
  36. #include <boost/json/impl/visit.hpp>
  37. #endif