cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
user name:
password:
Forgot your password?
please wait
try again
cancel
forgot your password?
sign up
log in
[Legacy version]
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
array of vector<int>
array of vector<int>
Jun 29, 2011 at 2:49am
Jun 29, 2011 at 2:49am UTC
nguyentrang
(21)
vector<
int
> v(5)
creates a vector<int> v of size 5
vector<
int
> v[5]
creates an array v of 5 vector<int>'s
What if we want an array v of 5 vector<int>'s of size 5?
Jun 29, 2011 at 3:13am
Jun 29, 2011 at 3:13am UTC
helios
(17607)
In general, it's not possible to pass parameters to constructors of objects in arrays. In this particular case, this
may
work (I wouldn't be surprised if it didn't):
std::vector<
int
> v[]={5,5,5,5,5};
Topic archived. No new replies allowed.