commit | d2e8ec33012a8826532cb77c697ced0c32f4da7e | [log] [tgz] |
---|---|---|
author | Aaron Green <aarongreen@google.com> | Tue Mar 19 14:14:19 2024 +0000 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Tue Mar 19 14:14:19 2024 +0000 |
tree | c8473723515173f75ef906bb7500daf3ee0b86d3 | |
parent | 2f9dd9339f474a9a94c442162ad8f522ec314f0b [diff] |
pw_allocator: Improve UniquePtr ergonomics This CL modifies a few aspects of UniquePtr. Specifically, it: * Changes the return type of ``MakeUnique<T>(...)`` to be just ``UniquePtr<T>``, with allocation failure handled by returning null. This should allow for more succinct, ergonomic code. * Modifies ``Release`` to return the pointer wrapped by a ``UniquePtr``. * Provides accessors for ``allocator`` and ``layout``, so that ``Release``d values may be ``Delete``d. Related tests and examples were added or updated. Change-Id: I4560a1a2329a844abfe4f9bbe6474148d7a9ad71 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/196181 Commit-Queue: Aaron Green <aarongreen@google.com> Reviewed-by: Taylor Cramer <cramertj@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/.