change support python version
[platform/upstream/boost.git] / boost / gil / extension / dynamic_image / apply_operation.hpp
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/variant/apply_visitor.hpp>
12
13 #ifdef BOOST_GIL_DOXYGEN_ONLY
14 #undef BOOST_GIL_REDUCE_CODE_BLOAT
15 #endif
16
17 // Implements apply_operation for variants.
18 // Optionally performs type reduction.
19 #ifdef BOOST_GIL_REDUCE_CODE_BLOAT
20
21 #include <boost/gil/extension/dynamic_image/reduce.hpp>
22
23 #else
24
25 namespace boost { namespace gil {
26
27 /// \ingroup Variant
28 /// \brief Invokes a generic mutable operation (represented as a unary function object) on a variant
29 template <typename Types, typename UnaryOp>
30 BOOST_FORCEINLINE
31 auto apply_operation(variant<Types>& arg, UnaryOp op)
32 #if defined(BOOST_NO_CXX14_DECLTYPE_AUTO) || defined(BOOST_NO_CXX11_DECLTYPE_N3276)
33     -> typename UnaryOp::result_type
34 #endif
35 {
36     return apply_visitor(op, arg);
37 }
38
39 /// \ingroup Variant
40 /// \brief Invokes a generic constant operation (represented as a unary function object) on a variant
41 template <typename Types, typename UnaryOp>
42 BOOST_FORCEINLINE
43 auto apply_operation(variant<Types> const& arg, UnaryOp op)
44 #if defined(BOOST_NO_CXX14_DECLTYPE_AUTO) || defined(BOOST_NO_CXX11_DECLTYPE_N3276)
45     -> typename UnaryOp::result_type
46 #endif
47 {
48     return apply_visitor(op, arg);
49 }
50
51 /// \ingroup Variant
52 /// \brief Invokes a generic constant operation (represented as a binary function object) on two variants
53 template <typename Types1, typename Types2, typename BinaryOp>
54 BOOST_FORCEINLINE
55 auto apply_operation(
56     variant<Types1> const& arg1,
57     variant<Types2> const& arg2,
58     BinaryOp op)
59 #if defined(BOOST_NO_CXX14_DECLTYPE_AUTO) || defined(BOOST_NO_CXX11_DECLTYPE_N3276)
60     -> typename BinaryOp::result_type
61 #endif
62 {
63     return apply_visitor(
64         op, arg1, arg2);
65 }
66
67 }}  // namespace boost::gil
68
69 #endif // defined(BOOST_GIL_REDUCE_CODE_BLOAT)
70
71 #endif