a set of scruct

hi everybody,
i'm new of c++ programming.
i'd like to create a set of object defined throw a struct.

i wrote this:
1
2
3
4
5
6
7
8
9
10
typedef std::set<terminal,std::less<Address> > setUser; //added by giuseppe 

struct terminal{
	Ptr <Node> ptrN;
	Ptr <LteNetDevice> ptrLND;
	Ptr <UeNetDevice> ptrUND;
	double lifeTime;
	Address macUe;
};


by i get the followed error:
terminal was not declared in this scope
invalid type in declaration before ';' token
template argument 1 is invalid
template argument 3 in invalid


please help me to solve this mistake.
thank you very much
Put the typedef after the struct definition.
it doesn't work also with typedef :(
¿same error?
Everything needs to be defined before you use it. I assume that you do included the definitions of set, less, Address, etc.

Provide a minimal example.
i changed a bit my code but it doesn't work as well

1
2
3
4
5
6
7
8
9
10
11
12
#include <set>
#include <algorithm>
#include <iterator>
 
typedef std::set<ueterm,std::less<Address> > setUser; //added by giuseppe 

typedef struct terminal{
	double lifeTime;
	Mac48Address macUe;
}ueterm;



the error are

Description	Resource	Path	Location	Type
‘ueterm’ was not declared in this scope	MioScenario.cc	/SpectrumSharing/scratch	line 39	C/C++ Problem
invalid type in declaration before ‘;’ token	MioScenario.cc	/SpectrumSharing/scratch	line 39	C/C++ Problem
template argument 1 is invalid	MioScenario.cc	/SpectrumSharing/scratch	line 39	C/C++ Problem
template argument 3 is invalid	MioScenario.cc	/SpectrumSharing/scratch	line 39	C/C++ Problem


¿What's Address?
As I told you the first time
1
2
3
4
5
6
7
8
9
10
#include <set>
#include <algorithm>
#include <iterator>
 
typedef struct terminal{
	double lifeTime;
	Mac48Address macUe;  //¿where's Mac48Address definition?
}ueterm;

typedef std::set<ueterm,std::less<Address> > setUser; //Put the typedef after the struct definition.   
sorry ne555

it should be like that
1
2
3
4
5
6
7
8
9
10
#include <set>
#include <algorithm>
#include <iterator>
 
typedef struct terminal{
	double lifeTime;
	Mac48Address macUe;  //¿where's Mac48Address definition?
}ueterm;

typedef std::set<ueterm,std::less<Mac48Address> > setUser; //Put the typedef after the struct definition.  
Topic archived. No new replies allowed.