[cmake-developers] Storage reallocation inside std::vector causing memory problem when using variable_watch

Brad King brad.king at kitware.com
Wed Mar 23 13:28:44 EDT 2016


On 03/23/2016 06:26 AM, Yves Frederix wrote:
> Please find a patch in attachment. In order to reduce the number of
> double value lookups (8378 for my simple case), I also changed the
> interface of VariableAccessed to return a bool (resulting in 3 double
> lookups). The patch was tested based onto 3.4.1 and I can confirm that
> it fixes the problem.

Thanks!  Please expand out the comment and commit message to avoid
referencing the mailing list thread.  A reader should be able to
understand the problem without following such links.

> Makes sense. I'm not sure, however, how to test if the compiler
> supports move construction. A link on stackoverflow suggests to use
> something like "201103L <= __cplusplus". Unfortunately this does not
> work for, e.g., VS2012 as it still defines __cplusplus as 199711L.
> What would be a good way of checking this?

One could use a try_compile to check it.  See Source/Checks/*.cmake
and their use in the top-level CMakeLists.txt file.  This may not
be worth the time unless you're interested in it.

-Brad



More information about the cmake-developers mailing list