Boostcon 2011

From Just in Time

This page will contain my notes taken during Boostcon 2011

Library in a Week

Review tools

  • Code Collaborator
  • Crucible (Crubicle?)

Notes of my 'homework' assignment are here


Radix sort, does not use comparison. Faster if compare takes a relatively long time (e.g. string). Has three functions (integer_sort, float_sort, string_sort) and three overloads for each.


Intended to be a collection of algorithms, so that review of new algorithms can be much lighter.


Chris Kohlhoff

fundamental concepts that went into the library. Use them in your programs.

One key criterium: should not be a framework, but a toolkit. This gives you more freedom.

"your channel into the operationg system"

Challenges of asynchronous programming:

  • Object lifetimes
  • Thinking asynchronously
  • Threads
  • ?

Object lifetimes

handlers and buffers are taken by value, a copy is made. Buffers are shallow.

Arguments taken by non-const reference: caller needs to guarantee lifetime. this-pointer should outlive operation. Newby problem: providing a buffer that goes out of scope (local variable for instance).

Use shared_ptr and shared_from_this to automatically manage object lifetime.

Thinking Asynchronously


if (socket.connected())


  • First: single threaded
  • Use other thread to handle long running task. Uset post to give the result back to the main thread. Take care to tell the service that there is still work pending while the background thread is working. use 'asio::ioservice::work.
  • multiple io_services. Tip: If you want to make handlers wait for some event triggered by another async op, use a timer that will never expire.
  • one io_service, multiple threads. Use strands.

"Difficulty with reactor pattern is that it is hard to create [higher order abstractions] based on it"

Manage Complexity


  • Pass the buck
    • create composed operations
  • the buck stops here

"Pass the buck" refers to passing the responsibility for the lifetime of objects to the caller in a similar way that the asio-function do this.

Phoenix V3

Hartmuth Kaiser


Function calls can be either done through <terminal>() or just writing a function that uses make_expr to return a proto expression(-tree). The latter has much better performance (as learned from spirit).

Creating derivative of an analytical function.

Transactional Language Constructs for C++

Transactional Memory. Bridge Boost and C++ TM Spec.

  • tutorial
  • solicit feedback

Transactions can be composed.

"relaxed transactions" like a global lock, but actually obtaining a lock could be deferred to when the irreversible action is performed?

"discussion ensues"


In case of compiler error: search for '***' in the output. go to the associated header file and there will probably be a useful comment there that explains what the problem is.

'%=' is not needed if the RHS does not contain semantic actions.

Gotcha: phoenix comma operator needs #iclude of 'sequence.hpp' to work, otherwise you get the regular comma, which silently fails.

Haskell and C++ Template Metaprogramming

Introduction to haskell

"a-> b" is a type and it means "function that takes an argument of type a and returns a value of type b" fact :: (Num t) => t-> t "if t is of Num type then fact is of type t -> t"

Operator overloading is possible, but, for instance the * operator can only be performed on types that are of 'class' Num

instead of returning a value, receive an extra (function-) argument that represents the rest (continuation) of the calculation.

Haskell Monads

"Proto is like a state monad"

Threads and Shared Variables in C++0x

Synchronization primitives normally include some memory fence.

DRF = Data Race Free SC = Sequentially Consistent

Skoot network library

  • Insulate application from asynchronous design and coding details.
  • App provides all threading, no threads in Skoot