fix building with boost 1.56 (fixes #4507)

boost 1.56 now uses explicit operator bool in boost::optional.