Copy from Boost repo.