Click here to Skip to main content
12,244,103 members (50,842 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

5.3K views
1 bookmarked
Posted

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

You may also be interested in...

Comments and Discussions

 
General+5 for ease of problem solving. If you're dealing with a fix... Pin
Andrew McAuley7-Oct-10 7:53
memberAndrew McAuley7-Oct-10 7:53 
GeneralReason for my vote of 5 Thanks for answering like this - I'm... Pin
Aescleal1-Oct-10 10:49
memberAescleal1-Oct-10 10:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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
Web01 | 2.8.160426.1 | Last Updated 1 Oct 2010
Article Copyright 2010 by Sauro Viti
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid