C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Chimeric Pointer

From: Gergely Nagy <gergely.nagy.alt_at_[hidden]>
Date: Fri, 25 Nov 2022 10:53:42 +0100
However I do not understand why simple overload is not good enough.

On Fri, Nov 25, 2022, 10:52 Frederick Virchanza Gotham via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Fri, Nov 25, 2022 at 6:15 AM Sebastian Wittmeier
> <wittmeier_at_[hidden]> wrote:
> >
> > Hi Frederick,
> >
> > as I understand your paper a Chimeric Pointer is a pointer to a class
> inheriting from all
> > the listed base classes and supporting the -> operator for members of
> those base
> > classes without additional cast
>
>
> Yeah that's right. The chimeric pointer may be bigger than
> "sizeof(void*)" in cases of virtual inheritance.
>
>
> > What would be the advantages and disadvantages of a concept with those
> properties?
> > Is the main advantage that the Chimeric Pointer erases the actual type
> and the function
> > with the pointer parameter does not have to be a template?
>
>
> Please write the concept you have in mind, and I'll compare it to a
> chimeric pointer.
>
> The idea behind a chimeric pointer such as
> "chimeric_pointer<wxControl,wxTextEntry>" is that it can hold the
> address(es) of any object whose pointer can convert implicitly to a
> wxControl* and also wxTextEntry*.
>
> Template functions are an absolutely fantastic addition to the C++
> language, they have brilliant uses in particular in implementing
> containers, but sometimes I just want _one_ function. If I have three
> instantiations of a template function, then that's three unique
> functions with three unique addresses in memory, and also that's three
> different copies of any static objects defined inside the function.
> Sometimes I just want one simple function, in particular if I'm
> exporting a function from a dynamic shared library.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2022-11-25 09:53:56