Date: Fri, 25 Nov 2022 10:29:43 +0000
Guys, seriously, can you give me an actual compileable code snippet
instead of an overly-simplistic English sentence? I have a great
imagination, I'm actually writing a stage play at the moment, but I
don't want to try imagine what you might mean in your posts here.
Please be verbose and pedantic, please give me a code snippet that
compiles so I know what you're talking about.
My imagination right now is telling me that you might mean having two
separate functions as follows:
extern void Red( wxTextCtrl * );
extern void Red( wxComboBox * );
The problem with having these two overloads is that it's not generic
enough. I want my function to work with *any* class that inherits from
both wxControl and wxTextEntry. Of course I could write a template
function but I want to have one simple concrete function.
Gergely I saw your other post in which you use "if constexpr (requires
{ p.what(); }) p.what();". I found that post helpful and I'm currently
testing code and composing my reply.
On Fri, Nov 25, 2022 at 9:53 AM Gergely Nagy <gergely.nagy.alt_at_[hidden]> wrote:
>
> 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
instead of an overly-simplistic English sentence? I have a great
imagination, I'm actually writing a stage play at the moment, but I
don't want to try imagine what you might mean in your posts here.
Please be verbose and pedantic, please give me a code snippet that
compiles so I know what you're talking about.
My imagination right now is telling me that you might mean having two
separate functions as follows:
extern void Red( wxTextCtrl * );
extern void Red( wxComboBox * );
The problem with having these two overloads is that it's not generic
enough. I want my function to work with *any* class that inherits from
both wxControl and wxTextEntry. Of course I could write a template
function but I want to have one simple concrete function.
Gergely I saw your other post in which you use "if constexpr (requires
{ p.what(); }) p.what();". I found that post helpful and I'm currently
testing code and composing my reply.
On Fri, Nov 25, 2022 at 9:53 AM Gergely Nagy <gergely.nagy.alt_at_[hidden]> wrote:
>
> 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 10:29:55