Help: Remove documented restriction on find in conditions.

The necessary conversion is supported by all CMake host compilers.
This commit is contained in:
Stephen Kelly 2014-12-31 14:37:44 +01:00
parent 36b8de563c
commit ac3d382920
2 changed files with 1 additions and 29 deletions

View File

@ -21,32 +21,6 @@ CMake is required to build with ancient C++ compilers and standard library
implementations. Some common C++ constructs may not be used in CMake in order implementations. Some common C++ constructs may not be used in CMake in order
to build with such toolchains. to build with such toolchains.
std::set const iterators
------------------------
The ``find()`` member function of a ``const`` ``std::set`` instance may not be
used in a comparison with the iterator returned by ``end()``:
.. code-block:: c++
const std::set<std::string>& someSet = getSet();
if (someSet.find("needle") == someSet.end()) // Wrong
{
// ...
}
The return value of ``find()`` must be assigned to an intermediate
``const_iterator`` for comparison:
.. code-block:: c++
const std::set<std::string>& someSet;
const std::set<std::string>::const_iterator i = someSet.find("needle");
if (i != propSet.end()) // Ok
{
// ...
}
std::auto_ptr std::auto_ptr
------------- -------------

View File

@ -66,9 +66,7 @@ cmGeneratorExpressionDAGChecker::Initialize()
if (it != top->Seen.end()) if (it != top->Seen.end())
{ {
const std::set<std::string> &propSet = it->second; const std::set<std::string> &propSet = it->second;
const std::set<std::string>::const_iterator i if (propSet.find(this->Property) != propSet.end())
= propSet.find(this->Property);
if (i != propSet.end())
{ {
this->CheckResult = ALREADY_SEEN; this->CheckResult = ALREADY_SEEN;
return; return;