lst-0044-godb.cpp
//#(compile) c++; compiler:g132; options:-O3 -std=c++23; libs:-
// https://godbolt.org/z/xhd7s1YhE
#include <string>
using std::string;
enum class StoplightColor {
RED, YELLOW, REDYELLOW, GREEN
};
struct Stoplight {
StoplightColor color_;
Stoplight(StoplightColor color, string name) : color_{color} {}
};
Stoplight createStoplight(StoplightColor color, string name) {
return Stoplight{color, name};
}
int main() {
Stoplight stoplight = createStoplight(StoplightColor::RED, "AX-001");
}