Help: Note that std::string::clear may not be used.
As found in commit 519c0a5d (Can't use std::string::clear() in cmake., 2012-09-15).
This commit is contained in:
parent
cc04bb6c16
commit
ed632736e3
|
@ -33,17 +33,19 @@ The ``at()`` member function of ``std::vector`` may not be used. Use
|
||||||
int i1 = someVec.at(5); // Wrong
|
int i1 = someVec.at(5); // Wrong
|
||||||
int i2 = someVec[5]; // Ok
|
int i2 = someVec[5]; // Ok
|
||||||
|
|
||||||
std::string::append
|
std::string::append and std::string::clear
|
||||||
-------------------
|
------------------------------------------
|
||||||
|
|
||||||
The ``append()`` member function of ``std::string`` may not be used. Use
|
The ``append()`` and ``clear()`` member functions of ``std::string`` may not
|
||||||
``operator+=`` instead:
|
be used. Use ``operator+=`` and ``operator=`` instead:
|
||||||
|
|
||||||
.. code-block:: c++
|
.. code-block:: c++
|
||||||
|
|
||||||
std::string stringBuilder;
|
std::string stringBuilder;
|
||||||
stringBuilder.append("chunk"); // Wrong
|
stringBuilder.append("chunk"); // Wrong
|
||||||
|
stringBuilder.clear(); // Wrong
|
||||||
stringBuilder += "chunk"; // Ok
|
stringBuilder += "chunk"; // Ok
|
||||||
|
stringBuilder = ""; // Ok
|
||||||
|
|
||||||
std::set const iterators
|
std::set const iterators
|
||||||
------------------------
|
------------------------
|
||||||
|
|
Loading…
Reference in New Issue