B
BobR
Gavin Deane wrote in message
Small (somewhat) safety issue; Those should be unsigned, not int.
const int dimensions = -5; // ouch, a HUGE size vector.
// vector ctor interprets it as unsigned.
const size_t dimensions = -5; // let the compiler warn first.
// I guess 'std::vector::size_type' would be even better (?).
to OP: the 'const' isn't required here, just good practice.
size_t dimensions( 5 );
std::vector<int> vecA(dimensions, int(42));
dimensions = 22;
// I guess that answers my question in my other post. Thanks!
Just a thought.
#include <vector>
typedef std::vector<std::vector<std::vector<int> > > vec3d;
const int dimensions = 5;
const int grid_points = 42;
const int the_third_one = 7;
Small (somewhat) safety issue; Those should be unsigned, not int.
const int dimensions = -5; // ouch, a HUGE size vector.
// vector ctor interprets it as unsigned.
const size_t dimensions = -5; // let the compiler warn first.
// I guess 'std::vector::size_type' would be even better (?).
to OP: the 'const' isn't required here, just good practice.
size_t dimensions( 5 );
std::vector<int> vecA(dimensions, int(42));
dimensions = 22;
std::vector said:int main(){
vec3d bar(dimensions, std::vector<std::vector<int> >(grid_points,
std::vector<int>(the_third_one)));
// I guess that answers my question in my other post. Thanks!
}
Gavin Deane
Just a thought.