Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualPolarist

Posted 12 February 2013 - 10:54 PM

It may be not as efficient, but I tend to use STL everywhere (until I need to optimize).  It's much easier to maintain/read.

const int NUM_THINGS = 10;

std::vector<int> myThings(NUM_THINGS);

for( const auto& thing : myThings ){
   do_something_with(thing);
}

It also makes it quite difficult to accidentally overrun your buffer.


#1Polarist

Posted 12 February 2013 - 10:53 PM

It may be not as efficient, but I tend to use STL everywhere (until I need to optimize).  It's much easier to maintain/read.

 

 

 

const int NUM_THINGS = 10;

std::vector<int> myThings(NUM_THINGS);

for( const auto& thing : myThings ){
   do_something_with(thing);
}

 

It also makes it quite difficult to accidentally overrun your buffer.


PARTNERS