TweetA short and to-the-point post illustrating how a deadlock situation can be created in C++, together with a possible strategy for avoiding such a condition. I’m am using the boost libraries to implement threads and mutexes, but it should be possible to the standard library implementations std::thread, std::mutex etc as well.
TweetSome examples of how to configure Code::Blocks to use the Boost C++ libraries: 1. Header-only (Windows) 2. Compiled libraries (Windows) 3. Compiled libraries (Ubuntu Linux) 1. Header-only (Windows) To configure Code::Blocks to use a header-only Boost library: Boost.DateTime. Select File > New > Project > Empty Project:
TweetSome short examples of how to use the Boost property tree in order to read from and write to XML files. Reading XML into a Boost property tree Here’s how to read an example XML into the Boost property tree and traverse each of the the “item” sections within this XML, given that items may more »
TweetFor many C++ applications I very much want to use the Boost libraries, just not the whole set. This post explains how to use the bcp tool to create a subset of the Boost libraries in order to leave out unnecessary libraries and tailor it to the needs of your project. One nice thing about more »
TweetExamples of using boost::filesystem for various things as and when I encounter them… Many have been lifted from the StackOverflow site. For reasons of brevity and clarity I generally avoid extraneous code such as exception handling etc in these examples and just focus on the techniques themselves. 1. Copying a directory This recursively uses boost::filesystem::create_directory more »
TweetAs stated on the boost.org Getting Started for Windows page, most Boost libraries are header-based that require no separate compilation. But there exist some Boost libraries that require a separate compilation in order to use them. This page essentially reiterates what is already explained in section 5.2.1 of the Getting Started page, but with additional more »
TweetA sample demonstration of using the Boost libraries as a means of finding matching words in a large array table, that match the given lookup criteria. Suppose you are wrestling with a cryptic crossword and want to find all seven-letter words whose third letter is ‘Y’ and fifth letter is ‘N’, or better still, run more »
TweetListing1: Serialization of STL containers: a std::vector example using text archives Your intuition may tell you to iterate through the STL container in order to serialize it, but it’s actually a lot simpler. First of all, be sure to include the necessary vector.hpp include file:
TweetUPDATE 15 February 2014: BoostPro is no more. You may find this alternative post useful in setting up the Boost libraries that require separate compilation. A number of Windows-based Boost libraries are not “header-only” and require that you must get them compiled. One way is to compile them yourself. A possibly easier way is to more »
TweetSome code samples I have collated in the sample below, that demonstrate how boost::function can be assigned with functors, ordinary functions, class member functions and overloaded class member functions respectively.