Introduction to OOP: Chapter 16 : A Case Study : The STL [next] [previous] [audio] [real] [text]

Representing a Distance

struct DistancePair {
	unsigned int first;
	string second;
	DistancePair() : first(0) { }
	DistancePair(unsigned int f, string & s)
		: first(f), second(s) { }
};

bool operator < (DistancePair & lhs, DistancePair & rhs)
	{ return lhs.first < rhs.first; }
Intro OOP, Chapter 16, Slide 18