Re: Storing a lambda alongside type-erased data

2022-09-08 Thread apz28 via Digitalmars-d-learn
On Thursday, 8 September 2022 at 15:02:13 UTC, Paul Backus wrote: On Thursday, 8 September 2022 at 03:18:08 UTC, Ali Çehreli wrote: I looked at how std.variant.VariantN prints the correct type and failed to understand the magic there. :( Then I came up with storing a lambda that is created

Re: Storing a lambda alongside type-erased data

2022-09-08 Thread Ali Çehreli via Digitalmars-d-learn
On 9/8/22 08:02, Paul Backus wrote: > This is actually pretty much exactly what VariantN does Great information, thanks! I am slowly getting up there. :) Ali

Re: Storing a lambda alongside type-erased data

2022-09-08 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 8 September 2022 at 03:18:08 UTC, Ali Çehreli wrote: I looked at how std.variant.VariantN prints the correct type and failed to understand the magic there. :( Then I came up with storing a lambda that is created when the exact type is known. The following simple variant can carry

Storing a lambda alongside type-erased data

2022-09-07 Thread Ali Çehreli via Digitalmars-d-learn
I am sure nothing is new here and I may have thought of this before but it was a revelation today. :) I've been trying to come up with a way of storing arbitrary number of objects of arbitrary types, which means I would be using a ubyte array. But then how do I use the data later without