[cmake-developers] [PSA] API changes to use strings
Ben Boeckel
ben.boeckel at kitware.com
Fri Feb 7 00:10:50 EST 2014
On Thu, Feb 06, 2014 at 23:44:51 +0100, Stephen Kelly wrote:
> Ben Boeckel wrote:
> > - cmMakefile::Get{Source,Header}Extensions returns a std::set rather
> > than a std::vector since it was never modified and is only iterated
> > over and searched in other code.
> The justification is strange. Generally, the guideline with C++ stl
> containers is to use std::vector unless you have a good reason to use
> something else.
It's read-only after construction, so with std::set we get
std::binary_search for free since we never have to pay set's insertion
penalty over time.
> > vec[vec.size()-1] (use *vec.rbegin())
> vec.back() ?
Err, for vectors, that works. I got mixed up with my examples. For
std::string, you need .rbegin() since .back() is C++11 there.
--Ben
More information about the cmake-developers
mailing list