C++ Logo

sg7

Advanced search

Re: Request for supporting and enumerating user-defined attributes

From: Peter Dimov <pdimov_at_[hidden]>
Date: Mon, 16 Oct 2023 13:24:03 +0300
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:24:10