From afc5ba002da663124f4c85f66d5239bea6f6cab9 Mon Sep 17 00:00:00 2001 From: SJkar Date: Sat, 20 Dec 2025 20:59:32 +0700 Subject: [PATCH] Fix set_stream to use unsigned integer for inc_; Workaround for Windows SDK header conflicts in pcg-cpp The build was failing on Windows (MSVC) with error C2678 due to ambiguous 'operator|' calls. Root cause: Windows SDK headers (winuser.h, winnt.h, etc.) define multiple operator| overloads for various enums. When using a literal integer '1' with pcg_extras types, the compiler cannot distinguish between PCG's custom operators and Windows' enum operators. Solution: Explicitly cast the literal to 'itype' to resolve the ambiguity. This ensures the compiler selects the correct operator defined in pcg-cpp while maintaining full cross-platform compatibility for Linux and macOS. --- include/pcg_random.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pcg_random.hpp b/include/pcg_random.hpp index d479a81..341c865 100644 --- a/include/pcg_random.hpp +++ b/include/pcg_random.hpp @@ -333,7 +333,7 @@ class specific_stream { void set_stream(itype specific_seq) { - inc_ = (specific_seq << 1) | 1; + inc_ = (specific_seq << 1) | itype(1U); } static constexpr bool can_specify_stream = true;