I get two errors with MS VC++ 6 c/w Sp5 which I do not understand!
The first error c2662 is on a set::clear command
and the second, error c2664, is on the 3rd param of a for_each algorithm.
If anyone can explain these to me I would appreciate it.
Here is the code:
In class definition:
typedef struct tag_CommentKey {
string section; // Section where comment appears
string key; // key in section where comment appears
} COMMENTKEY;
typedef struct tag_Comment {
int sequence; // Order of command line (0 for inline, n for stand-alone
int position; // Position on line
string comments; // Comment text
} COMMENTS;
typedef multimap<COMMENTKEY, COMMENTS> m_IniComment; // list of comments
typedef set<COMMENTS> m_CommentSet ; // Some comments
COMMENTKEY m_CommentKey;
COMMENTS m_CommentText;
m_IniComment m_IniComments; // Keyed Comments list
m_IniComment::iterator m_itIniComment;
void
IniFile::getComments ( void ) const
{
int number = m_IniComments.count (m_CommentKey);
if (number > 0) {
if (!m_Comments.empty()) { m_Comments.clear (); // this gets an error C2662!
}
pair<m_IniComment::iterator, m_IniComment::iterator> ret =
m_IniComments.equal_range (m_CommentKey);
for_each (ret.first, ret.second, setCommentSet); // this gets an error c2664 on param 3
}
return;
}