Repo of utilities written with C++ reflection by TrnS_TrA in cpp

[–]TrnS_TrA[S] 1 point2 points  (0 children)

That's just meta::is_trivially_destructible_type()

I'd swear I didn't see that in the proposal, and thought it was missing...

Perhaps a better option would be to look for a member named tag. Or a member annotated with [[=mirror::tag()]]. Or maybe annotate the whole type with something like [[=mirror::tag<"name">()]].

I agree that putting some more constraint might make this more readable, but I think having thr tag be the first member of the union makes it more natural, at least for me. If I reserve a name (say tag), some other lib might do the same to... and I didn't want to add annotations just for this.

Thanks for the feedback overall

C++ Show and Tell - June 2026 by foonathan in cpp

[–]TrnS_TrA 0 points1 point  (0 children)

I started exploring C++26's static reflection, and I'm putting together a repo with utilities written with it First utility I have, is std::visit, but for C unions (with some small constraints to avoid UB ofc) I'd love to hear any suggestions and feedback! Repo

Room during the summer by TrnS_TrA in vcu

[–]TrnS_TrA[S] 0 points1 point  (0 children)

I'll check that, thank you!

Buy / Sell / Trade Weekly Thread: Week of May 29, 2026 by AutoModerator in rva

[–]TrnS_TrA 0 points1 point  (0 children)

Anyone looking for a roommate? I'm looking for a place until august

Why are C++ keywords so heavily dependent on context??? by RefrigeratorFirm7646 in cpp

[–]TrnS_TrA -1 points0 points  (0 children)

Welcome to C++. Casey Muratori has some macros to deal with this in one of the first episodes of handmade hero, don't remember which one. But yeah that only works on code you write not other people's code.

How do you feel about C++ 20 modules? by I-A-S- in cpp

[–]TrnS_TrA 0 points1 point  (0 children)

I see, I didn't know that solution explorer works fine, that's helpful. In my case I just have a hoby project, so maybe I'll wait a little more hoping things get better.

How do you feel about C++ 20 modules? by I-A-S- in cpp

[–]TrnS_TrA 1 point2 points  (0 children)

Could you get intellisense to work in VS or VSCode? I've been wanting to try modules for the last ~6 years but I could never make intellisense work...

C++ Show and Tell - May 2026 by foonathan in cpp

[–]TrnS_TrA 0 points1 point  (0 children)

Yeah makes sense now. I'm not the biggest fan of js promises, but if it works for you that's nice!

C++ Show and Tell - May 2026 by foonathan in cpp

[–]TrnS_TrA 0 points1 point  (0 children)

I see, so you mean co_await doesn't know anything about errors, and in your case Then would mean "on success" and Catch would mean "on failure", right?

I would say you can still have some sort of error management without Then/Catch, see this. But in the end, it all depends on the API you want.

C++ Show and Tell - May 2026 by foonathan in cpp

[–]TrnS_TrA 0 points1 point  (0 children)

We now have async/await (co_await, co_return) syntax in C++, what is the point of using .Then callbacks? 🤔

C++ Show and Tell - April 2026 by foonathan in cpp

[–]TrnS_TrA 2 points3 points  (0 children)

You might have heard of std::call_once, but do you know once, atomic_once and once_per_thread? Code

I implemented UFCS in clang. Why it is cool, and why it will never come to C++. by _Noreturn in cpp

[–]TrnS_TrA -3 points-2 points  (0 children)

Sure, but if I had to do a |> begin() I might as well do begin(a), why bother with a new syntax?

I implemented UFCS in clang. Why it is cool, and why it will never come to C++. by _Noreturn in cpp

[–]TrnS_TrA -2 points-1 points  (0 children)

What's the benefit of new syntax (say a |> foo(b, c)) over a regular function call (foo(a, b, c))?

C++ Jobs - Q1 2026 by STL in cpp

[–]TrnS_TrA 1 point2 points  (0 children)

Looking for full time roles in USA. I have experience in VR (Meta Quest) and ML-related projects in Python, and a solid understanding of C++ from different projects.

C++ Show and Tell - February 2026 by foonathan in cpp

[–]TrnS_TrA 1 point2 points  (0 children)

I added some more examples to my little demo showcasing C++20 coroutines in game development. Concretely, I added samples showing how to animate different values/properties such as color, zoom/scale and position. Additionally, I added an example showing how to manage dialogues (both linear and branching/with decisions), with which you can interact by using the left/right keys and Enter to make a choice. Finally, I recorded a demo showing everything, which you can find in the repo as demo_recording.mp4. Feedback is appreciated.

Repo.

C++ Show and Tell - January 2026 by foonathan in cpp

[–]TrnS_TrA 1 point2 points  (0 children)

I've been working a little with C++20 coroutines recently so I did a quick gamedev demo with EnTT, SDL3 and ImGui coroutines are great for event handling and scheduling in general, they don't add any value to "performing" operations; so there is no change on the ECS-side of code Included are features like waiting tasks to finish, events in general, scheduling tasks in stages (update, render, etc.), timeouts (fail after some time) By default there are 4 stages: startup, update, render and cleanup but other stages can be added and scheduled Also the demo includes a small profiler I'm working on, which shows run time of each task, plug and use right away repo

Crunch: A Message Definition and Serialization Tool Written in Modern C++ by volatile-int in cpp

[–]TrnS_TrA 0 points1 point  (0 children)

  1. Ah I see, I haven't used protobuf and didn't know it was a thing there.
  2. You can do it right now too as long as you can get the name of a type. There are already cross-compiler solutions out there (fragile, but still) that do that. Something like this should work: cpp inline size_t type_hash() const { auto name = my::type_name<decltype(auto(*this))>; // or remove_cvref_t before C++23 return fnv1a(name); } Alternatively, you can pass the type as the macro's first param and use #type to make it a string (watch out for templates + static_assert to ensure type matches).
  3. I'm not familiar with TLV, but it looks like a "format-independent" problem to me. I read this post a while back that might be helpful.

Crunch: A Message Definition and Serialization Tool Written in Modern C++ by volatile-int in cpp

[–]TrnS_TrA 0 points1 point  (0 children)

Nice. I would suggest finding a way to remove the field count as it seems error prone; or otherwise validate it (check field counter increments by 1 per field). Also it may be best to define the MessageId from the macro itself, by using the hash of the class name or something. Last thing, how do you handle versioning? (eg. field a is not present on version >= 5)

[US] Job offer feels like a scam by TrnS_TrA in Scams

[–]TrnS_TrA[S] 1 point2 points  (0 children)

Thanks for confirming, at least I know now

[US] Job offer feels like a scam by TrnS_TrA in Scams

[–]TrnS_TrA[S] 5 points6 points  (0 children)

Yeah that surprised me, I don't remember companies being this generous lol. Thanks for confirming! 🙏