Skip to content

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

Closed
Ataba29 wants to merge 13 commits into
mainfrom
V23
Closed

Updated to C++23 with some minor refactoring and documentation#22
Ataba29 wants to merge 13 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
@Ataba29
Ataba29 marked this pull request as draft August 1, 2026 15:03
@Ataba29

Ataba29 commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

This will take a while to work on and fix, the changes in this PR are not worth the effort imo

@Ataba29 Ataba29 closed this Aug 2, 2026
@Ataba29
Ataba29 deleted the V23 branch August 2, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant