Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

template compiling issues

Status
Not open for further replies.

joeGrammar

Programmer
Jun 4, 2001
162
CA
code:


template <class T>
class RangeValidator : public FieldValidator
{
public:
RangeValidator( RECTYPE eRecType, int iErrNo, PValMsgArgsCB pVMCBINI, const char *szName, const char *pData, T, T );
virtual LOGIC IsValid();

private:
--> T Low;
--> T High;
};

template <class T>
RangeValidator<T>::RangeValidator(
RECTYPE eRecType, int iErrNo, PValMsgArgsCB pVMCBINI, const char *szName, const char *pDataIni, T LowIni, T HighIni ) :
FieldValidator( eRecType, iErrNo, pVMCBINI, szName )
{
--> pData = pDataIni;
--> Low = LowIni;
--> High = HighIni;
}

template <class T>
LOGIC RangeValidator<T>::IsValid()
{
error --> return ( Low <= pData && pData <= High ) ? PASS : FAIL;
}

c:\windows\desktop\newbatch\inc\zdataval.hpp(161) : error C2667: '<=' : none of 2 overload have a best conversion


I understand what's going on here, I need you guys to tell me if you think this error should be occuring. One parameter is a template var, the other is a const char. Isn't it possible to compare a template var?
 
some of templates are incompatible.
for example
template<class T> class x:public T
{
a(){return T.cc();}
};//everithing is good till you try to create a template of class what doesn't support cc() John Fill
1c.bmp


ivfmd@mail.md
 
templates is always created at compile time. If they are not compatible they not compille. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top