From 57476ca48b8f9475981fc6831699bd0dd78ce7ee Mon Sep 17 00:00:00 2001 From: Billy O'Neal Date: Thu, 11 Jun 2020 17:47:18 -0700 Subject: [PATCH] [vcpkg] Fix bootstrap on VS2015 (#11891) * Fix boostrap on VS2015 by removing use of C++17 constexpr lambdas. --- src/vcpkg/metrics.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/vcpkg/metrics.cpp b/src/vcpkg/metrics.cpp index d1acbed996931f..e2661d98a9efc7 100644 --- a/src/vcpkg/metrics.cpp +++ b/src/vcpkg/metrics.cpp @@ -30,6 +30,14 @@ namespace vcpkg::Metrics return ""; } + struct append_hexits { + constexpr static char hex[17] = "0123456789abcdef"; + void operator()(std::string& res, std::uint8_t bits) const { + res.push_back(hex[(bits >> 4) & 0x0F]); + res.push_back(hex[(bits >> 0) & 0x0F]); + } + }; + // note: this ignores the bits of these numbers that would be where format and variant go static std::string uuid_of_integers(uint64_t top, uint64_t bottom) { @@ -40,11 +48,7 @@ namespace vcpkg::Metrics // uuid_field_size in hex characters, not bytes constexpr size_t uuid_size = 8 + 1 + 4 + 1 + 4 + 1 + 4 + 1 + 12; - constexpr static char hex[17] = "0123456789abcdef"; - constexpr static auto write_byte = [](std::string& res, std::uint8_t bits) { - res.push_back(hex[(bits >> 4) & 0x0F]); - res.push_back(hex[(bits >> 0) & 0x0F]); - }; + constexpr static append_hexits write_byte; // set the version bits to 4 top &= 0xFFFF'FFFF'FFFF'0FFFULL;