Articles

This category is for general articles about C++.

One of my pet peeves about most C++ courses, tutorials, and books is that they seem to pointedly ignore algorithms. I don’t mean algorithms from a theoretical perspective, I mean the standard algorithms library – I am stunned at how many C++ teachers insist their students don’t use algorithms in their assignments. And aside from the actual standard algorithms themselves, most books, tutorials, and courses make absolutely no effort to discuss algorithms that follow the same general design. In my opinion, writing a standard-like algorithm should be one of the key parts of a modern C++ beginner’s course outline. Continue Reading

In their recent meeting in Urbana, the C++ standard committee took the rare step of removing several outdated facilities from (what will probably become) C++17. Most of the things removed had been deprecated since C++11, but there was one surprising item on the list: std::random_shuffle(). Its removal is a signal of a big change that has been building in the background for a while: the end of std::rand(). Continue Reading

Over ten years ago I first wrote an article about reading an entire file into memory in C++. It has become my most copied work (always without attribution), and every time I’ve set up a new site or blog, I’ve included an updated version – which again usually ranks among the most popular pages or posts there. So, it’s time again for the 2014 version of How to read an entire file into memory in C++. Continue Reading