-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use dynamic cast on reference when should not fail
There is a common pattern in our code where we dynamically cast a pointer and assert that it is not null. This pattern implies that the cast should not fail. Therefore, we can use the reference version of dynamic casting, which throws a `std::bad_cast` exception if the cast fails. Additionally, we are using dynamic casting with unique pointers, which requires a manual `get()` to obtain the underlying pointer. Since `get()` should only be used when necessary, this change also eliminates its use.
- Loading branch information
Showing
4 changed files
with
61 additions
and
79 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