Skip to content

Commit

Permalink
Refs #21186: Fix windows build
Browse files Browse the repository at this point in the history
Signed-off-by: JesusPoderoso <[email protected]>
  • Loading branch information
JesusPoderoso committed Jul 9, 2024
1 parent 7a4708b commit 74fe642
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions examples/cpp/topic_instances/CLIParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,6 @@ class CLIParser
subscriber_config sub_config;
};

//! Get the shape color as a string
static std::string shape_color(
int index)
{
const int max_colors = 10;
const std::array<std::string, max_colors> shape_colors =
{ "RED", "BLUE", "GREEN", "YELLOW", "ORANGE", "CYAN", "MAGENTA", "PURPLE", "GREY", "BLACK"};
return shape_colors[index % max_colors];
}

/**
* @brief Print usage help message and exit with the given return code
*
Expand Down Expand Up @@ -721,6 +711,23 @@ class CLIParser
}
}

//! Get the shape color as a string
static std::string shape_color(
int index)
{
constexpr int max_colors = 10;
const auto& shape_colors = get_shape_colors();
return shape_colors[index % max_colors];
}

private:

//! Private method to declare constant array of colors
static constexpr std::array<const char*, 10> get_shape_colors()
{
return { "RED", "BLUE", "GREEN", "YELLOW", "ORANGE", "CYAN", "MAGENTA", "PURPLE", "GREY", "BLACK" };
}

};

} // namespace topic_instances
Expand Down

0 comments on commit 74fe642

Please sign in to comment.