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:


//defines a simple class TNode and a function object, NodeCompare, for sorting of TNode*.

#define ATOL 0.0001

class TNode {

private: // User declarations

public: // User declarations



TNode(const TNode&);

bool operator < (TNode const& node) const;

double x;


struct NodeCompare


bool operator () (TNode* left,TNode* right) const


return *left < *right;




//Defines TNode members.

#include "stdafx.h"

#include "test1.h"

TNode::TNode(){ x = 0.0; }


TNode::TNode(const TNode& node){ x = node.x; }

bool TNode::operator < (TNode const& node) const


double dx;

dx = x - node.x;

if(dx < -ATOL)

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[])


std:Tongue Tiedet <TNode*,NodeCompare() > nodeset;

//declaration fails with numerous warnings - 'C4180: qualifier applied to function type has no meaning; ignored'

//and 2 fatal errors - 'C2091: function returns function'

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.


Re: Visual C++ Language STL set problem


I tried this. You just need to remove the brackets from your declaration in test.cpp i.e.

std:Tongue Tiedet<TNode*, NodeCompare> Nodeset;

You want to pass the function name. Not the function name and some brackets. I think.

That compiled for me. Haven't tried running or using this code. But I think that solves your problem.



Re: Visual C++ Language STL set problem


Yes, that's fixed it - I must be going blind. Many thanks.

Re: Visual C++ Language STL set problem


"NodeCompare" is a token that resolves to the address of a function

"NodeCompare()" is a call to the function