C++ Logo

sg7

Advanced search

Re: Request for supporting and enumerating user-defined attributes

From: Jeremy Ong <jeremycong_at_[hidden]>
Date: Mon, 16 Oct 2023 04:25:28 -0600
That would be fabulous IMO!

2023년 10월 16일 (월) 오전 4:24, Peter Dimov <pdimov_at_[hidden]>님이 작성:

> Jeremy Ong wrote:
> > Thinking outloud, as an example, we might declare:
> >
> > template <bool>
> > class Serializable {};
> >
> > And later use this class as a decorator like so:
> >
> > struct Foo
> > {
> > @Serializable<true>
> > int data;
> > }:
>
> We can do this, but it isn't necessary. @type is not
> substantially easier to implement than @expr, so we
> can just do
>
> struct serializable
> {
> bool value;
> };
>
> struct Foo
> {
> @serializable(true)
> int data;
> };
>
> instead.
>
>
>

Received on 2023-10-16 10:25:41