-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Context (Input, Language)
Input Format: schema
Output Language: C++
Description
The getter should return std::optional<T>& instead of std::optional<T> to avoid unnecessary copy construction.
Current Behaviour / Output
std::optional<std::string> get_field() {
return field; // std::optional<std::string> field;
}BTW. I used --all-properties-optional and --code-format with-getter-setter to generate the above code.
Proposed Behaviour / Output
std::optional<std::string>& get_field() {
return field; // std::optional<std::string> field;
}