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