Click here to Skip to main content
11,412,516 members (69,401 online)
Click here to Skip to main content
Alternative Tip/Trick

Tagged as

C++ Tip: Aware of the confusion between delete with delete[]

, 1 Oct 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
The C++ comes with a rich standard library: the STL (Standard Template Library).So, why we should re-invent the wheel while we already have it done, safe and written to be light-weighed and performant?It's too much better to use the vector Class (Standard C++ Library)[^]:#include...
The C++ comes with a rich standard library: the STL (Standard Template Library).
So, why we should re-invent the wheel while we already have it done, safe and written to be light-weighed and performant?
It's too much better to use the vector Class (Standard C++ Library)[^]:

#include <vector>

...
 
std::vector<int> a(10); // Pre-allocate an array of 10 int

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Sauro Viti
Engineer Cutlite Penta S.r.l.
Italy Italy
No Biography provided

Comments and Discussions

 
General+5 for ease of problem solving. If you're dealing with a fix... Pin
Andrew McAuley at 7-Oct-10 7:53
memberAndrew McAuley7-Oct-10 7:53 
GeneralReason for my vote of 5 Thanks for answering like this - I'm... Pin
Aescleal at 1-Oct-10 10:49
memberAescleal1-Oct-10 10:49 
Reason for my vote of 5
Thanks for answering like this - I'm getting a bit fed up of anwering questions: "Have you considered using a vector?"

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150427.1 | Last Updated 1 Oct 2010
Article Copyright 2010 by Sauro Viti
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid