Mercurial > hg > orthanc
changeset 4948:5f6b13202e85
fix for older gcc versions
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 21 Mar 2022 09:44:01 +0100 |
parents | dfbe764995cf |
children | 49bd6504f15e |
files | OrthancFramework/Sources/Images/ImageProcessing.cpp |
diffstat | 1 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/Images/ImageProcessing.cpp Mon Mar 21 08:59:20 2022 +0100 +++ b/OrthancFramework/Sources/Images/ImageProcessing.cpp Mon Mar 21 09:44:01 2022 +0100 @@ -3000,11 +3000,13 @@ } } - - void ImageProcessing::Maximum(ImageAccessor& image, - const ImageAccessor& other) + + namespace { - struct F + // For older version of gcc, templated functors cannot be defined + // as types internal to functions, hence the anonymous namespace + + struct MaximumFunctor { void operator() (uint8_t& a, const uint8_t& b) { @@ -3016,15 +3018,20 @@ a = std::max(a, b); } }; - + } + + + void ImageProcessing::Maximum(ImageAccessor& image, + const ImageAccessor& other) + { switch (image.GetFormat()) { case PixelFormat_Grayscale8: - ApplyImageOntoImage<uint8_t, F>(F(), image, other); + ApplyImageOntoImage<uint8_t, MaximumFunctor>(MaximumFunctor(), image, other); return; case PixelFormat_Grayscale16: - ApplyImageOntoImage<uint16_t, F>(F(), image, other); + ApplyImageOntoImage<uint16_t, MaximumFunctor>(MaximumFunctor(), image, other); return; default: