vector/valarray initialization

Discussion in 'C++' started by Chris Forone, Apr 5, 2008.

  1. Chris Forone

    Chris Forone Guest

    hello group,

    is there a "more elegant" method to initialize vectors/valarrays?

    std::valarray<float> temp(1.f / 8, 8 + 1);
    temp[0] = 0, std::partial_sum(&temp[0], &temp[temp.size()], &temp[0]);

    nedded: start value, increment value

    the one with std::generate i had already...

    thanx a lot & hand, chris
     
    Chris Forone, Apr 5, 2008
    #1
    1. Advertising

  2. Chris Forone

    Chris Forone Guest

    needed
     
    Chris Forone, Apr 5, 2008
    #2
    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. Jim West
    Replies:
    2
    Views:
    521
    Jim West
    Dec 23, 2003
  2. pmatos
    Replies:
    6
    Views:
    24,120
  3. Replies:
    8
    Views:
    1,998
    Csaba
    Feb 18, 2006
  4. Alex Howlett

    valarray Initialization Question

    Alex Howlett, Mar 14, 2007, in forum: C++
    Replies:
    3
    Views:
    772
    Marcus Kwok
    Mar 22, 2007
  5. toton

    valarray or vector ?

    toton, Mar 22, 2007, in forum: C++
    Replies:
    1
    Views:
    838
    Fei Liu
    Mar 22, 2007
Loading...

Share This Page