[committed] libstdc++: Fix uses of non-reserved names in headers

2023-02-16 Thread Maciej Cencora via Gcc-patches
Hi,

instead of uglyfing all the libstdc++ code wouldn't it be simpler to
just ignore all non-reserved macro expansions (+ some special ones
like assert) inside system headers on compiler level?

Regards,
Maciej


[PATCH] tree: Fix up tree_code_{length,type}

2023-01-27 Thread Maciej Cencora via Gcc-patches
Hi,

you can emulate C++17 inline variables in C++11 with either of the two ways:

1) via a template helper
template 
struct Helper
{
static constexpr unsigned value[4] = {1, 2, 3, 4};
};

template 
constexpr unsigned Helper::value[4];

static constexpr auto& arr = Helper<>::value;

2) extern constexpr + weak attribute
[[gnu::weak]] extern constexpr unsigned arr[] = {1, 2, 3, 4};

Regards,
Maciej


Re: [committed] libstdc++: Simplify variant access functions

2021-10-15 Thread Maciej Cencora via Gcc-patches
Hi,

variant getter can be implemented in C++17 without using "recursive"
calls, but by generating a list of member pointers and applying them
with fold expression. Here's an example:

https://godbolt.org/z/3vcKjWjPG

Regards,
Maciej