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
-- 

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to