diff --git a/pw_metric/metric.cc b/pw_metric/metric.cc index e2f64542ef..18721126c0 100644 --- a/pw_metric/metric.cc +++ b/pw_metric/metric.cc @@ -109,8 +109,6 @@ void Metric::Dump(IntrusiveList& metrics, int level) { } } -Group::Group(Token name) : name_(name) {} - Group::Group(Token name, IntrusiveList& groups) : name_(name) { groups.push_front(*this); } diff --git a/pw_metric/public/pw_metric/metric.h b/pw_metric/public/pw_metric/metric.h index 5a6a3e0305..5dfd1ab64e 100644 --- a/pw_metric/public/pw_metric/metric.h +++ b/pw_metric/public/pw_metric/metric.h @@ -65,10 +65,10 @@ class Metric : public IntrusiveList::Item { void operator=(const Metric&) = delete; protected: - Metric(Token name, float value) + constexpr Metric(Token name, float value) : name_and_type_((name & kTokenMask) | kTypeFloat), float_(value) {} - Metric(Token name, uint32_t value) + constexpr Metric(Token name, uint32_t value) : name_and_type_((name & kTokenMask) | kTypeInt), uint_(value) {} Metric(Token name, float value, IntrusiveList& metrics); @@ -112,7 +112,7 @@ class TypedMetric; template <> class TypedMetric : public Metric { public: - TypedMetric(Token name, float value) : Metric(name, value) {} + constexpr TypedMetric(Token name, float value) : Metric(name, value) {} TypedMetric(Token name, float value, IntrusiveList& metrics) : Metric(name, value, metrics) {} @@ -129,7 +129,7 @@ class TypedMetric : public Metric { template <> class TypedMetric : public Metric { public: - TypedMetric(Token name, uint32_t value) : Metric(name, value) {} + constexpr TypedMetric(Token name, uint32_t value) : Metric(name, value) {} TypedMetric(Token name, uint32_t value, IntrusiveList& metrics) : Metric(name, value, metrics) {} @@ -148,7 +148,7 @@ class TypedMetric : public Metric { // Size: 16 bytes/128 bits - next, name, metrics, children. class Group : public IntrusiveList::Item { public: - Group(Token name); + constexpr Group(Token name) : name_(name) {} Group(Token name, IntrusiveList& groups); Token name() const { return name_; }