M
Marco Segurini
Hi,
I am asking myself, why the compilation of line 21 and 22 fail using
Visual Studio 2002.
Begin program --------------------------
#include <map>
class TestMap
{
typedef void (TestMap::*ptrCmd)();
typedef std:air<long,ptrCmd> LongPtrFnPair;
std::map<long,ptrCmd> m_map;
void Cmd1();
void Cmd2();
void Cmd3();
public:
TestMap();
};
TestMap::TestMap()
{
m_map.insert(LongPtrFnPair(1, Cmd1)); //line 21
m_map.insert(LongPtrFnPair(2, TestMap::Cmd2)); //line 22
m_map.insert(LongPtrFnPair(3, &TestMap::Cmd3)); //line 23
}
void TestMap::Cmd1() {}
void TestMap::Cmd2() {}
void TestMap::Cmd3() {}
int main()
{
TestMap TM;
return 0;
}
End program ---------------
Compiling...
MapPair.cpp
e:\Prove\C++ NET\MapPair\MapPair.cpp(21) : error C2665:
'std:air::__ctor' : none of the 3 overloads can convert parameter 2
from type 'void (void)'
c:\Programmi\Microsoft Visual Studio
..NET\Vc7\include\utility(32): could be 'std:air<_Ty1,_Ty2>:air(const
_Ty1 &,const TestMap:trCmd & )'
with
[
_Ty1=long,
_Ty2=TestMap:trCmd
]
while trying to match the argument list '(int,
overloaded-function)'
e:\Prove\C++ NET\MapPair\MapPair.cpp(22) : error C2665:
'std:air::__ctor' : none of the 3 overloads can convert parameter 2
from type 'void (void)'
c:\Programmi\Microsoft Visual Studio
..NET\Vc7\include\utility(32): could be 'std:air<_Ty1,_Ty2>:air(const
_Ty1 &,const TestMap:trCmd & )'
with
[
_Ty1=long,
_Ty2=TestMap:trCmd
]
while trying to match the argument list '(int,
overloaded-function)'
End build log -------------------
TIA.
Marco.
I am asking myself, why the compilation of line 21 and 22 fail using
Visual Studio 2002.
Begin program --------------------------
#include <map>
class TestMap
{
typedef void (TestMap::*ptrCmd)();
typedef std:air<long,ptrCmd> LongPtrFnPair;
std::map<long,ptrCmd> m_map;
void Cmd1();
void Cmd2();
void Cmd3();
public:
TestMap();
};
TestMap::TestMap()
{
m_map.insert(LongPtrFnPair(1, Cmd1)); //line 21
m_map.insert(LongPtrFnPair(2, TestMap::Cmd2)); //line 22
m_map.insert(LongPtrFnPair(3, &TestMap::Cmd3)); //line 23
}
void TestMap::Cmd1() {}
void TestMap::Cmd2() {}
void TestMap::Cmd3() {}
int main()
{
TestMap TM;
return 0;
}
End program ---------------
Compiling...
MapPair.cpp
e:\Prove\C++ NET\MapPair\MapPair.cpp(21) : error C2665:
'std:air::__ctor' : none of the 3 overloads can convert parameter 2
from type 'void (void)'
c:\Programmi\Microsoft Visual Studio
..NET\Vc7\include\utility(32): could be 'std:air<_Ty1,_Ty2>:air(const
_Ty1 &,const TestMap:trCmd & )'
with
[
_Ty1=long,
_Ty2=TestMap:trCmd
]
while trying to match the argument list '(int,
overloaded-function)'
e:\Prove\C++ NET\MapPair\MapPair.cpp(22) : error C2665:
'std:air::__ctor' : none of the 3 overloads can convert parameter 2
from type 'void (void)'
c:\Programmi\Microsoft Visual Studio
..NET\Vc7\include\utility(32): could be 'std:air<_Ty1,_Ty2>:air(const
_Ty1 &,const TestMap:trCmd & )'
with
[
_Ty1=long,
_Ty2=TestMap:trCmd
]
while trying to match the argument list '(int,
overloaded-function)'
End build log -------------------
TIA.
Marco.