Comparator

B

bil050

Hi,
I have defined suc a comparator class
Code:
lass FComapare
{
public:
	FComapare(size_t p):m_p(p){};
	bool operator() (Node *lId,Node* rId)
	{
		if(lId->getDiff(m_p) < rId->getDiff(m_p))
			return true;
		else if(lId->getDiff(m_p) == rId->getDiff(m_p))
		{
			if(lId->getLT() < rId->getLT())
				return true;
			return false;
		}
	}
private:
	size_t m_p;
};
I want to create vector of sets while the comarator for each set is
created as FComapare object with differnt paremeter.
How can I do it?
Thanks
 
V

Victor Bazarov

Hi,
I have defined suc a comparator class
Code:
lass FComapare
{
public:
	FComapare(size_t p):m_p(p){};
	bool operator() (Node *lId,Node* rId)
	{
		if(lId->getDiff(m_p)<  rId->getDiff(m_p))
			return true;
		else if(lId->getDiff(m_p) == rId->getDiff(m_p))
		{
			if(lId->getLT()<  rId->getLT())
				return true;
			return false;
		}
	}
private:
	size_t m_p;
};
I want to create vector of sets while the comarator for each set is
created as FComapare object with differnt paremeter.
How can I do it?

What's the problem? To create a vector you simply define one. A vector
of sets? Sure:

std::vector<std::set< ... > > vector_of_sets;

But you didn't give us enough to go on. What's "Node"? What is the set
going to be of? Consider giving it a shot yourself first. We do not do
anybody's homework, and your post sounds too much like one.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top