apply_operation.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // Copyright 2005-2007 Adobe Systems Incorporated
  3. //
  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. //
  8. #ifndef BOOST_GIL_EXTENSION_DYNAMIC_IMAGE_APPLY_OPERATION_HPP
  9. #define BOOST_GIL_EXTENSION_DYNAMIC_IMAGE_APPLY_OPERATION_HPP
  10. #include <boost/variant2/variant.hpp>
  11. namespace boost { namespace gil {
  12. /// \ingroup Variant
  13. /// \brief Applies the visitor op to the variants
  14. template <typename Variant1, typename Visitor>
  15. [[deprecated("Use variant2::visit instead.")]]
  16. BOOST_FORCEINLINE
  17. auto apply_operation(Variant1&& arg1, Visitor&& op)
  18. #if defined(BOOST_NO_CXX14_DECLTYPE_AUTO) || defined(BOOST_NO_CXX11_DECLTYPE_N3276)
  19. -> decltype(variant2::visit(std::forward<Visitor>(op), std::forward<Variant1>(arg1)))
  20. #endif
  21. {
  22. return variant2::visit(std::forward<Visitor>(op), std::forward<Variant1>(arg1));
  23. }
  24. /// \ingroup Variant
  25. /// \brief Applies the visitor op to the variants
  26. template <typename Variant1, typename Variant2, typename Visitor>
  27. [[deprecated("Use variant2::visit instead.")]]
  28. BOOST_FORCEINLINE
  29. auto apply_operation(Variant1&& arg1, Variant2&& arg2, Visitor&& op)
  30. #if defined(BOOST_NO_CXX14_DECLTYPE_AUTO) || defined(BOOST_NO_CXX11_DECLTYPE_N3276)
  31. -> decltype(variant2::visit(std::forward<Visitor>(op), std::forward<Variant1>(arg1), std::forward<Variant2>(arg2)))
  32. #endif
  33. {
  34. return variant2::visit(std::forward<Visitor>(op), std::forward<Variant1>(arg1), std::forward<Variant2>(arg2));
  35. }
  36. }} // namespace boost::gil
  37. #endif