-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Allow passing a ptr into `folly::get_ptr(map, key)`. There is some code that looks like: ``` auto foo(const MyMap* map) { if (map != nullptr && map.contains(k)) { auto& v = map.at(k); // do stuff with v } } ``` That can now be re-written as: ``` auto foo(const MyMap* map) { if (const auto* vPtr = folly::get_ptr(map, k)) { auto& v = *vPtr; // do stuff with v } } ``` Reviewed By: yfeldblum Differential Revision: D64054668 fbshipit-source-id: 7ef52d5f4ef751ad796ba4a950b8358e14c7d0c7
- Loading branch information
1 parent
02547bf
commit ec7513e
Showing
2 changed files
with
51 additions
and
5 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