guess you have the following:
_______________ _______________ _______________ ____
template <class T>
class CQVector
{
public:
// find an element, returns index or -1 if none is found
int find(int id) const;
private:
std::vector<Tm_ vec;
};
template <class T>
int CQVector<T>::fi nd(int id) const
{
int iCnt = m_vec.size();
while (iCnt-->0)
{
if (m_vec[iCnt].ID() == id)
break;
}
return iCnt;
}
_______________ _______________ _______________ ____
this finds an element in the vector by calling elements fn ID() and
compiles for all structures/classes that have an ID() memeber-fn
returning something comparable to int.
now i also want the possibility to store pointers, eg
CQVector<MyClas s*m_foo;
and need some specialisation that does a...
_______________ _______________ _______________ ____
int iCnt = m_vec.size();
while (iCnt-->0)
{
if (m_vec[iCnt]->ID() == id)
break;
}
return iCnt;
_______________ _______________ _______________ ____
what syntax is need ed for the specialisation?
something like template<class* Tdoesnt work...
TIA, -.rhavin;)
_______________ _______________ _______________ ____
template <class T>
class CQVector
{
public:
// find an element, returns index or -1 if none is found
int find(int id) const;
private:
std::vector<Tm_ vec;
};
template <class T>
int CQVector<T>::fi nd(int id) const
{
int iCnt = m_vec.size();
while (iCnt-->0)
{
if (m_vec[iCnt].ID() == id)
break;
}
return iCnt;
}
_______________ _______________ _______________ ____
this finds an element in the vector by calling elements fn ID() and
compiles for all structures/classes that have an ID() memeber-fn
returning something comparable to int.
now i also want the possibility to store pointers, eg
CQVector<MyClas s*m_foo;
and need some specialisation that does a...
_______________ _______________ _______________ ____
int iCnt = m_vec.size();
while (iCnt-->0)
{
if (m_vec[iCnt]->ID() == id)
break;
}
return iCnt;
_______________ _______________ _______________ ____
what syntax is need ed for the specialisation?
something like template<class* Tdoesnt work...
TIA, -.rhavin;)
Comment