The Fishing Planet is a third-person fishing game for Android designed specifically to recreate the experience of a day on the river and deliver the most accurate simulation for the most authentic fishing experience possible.
Check out our other highly rated products!
How to use assignment operator to initialize a structure array in C++?
How to use assignment operator to initialize a structure array in C++?
Something like this:
struct shape {
int length;
int width;
int height;
vector points;
} s;
int main(int argc, char *argv[])
{
s.points[100].push_back(4.0);
return 0;
}
A:
If you’re using C++11, you don’t even need an assignment statement. Simply supply an initializer list and assignment will initialize points for you:
int main(int argc, char *argv[])
{
s{100}.points.push_back(4.0);
return 0;
}
If you’re using C++03, you can specify the type in an initializer list:
int main(int argc, char *argv[])
{
s{100}.points.push_back(4.0);
return 0;
}
Alternatively, you can declare a helper class to initialize the vector:
template
struct point {
point