C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::chimeric_ptr -- it's alive... it's ALIVE!

From: Jeremy Rifkin <jeremy_at_[hidden]>
Date: Sat, 22 Nov 2025 14:11:49 -0500
> https://www.youtube.com/watch?v=QuoKNZjr8_U

I don’t think C++ needs any more Frankenstinian contraptions.

Jeremy

On Fri, Nov 21, 2025 at 13:05 Frederick Virchanza Gotham via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> https://www.youtube.com/watch?v=QuoKNZjr8_U
>
>
> WARNING: This post is exceedingly cool, and so if you're winding down
> for the evening or due to take a nap, or if you have been advised by
> your doctor to avoid intense mental stimulation, then postpone reading
> to another time.
>
> As an ode to my twin I absorbed in the womb, I shared my idea of a
> "chimeric pointer" three years ago on this mailing list:
>
> https://lists.isocpp.org/std-proposals/2022/11/5033.php
>
> Here is the paper I shared at the time:
>
> https://www.virjacode.com/papers/chimeric_pointer3.pdf
>
> Soon afterward, Arthur O'Dwyer then went on to write a blog post about it:
>
> https://quuxplusone.github.io/blog/2022/12/01/chimeric-ptr/
>
> Now . . . three years on . . . I pay homage to my absorbed twin . . .
> I've written 'std::chimeric_ptr' into the GNU g++ compiler. Here's my
> compiler patch:
>
> https://github.com/healytpk/gcc-thomas-healy/commit/tag_chimeric_ptr
>
> Specifically here's what it does:
>
> When you apply the operator -> to an object of type
> 'chimeric_ptr', followed by the name of a member, a search is
> performed through all of the Base classes in order to find the member
> (i.e. you don't need to specifically identify the correct Base class).
>
> Here it is tested and working up on GodBolt:
>
> https://godbolt.org/z/vdf5Gz871
>
> This is the coolest new feature since C++11, I think I can argue.
> There's a few cool things that have been added in C++14, C++17, C++20,
> C++23 and the upcoming C++26, but 'std::chimeric_ptr' might be the
> cream. Possibly.
>
> And here's the GodBolt copy-pasted:
>
> #include <cstdio> // puts
> #include <memory> // chimeric_ptr
> using std::puts;
>
> struct Widget {
> virtual ~Widget(void) noexcept = default;
> };
>
> struct Text : virtual Widget {
> virtual void set_text(void) noexcept = 0;
> };
>
> struct Colorful : virtual Widget {
> virtual void set_color(void) noexcept = 0;
> };
>
> struct Placard : Colorful, Text {
> void set_color(void) noexcept override { puts("Placard SetColor"); }
> void set_text (void) noexcept override { puts("Placard SetText" ); }
> };
>
> struct Billboard : Text, Colorful {
> void set_color(void) noexcept override { puts("Billboard SetColor"); }
> void set_text (void) noexcept override { puts("Billboard SetText" ); }
> };
>
> void set_text_and_color( std::chimeric_ptr<Colorful,Text> p )
> {
> p->set_color();
> p->set_text ();
> }
>
> int main(void)
> {
> Placard placard;
> set_text_and_color(&placard);
> }
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2025-11-22 19:12:05