How to extend existing template in C++? -


i working legacy code of template based on

  template<class keytype, class dtype> foo bar(const dtype val) 

somewhere in code place made debug function this:

virtual void getdebugstr01(int db_id, ofcstring & db_str) {     //ofcstringstream ss;     if(db_id==0)     {         map<keytype, dtype>::iterator = m_statedata.begin();         for(;it!=m_statedata.end();it++)         {             (it->second).getdebugstr01(db_str);         }     } } 

now, need use template class float. there anyway this?

currently a:

    error c2228: left of '.getdebugstr01' must have class/struct/union 

getdebugstr01() should member of class/struct. virtual methods cannot stand alone.

you can like,

foo bar (const float f) { ... } 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -