[Insight-developers] VS2010 and itkStdAlgorithm

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Apr 25 13:21:13 EDT 2013


Kent,

Getting these details just right is going to be a pain.

Would you mind if I made a patch to replace usage of copy_n with std::copy and removed itkStdAlgorithm.h?

Brad

On Apr 25, 2013, at 9:12 AM, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:

> Niels,
> 
> It would solve your problem. But.. why was it added? 
> 
> $ git log Modules/Core/Common/include/itkStdAlgorithm.h
> commit 137b5c35a733782cb443a19ef4901520e98bac98
> Author: Kent Williams <norman-k-williams at uiowa.edu>
> Date:   Wed Apr 17 09:57:37 2013 -0500
> 
>    COMP: Further changes to the use of std::copy_n
> 
>    1. Add preprocessor test for condition (detected by David
>    Doria) where ITK was configured & built with a compiler that
>    supports C++11 std::copy_n, but a user program was not.
> 
>    2. Small changes suggested by Bradley Lowencamp that didn't
>    make it into the last patch.
> 
>    Change-Id: I1635cccc52b2dbf3621b896db9a139f33cda4fe2
> 
> 
> So doing the change you suggest would undo this bug fix and this prior work.
> 
> The the problem presented above is that ITK was compiled with a newer version of C++ then an application... So the solution is to make sure the version of C++ the compiler supports at build time is greater than to equal to that used during configuration.
> 
> 1) A small program an be compiled and run during cmake configuration to get the __cplusplus values into a cmake variable.
> 2) This variable can be placed into the itkConfigure.h.in configuration file as say ITK__CPLUSPLUS
> 3) Using C preprocess it can be checked if   __cplusplus >= ITK__CPLUSPLUS 
> 
> Brad
> 
> On Apr 25, 2013, at 8:59 AM, Niels Dekker <niels-xtk at xs4all.nl> wrote:
> 
>> On 2013-04-25 14:39, Bradley Lowekamp wrote:
>>> I think the solution to this problem to obtain the __cplusplus version at CMake configuration time,
>>> stash it in a variable to be used in a configuration file, and make sure that it is always greater
>>> than or equal to that in the itkConfigure.h.in file.
>> 
>> Sorry, Brad, I don't really understand this solution. Wouldn't it be sufficient to just remove the line which says "#error ITK built with C++11, current source file is not." from itkStdAlgorithm.h?
>> 
>> Kind regard, Niels
>> 
> 



More information about the Insight-developers mailing list