Z
zs0723
I want to write my own function objects and used in vector<T>
instanstance,
for example
class equalDate
{
string m_date;
public:
equalDate(string date):m_date(date){}
bool operator()(string date)
{
return date == m_date;
}
};
used in another class A's foo() function:
void A::foo()
{
remove_if(vDate.begin(),vDate.end(),qualDate(baseDate));
}
my question is where to declare class "equalDate ", put it in class
A scope
or a separate file ?
instanstance,
for example
class equalDate
{
string m_date;
public:
equalDate(string date):m_date(date){}
bool operator()(string date)
{
return date == m_date;
}
};
used in another class A's foo() function:
void A::foo()
{
remove_if(vDate.begin(),vDate.end(),qualDate(baseDate));
}
my question is where to declare class "equalDate ", put it in class
A scope
or a separate file ?