Repository navigation
Conversation
C++23 explicit object parameters need GCC 14, but ubuntu-latest still defaults to GCC 13. The manylinux_2_28 image used for release wheels already ships GCC 14.
Allows C++23 features in the bindings. The unqualified forward_like call in the vendored visit.h becomes ambiguous with std::forward_like under C++23, so qualify it like the other call site in that file. CMake only accepts C++23 as a standard from 3.20 on, so require it.
Every borrowable type repeated the same isinstance/borrow/restore block. A recursive lambda over (type, enum) tags keeps one copy while still returning the callable's result directly, void included.
The Python module already builds as C++23 and compiles the core sources with it, so standalone builds were the only ones still on C++20. Moving the core target up lets the library itself use deducing this, std::byteswap and friends. CMake only knows cxx_std_23 from 3.20 on, so require it here too.
The platform #ifdef ladder over compiler and OS byte swap intrinsics, and the runtime htonl probe for the host byte order, are what std::byteswap and std::endian now provide portably; they also drop the POSIX-only headers from a public include. The swap8/16/24/32/64 helpers and their pointer-based forms had no users in oead and are removed; C++ callers should use std::byteswap. Checked against the old implementation on integer, float and NaN bit patterns with zero mismatches.
BitCast was a pre-C++20 stand-in for std::bit_cast and went through std::aligned_storage, which C++23 deprecates. The standard version is also constexpr. C++ callers of util::BitCast should switch to std::bit_cast.
The two overloads had identical bodies. With deducing this one definition serves both; std::forward_like keeps the boxed alternatives const for a const Variant, since dereferencing a const unique_ptr would otherwise yield a mutable reference.
Each of GetHash, GetArray, GetString and GetBinary had a const and a non-const overload defined out of line, all forwarding to Get. A single inline member per getter now covers both. Being templates, they can no longer be named as member function pointers (py::overload_cast, static_cast to a pointer type), so get_string is bound through a lambda.
Each pair had identical bodies. One deducing-this member per accessor keeps the result's constness tied to the object, as Variant::Get does, and still accepts rvalues. Like the container getters, they can no longer be named as member function pointers.
The two overloads differed only in whether the result referred to a const value. Deducing this picks that from the object, so a const Byml still yields Reference<const T>. The template parameter no longer shadows the Type enum.
std::to_underlying states the intent of these enum-to-integer conversions directly and can't drift from the enum's actual underlying type the way a spelled-out cast can.
The standard member does the same single-character search without pulling in absl/strings/match.h, which yaml.cpp no longer needs.
ExtractBit(s), RotateLeft/Right, IsValidLowMask, SetBit, BitSize and BitCastToArray/FromArray came over from Dolphin with this header but nothing in oead uses them, and std::rotl/std::rotr and std::bit_cast now cover what they offered.
Nothing in oead calls them; std::ranges::contains now covers Contains, and keeping a const_cast helper around only invites misuse.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Not sure what compiler support is like, let's see.
This change is