Using STL set with my own comparison function

How do I override the STL comparison function

Page 1 of 1

2 Replies - 4033 Views - Last Post: 29 September 2009 - 03:11 PM Rate Topic: -----

#1 zerobus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 29-September 09

Using STL set with my own comparison function

Posted 29 September 2009 - 08:50 AM

I'm trying to write a graph management system for fun.
So I have my own defined class
class Node
{
  public:
	string name;
	string getName() { return name; } 
}



I want to use the STL set to store Nodes with the name member field as the comparison criterion.
So how do I use the STL set's templates to make this happen?
Is This A Good Question/Topic? 0
  • +

Replies To: Using STL set with my own comparison function

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6058
  • View blog
  • Posts: 23,496
  • Joined: 23-August 08

Re: Using STL set with my own comparison function

Posted 29 September 2009 - 09:15 AM

Reference Material
Was This Post Helpful? 0
  • +
  • -

#3 poncho4all  Icon User is offline

  • D.I.C Head!
  • member icon

Reputation: 123
  • View blog
  • Posts: 1,405
  • Joined: 15-July 09

Re: Using STL set with my own comparison function

Posted 29 September 2009 - 03:11 PM

You class is missing a semicolon after the closing brace :P
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1