C++ Logo

std-proposals

Advanced search

Re: [std-proposals] cout << any

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Wed, 4 Jan 2023 22:37:43 +0000
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.

And even if you _do_ include my header file and never use anything in
it, your compiler will eradicate unreachable code.

I don't know why you think std::any has to become any more complicated
or less efficient.

Received on 2023-01-04 22:37:55