Help: Document non-use of std::set::insert.
As found in commit 8e7c207e (Use a manual loop to insert into set::set., 2012-09-15).
This commit is contained in:
parent
0183ede2cc
commit
cc04bb6c16
|
@ -124,6 +124,29 @@ A loop must be used instead:
|
|||
theVector.push_back(*li);
|
||||
}
|
||||
|
||||
std::set::insert
|
||||
----------------
|
||||
|
||||
Use of ``std::set::insert`` is not allowed with any source container:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
std::set<cmTarget*> theSet;
|
||||
theSet.insert(targets.begin(), targets.end()); // Wrong
|
||||
|
||||
A loop must be used instead:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
ConstIterator it = targets.begin();
|
||||
const ConstIterator end = targets.end();
|
||||
for ( ; it != end; ++it)
|
||||
{
|
||||
theSet.insert(*it);
|
||||
}
|
||||
|
||||
.. MSVC6, SunCC 5.9
|
||||
|
||||
Template Parameter Defaults
|
||||
---------------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue