Hi,
i'm trying to make a calendar but get stuck at the following compiler error.
Here follows the snippet of code which i think is relevant to the problem. (The code in full can be found here Nopaste - calendar.cpp and Nopaste - calendar.h)
I guess i'm using some bad syntax for the set of strings within the map, or?
Help would be much appreciated.
BR
peal
i'm trying to make a calendar but get stuck at the following compiler error.
calendar.cpp: In member function `bool lab2::Calendar< T>::add_event(s td::string, int, int, int)':
calendar.cpp:45 : error: expected `;' before "it"
calendar.cpp:45 : error: expected `;' before "it"
Code:
template <typename T>
bool Calendar<T>::add_event( std::string event, int y, int m, int d)
{
if( (y < 1858) || (m < 1) || (d < 1) || (y > 2558)
|| (m > m_today.months_per_year())
|| (d > m_today.days_this_month(m)) )
{
return false;
}
T t(y,m,d);
map<T, set<string> >::iterator it;
it = m_events.find(t);
pair< set<string>::iterator,bool > res = it.insert(event);
return res.second;
}
Help would be much appreciated.
BR
peal
Comment