Skip to content

Commit

Permalink
change static const to inline to avoid warnings and potentially decre…
Browse files Browse the repository at this point in the history
…ase code size (#139)

Signed-off-by: Siebren Weertman <[email protected]>
Co-authored-by: Siebren Weertman <[email protected]>
  • Loading branch information
SiebrenW and Siebren Weertman authored May 8, 2024
1 parent 35a4446 commit 8a0095a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ev-dev-tools/src/ev_cli/templates/types.hpp.j2
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum class {{ enum.enum_type}}

/// \brief Converts the given {{ enum.enum_type }} \p e to human readable string
/// \returns a string representation of the {{ enum.enum_type }}
static const std::string {{ enum.enum_type | snake_case }}_to_string({{ enum.enum_type }} e) {
inline std::string {{ enum.enum_type | snake_case }}_to_string({{ enum.enum_type }} e) {
switch (e) {
{% for e in enum.enum %}
case {{ enum.enum_type }}::{{ e }}: return "{{e}}";
Expand All @@ -52,7 +52,7 @@ static const std::string {{ enum.enum_type | snake_case }}_to_string({{ enum.enu

/// \brief Converts the given std::string \p s to {{ enum.enum_type }}
/// \returns a {{ enum.enum_type }} from a string representation
static const {{ enum.enum_type }} string_to_{{ enum.enum_type | snake_case }}(const std::string& s) {
inline {{ enum.enum_type }} string_to_{{ enum.enum_type | snake_case }}(const std::string& s) {
{% for e in enum.enum %}
if(s == "{{e}}") {
return {{ enum.enum_type }}::{{ e }};
Expand Down

0 comments on commit 8a0095a

Please sign in to comment.