Skip to content

mir::Synchronised: propagate noexcept to the construtor when possible#4925

Open
RAOF wants to merge 1 commit into
mainfrom
tiny-synchronised-improvement
Open

mir::Synchronised: propagate noexcept to the construtor when possible#4925
RAOF wants to merge 1 commit into
mainfrom
tiny-synchronised-improvement

Conversation

@RAOF
Copy link
Copy Markdown
Contributor

@RAOF RAOF commented May 4, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 4, 2026 08:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates mir::Synchronised<T> to conditionally mark its rvalue-initializing constructor noexcept when the contained T can be constructed without throwing, improving exception guarantees for callers and enabling better optimizations in generic code.

Changes:

  • Add <type_traits> to support compile-time noexcept conditions.
  • Make Synchronised(T&&) conditionally noexcept(...) based on T’s construction traits.

Comment thread include/core/mir/synchronised.h
public:
Synchronised() = default;
Synchronised(T&& initial_value)
Synchronised(T&& initial_value) noexcept(std::is_nothrow_move_constructible_v<T>)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect; std::is_nothrow_move_constructible_v<T> is documented to be the equivalent of std::is_nothrow_constructible_v<T, T&&> (or, rather, std::add_rvalue_reference<T>) anyway.

@RAOF RAOF force-pushed the tiny-synchronised-improvement branch from 8f58a45 to 0bd05f1 Compare May 4, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants