Split get_default() into two for deferred default construction and added forwarding...
authorAaryaman Sagar <aary@instagram.com>
Tue, 5 Dec 2017 18:54:55 +0000 (10:54 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 5 Dec 2017 19:05:36 +0000 (11:05 -0800)
commit5a07e203d79324b68d69f294fa38e43b9671e9b1
tree556e1d4c3259c5b28e126fc42ec80a8670075a26
parentd7629090e2c23da58ffc8977b22ccb17a25ae51c
Split get_default() into two for deferred default construction and added forwarding to speed up default element construction with rvalues

Summary:
As it stood currently folly::get_default() would unnecessarily
construct a value into the third parameter, which was unnecessary in the code
path where the element was found in the map.  Also the default value can be
forwarded to the return type in the code path where the element is not found
and an rvalue parameter is passed as the default value

Reviewed By: yfeldblum

Differential Revision: D6390315

fbshipit-source-id: ef692b827d5a36751b4eb1e12042869e8fbba2e5
folly/MapUtil.h
folly/test/MapUtilTest.cpp