From bb579072077153fabfa74acec852bce222265357 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Wed, 10 Jul 2019 17:39:04 -0700 Subject: make it compile on macos under g++6 --- toolsrc/include/vcpkg/base/strings.h | 6 ++++-- toolsrc/include/vcpkg/base/work_queue.h | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h index 82145b826..9890bedbc 100644 --- a/toolsrc/include/vcpkg/base/strings.h +++ b/toolsrc/include/vcpkg/base/strings.h @@ -191,7 +191,8 @@ namespace vcpkg::Strings template std::string b64url_encode(Integral x) { static_assert(std::is_integral::value, "b64url_encode must take an integer type"); - auto value = static_cast>(x); + using Unsigned = std::make_unsigned_t; + auto value = static_cast(x); // 64 values, plus the implicit \0 constexpr static char map[0x41] = @@ -202,8 +203,8 @@ namespace vcpkg::Strings /*3*/ "wxyz0123456789-_" ; - constexpr static std::make_unsigned_t mask = 0x3F; constexpr static int shift = 5; + constexpr static auto mask = (static_cast(1) << shift) - 1; std::string result; // reserve ceiling(number of bits / 3) @@ -212,6 +213,7 @@ namespace vcpkg::Strings while (value != 0) { char mapped_value = map[value & mask]; result.push_back(mapped_value); + value >>= shift; } return result; diff --git a/toolsrc/include/vcpkg/base/work_queue.h b/toolsrc/include/vcpkg/base/work_queue.h index 71e00a2ab..8a3d27538 100644 --- a/toolsrc/include/vcpkg/base/work_queue.h +++ b/toolsrc/include/vcpkg/base/work_queue.h @@ -103,7 +103,7 @@ namespace vcpkg { m_actions.reserve(m_actions.size() + (last - first)); - std::move(first, last, std::back_insert_iterator(rng)); + std::move(first, last, std::back_inserter(rng)); } m_cv.notify_all(); @@ -122,7 +122,7 @@ namespace vcpkg { m_actions.reserve(m_actions.size() + (last - first)); - std::copy(first, last, std::back_insert_iterator(rng)); + std::copy(first, last, std::back_inserter(rng)); } m_cv.notify_all(); -- cgit v1.2.3