ABSL_ATTRIBUTE_LIFETIME_BOUND

447 views
Skip to first unread message

Dana Jansens

unread,
Jul 28, 2021, 11:52:15 AM7/28/21
to cxx
Hello,

I'd like to allow use of ABSL_ATTRIBUTE_LIFETIME_BOUND in Chromium. It is a simple wrapper around the clang lifetimebound attribute, which is inspired by WG21 P0936R0.

I would propose to use it for objects that receive a reference in the constructor and store it as a member, such as base::span. The absl wrapper provides a nice way to use the attribute only if present, without writing our own version in base.

Cheers,
Dana

Peter Kasting

unread,
Jul 28, 2021, 12:01:38 PM7/28/21
to Dana Jansens, cxx
SGTM

PK

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAHtyhaSdZbXVyM69m2Zt451VQZ1eN-L19JuKq6GxWKWSNShvtg%40mail.gmail.com.

Jeremy Roman

unread,
Jul 28, 2021, 12:49:30 PM7/28/21
to Peter Kasting, Dana Jansens, cxx

Dana Jansens

unread,
Jul 28, 2021, 1:31:19 PM7/28/21
to Jeremy Roman, Peter Kasting, cxx
I am second guessing this at the moment. There seems to be very little the attribute actually catches. Unless I am holding it wrong. Would anyone know if I am?

Dana Jansens

unread,
Jul 28, 2021, 1:39:54 PM7/28/21
to Jeremy Roman, Peter Kasting, cxx
Followup from an offline chat, it appears to work only for a single expression at the moment, iow only for temporaries.
Reply all
Reply to author
Forward
0 new messages