From 63683c1596484161c085ff642cb0e34b7bdf2bfb Mon Sep 17 00:00:00 2001 From: WenTao Ou Date: Thu, 17 Oct 2024 15:57:10 +0800 Subject: [PATCH] [BUILD] Fix compiling problems for gcc 4.8 (#3100) * Fix compiling problems for gcc 4.8 * Apply suggestions from code review --------- Co-authored-by: Marc Alff --- exporters/memory/src/in_memory_metric_data.cc | 7 +++++-- exporters/memory/src/in_memory_metric_exporter_factory.cc | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/exporters/memory/src/in_memory_metric_data.cc b/exporters/memory/src/in_memory_metric_data.cc index 2a77e0b5a3..90f1c1450f 100644 --- a/exporters/memory/src/in_memory_metric_data.cc +++ b/exporters/memory/src/in_memory_metric_data.cc @@ -31,7 +31,9 @@ void SimpleAggregateInMemoryMetricData::Add(std::unique_ptr res const auto &metric = m.instrument_descriptor.name_; for (const auto &pda : m.point_data_attr_) { - data_[{scope, metric}].insert({pda.attributes, pda.point_data}); + // NOTE: Explicit type conversion added for C++11 (gcc 4.8) + data_[std::tuple{scope, metric}].insert( + {pda.attributes, pda.point_data}); } } } @@ -41,7 +43,8 @@ const SimpleAggregateInMemoryMetricData::AttributeToPoint &SimpleAggregateInMemo const std::string &scope, const std::string &metric) { - return data_[{scope, metric}]; + // NOTE: Explicit type conversion added for C++11 (gcc 4.8) + return data_[std::tuple{scope, metric}]; } void SimpleAggregateInMemoryMetricData::Clear() diff --git a/exporters/memory/src/in_memory_metric_exporter_factory.cc b/exporters/memory/src/in_memory_metric_exporter_factory.cc index 7f6ab83346..0deff73dcd 100644 --- a/exporters/memory/src/in_memory_metric_exporter_factory.cc +++ b/exporters/memory/src/in_memory_metric_exporter_factory.cc @@ -78,7 +78,8 @@ class InMemoryMetricExporter final : public sdk::metrics::PushMetricExporter std::unique_ptr InMemoryMetricExporterFactory::Create( const std::shared_ptr &data) { - return Create(data, [](auto) { return AggregationTemporality::kCumulative; }); + return Create(data, + [](sdk::metrics::InstrumentType) { return AggregationTemporality::kCumulative; }); } std::unique_ptr InMemoryMetricExporterFactory::Create(