Date: Thu, 5 Jan 2023 01:00:56 +0200
On Thu, 5 Jan 2023 at 00:37, Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> On Wed, Jan 4, 2023 at 10:04 PM Andrey Semashev via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> > Even if you never call the
> > operator<< in your program that uses std::any, the compiler still has to
> > generate the implementation for it - for every type that you ever store
> > in std::any. Eventually this makes std::any too expensive to use for
> > more and more people.
>
>
> If none of the source files in your project have:
>
> #include <any_ostream>
>
> then your program will never have the extra classes and functions I wrote.
My source files will have
import std;
in them.
> And even if you _do_ include my header file and never use anything in
> it, your compiler will eradicate unreachable code.
Make the stream inserter a function template constrained with
same_as<std::any> and that problem goes away.
It's completely unnecessary to use the anyer_success throwing
technique to do this.
You're also reinventing QVariant, bringing in some of its downsides.
Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> On Wed, Jan 4, 2023 at 10:04 PM Andrey Semashev via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> > Even if you never call the
> > operator<< in your program that uses std::any, the compiler still has to
> > generate the implementation for it - for every type that you ever store
> > in std::any. Eventually this makes std::any too expensive to use for
> > more and more people.
>
>
> If none of the source files in your project have:
>
> #include <any_ostream>
>
> then your program will never have the extra classes and functions I wrote.
My source files will have
import std;
in them.
> And even if you _do_ include my header file and never use anything in
> it, your compiler will eradicate unreachable code.
Make the stream inserter a function template constrained with
same_as<std::any> and that problem goes away.
It's completely unnecessary to use the anyer_success throwing
technique to do this.
You're also reinventing QVariant, bringing in some of its downsides.
Received on 2023-01-04 23:01:09