6 #if defined(OPENTELEMETRY_STL_VERSION)
7 # if OPENTELEMETRY_STL_VERSION >= 2011
8 # include "opentelemetry/std/unique_ptr.h"
9 # define OPENTELEMETRY_HAVE_STD_UNIQUE_PTR
13 #if !defined(OPENTELEMETRY_HAVE_STD_UNIQUE_PTR)
16 # include <type_traits>
19 # include "opentelemetry/version.h"
27 struct unique_ptr_element_type
60 typename std::enable_if<std::is_convertible<U *, pointer>::value>::type * =
nullptr>
65 typename std::enable_if<std::is_convertible<U *, pointer>::value>::type * =
nullptr>
66 unique_ptr(std::unique_ptr<U> &&other) noexcept : ptr_{other.release()}
73 reset(other.release());
84 typename std::enable_if<std::is_convertible<U *, pointer>::value>::type * =
nullptr>
87 reset(other.release());
92 typename std::enable_if<std::is_convertible<U *, pointer>::value>::type * =
nullptr>
95 reset(other.release());
99 operator std::unique_ptr<T>() && noexcept {
return std::unique_ptr<T>{
release()}; }
101 operator bool() const noexcept {
return ptr_ !=
nullptr; }
130 void delete_ptr() noexcept
132 if (std::is_array<T>::value)
143 template <
class T1,
class T2>
144 bool operator==(
const unique_ptr<T1> &lhs,
const unique_ptr<T2> &rhs) noexcept
146 return lhs.get() == rhs.get();
150 bool operator==(
const unique_ptr<T> &lhs, std::nullptr_t) noexcept
152 return lhs.get() ==
nullptr;
156 bool operator==(std::nullptr_t,
const unique_ptr<T> &rhs) noexcept
158 return nullptr == rhs.get();
161 template <
class T1,
class T2>
162 bool operator!=(
const unique_ptr<T1> &lhs,
const unique_ptr<T2> &rhs) noexcept
164 return lhs.get() != rhs.get();
168 bool operator!=(
const unique_ptr<T> &lhs, std::nullptr_t) noexcept
170 return lhs.get() !=
nullptr;
174 bool operator!=(std::nullptr_t,
const unique_ptr<T> &rhs) noexcept
176 return nullptr != rhs.get();