commit | 878f2906ee814b44fc314050b81bcb49fa8a0ad7 | [log] [tgz] |
---|---|---|
author | Anqi Dong <anqid@google.com> | Tue Nov 22 23:39:02 2022 +0000 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Tue Nov 22 23:39:02 2022 +0000 |
tree | bab7be367ababee4a3aa0597a1871848adf01b83 | |
parent | f0ea55a197a61f40ef9c774e4dd0ea06a222f0a0 [diff] |
pw_containers: Make Pair in FlatMap support CTAD Adding an explicit deduction guide for Pair does a few things: * Some cases are not covered by implicit deduction guides, for the same reason as for std::pair. For more information, see https://en.cppreference.com/w/cpp/utility/pair/deduction_guides * CTAD can be sketchy in some cases, and so some projects might opt to enable something like -Wctad-maybe-unsupported. Adding an explicit deduction guide is a signal to the compiler that the type is "opting in" to CTAD. Unfortunately, the aggregate initialization with no types does not work in all circumstances (for example, it can be tricky to get all the deductions to line up when using std::apply and a lambda), and the CTAD option exists as a less verbose option than one where the template parameters _also_ need to be stated explicitly. Note that the Google style guide doesn't love CTAD in general: https://google.github.io/styleguide/cppguide.html#CTAD (Note: CTAD = class template argument deduction) Change-Id: Ib4555e8d3655f2a91e8c487641df1b973453723e Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/120731 Reviewed-by: Wyatt Hepler <hepler@google.com> Commit-Queue: Anqi Dong <anqid@google.com>
Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.
For more information please see our website: https://pigweed.dev/.