2 Copyright 2005-2007 Adobe Systems Incorporated
4 Use, modification and distribution are subject to the Boost Software License,
5 Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt).
8 See http://opensource.adobe.com/gil for most recent version including documentation.
11 /*************************************************************************************************/
13 #ifndef GIL_APPLY_OPERATION_HPP
14 #define GIL_APPLY_OPERATION_HPP
16 ////////////////////////////////////////////////////////////////////////////////////////
18 /// \brief Implements apply_operation for variants. Optionally performs type reduction
19 /// \author Lubomir Bourdev and Hailin Jin \n
20 /// Adobe Systems Incorporated
21 /// \date 2005-2007 \n Last updated on May 4, 2006
23 ////////////////////////////////////////////////////////////////////////////////////////
25 #include "apply_operation_base.hpp"
26 #include "variant.hpp"
28 #ifndef GIL_REDUCE_CODE_BLOAT
30 namespace boost { namespace gil {
33 /// \brief Invokes a generic mutable operation (represented as a unary function object) on a variant
34 template <typename Types, typename UnaryOp> GIL_FORCEINLINE
35 typename UnaryOp::result_type apply_operation(variant<Types>& arg, UnaryOp op) {
36 return apply_operation_base<Types>(arg._bits, arg._index ,op);
40 /// \brief Invokes a generic constant operation (represented as a unary function object) on a variant
41 template <typename Types, typename UnaryOp> GIL_FORCEINLINE
42 typename UnaryOp::result_type apply_operation(const variant<Types>& arg, UnaryOp op) {
43 return apply_operation_basec<Types>(arg._bits, arg._index ,op);
47 /// \brief Invokes a generic constant operation (represented as a binary function object) on two variants
48 template <typename Types1, typename Types2, typename BinaryOp> GIL_FORCEINLINE
49 typename BinaryOp::result_type apply_operation(const variant<Types1>& arg1, const variant<Types2>& arg2, BinaryOp op) {
50 return apply_operation_base<Types1,Types2>(arg1._bits, arg1._index, arg2._bits, arg2._index, op);
53 } } // namespace boost::gil