Hi,
I have a vector of struct called ViewList defined like this :
class CViewMgr : public CSingleton<CVie wMgr>
{
friend class CSingleton<CVie wMgr>;
// Constructor
CViewMgr(): m_pCurView(NULL ) {}
CViewMgr(CViewM gr const&) {}
virtual ~CViewMgr(void) {}
protected:
CMobidjinnView m_MobidjinnView ;
public:
struct ViewInfo
{
ViewInfo(const GString& view, const CViewBase* a_pViewBase)
: m_viewname(view ), m_pView(a_pView Base)
{
}
GString m_viewname;
const CViewBase* m_pView;
};
typedef std::vector<Vie wInfoViewList;
void Init()
{
m_viewlist.push _back(ViewInfo( _T("SelectModul eView"), &m_MobidjinnVie w));
}
CViewBase* SwitchView(cons t GString& strViewName)
{
// I want to search in the ViewList an element
// with a m_viewname matching strViewName
CViewBase* pView = ??????????????? ??????????;
pView = find_if( m_viewlist.begi n(), m_viewlist.end( ),
... ) );
return NULL;
}
protected:
ViewList m_viewlist;
CViewBase* m_pCurView;
};
static inline CViewMgr& ViewMgr() { return *(CViewMgr::Get Instance()); }
and I would like to search my vector for a particular value matching the
m_viewname value.
How should I declare my functor ?
I have a vector of struct called ViewList defined like this :
class CViewMgr : public CSingleton<CVie wMgr>
{
friend class CSingleton<CVie wMgr>;
// Constructor
CViewMgr(): m_pCurView(NULL ) {}
CViewMgr(CViewM gr const&) {}
virtual ~CViewMgr(void) {}
protected:
CMobidjinnView m_MobidjinnView ;
public:
struct ViewInfo
{
ViewInfo(const GString& view, const CViewBase* a_pViewBase)
: m_viewname(view ), m_pView(a_pView Base)
{
}
GString m_viewname;
const CViewBase* m_pView;
};
typedef std::vector<Vie wInfoViewList;
void Init()
{
m_viewlist.push _back(ViewInfo( _T("SelectModul eView"), &m_MobidjinnVie w));
}
CViewBase* SwitchView(cons t GString& strViewName)
{
// I want to search in the ViewList an element
// with a m_viewname matching strViewName
CViewBase* pView = ??????????????? ??????????;
pView = find_if( m_viewlist.begi n(), m_viewlist.end( ),
... ) );
return NULL;
}
protected:
ViewList m_viewlist;
CViewBase* m_pCurView;
};
static inline CViewMgr& ViewMgr() { return *(CViewMgr::Get Instance()); }
and I would like to search my vector for a particular value matching the
m_viewname value.
How should I declare my functor ?
Comment