How can I make a Java like records on C++?
I'm porting some of my Java Game Engine code to C++, but I don't know what's the equivalent to a Record class (object) from Java. My first thought was making a struct but I don't know how much overhead it will do in my project if used much.
Here's what I want:
public record Color (float r, float g, float b, float a) {}
And what I tried on C++:
#pragma once
namespace core {
struct Color {
public:
float r, g, b, a;
Color(float red, float green, float blue, float alpha = 1.0f)
: r(red), g(green), b(blue), a(alpha) { }
};
}