ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkBinaryOperationConcept.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18
19#ifndef itkBinaryOperationConcept_h
20#define itkBinaryOperationConcept_h
21
22#include "itkPromoteType.h"
23
25
26namespace itk::Details::op
27{
40struct BinaryOperationConcept
41{};
42
47struct Plus : BinaryOperationConcept
48{
49 template <typename T1, typename T2>
50 static typename mpl::PromoteType<T1, T2>::Type
51 Apply(T1 const & lhs, T2 const & rhs)
52 {
53 return lhs + rhs;
54 }
55};
56
61struct Sub : BinaryOperationConcept
62{
63 template <typename T1, typename T2>
64 static typename mpl::PromoteType<T1, T2>::Type
65 Apply(T1 const & lhs, T2 const & rhs)
66 {
67 return lhs - rhs;
68 }
69};
70
75struct Mult : BinaryOperationConcept
76{
77 template <typename T1, typename T2>
78 static typename mpl::PromoteType<T1, T2>::Type
79 Apply(T1 const & lhs, T2 const & rhs)
80 {
81 return lhs * rhs;
82 }
83};
84
89struct Div : BinaryOperationConcept
90{
91 template <typename T1, typename T2>
92 static typename mpl::PromoteType<T1, T2>::Type
93 Apply(T1 const & lhs, T2 const & rhs)
94 {
95 return lhs / rhs;
96 }
97};
98
99} // namespace itk::Details::op
101
102#endif // itkBinaryOperationConcept_h