Maps and constructors and other crap
Grettings and salutations :)
I have the following two classes:
Code:
//------------------------------------------
// VHSTATS Class
//------------------------------------------
class VHSTATS
{
public:
VHSTATS();
VHSTATS(VIRTUALHOST);
map <string, int> PageRequests;
unsigned long NumberOfRequests;
unsigned long BytesSent;
VIRTUALHOST ThisVH; // VIRTUALHOST is a structure with info and strings and crap
};
//------------------------------------------
// STATS Class
//------------------------------------------
class STATS
{
public:
STATS();
bool WriteStatsFile();
unsigned long NumberOfRequests;
unsigned long TotalNumberOfRequests;
unsigned long BytesSent;
unsigned long TotalBytesSent;
string LastRestart;
map <string, int> PageRequests;
map <VIRTUALHOST, VHSTATS> VirtualHosts;basis
};
STATS::STATS() looks something like this:
Code:
STATS::STATS()
{
// 1: Load all the virtual hosts
int X = 0;
while (VHI.HostNumbers[X].empty() == false)
{
string Name = VHI.HostNumbers[X];
VHSTATS TempVHStats(VHI.Host[Name]);
VirtualHosts[VHI.Host[Name]] = TempVHStats;
}
.....
Where VHI.Host is an map of strings to VIRTUALHOST's, and VHI.HostNumbers is a map of integers to strings (that match the strings used by VHI.Host).
When I try to compile, VC++ gives me this:
Code:
stats.cpp
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : error C2784: 'bool __cdecl std::operator <(const class std::multimap<_K,_Ty,_Pr,_A> &,const class std::multimap<_K,_Ty,_Pr,_A> &)' : could not deduce template argument for 'const
class std::multimap<_K,_Ty,_Pr,_A> &' from 'const class VIRTUALHOST'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : while compiling class-template member function 'bool __thiscall std::less<class VIRTUALHOST>::operator ()(const class VIRTUALHOST &,const class VIRTUALHOST &) const'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : error C2784: 'bool __cdecl std::operator <(const class std::map<_K,_Ty,_Pr,_A> &,const class std::map<_K,_Ty,_Pr,_A> &)' : could not deduce template argument for 'const class std
::map<_K,_Ty,_Pr,_A> &' from 'const class VIRTUALHOST'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : while compiling class-template member function 'bool __thiscall std::less<class VIRTUALHOST>::operator ()(const class VIRTUALHOST &,const class VIRTUALHOST &) const'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : error C2784: 'bool __cdecl std::operator <(const class std::_Tree<_K,_Ty,_Kfn,_Pr,_A> &,const class std::_Tree<_K,_Ty,_Kfn,_Pr,_A> &)' : could not deduce template argument for 'c
onst class std::_Tree<_K,_Ty,_Kfn,_Pr,_A> &' from 'const class VIRTUALHOST'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : while compiling class-template member function 'bool __thiscall std::less<class VIRTUALHOST>::operator ()(const class VIRTUALHOST &,const class VIRTUALHOST &) const'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : error C2784: 'bool __cdecl std::operator <(const class std::basic_string<_E,_Tr,_A> &,const _E *)' : could not deduce template argument for 'const class std::basic_string<_E,_Tr,
_A> &' from 'const class VIRTUALHOST'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : while compiling class-template member function 'bool __thiscall std::less<class VIRTUALHOST>::operator ()(const class VIRTUALHOST &,const class VIRTUALHOST &) const'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : error C2784: 'bool __cdecl std::operator <(const _E *,const class std::basic_string<_E,_Tr,_A> &)' : could not deduce template argument for 'const *' from 'const class VIRTUALHO
ST'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : while compiling class-template member function 'bool __thiscall std::less<class VIRTUALHOST>::operator ()(const class VIRTUALHOST &,const class VIRTUALHOST &) const'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : error C2784: 'bool __cdecl std::operator <(const class std::basic_string<_E,_Tr,_A> &,const class std::basic_string<_E,_Tr,_A> &)' : could not deduce template argument for 'const
class std::basic_string<_E,_Tr,_A> &' from 'const class VIRTUALHOST'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : while compiling class-template member function 'bool __thiscall std::less<class VIRTUALHOST>::operator ()(const class VIRTUALHOST &,const class VIRTUALHOST &) const'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : error C2784: 'bool __cdecl std::operator <(const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &,const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &)' : could not deduce te
mplate argument for 'const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &' from 'const class VIRTUALHOST'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : while compiling class-template member function 'bool __thiscall std::less<class VIRTUALHOST>::operator ()(const class VIRTUALHOST &,const class VIRTUALHOST &) const'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : error C2784: 'bool __cdecl std::operator <(const struct std::pair<_T1,_T2> &,const struct std::pair<_T1,_T2> &)' : could not deduce template argument for 'const struct std::pair<
_T1,_T2> &' from 'const class VIRTUALHOST'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : while compiling class-template member function 'bool __thiscall std::less<class VIRTUALHOST>::operator ()(const class VIRTUALHOST &,const class VIRTUALHOST &) const'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : error C2676: binary '<' : 'const class VIRTUALHOST' does not define this operator or a conversion to a type acceptable to the predefined operator
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : while compiling class-template member function 'bool __thiscall std::less<class VIRTUALHOST>::operator ()(const class VIRTUALHOST &,const class VIRTUALHOST &) const'
Error executing cl.exe.
SWEBS.exe - 9 error(s), 0 warning(s)
All of them seem to be in files which I have not touched. Can anyone see what it is I must have done wrong? I'm stumped on this one, it should work fine :( Thanks for any help!