cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
How to declare a vector of objects with
How to declare a vector of objects with no default constructor?
Jun 1, 2010 at 10:07am UTC
waleed 707
(11)
I'm having a problem with vectors. I need to create a vector of objects that don't have a default constructor. Any ideas are appreciated ;)
Thx in advance.
Jun 1, 2010 at 10:55am UTC
siavoshkc
(21)
Can you explain more?
Jun 1, 2010 at 10:56am UTC
helios
(17574)
You can't. std::vector requires that the type has a default constructor. If it's absolutely necessary, you can declare the vector as a vector of pointers to dynamically allocated objects.
Jun 1, 2010 at 4:07pm UTC
waleed 707
(11)
helios u saved me, working with pointers was very hard but at last it worked, thank u very much :)
Topic archived. No new replies allowed.