M
Michael
Hi,
I'm having a few problems getting the following find_if to work
class Entity
{
};
class factory
{
public:
string GetType();
Entity* CreateEntity();
};
class TheFactories
{
vector<factory*> factories;
public:
Entity* CreateEntity( const string& type)
{
vector<factory*>::iterator fact= find_if(
factories.begin(),
factories.end(),
/* What goes
here! */
);
if( fact != vector<factory*> ) return
(*fact)->CreateEntity();
assert(0);
}
};
now I know I could unroll the find_if but I'm trying to get the hang of
function objects and the like.
If i have vector<string>, i can use equal_to<string>() but I don't
understand where the arguements are supposed to go.
I'd have thought the syntax would be:
equal_to<string>(str1,str2)
not bind1st( equal_to<string>(), str2 )!
Ahhhhhh!
Thanks Mike
I'm having a few problems getting the following find_if to work
class Entity
{
};
class factory
{
public:
string GetType();
Entity* CreateEntity();
};
class TheFactories
{
vector<factory*> factories;
public:
Entity* CreateEntity( const string& type)
{
vector<factory*>::iterator fact= find_if(
factories.begin(),
factories.end(),
/* What goes
here! */
);
if( fact != vector<factory*> ) return
(*fact)->CreateEntity();
assert(0);
}
};
now I know I could unroll the find_if but I'm trying to get the hang of
function objects and the like.
If i have vector<string>, i can use equal_to<string>() but I don't
understand where the arguements are supposed to go.
I'd have thought the syntax would be:
equal_to<string>(str1,str2)
not bind1st( equal_to<string>(), str2 )!
Ahhhhhh!
Thanks Mike