std:vector::resize in gcc4.2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • basti
    New Member
    • Feb 2012
    • 1

    std:vector::resize in gcc4.2

    hi bytes people,

    my name is bastian and i am new to this list.
    a week ago i upgraded from gcc4.0 to llvm gcc4.2. everything went well except for one thing i have really big trouble to figure out because i am more the audio signal processing kind of guy. so i really hope someone of you could help me. my issue is that the use of ::resize in stl_vector.h has completely changed.

    in gcc4.0 the following code compiled fine:

    std::vector< std::vector<myD ata> > mMy;

    std::for_each( mMy.begin(), mMy.end(), std::bind2nd(st d::mem_fun_ref( &std::vector < myData >::resize), numMy) );


    in gcc4.2 it does not compile with error:

    no matching function for call to mem_fun_ref ..

    i am pretty sure that i do not know how to implement ::resize correctly, could someone tell me what i have to do get this fixed. i am happy if you could show me a correct code example, but hints (books) and keywords that could help me figure this out would also be greatly appreciated ..


    thanks a lot for your help ..

    kind regards,
    bastian
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    It would be helpful if you posted the entire output of the compiler rather than 1/2 of 1 message.

    std::mem_fun_re f expects a function with 0 or 1 parameters but you have supplied it with a function that accepts 2, all be it the second one has a default value, so I wonder if that is having an effect. If this is the case you could try

    Code:
    std::for_each( mMy.begin(), mMy.end(), 
      std::bind2nd(
        std::mem_fun_ref(
          std::bind2nd(&std::vector< myData >::resize, MyData())), numMy) );

    Comment

    Working...