r/cpp • • May 02 '26

Post examples of using reflections in your projects

What the title says. I just want to see what interesting things people are using reflection for now that its in gcc. Thanks.

58 Upvotes

25 comments sorted by

View all comments

Show parent comment

1

u/Dubbus_ May 08 '26

You guys ever end up using std::lerp and wishing there was an inverse/unlerp() function?

I cant imagine why they would standardize lerp but not unlerp. I find that 90% of my uses of one involve the other (i.e to remap a range, usually colors or noise values or something like that).

(of course its trivial to hand roll, but its just a bit awkward using my_own::unlerp() alongside std::lerp())

1

u/fdwr fdwr@github 🔍 May 08 '26 edited May 09 '26

I haven't needed unlerp ((x - a) / (b - a)), because generally my range minimum is 0 when normalizing (reducing that to just x / b), but I see how it could be useful, and evidently it exists in Unity and Construct.

2

u/Dubbus_ May 09 '26

My calling for game dev continues