]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
refactor: Use C++17-style variable templates
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 20 Oct 2024 16:23:14 +0000 (18:23 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 22 Oct 2024 16:42:55 +0000 (18:42 +0200)
src/ccache/inodecache.cpp
src/ccache/util/file.cpp

index d32c171241b573f59527e5aa5932a1a13020da1b..a4771fd8074f3f2431c7d405b5dabc0f09316537 100644 (file)
@@ -94,7 +94,7 @@ const util::Duration k_fs_space_check_valid_duration(1);
 
 static_assert(std::tuple_size<Hash::Digest>() == 20,
               "Increment version number if size of digest is changed.");
-static_assert(std::is_trivially_copyable<Hash::Digest>::value,
+static_assert(std::is_trivially_copyable_v<Hash::Digest>,
               "Digest is expected to be trivially copyable.");
 
 static_assert(
index 03f005261a3877fe95d30ae653c227f69d44b252..183d04bb1fbe9bc9d27e69c87b178eababe6e0f8 100644 (file)
@@ -318,7 +318,7 @@ tl::expected<T, std::string>
 read_file(const fs::path& path, size_t size_hint)
 {
   const int open_flags = [] {
-    if constexpr (std::is_same<T, std::string>::value) {
+    if constexpr (std::is_same_v<T, std::string>) {
       return O_RDONLY | O_TEXT;
     } else {
       return O_RDONLY | O_BINARY;
@@ -376,7 +376,7 @@ read_file(const fs::path& path, size_t size_hint)
   result.resize(pos);
 
 #ifdef _WIN32
-  if constexpr (std::is_same<T, std::string>::value) {
+  if constexpr (std::is_same_v<T, std::string>) {
     // Convert to UTF-8 if the content starts with a UTF-16 little-endian BOM.
     if (has_utf16_le_bom(result)) {
       result.erase(0, 2); // Remove BOM.