How to fix compile error error C2535
-
I am getting follwoing error when compiling in VS2010. The same code compiles in VC6. Any help on this?
error C2535: 'bool std::binder2nd<_Fn2>::operator ()(const long &) const' : member function already defined or declared
d:\program files\microsoft visual studio 10.0\vc\include\xfunctional 341 TestVectIn Test.h file:
struct VerifyAddressAtAllSlots:
public binary_function
{
VerifyAddressAtAllSlots()
{
}
const bool
operator()(const long& thisAddress,
const long& thatAddress) const
{
return true;
}
};In Test.cpp file:
std::vector addrList;
long verifyAddress = 0;
for_each(addrList.begin(), addrList.end(), bind2nd(VerifyAddressAtAllSlots(), verifyAddress));
-
I am getting follwoing error when compiling in VS2010. The same code compiles in VC6. Any help on this?
error C2535: 'bool std::binder2nd<_Fn2>::operator ()(const long &) const' : member function already defined or declared
d:\program files\microsoft visual studio 10.0\vc\include\xfunctional 341 TestVectIn Test.h file:
struct VerifyAddressAtAllSlots:
public binary_function
{
VerifyAddressAtAllSlots()
{
}
const bool
operator()(const long& thisAddress,
const long& thatAddress) const
{
return true;
}
};In Test.cpp file:
std::vector addrList;
long verifyAddress = 0;
for_each(addrList.begin(), addrList.end(), bind2nd(VerifyAddressAtAllSlots(), verifyAddress));
Try making the operator
inline
:inline const bool
operator()(const long& thisAddress,
const long& thatAddress) const
{
return true;
}> The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<