@@ -74,9 +74,10 @@ class AttributesHashMapWithCustomHash
7474 * If not present, it uses the provided callback to generate
7575 * value and store in the hash
7676 */
77- Aggregation *GetOrSetDefault (const opentelemetry::common::KeyValueIterable &attributes,
78- const AttributesProcessor *attributes_processor,
79- std::function<std::unique_ptr<Aggregation>()> aggregation_callback)
77+ Aggregation *GetOrSetDefault (
78+ const opentelemetry::common::KeyValueIterable &attributes,
79+ const AttributesProcessor *attributes_processor,
80+ nostd::function_ref<std::unique_ptr<Aggregation>()> aggregation_callback)
8081 {
8182 // TODO: avoid constructing MetricAttributes from KeyValueIterable for
8283 // hash_map_.find which is a heavy operation
@@ -97,8 +98,9 @@ class AttributesHashMapWithCustomHash
9798 return result.first ->second .get ();
9899 }
99100
100- Aggregation *GetOrSetDefault (const MetricAttributes &attributes,
101- std::function<std::unique_ptr<Aggregation>()> aggregation_callback)
101+ Aggregation *GetOrSetDefault (
102+ const MetricAttributes &attributes,
103+ nostd::function_ref<std::unique_ptr<Aggregation>()> aggregation_callback)
102104 {
103105 auto it = hash_map_.find (attributes);
104106 if (it != hash_map_.end ())
@@ -115,8 +117,9 @@ class AttributesHashMapWithCustomHash
115117 return hash_map_[attributes].get ();
116118 }
117119
118- Aggregation *GetOrSetDefault (MetricAttributes &&attributes,
119- std::function<std::unique_ptr<Aggregation>()> aggregation_callback)
120+ Aggregation *GetOrSetDefault (
121+ MetricAttributes &&attributes,
122+ nostd::function_ref<std::unique_ptr<Aggregation>()> aggregation_callback)
120123 {
121124 auto it = hash_map_.find (attributes);
122125 if (it != hash_map_.end ())
@@ -207,7 +210,7 @@ class AttributesHashMapWithCustomHash
207210 size_t attributes_limit_;
208211
209212 Aggregation *GetOrSetOveflowAttributes (
210- std::function <std::unique_ptr<Aggregation>()> aggregation_callback)
213+ nostd::function_ref <std::unique_ptr<Aggregation>()> aggregation_callback)
211214 {
212215 auto agg = aggregation_callback ();
213216 return GetOrSetOveflowAttributes (std::move (agg));
0 commit comments