Trying It Out
Team LiB
Previous Section Next Section

Trying It Out

To compile any of the examples, just put the CD's boost_1_32_0/ directory into your compiler's #include path.

The libraries we present in this book go to great lengths to hide the problems of less-than-perfect compilers, so it's unlikely that you'll have trouble with the examples we present here. That said, we divide C++ compilers roughly into three categories.

  1. Those with mostly conforming template implementations. On these compilers, the examples and libraries "just work." Almost anything released since 2001, and a few compilers released before then, fall into this category.

  2. Those that can be made to work, but require some workarounds in user code.

  3. Those that are too broken to use effectively for template metaprogramming.

Appendix D lists the compilers that are known to fall into each of these categories. For those in category B, Appendix D refers to a list of portability idioms. These idioms have been applied to the copies of the book's examples that appear on the accompanying CD, but to avoid distracting the majority of readers they don't appear in the main text.

The CD also contains a portability table with a detailed report of how various compilers are doing with our examples. GCC is available free for most platforms, and recent versions have no problems handling the code we present here.

Even if you have a relatively modern compiler from category A, it might be a good idea to grab a copy of GCC with which to cross-check your code. Often the easiest way to decipher an inscrutable error message is to see what some other compiler has to say about your program. If you find yourself struggling with error messages as you try to do the exercises, you might want to skip ahead and read the first two sections of Chapter 8, which discusses how to read and manage diagnostics.

And now, on to C++ Template Metaprogramming!

    Team LiB
    Previous Section Next Section