Working on C++ Book Again 401

Posted by Brett Schuchert Wed, 03 Aug 2011 23:56:00 GMT

Picked up working on a book on C++. It’s freely available (as I work on it) and a PDF is available here.

CPP And OOD: The Least You Need To Know 273

Posted by Brett Schuchert Fri, 08 Oct 2010 21:34:00 GMT

I’ve put what I’ve been writing up, available for free. Not sure if I’ll ever try to get it published dead-tree form.

http://schuchert.wikispaces.com/cpptraining.CppAndOodTheLeastYouNeedToKnow

Feedback appreciated.

Have a great weekend.

Getting Started With cslim in Visual Studio 2010 Using the Command Line Tools 133

Posted by Brett Schuchert Mon, 09 Aug 2010 03:08:00 GMT

Some of you asked for it. Here’s something to get you started:

http://schuchert.wikispaces.com/cpptraining.UsingCSlimWithVisualStudio2010

These instructions are a work in progress and alpha. However, they do get the basics working.

If you are so inclined, have a look at the NMakefile (you’ll come across it in the instructions) and give me a better way to build it.

I spent probably 8 hours getting a working environment (much yak shaving including a faulty mac book pro DVD drive). I then spent another 8 – 10 hours getting this working. I worked through it about 5 times to minimize the amount of changes I needed to make to the original library source.

I ended up using some link and pre-processor seams to get most of this built. However, most of my time was spent trying to figure out the command line tools and their options.

If you can give me some guidance on improving this, I’d like to hear it. However, this is now a low-burning thread, so some assembly required!

Enjoy,

C++ Algorithms, Boost and function currying 165

Posted by Brett Schuchert Sun, 13 Jun 2010 04:41:00 GMT

I’ve been experimenting with C++ using the Eclipse CDT and gcc 4.4. Since I’m a fan of boost, I’ve been using that as well. I finally got into I realistic use of boost::bind.

I converted this:
int Dice::total() const {
  int total = 0;

  for(const_iterator current = dice.begin();
      current != dice.end();
      ++current)
    total += (*current)->faceValue();

  return total;
}
Into this:
int Dice::total() const {
  return std::accumulate(
      dice.begin(),
      dice.end(),
      0,
      bind(std::plus<int>(), _1, bind(&Die::faceValue, _2))
  );
}

To see how to go from the first version to the final version with lots of steps in between: http://schuchert.wikispaces.com/cpptraining.SummingAVector.

This is a first draft. I’ll be cleaning it up over the next few days. If you see typos, or if anything is not clear from the code, please let me know where. Also, if my interpretation of what boost is doing under the covers (there’s not much of that) is wrong, please correct me.

Thanks!

Different Test Examples in C++ Using C++ CppUTest 74

Posted by Brett Schuchert Thu, 26 Mar 2009 23:08:00 GMT

Here are several versions of the same unit tests written in different styles using CppUTest: C++ Unit Test Examples. If you look near the bottom, you’ll see what looks like story tests in C++. Shocking!

These are all based on Bob’s Prime Factors Kata.