Iterators Must Go (aka, Alexandrescu endorses D)

Andrei Alexandrescu gave the keynote speech at Boostcon 2009. The speech’s title was “Iterators Must Go.” I did not have the opportunity to attend this year’s Boostcon, but the slides of the keynote are available online.



What is C++ Virtual Inheritance?

C++ Virtual Methods

In C++, the virtual keyword, when applied to class methods, aids in polymorphism. If a method is declared to be virtual, the most derived version of the method is executed when a call is made. If a method is non-virtual, the specific version that is called depends on how the method is called. If the method is called via a pointer to the base class, the base class method is called, if by the derived class, then the derived method is called. This definition is weak; an example is better, as usual:



Programming With Portability in Mind

Almost a year ago now I promised a series of articles on cross-platform C++. Since then, I have finished porting a relatively large C++ project that I wrote to Linux, Solaris, and Windows. I’ve learned that C++ is really quite portable and there are just a few guidelines that you should keep in mind.



C++ Question of the Day: std::map index operator

Jon asks:



Using Visual Studio Property Sheets to Manage Common Properties

Now that we have built Boost for Visual Studio, it sure would be handy to store the settings we need to use Boost in one place so that they can be easily set and reused. Visual Studio property sheets allow us to do just this. A property sheet is a collected set of settings which are stored in a .vsprops file. The file can be stored and reused between projects when common properties are desired. To create a property sheet for our Boost installation, we will first need to select the “Property Manager” tab of our project. [img_assist nid=415 title=Selecting the Property Manager Tab desc= link=popup align=none width=640 height=375] Next, right click on the project and choose “Add New Project Property Sheet…” [img_assist nid=416 title=Adding a New Property Sheet desc= link=popup align=none width=640 height=375] Now, choose the name and location of the property sheet that you would like to create. We are calling ours “boost.vsprops” [img_assist nid=417 title=Naming the Property Sheet desc= link=popup align=none width=640 height=375] Then, right click on the new property sheet and choose “Properties.” This will allow us to actually set the properties that the property sheet contains. [img_assist nid=418 title=Bringing Up the Property Sheet Properties desc= link=popup align=none width=640 height=375] The goal of this particular property sheet is make Boost easy to use. We will need to configure the includes directory and library directory of Boost to accomplish this. Select “Common Properties -> C/C++ -> General” in the property tree and set the “Additional Include Directories” to include your Boost installation’s header file directory. [img_assist nid=419 title=Setting the Boost Include Directory Property desc= link=popup align=none width=640 height=375] Finally, you will need to set “Common Properties -> Linker -> General -> Additional Library Directories” to include your Boost’s library installation folder. [img_assist nid=420 title=Setting the Boost Library Directory Property desc= link=popup align=none width=640 height=375] There, now we have created the Boost property sheet. Any time we want to use Boost from now on we just need to add this property sheet to our project and it will be ready to go. We can add many property sheets to our projects; so, we could create a library of property sheets for the various libraries that we regularly use.


Building Boost With Visual Studio

Unfortunately, if you want to download a pre-compiled Boost for Visual Studio, you are required to register for an account with boostpro.com. When I was looking to download Boost for Windows recently 1.38 was not yet available precompiled and I personally did not want to register for an account to download free software, so I built it myself. Fortunately, the process is very simple:



Now Tweeting

I’ve just installed the Drupal Twitter module which is supposed to add features such as automatic tweeting of blog postings. We’ll see how well it works or not. I’ll be tweeting under the name lefticus.



Paid Enhancements to Swig Starter Kit Coming Soon

I’m hoping to finalize the details of a paid contract to enhance the Swig Starter Kit soon. If the contract goes through, you can expect to see some significant enhancements. Specifically, Visual Studio, smart pointer and exceptions support will be added. Also, you can expect to see significant improvements in documentation. This particular client found me through the, “If you like this software, please consider hiring me,” license that I show on the google code project page. If anyone else is interested, I am available for C++ project work.



Real World Haskell: Chapter 5

Chapter 5 of Real World Haskell covers the creation of our first Haskell module. The chapter seems to come prematurely from my perspective. I am not yet concerned about making a module while I’m still trying to understand the language. One thing that did catch my attention is the Prelude.undefined special value which allows for easy creation of stub code: ` – This compiles but causes a runtime error if you try to execute it text :: String -> Doc text str = undefined` Bitwise Functions We also learn in Chapter 5 that the bitwise manipulations we have come to take for granted in C, C++ and similar languages is now a library module. This is the first point at which I can see an obvious point where C++ would make more succinct and readable code than Haskell.