Overload assignment operator for assigning sql::ResultSet to struct tm
Posted
by Luke Mcneice
on Stack Overflow
See other posts from Stack Overflow
or by Luke Mcneice
Published on 2010-04-04T21:31:50Z
Indexed on
2010/04/04
22:23 UTC
Read the original article
Hit count: 457
Are there exceptions for types which can't have thier assignment operator overloaded?
Specifically, I'm wanting to overload the assignment operator of a struct tm (from time.h) so I can assign a sql::ResultSet to it.
I already have the conversion logic:
sscanf(sqlresult->getString("StoredAt").c_str(), "%d-%d-%d %d:%d:%d",
&TempTimeStruct->tm_year, &TempTimeStruct->tm_mon, &TempTimeStruct->tm_mday,
&TempTimeStruct->tm_hour, &TempTimeStruct->tm_min, &TempTimeStruct->tm_sec);
I tried the overload with this:
tm& tm::operator=(sql::ResultSet & results)
{
/*CODE*/
return *this;
}
However VS08 reports:
error C2511: 'tm &tm::operator =(sql::ResultSet &)' : overloaded member function not found in 'tm'
© Stack Overflow or respective owner