-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use std::string_view instead of std::string when string constant are generated #203
Comments
This is a good suggestion. However, since Gluecodium supports C++11 and C++14 where std::string_view does not exist, this optimization needs to be controlled by a command line option. Since we already have quite a mess of command line options, those need to be sorted out somehow. One possible approach would be to have structured per-language options, e.g. |
Can be implemented now that Gluecodium fully supports C++17. |
Resolves: #203 Signed-off-by: Daniel Kamkha <daniel.kamkha@here.com>
Resolves: #203 Signed-off-by: Daniel Kamkha <daniel.kamkha@here.com>
Resolves: #203 Signed-off-by: Daniel Kamkha <daniel.kamkha@here.com>
Resolves: #203 Signed-off-by: Daniel Kamkha <daniel.kamkha@here.com>
Resolves: #203 Signed-off-by: Daniel Kamkha <daniel.kamkha@here.com>
Resolves: #203 Signed-off-by: Daniel Kamkha <daniel.kamkha@here.com>
Assuming next declaration in lime:
Gluecodium generates struct with static const std::string fields:
It leads to waisting of memory, warnings that constructor of std::string may throw an uncaught exception and undefined initialisation order in case when user code relies on those constants.
Possible solution which may solve all these problems: use std::string_view from C++17. Gluecodium may generate something like this:
Also consider to generate to_string for enums using string_view.
The text was updated successfully, but these errors were encountered: