zwoop commented on code in PR #10694:
URL: https://github.com/apache/trafficserver/pull/10694#discussion_r1384390733


##########
include/api/Metrics.h:
##########
@@ -45,23 +45,47 @@ class Metrics
 private:
   using self_type = Metrics;
 
+  class AtomicType
+  {
+    friend class Metrics;
+
+  public:
+    AtomicType()          = default;
+    virtual ~AtomicType() = default;

Review Comment:
   It had to be virtual, otherwise I couldn't subclass it later as I did. And I 
had to sub class it, rather than aliases, to make the compiler detect bad 
usage. It's not considered polymorphic otherwise, e.g.
   
   ```
   /Users/leif/apache/trafficserver/src/proxy/http/PreWarmManager.cc:1181:18: 
error: 'ts::Metrics::AtomicType' is not polymorphic
           metric = dynamic_cast<Metrics::Counter::AtomicType 
*>(metrics.lookup(stats_id));
   ```
   
   Maybe we can fix the usage that's causing trouble here, I didn't write this 
code in the PreWarmManager.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to