diff --git a/CMake/itkImageIOFactoryRegisterManager.h.in b/CMake/itkImageIOFactoryRegisterManager.h.in index 9e105ec72a7..dbea89733a2 100644 --- a/CMake/itkImageIOFactoryRegisterManager.h.in +++ b/CMake/itkImageIOFactoryRegisterManager.h.in @@ -24,7 +24,7 @@ namespace itk { class ImageIOFactoryRegisterManager { public: - explicit ImageIOFactoryRegisterManager(void (*list[])(void)) + explicit ImageIOFactoryRegisterManager(void (* const list[])(void)) { for(;*list != nullptr; ++list) { @@ -45,14 +45,11 @@ class ImageIOFactoryRegisterManager // application translation units. Note that this code will be expanded in the // ITK-based applications and not in ITK itself. // -namespace { - void (*ImageIOFactoryRegisterRegisterList[])(void) = { - @LIST_OF_FACTORY_NAMES@ - nullptr}; - ImageIOFactoryRegisterManager ImageIOFactoryRegisterManagerInstance(ImageIOFactoryRegisterRegisterList); - -} +constexpr void (*ImageIOFactoryRegisterRegisterList[])(void) = { + @LIST_OF_FACTORY_NAMES@ + nullptr}; +const ImageIOFactoryRegisterManager ImageIOFactoryRegisterManagerInstance(ImageIOFactoryRegisterRegisterList); } diff --git a/CMake/itkMeshIOFactoryRegisterManager.h.in b/CMake/itkMeshIOFactoryRegisterManager.h.in index 770b9cc05a2..0ef0ba34141 100644 --- a/CMake/itkMeshIOFactoryRegisterManager.h.in +++ b/CMake/itkMeshIOFactoryRegisterManager.h.in @@ -24,7 +24,7 @@ namespace itk { class MeshIOFactoryRegisterManager { public: - explicit MeshIOFactoryRegisterManager(void (*list[])(void)) + explicit MeshIOFactoryRegisterManager(void (* const list[])(void)) { for(;*list != nullptr; ++list) { @@ -45,14 +45,11 @@ class MeshIOFactoryRegisterManager // application translation units. Note that this code will be expanded in the // ITK-based applications and not in ITK itself. // -namespace { - void (*MeshIOFactoryRegisterRegisterList[])(void) = { - @LIST_OF_FACTORY_NAMES@ - nullptr}; - MeshIOFactoryRegisterManager MeshIOFactoryRegisterManagerInstance(MeshIOFactoryRegisterRegisterList); - -} +constexpr void (*MeshIOFactoryRegisterRegisterList[])(void) = { + @LIST_OF_FACTORY_NAMES@ + nullptr}; +const MeshIOFactoryRegisterManager MeshIOFactoryRegisterManagerInstance(MeshIOFactoryRegisterRegisterList); } diff --git a/CMake/itkTransformIOFactoryRegisterManager.h.in b/CMake/itkTransformIOFactoryRegisterManager.h.in index 998e1f10244..d4132a38ee2 100644 --- a/CMake/itkTransformIOFactoryRegisterManager.h.in +++ b/CMake/itkTransformIOFactoryRegisterManager.h.in @@ -24,7 +24,7 @@ namespace itk { class TransformIOFactoryRegisterManager { public: - explicit TransformIOFactoryRegisterManager(void (*list[])(void)) + explicit TransformIOFactoryRegisterManager(void (* const list[])(void)) { for(;*list != nullptr; ++list) { @@ -45,14 +45,11 @@ class TransformIOFactoryRegisterManager // application translation units. Note that this code will be expanded in the // ITK-based applications and not in ITK itself. // -namespace { - void (*TransformIOFactoryRegisterRegisterList[])(void) = { - @LIST_OF_FACTORY_NAMES@ - nullptr}; - TransformIOFactoryRegisterManager TransformIOFactoryRegisterManagerInstance(TransformIOFactoryRegisterRegisterList); - -} +constexpr void (*TransformIOFactoryRegisterRegisterList[])(void) = { + @LIST_OF_FACTORY_NAMES@ + nullptr}; +const TransformIOFactoryRegisterManager TransformIOFactoryRegisterManagerInstance(TransformIOFactoryRegisterRegisterList); }