# Always use concept checks?

**URL:** https://discourse.itk.org/t/always-use-concept-checks/1372
**Category:** Engineering
**Created:** [October 24, 2018, 7:35pm UTC](https://discourse.itk.org/t/always-use-concept-checks/1372 "2018-10-24T19:35:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [October 24, 2018, 7:35pm UTC](https://discourse.itk.org/t/always-use-concept-checks/1372/1 "2018-10-24T19:35:19Z")

</div>

Should we remove option `ITK_USE_CONCEPT_CHECKING` and always use concept checking in classes? Were there other use cases for this option besides inconsistent support in older compilers?

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [October 24, 2018, 10:46pm UTC](https://discourse.itk.org/t/always-use-concept-checks/1372/2 "2018-10-24T22:46:38Z")

</div>

It used to be inconsistent support in compilers.

The only concern now is build time (?).

It may be reasonable to remove the option if build times of large projects like Python wrapping, Slicer, etc. are not significantly effected in their build time.

---

<div class="post-metadata">

### Author: ![Niels\_Dekker](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/9d8465/32.png) [@Niels\_Dekker](https://discourse.itk.org/u/Niels_Dekker)
#### Post date: [October 26, 2018, 5:09pm UTC](https://discourse.itk.org/t/always-use-concept-checks/1372/3 "2018-10-26T17:09:49Z")

</div>

Personally I wouldn’t mind if updates on ITK concept checking would be postponed until concepts are standardized in C++ (both the language and the _std_ library). Looking at [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018) (searching for “concept”), there still appears a lot of progress in that area. 😀

In the meantime, it seems to me that C++11 `static_assert` and `<type_traits>` could already be helpful to do similar checking. For example:

```
static_assert(std::is_convertible<int, TOutputPixelType>::value, 
    "IntConvertibleToOutputCheck");

```

Appears similar to:

```
itkConceptMacro( IntConvertibleToOutputCheck,
               ( Concept::Convertible< int, TOutputPixelType > ) );

```

From the class definition of HoughTransform2DCirclesImageFilter:

> <https://github.com/Kitware/ITK/blob/v5.0b01/Modules/Filtering/ImageFeature/include/itkHoughTransform2DCirclesImageFilter.h#L164>

My 2 cents

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [October 26, 2018, 5:59pm UTC](https://discourse.itk.org/t/always-use-concept-checks/1372/4 "2018-10-26T17:59:33Z")

</div>

Refactoring concept checks themselves is something we should do too. `static_assert` should be quite useful there, both for friendlier error messages and faster compile times.
