ITK  6.0.0
Insight Toolkit
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 namespace itk
26 {
27 namespace Details
28 {
29 namespace op
30 {
43 struct BinaryOperationConcept
44 {};
45 
50 struct Plus : BinaryOperationConcept
51 {
52  template <typename T1, typename T2>
53  static typename mpl::PromoteType<T1, T2>::Type
54  Apply(T1 const & lhs, T2 const & rhs)
55  {
56  return lhs + rhs;
57  }
58 };
59 
64 struct Sub : BinaryOperationConcept
65 {
66  template <typename T1, typename T2>
67  static typename mpl::PromoteType<T1, T2>::Type
68  Apply(T1 const & lhs, T2 const & rhs)
69  {
70  return lhs - rhs;
71  }
72 };
73 
78 struct Mult : BinaryOperationConcept
79 {
80  template <typename T1, typename T2>
81  static typename mpl::PromoteType<T1, T2>::Type
82  Apply(T1 const & lhs, T2 const & rhs)
83  {
84  return lhs * rhs;
85  }
86 };
87 
92 struct Div : BinaryOperationConcept
93 {
94  template <typename T1, typename T2>
95  static typename mpl::PromoteType<T1, T2>::Type
96  Apply(T1 const & lhs, T2 const & rhs)
97  {
98  return lhs / rhs;
99  }
100 };
101 
102 } // namespace op
103 } // namespace Details
104 } // namespace itk
106 
107 #endif // itkBinaryOperationConcept_h
itkPromoteType.h
Details
Definition: itkVariableLengthVector.h:1038
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29