T
tomix
Hi,
I am trying to create a template which fill window list control with
items.
I would like to ask can i 'pass' to the template the actual function
which need
to be called on the item in order to get its name or description?
currently i assuming that the container is a map and the item have
GetName method:
template < class TControl,class TContainer>
class WindowLoaderFromMap
{
public:
static Load(TControl& wnd,TContainer& container)
{
for(TContainer::iterator
it=container.begin();it!=container.end();it++)
{
int index=wnd.AddString(it->second->GetName().c_str());
wnd.SetItemDataPtr(index,static_cast<void*>(it->second));
}
}
};
I am trying to create a template which fill window list control with
items.
I would like to ask can i 'pass' to the template the actual function
which need
to be called on the item in order to get its name or description?
currently i assuming that the container is a map and the item have
GetName method:
template < class TControl,class TContainer>
class WindowLoaderFromMap
{
public:
static Load(TControl& wnd,TContainer& container)
{
for(TContainer::iterator
it=container.begin();it!=container.end();it++)
{
int index=wnd.AddString(it->second->GetName().c_str());
wnd.SetItemDataPtr(index,static_cast<void*>(it->second));
}
}
};