Skip to main content
added 264 characters in body
Source Link
111111
  • 16.3k
  • 6
  • 49
  • 64

Make sure you have

#include <functional> 

in your included.

However it would be easier for you to do this (if you are trying to set the size of all the vectors of myData.

std::vector<std::vector<myData > > mMy (size, std::vector(numMy) ); 

Here each vector will of size numMy

Also you do know that gcc 4.2 is still really quite old?, if you can I would highly recommend gcc 4.6.

with gcc 4.6 you could do rid of all that mem_func whatever stuff with this:

std::for_each( mMy.begin(), mMy.end(), std::bind(std::vector<myData>::resize, std::placeholders::_1, numMy)); 

(although I would still prefer the constructor option if it is required by your use case).

Make sure you have

#include <functional> 

in your included.

However it would be easier for you to do this (if you are trying to set the size of all the vectors of myData.

std::vector<std::vector<myData > > mMy (size, std::vector(numMy) ); 

Here each vector will of size numMy

Also you do know that gcc 4.2 is still really quite old?

Make sure you have

#include <functional> 

in your included.

However it would be easier for you to do this (if you are trying to set the size of all the vectors of myData.

std::vector<std::vector<myData > > mMy (size, std::vector(numMy) ); 

Here each vector will of size numMy

Also you do know that gcc 4.2 is still really quite old, if you can I would highly recommend gcc 4.6.

with gcc 4.6 you could do rid of all that mem_func whatever stuff with this:

std::for_each( mMy.begin(), mMy.end(), std::bind(std::vector<myData>::resize, std::placeholders::_1, numMy)); 

(although I would still prefer the constructor option if it is required by your use case).

Source Link
111111
  • 16.3k
  • 6
  • 49
  • 64

Make sure you have

#include <functional> 

in your included.

However it would be easier for you to do this (if you are trying to set the size of all the vectors of myData.

std::vector<std::vector<myData > > mMy (size, std::vector(numMy) ); 

Here each vector will of size numMy

Also you do know that gcc 4.2 is still really quite old?