Skip to content
Snippets Groups Projects
Commit 4e5dc6d9 authored by Jonathan Wakely's avatar Jonathan Wakely
Browse files

libstdc++: Add comment to gslice::operator=(const gslice&) [PR100147]

There's no need to check for self-assignment here, it would just add
extra code for an unlikely case. Add a comment saying so.

libstdc++-v3/ChangeLog:

	PR libstdc++/100147
	* include/bits/gslice.h (operator=): Add comment about lack of
	self-assignment check.
parent 232ffb61
No related branches found
No related tags found
No related merge requests found
...@@ -169,6 +169,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -169,6 +169,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline gslice& inline gslice&
gslice::operator=(const gslice& __g) gslice::operator=(const gslice& __g)
{ {
// Safe for self-assignment. Checking for it would add overhead just to
// optimize a case that should never happen anyway.
if (__g._M_index) if (__g._M_index)
__g._M_index->_M_increment_use(); __g._M_index->_M_increment_use();
if (_M_index && _M_index->_M_decrement_use() == 0) if (_M_index && _M_index->_M_decrement_use() == 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment