ITK  5.4.0
Insight Toolkit
itkEnableIf.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#ifndef itkEnableIf_h
19#define itkEnableIf_h
20
21#include "itkMacro.h"
22
23#if !defined(ITK_LEGACY_REMOVE)
24
25namespace itk
26{
28namespace mpl
29{
30
62template <bool V, typename TType = void>
63struct EnableIfC
64{};
66template <typename TType>
67struct EnableIfC<true, TType>
68{
69 using Type = TType;
70};
72
73
81template <bool V, typename TType = void>
82struct DisableIfC
83{};
85template <typename TType>
86struct DisableIfC<false, TType>
87{
88 using Type = TType;
89};
91
119template <class TCondition, class TType = void>
120struct EnableIf : public EnableIfC<TCondition::Value, TType>
121{};
122
150template <class TCondition, class TType = void>
151struct DisableIf : public DisableIfC<TCondition::Value, TType>
152{};
153
154} // namespace mpl
155
156// itk::EnableIf(C), DisableIf(C) have move to itk::mpl
157// Expect them to be deprecated.
158using mpl::EnableIf;
159using mpl::DisableIf;
160using mpl::EnableIfC;
161using mpl::DisableIfC;
162
164} // namespace itk
165
166#else // ITK_LEGACY_REMOVE
167# error Use C++ 11 std::enable_if directly
168#endif
169
170#endif // itkEnableIf_h
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....