Click here to Skip to main content
Click here to Skip to main content
Alternative Tip

Tagged as

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

, 1 Oct 2010
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
Italy Italy
No Biography provided

Comments and Discussions

 
General+5 for ease of problem solving. If you're dealing with a fix... PinmemberAndrew McAuley7-Oct-10 6:53 
GeneralReason for my vote of 5 Thanks for answering like this - I'm... PinmemberAescleal1-Oct-10 9:49 

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 | Mobile
Web03 | 2.8.140821.2 | Last Updated 1 Oct 2010
Article Copyright 2010 by Sauro Viti
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid