Skip to content

Commit

Permalink
Use nostd::enable_if_t instead of std::enable_if_t (#2648)
Browse files Browse the repository at this point in the history
  • Loading branch information
owent authored Apr 29, 2024
1 parent 0ca7d70 commit 830651a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "opentelemetry/common/key_value_iterable_view.h"

#include <opentelemetry/nostd/span.h>
#include <opentelemetry/nostd/type_traits.h>
#include <map>
#include <string>
#include <vector>
Expand Down Expand Up @@ -106,7 +107,7 @@ class PropertyValue : public PropertyVariant
* @param vec Vector of integral type primitives to convert to span.
* @return Span of integral type primitives.
*/
template <typename T, std::enable_if_t<std::is_integral<T>::value, bool> = true>
template <typename T, nostd::enable_if_t<std::is_integral<T>::value, bool> = true>
static nostd::span<const T> to_span(const std::vector<T> &vec)
{
nostd::span<const T> result(vec.data(), vec.size());
Expand All @@ -119,7 +120,7 @@ class PropertyValue : public PropertyVariant
* @param vec Vector of float type primitives to convert to span.
* @return Span of float type primitives.
*/
template <typename T, std::enable_if_t<std::is_floating_point<T>::value, bool> = true>
template <typename T, nostd::enable_if_t<std::is_floating_point<T>::value, bool> = true>
static nostd::span<const T> to_span(const std::vector<T> &vec)
{
nostd::span<const T> result(vec.data(), vec.size());
Expand All @@ -139,7 +140,7 @@ class PropertyValue : public PropertyVariant
* @param v
* @return
*/
template <typename TInteger, std::enable_if_t<std::is_integral<TInteger>::value, bool> = true>
template <typename TInteger, nostd::enable_if_t<std::is_integral<TInteger>::value, bool> = true>
PropertyValue(TInteger number) : PropertyVariant(number)
{}

Expand All @@ -148,7 +149,7 @@ class PropertyValue : public PropertyVariant
* @param v
* @return
*/
template <typename TFloat, std::enable_if_t<std::is_floating_point<TFloat>::value, bool> = true>
template <typename TFloat, nostd::enable_if_t<std::is_floating_point<TFloat>::value, bool> = true>
PropertyValue(TFloat number) : PropertyVariant(double(number))
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "opentelemetry/common/key_value_iterable_view.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/type_traits.h"
#include "opentelemetry/nostd/unique_ptr.h"
#include "opentelemetry/nostd/variant.h"
#include "opentelemetry/sdk/common/attribute_utils.h"
Expand Down Expand Up @@ -73,7 +74,7 @@ class InstrumentationScope
*/
template <
class ArgumentType,
std::enable_if_t<opentelemetry::common::detail::is_key_value_iterable<ArgumentType>::value>
nostd::enable_if_t<opentelemetry::common::detail::is_key_value_iterable<ArgumentType>::value>
* = nullptr>
static nostd::unique_ptr<InstrumentationScope> Create(nostd::string_view name,
nostd::string_view version,
Expand Down

2 comments on commit 830651a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp sdk Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 830651a Previous: 0ca7d70 Ratio
BM_SumAggregation 9144571.092393663 ns/iter 4343690.294207948 ns/iter 2.11
BM_BaselineBuffer/2 11687681.674957275 ns/iter 1697481.4752182434 ns/iter 6.89
BM_BaselineBuffer/4 14918997.287750244 ns/iter 6199917.793273926 ns/iter 2.41
BM_SpanCreation 1235.2552307243584 ns/iter 518.6479657872198 ns/iter 2.38

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp api Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 830651a Previous: 0ca7d70 Ratio
BM_NaiveSpinLockThrashing/2/process_time/real_time 2.123937986322484 ms/iter 0.1904535170046159 ms/iter 11.15

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.