Could someone please help me with this problem I have found that the following code that used to build on VC++ 7.0 fails on VC++ 8.0:
//test1.h
//defines a simple class TNode and a function object, NodeCompare, for sorting of TNode*.
#define
ATOL 0.0001class
TNode {: // User declarationsprivate
public
: // User declarationsTNode();
~TNode();
TNode(const TNode&);
bool operator < (TNode const& node) const;
double x;
};
struct
NodeCompare{
bool operator () (TNode* left,TNode* right) const
{
return *left < *right;
}
};
//test1.cpp
//Defines TNode members.
#include
"stdafx.h"#include
"test1.h"TNode::TNode(){ x = 0.0; }
TNode::~TNode(){}
TNode::TNode(
const TNode& node){ x = node.x; }
bool
TNode::operator < (TNode const& node) const{
double dx;
if(dx < -ATOL)dx = x - node.x;
return true; return false;
}
// test.cpp : Defines the entry point for the console application.
//
#include
"stdafx.h"#include
"test1.h"#include
<set>int
_tmain(int argc, TCHAR* argv[]){
//declaration fails with numerous warnings - 'C4180: qualifier applied to function type has no meaning; ignored' //and 2 fatal errors - 'C2091: function returns function'std:
et <TNode*,NodeCompare() > nodeset;
return 0;
}
The warnings and errors occur in the STL code but their descriptions are well outside my level of competence in C++. Any assistance will be much appreciated.
Regards,