forked from fruits-lab/vitaminc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return constant reference on query of member type
Since the `MemberType` function is a query function, it should not have to clone the type. Note that the function is no longer `noexcept` after the change. Originally, it returned the `unknown` type when the `id` was not a member of the record. However, since we cannot make up such an unknown type as a temporary object and return its reference (undefined behavior), we have to throw an exception. This is acceptable because the type checker should already ensure that the member exists, thus querying with a non-existing `id` indicates some internal errors.
- Loading branch information
Showing
4 changed files
with
13 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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