diff --git a/Modules/Core/Functor/include/otbFunctorImageFilter.h b/Modules/Core/Functor/include/otbFunctorImageFilter.h index 06de75fa13590aa8ec8fe0b336943378319d789d..7052bcc2222f28490c7dcab1da2370d8ad3603d2 100644 --- a/Modules/Core/Functor/include/otbFunctorImageFilter.h +++ b/Modules/Core/Functor/include/otbFunctorImageFilter.h @@ -310,6 +310,17 @@ public: p->UnRegister(); return p; } + + /** New() macro defined only if TFunction is NOT default constructible + * This will yield an error message since New() can not be implemented in this case. */ + template <typename F = TFunction> static std::enable_if_t<!std::is_default_constructible<F>::value, Pointer> New() + { + static_assert(std::is_default_constructible<F>::value,"Cannot call New() " + "methode as the functor used for the filter creation is not default " + "constructible"); + + return nullptr; + } /** Get the functor object. *