diff options
author | Wyatt Hepler <hepler@google.com> | 2023-02-07 17:51:48 +0000 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-02-07 17:51:48 +0000 |
commit | 9db19499252beb8fc865343e65e57c7117ef0b2f (patch) | |
tree | 02699f63a733ce629c13af16a40e580138b184bf /pw_protobuf | |
parent | 038bd9501a05adcc8e1a79c1233947200455f915 (diff) | |
download | pigweed-9db19499252beb8fc865343e65e57c7117ef0b2f.tar.gz |
pw_protobuf: Avoid CTAD on const container with non-const elements
Specify the span template argument instead of relying on class template
argument deduction (CTAD) for a temporary array with non-const elements.
std::span CTAD does not work in this scenario, though there is a
deduction guide for const std::array<T, N>&. Having GetDoubleArray()
return const std::array also would fix this.
Change-Id: Ie1b622ddb4f4244dae82c1b6ea15275468118c4a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/128312
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Diffstat (limited to 'pw_protobuf')
-rw-r--r-- | pw_protobuf/size_report/proto_bloat.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pw_protobuf/size_report/proto_bloat.cc b/pw_protobuf/size_report/proto_bloat.cc index 542653d15..9d5884422 100644 --- a/pw_protobuf/size_report/proto_bloat.cc +++ b/pw_protobuf/size_report/proto_bloat.cc @@ -200,7 +200,7 @@ void CodeToPullInProtoEncoder() { child.WritePackedBool(8, GetBoolArray()); child.WriteRepeatedBool(8, GetBoolVector()); - encoder.WriteBytes(93, as_bytes(span(GetDoubleArray()))); + encoder.WriteBytes(93, as_bytes(span<const double>(GetDoubleArray()))); encoder.WriteString(21343, kTestString); } |