Date: Fri, 9 Apr 2021 15:26:01 +0300
Matus Chochlik wrote:
> Hi,
>
> IIUC the current plan is to use `string` and `vector<meta::info>` in the
> reflection API (both of which require consteval dynamic allocation). Is this
> correct and if so, was there some reason for not using `string_view` and
> `span<meta::info>` instead? The returned metadata is always static, so
> mutable containers look like overkill.
I would go even further and argue in favor of returning char const*. You
can construct a string_view from that but not vice versa.
vector<info> can't be replaced with span<info> though because it's
often built dynamically (e.g. if the contents are filtered with a predicate.)
> Hi,
>
> IIUC the current plan is to use `string` and `vector<meta::info>` in the
> reflection API (both of which require consteval dynamic allocation). Is this
> correct and if so, was there some reason for not using `string_view` and
> `span<meta::info>` instead? The returned metadata is always static, so
> mutable containers look like overkill.
I would go even further and argue in favor of returning char const*. You
can construct a string_view from that but not vice versa.
vector<info> can't be replaced with span<info> though because it's
often built dynamically (e.g. if the contents are filtered with a predicate.)
Received on 2021-04-09 07:26:04