Skip to content

Commit

Permalink
Move static_assert from ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
Wiktor-99 committed Jan 19, 2025
1 parent 8d45e01 commit 469214d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ template <GPSSensorOption sensor_option>
class GPSSensor : public SemanticComponentInterface<sensor_msgs::msg::NavSatFix>
{
public:
static_assert(
sensor_option == GPSSensorOption::WithCovariance ||
sensor_option == GPSSensorOption::WithoutCovariance,
"Invalid GPSSensorOption");
explicit GPSSensor(const std::string & name)
: SemanticComponentInterface(
name, {{name + "/" + "status"},
Expand All @@ -42,10 +46,6 @@ class GPSSensor : public SemanticComponentInterface<sensor_msgs::msg::NavSatFix>
{name + "/" + "longitude"},
{name + "/" + "altitude"}})
{
static_assert(
sensor_option == GPSSensorOption::WithCovariance ||
sensor_option == GPSSensorOption::WithoutCovariance,
"Invalid GPSSensorOption");
if constexpr (sensor_option == GPSSensorOption::WithCovariance)
{
interface_names_.emplace_back(name + "/" + "latitude_covariance");
Expand Down

0 comments on commit 469214d

Please sign in to comment.