backport https://svn.boost.org/trac/boost/changeset/80820 from boost trunk