The Wayback Machine - https://web.archive.org/web/20150414004536/http://www.codeguru.com:80/cpp/misc/samples/basicprogramming/

Latest Basic Programming Articles

C++ Programming: A Better Vector Trim Algorithm With Move Semantics

Vectors are one of the single most useful and most used objects in the STL. They are easy to use, and remove the burden of memory management from the user. It is possible to partially control memory usage by using functions like reserve, but nothing is provided to free up excess memory. Users have come up with ways to trim a vector by hand, but with the advent of the new C++0x and its move semantics, the classic solution of copy-swaping has become excessively expensive. This article seeks to find a better solution.

Latest Developer Videos

More...

Latest CodeGuru Developer Columns

Top White Papers and Webcasts

  • You may not realize the complexity you could be creating when developing mobile apps – many companies don't initially. You could be doubling your IT costs for development and delivery; not to mention, risking sales, productivity and brand satisfaction. Read this IBM-commissioned Forrester Study to understand the key cost drivers of mobile app delivery -- for both customer-facing and enterprise applications. Find out how you could lower costs and increase success with the right strategy and investment.

  • Live Event Date: May 13, 2105 @ 1:00 p.m. ET / 10:00 a.m. PT Your data is a valuable asset that can quickly transform into a liability when breached. Organizations often become hung up on combating external breaches, while the insider threat doesn't get the attention it deserves. To manage both external and internal threats, new approaches to security are required, particularly in regards to authorized internal users who have legitimate access to sensitive information. Join TITUS and a guest speaker from …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date