aboutsummaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-01-12 15:30:38 +0800
committerfanquake <fanquake@gmail.com>2021-01-12 15:56:19 +0800
commit7838db141b76fa72fcb9c3a3081859f9db102039 (patch)
tree37687d54c2e964c2b64f6a35a85a9833828d96c0 /ci
parent6af013792f1bf85824803fc5283bf0d68a8fd080 (diff)
parent3eb94ec81b72b14f72a1f6ce5c9aa24476df755a (diff)
Merge #20495: sync: Use decltype(auto) return type for WITH_LOCK
3eb94ec81b72b14f72a1f6ce5c9aa24476df755a sync: Use decltype(auto) return type for WITH_LOCK (Carl Dong) Pull request description: > Now that we're using C++17, we can use the decltype(auto) return type > for functions and lambda expressions. > > As demonstrated in this commit, this can simplify cases where previously > the compiler failed to deduce the correct return type. > > Just for reference, for the "assign to ref" cases fixed here, there are > 3 possible solutions: > > - Return a pointer and immediately deref as used before this commit > - Make sure the function/lambda returns declspec(auto) as used after > this commit > - Class& i = WITH_LOCK(..., return std::ref(...)); > > ----- > > References: > 1. https://en.cppreference.com/w/cpp/language/function#Return_type_deduction > 2. https://en.cppreference.com/w/cpp/language/template_argument_deduction#Other_contexts > 3. https://en.cppreference.com/w/cpp/language/auto > 4. https://en.cppreference.com/w/cpp/language/decltype > > Explanations: > 1. https://stackoverflow.com/a/21369192 > 2. https://stackoverflow.com/a/21369170 Thanks to sipa and ryanofsky for helping me understand this ACKs for top commit: jnewbery: utACK 3eb94ec81b72b14f72a1f6ce5c9aa24476df755a hebasto: ACK 3eb94ec81b72b14f72a1f6ce5c9aa24476df755a, I have reviewed the code and it looks OK, I agree it can be merged. I have verified possible warnings: ryanofsky: Code review ACK 3eb94ec81b72b14f72a1f6ce5c9aa24476df755a Tree-SHA512: 5f55c7722aeca8ea70e5c1a8db93e93ba0e356e8967e7f607ada38003df4b153d73c29bd2cea8d7ec1344720d37d857ea7dbfd2a88da1d92e0e9cbb9abd287df
Diffstat (limited to 'ci')
0 files changed, 0 insertions, 0 deletions