Remove outdated and wrong comment about making functions const
The comment suggested Get{First,Next,Prev,Last}Line() should be changed to const functions once compilers understand the 'mutable' keyword. Hopefully now, after 19 years, compilers do understand the 'mutable' keyword, but regardless of that the functions should not be const, as they very clearly modify the state of the object that is observable through the public interface. Closes https://github.com/wxWidgets/wxWidgets/pull/1750
This commit is contained in:
committed by
Vadim Zeitlin
parent
61277424d7
commit
bf6dae2151
@@ -115,16 +115,14 @@ public:
|
||||
// lines, i.e. you may write something like:
|
||||
// for ( str = GetFirstLine(); !Eof(); str = GetNextLine() ) { ... }
|
||||
|
||||
// NB: const is commented out because not all compilers understand
|
||||
// 'mutable' keyword yet (m_nCurLine should be mutable)
|
||||
wxString& GetFirstLine() /* const */
|
||||
wxString& GetFirstLine()
|
||||
{ return m_aLines.empty() ? ms_eof : m_aLines[m_nCurLine = 0]; }
|
||||
wxString& GetNextLine() /* const */
|
||||
wxString& GetNextLine()
|
||||
{ return ++m_nCurLine == m_aLines.size() ? ms_eof
|
||||
: m_aLines[m_nCurLine]; }
|
||||
wxString& GetPrevLine() /* const */
|
||||
wxString& GetPrevLine()
|
||||
{ wxASSERT(m_nCurLine > 0); return m_aLines[--m_nCurLine]; }
|
||||
wxString& GetLastLine() /* const */
|
||||
wxString& GetLastLine()
|
||||
{ return m_aLines.empty() ? ms_eof : m_aLines[m_nCurLine = m_aLines.size() - 1]; }
|
||||
|
||||
// get the type of the line (see also GetEOL)
|
||||
|
Reference in New Issue
Block a user