static var and static map

Discussion in 'C++' started by Gary Wessle, Feb 19, 2007.

  1. Gary Wessle

    Gary Wessle Guest

    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
     
    Gary Wessle, Feb 19, 2007
    #1
    1. Advertising

  2. Gary Wessle

    Gary Wessle Guest

    Gary Wessle <> writes:

    >> 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


    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?
     
    Gary Wessle, Feb 19, 2007
    #2
    1. Advertising

  3. Gary Wessle wrote:
    > Gary Wessle <> writes:
    >
    >
    >>>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

    >
    >
    > 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
     
    John Harrison, Feb 19, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. thomson
    Replies:
    10
    Views:
    2,510
    Eliyahu Goldin
    Jun 20, 2005
  2. thomson
    Replies:
    0
    Views:
    396
    thomson
    Jun 20, 2005
  3. Alex Vinokur
    Replies:
    4
    Views:
    484
    Ron Natalie
    Sep 24, 2003
  4. daniele.g
    Replies:
    4
    Views:
    486
    Joe Pfeiffer
    Jul 15, 2011
  5. Shea Martin

    difference between @var and self.var

    Shea Martin, Jun 21, 2006, in forum: Ruby
    Replies:
    2
    Views:
    157
    Shea Martin
    Jun 22, 2006
Loading...

Share This Page