Fix incompatibility with Boost 1.56

The fix is based on the proposal of @McDamon. Closes #864.