Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace macro PRO_DEF_WEAK_DISPATCH with class template weak_dispatch #224

Merged
merged 6 commits into from
Dec 26, 2024

Conversation

mingxwa
Copy link
Collaborator

@mingxwa mingxwa commented Dec 25, 2024

This change replaced macro PRO_DEF_WEAK_DISPATCH with class template weak_dispatch<D>. Specifically,

  • Added a new exception type not_implemented, inspired by NotImplementedException in .NET. However, not_implemented is not derived from std::logic_error or std::runtime_error due to freestanding limitations.
  • weak_dispatch<D> will add a default implementation to an existing dispatch type D. The default implementation simply throws not_implemented.
  • Updated unit tests accordingly.
  • Added [[deprecated]] attribute to types defined with PRO_DEF_WEAK_DISPATCH.
  • Added error message to bad_proxy_cast.
  • Documentation and sample code will be updated later.

Note that the return type of weak_dispatch's default implementation is details::wildcard, which can syntactically be convertible to any type, while it will never be constructed.

@mingxwa mingxwa requested review from tian-lt and guominrui December 25, 2024 10:00
@mingxwa mingxwa merged commit 1f2037f into microsoft:main Dec 26, 2024
7 checks passed
@mingxwa mingxwa deleted the user/mingxwa/weak-dispatch branch December 26, 2024 09:32
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