itor = m_szBuffer.end(); for( int i = 0; i < szCount; i++, itor-- ) ;
std::string text = ""; for( i = 0; i < szCount; i++, itor++ ) text += (*itor);
itor = m_szBuffer.end(); for( int i = 0; i < szCount; i++, itor-- ) ;
std::string text = ""; for( i = 0; i < szCount; i++, itor++ ) text += (*itor);
itor = m_szBuffer.end();
for( int i = 0; i < szCount; i++, itor--)
text = (*itor) + text;

std::list<std::string>::reverse_iterator ritor = m_szBuffer.rbegin();
std::advance(ritor, szCount);
std::string text = std::accumulate(ritor.base(), m_szBuffer.end(), std::string());
quote:
Original post by Ironside
front( ) and back( ) return an iterator at the first and last elemetns in the list
begin() and end() return an itiorator before the first and after the last elements respectively.
quote:
Original post by Ironside
The pointer, or first element in the list doesn''t contain a value though, it''s also not counted as part of the lists size.
So you you use begin() you are getting an iterator at the first element in your list. however the content you instert into the list doesn''t start until the following element.
that''s why i said begin() returns an iterator before the first element in the list. Symantics
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more