static var and static map

G

Gary Wessle

Hi

I have a method with some static double variables, if I make a
map<string,double> instead, will it do the same thing? apart from
assigning and accessing the values.

thank you
 
G

Gary Wessle

Gary Wessle said:
I have a method with some static double variables, if I make a
map<string,double> instead, will it do the same thing? apart from
assigning and accessing the values.

thank you

do I need to make the values themselves static or no need.
i.e
static map<string,int> m;
static int a = 5;
m["a"] = 5;

or just
int a = 5;
will do?
 
J

John Harrison

Gary said:
I have a method with some static double variables, if I make a
map<string,double> instead, will it do the same thing? apart from
assigning and accessing the values.

thank you


do I need to make the values themselves static or no need.
i.e
static map<string,int> m;
static int a = 5;
m["a"] = 5;

or just
int a = 5;
will do?

You only need to make the map static, because the map is static any
values inside the map will also be static (in effect).

john
 

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,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top