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
11 #include <boost/variant2/variant.hpp>
12
13 namespace boost { namespace gil {
14
15 /// \ingroup Variant
16 /// \brief Applies the visitor op to the variants
17 template <typename Variant1, typename Visitor>
18 BOOST_FORCEINLINE
apply_operation(Variant1 && arg1,Visitor && op)19 auto apply_operation(Variant1&& arg1, Visitor&& op)
20 #if defined(BOOST_NO_CXX14_DECLTYPE_AUTO) || defined(BOOST_NO_CXX11_DECLTYPE_N3276)
21 -> decltype(variant2::visit(std::forward<Visitor>(op), std::forward<Variant1>(arg1)))
22 #endif
23 {
24 return variant2::visit(std::forward<Visitor>(op), std::forward<Variant1>(arg1));
25 }
26
27 /// \ingroup Variant
28 /// \brief Applies the visitor op to the variants
29 template <typename Variant1, typename Variant2, typename Visitor>
30 BOOST_FORCEINLINE
apply_operation(Variant1 && arg1,Variant2 && arg2,Visitor && op)31 auto apply_operation(Variant1&& arg1, Variant2&& arg2, Visitor&& op)
32 #if defined(BOOST_NO_CXX14_DECLTYPE_AUTO) || defined(BOOST_NO_CXX11_DECLTYPE_N3276)
33 -> decltype(variant2::visit(std::forward<Visitor>(op), std::forward<Variant1>(arg1), std::forward<Variant2>(arg2)))
34 #endif
35 {
36 return variant2::visit(std::forward<Visitor>(op), std::forward<Variant1>(arg1), std::forward<Variant2>(arg2));
37 }
38
39 }} // namespace boost::gil
40
41 #endif
42