ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkBinaryOperationConcept.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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 namespace Details {
27 namespace op {
40 struct BinaryOperationConcept { };
41 
46 struct Plus : BinaryOperationConcept
47  {
48  template <typename T1, typename T2>
49  static typename mpl::PromoteType<T1, T2>::Type Apply(T1 const& lhs, T2 const& rhs) ITK_NOEXCEPT
50  { return lhs + rhs; }
51  };
52 
57 struct Sub : BinaryOperationConcept
58  {
59  template <typename T1, typename T2>
60  static typename mpl::PromoteType<T1, T2>::Type Apply(T1 const& lhs, T2 const& rhs) ITK_NOEXCEPT
61  { return lhs - rhs; }
62  };
63 
68 struct Mult : BinaryOperationConcept
69  {
70  template <typename T1, typename T2>
71  static typename mpl::PromoteType<T1, T2>::Type Apply(T1 const& lhs, T2 const& rhs) ITK_NOEXCEPT
72  { return lhs * rhs; }
73  };
74 
79 struct Div : BinaryOperationConcept
80  {
81  template <typename T1, typename T2>
82  static typename mpl::PromoteType<T1, T2>::Type Apply(T1 const& lhs, T2 const& rhs) ITK_NOEXCEPT
83  { return lhs / rhs; }
84  };
85 
86 } // itk::Details::op namespace
87 } // itk::Details namespace
88 } // itk namespace
90 
91 #endif // itkBinaryOperationConcept_h