Skip to content

Updated to C++23 with some minor refactoring and documentation#22

Open
Ataba29 wants to merge 12 commits into
mainfrom
V23
Open

Updated to C++23 with some minor refactoring and documentation#22
Ataba29 wants to merge 12 commits into
mainfrom
V23

Conversation

@Ataba29

@Ataba29 Ataba29 commented Jul 22, 2026

Copy link
Copy Markdown
Owner

This PR begins the C++23 refactor of ByteForge, starting with the networking and startup layer. main.cpp's server-accept thread now uses std::jthread instead of std::thread, removing the need for a manual .join() call since it joins automatically on destruction. Server::start() now returns std::expected<void, std::string> instead of throwing std::runtime_error on bind/listen failure, giving main.cpp explicit control over the failure message and exit path rather than relying on an unhandled exception. Server's connections and busySockets members were converted from std::unordered_map/std::unordered_set to std::flat_map/std::flat_set, trading hash-bucket lookups for cache-friendlier contiguous storage, which suits their typically small size. A [[assume(bytesReceived > 0)]] hint was also added in messageHandler immediately after the two early-return branches that already rule out zero and negative values, letting the compiler skip re-deriving that invariant.

Related to #19

@Ataba29 Ataba29 added documentation Improvements or additions to documentation Refactoring Going over the code and making minor changes that lead to readability imporvements labels Jul 22, 2026
@Ataba29
Ataba29 requested a review from razimograbi July 22, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation Refactoring Going over the code and making minor changes that lead to readability imporvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant