summaryrefslogtreecommitdiffstats
path: root/Source/cmListCommand.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-02-12 17:47:10 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-02-15 18:04:31 (GMT)
commit0b5cf0dabd430dfe1289e865b1b51c41066338a7 (patch)
treecc48e846bf6269a9737f6267c7aae1fa5335dcf6 /Source/cmListCommand.cxx
parent069f2440c471e89dfe2ecf6778bbab16e9fbe491 (diff)
downloadCMake-0b5cf0dabd430dfe1289e865b1b51c41066338a7.zip
CMake-0b5cf0dabd430dfe1289e865b1b51c41066338a7.tar.gz
CMake-0b5cf0dabd430dfe1289e865b1b51c41066338a7.tar.bz2
cmAlgorithms: Implement algorithm for removing indexes.
Implement ContainerAlgorithms::RemoveN to remove N elements to the end of a container by rotating. The rotate is implemented in terms of the efficient swap algorithm, optimized even more in the standard library implementation when the compiler supports the rvalue-references feature to move elements. Implement cmRemoveN with a Range API for completeness. std::rotate in C++11 is specified to return an iterator, but c++98 specifies it to return void. libstdc++ 5.0 will be the first version to have the correct return type. Implement ContainerAlgorithms::Rotate in terms of std::rotate and return the correct iterator from it. While std::rotate requires forward iterators, this workaround means cmRotate requires bidirectional iterators. As most of CMake uses random access iterators anyway, this should not be a problem. Implement cmRemoveIndices in terms of the RemoveN algorithm, such that each element which is not removed is rotated only once. This can not use the cmRemoveN range-API algorithm because that would require creating a new range, but the range must be taken by reference and so it can't be a temporary. These remove algorithms are not part of the STL and I couldn't find them anywhere else either.
Diffstat (limited to 'Source/cmListCommand.cxx')
0 files changed, 0 insertions, 0 deletions