how do i fix these warnings / errors from using multiset?

I am trying to learn how to use multiset, but my tests keep throwing errors from xtree rather than my from my own code. How do I fix this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// header
#pragma once
#include <set>
using namespace std;

struct DrawReqCompare{
	bool operator()( int A, int B );
};

class cDrawSys 
{
public:
	void			RenderFunc();

	void			ToDraw( int val );

	void			UpdatedLvl( int val );

	void			RemoveFromDraw( int val );

private:

	typedef std::multiset< int , DrawReqCompare() >	DrawReqSet;
	DrawReqSet			wDrawReqSet;
};


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//source
#include "multiset.h"

bool
DrawReqCompare::operator()( int A, int B ){
	return A < B; }

void			
cDrawSys::RenderFunc()
{

	DrawReqSet::iterator
		It = wDrawReqSet.begin(),
		End = wDrawReqSet.end();

	for( ; It != End; ++It )
		(*It);
}

void			
cDrawSys::ToDraw( 
				 int val )
{ 
	wDrawReqSet.insert( val ); 
}

void			
cDrawSys::UpdatedLvl( 
					 int val )
{
	RemoveFromDraw( val );
	ToDraw( val );
}

void			
cDrawSys::RemoveFromDraw( 
						 int val )
{
	DrawReqSet::iterator 
		FindIt	=	wDrawReqSet.find( val );

	// If object does not exist on map, return and take no action
	if( FindIt == wDrawReqSet.end() )
		return;

	wDrawReqSet.erase( FindIt );
}



xtree(49) warning c4180: qualifier applied to function type has no meaning
xtree(625) error c2091: function returns function
Last edited on
This doesn't seem right:

typedef std::multiset< int , DrawReqCompare() > DrawReqSet;


std::multiset wants a type as its second template parameter. You are
passing an instantiation.
Damn I'm dumb, that was it. Thanks!
Topic archived. No new replies allowed.