cpp-common: add `bt2s::optional`, alias of `nonstd::optional`
[babeltrace.git] / src / cpp-common / bt2 / trace-ir.hpp
index 0542cd959c58cb3e70434a17ddd2477e9740df85..51e53732af752d98040c178ad83f38e8d99e4e2a 100644 (file)
@@ -12,8 +12,7 @@
 
 #include <babeltrace2/babeltrace.h>
 
-#include "cpp-common/optional.hpp"
-#include "cpp-common/string_view.hpp"
+#include "cpp-common/bt2s/optional.hpp"
 
 #include "borrowed-object.hpp"
 #include "clock-class.hpp"
@@ -121,6 +120,9 @@ struct CommonEventSpec<const bt_event> final
     }
 };
 
+template <typename LibObjT>
+using DepStructField = DepType<LibObjT, StructureField, ConstStructureField>;
+
 } /* namespace internal */
 
 template <typename LibObjT>
@@ -130,22 +132,13 @@ private:
     using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
     using typename BorrowedObject<LibObjT>::_LibObjPtr;
     using _Spec = internal::CommonEventSpec<LibObjT>;
-
-    using _Packet =
-        typename std::conditional<std::is_const<LibObjT>::value, CommonPacket<const bt_packet>,
-                                  CommonPacket<bt_packet>>::type;
-
-    using _Stream =
-        typename std::conditional<std::is_const<LibObjT>::value, CommonStream<const bt_stream>,
-                                  CommonStream<bt_stream>>::type;
-
-    using _StructureField = typename std::conditional<std::is_const<LibObjT>::value,
-                                                      ConstStructureField, StructureField>::type;
+    using _Packet = internal::DepPacket<LibObjT>;
+    using _Stream = internal::DepStream<LibObjT>;
+    using _StructureField = internal::DepStructField<LibObjT>;
 
 public:
-    using Class = typename std::conditional<std::is_const<LibObjT>::value,
-                                            CommonEventClass<const bt_event_class>,
-                                            CommonEventClass<bt_event_class>>::type;
+    using Class = internal::DepType<LibObjT, CommonEventClass<bt_event_class>,
+                                    CommonEventClass<const bt_event_class>>;
 
     explicit CommonEvent(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr}
     {
@@ -157,7 +150,7 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonEvent<LibObjT>& operator=(const CommonEvent<OtherLibObjT> event) noexcept
+    CommonEvent<LibObjT> operator=(const CommonEvent<OtherLibObjT> event) noexcept
     {
         _ThisBorrowedObject::operator=(event);
         return *this;
@@ -170,9 +163,9 @@ public:
 
     Class cls() const noexcept;
     _Stream stream() const noexcept;
-    nonstd::optional<_Packet> packet() const noexcept;
+    bt2s::optional<_Packet> packet() const noexcept;
 
-    nonstd::optional<_StructureField> payloadField() const noexcept
+    bt2s::optional<_StructureField> payloadField() const noexcept
     {
         const auto libObjPtr = _Spec::payloadField(this->libObjPtr());
 
@@ -180,10 +173,10 @@ public:
             return _StructureField {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
-    nonstd::optional<_StructureField> specificContextField() const noexcept
+    bt2s::optional<_StructureField> specificContextField() const noexcept
     {
         const auto libObjPtr = _Spec::specificContextField(this->libObjPtr());
 
@@ -191,10 +184,10 @@ public:
             return _StructureField {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
-    nonstd::optional<_StructureField> commonContextField() const noexcept
+    bt2s::optional<_StructureField> commonContextField() const noexcept
     {
         const auto libObjPtr = _Spec::commonContextField(this->libObjPtr());
 
@@ -202,7 +195,7 @@ public:
             return _StructureField {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 };
 
@@ -282,17 +275,11 @@ private:
     using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
     using typename BorrowedObject<LibObjT>::_LibObjPtr;
     using _Spec = internal::CommonPacketSpec<LibObjT>;
-    using _ThisCommonPacket = CommonPacket<LibObjT>;
-
-    using _Stream =
-        typename std::conditional<std::is_const<LibObjT>::value, CommonStream<const bt_stream>,
-                                  CommonStream<bt_stream>>::type;
-
-    using _StructureField = typename std::conditional<std::is_const<LibObjT>::value,
-                                                      ConstStructureField, StructureField>::type;
+    using _Stream = internal::DepStream<LibObjT>;
+    using _StructureField = internal::DepStructField<LibObjT>;
 
 public:
-    using Shared = SharedObject<_ThisCommonPacket, LibObjT, internal::PacketRefFuncs>;
+    using Shared = SharedObject<CommonPacket, LibObjT, internal::PacketRefFuncs>;
 
     explicit CommonPacket(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr}
     {
@@ -304,7 +291,7 @@ public:
     }
 
     template <typename OtherLibObjT>
-    _ThisCommonPacket& operator=(const CommonPacket<OtherLibObjT> packet) noexcept
+    CommonPacket operator=(const CommonPacket<OtherLibObjT> packet) noexcept
     {
         _ThisBorrowedObject::operator=(packet);
         return *this;
@@ -317,7 +304,7 @@ public:
 
     _Stream stream() const noexcept;
 
-    nonstd::optional<_StructureField> contextField() const noexcept
+    bt2s::optional<_StructureField> contextField() const noexcept
     {
         const auto libObjPtr = _Spec::contextField(this->libObjPtr());
 
@@ -325,7 +312,7 @@ public:
             return _StructureField {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     Shared shared() const noexcept
@@ -358,8 +345,7 @@ struct TypeDescr<ConstPacket> : public PacketTypeDescr
 } /* namespace internal */
 
 template <typename LibObjT>
-nonstd::optional<typename CommonEvent<LibObjT>::_Packet>
-CommonEvent<LibObjT>::packet() const noexcept
+bt2s::optional<typename CommonEvent<LibObjT>::_Packet> CommonEvent<LibObjT>::packet() const noexcept
 {
     const auto libObjPtr = _Spec::packet(this->libObjPtr());
 
@@ -367,7 +353,7 @@ CommonEvent<LibObjT>::packet() const noexcept
         return _Packet {libObjPtr};
     }
 
-    return nonstd::nullopt;
+    return bt2s::nullopt;
 }
 
 namespace internal {
@@ -437,21 +423,14 @@ private:
     using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
     using typename BorrowedObject<LibObjT>::_LibObjPtr;
     using _Spec = internal::CommonStreamSpec<LibObjT>;
-    using _ThisCommonStream = CommonStream<LibObjT>;
-
-    using _Trace =
-        typename std::conditional<std::is_const<LibObjT>::value, CommonTrace<const bt_trace>,
-                                  CommonTrace<bt_trace>>::type;
+    using _Trace = internal::DepType<LibObjT, CommonTrace<bt_trace>, CommonTrace<const bt_trace>>;
 
 public:
-    using Shared = SharedObject<_ThisCommonStream, LibObjT, internal::StreamRefFuncs>;
-
-    using Class = typename std::conditional<std::is_const<LibObjT>::value,
-                                            CommonStreamClass<const bt_stream_class>,
-                                            CommonStreamClass<bt_stream_class>>::type;
+    using Shared = SharedObject<CommonStream, LibObjT, internal::StreamRefFuncs>;
+    using UserAttributes = internal::DepUserAttrs<LibObjT>;
 
-    using UserAttributes =
-        typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
+    using Class = internal::DepType<LibObjT, CommonStreamClass<bt_stream_class>,
+                                    CommonStreamClass<const bt_stream_class>>;
 
     explicit CommonStream(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr}
     {
@@ -463,7 +442,7 @@ public:
     }
 
     template <typename OtherLibObjT>
-    _ThisCommonStream& operator=(const CommonStream<OtherLibObjT> stream) noexcept
+    CommonStream operator=(const CommonStream<OtherLibObjT> stream) noexcept
     {
         _ThisBorrowedObject::operator=(stream);
         return *this;
@@ -508,15 +487,9 @@ public:
         this->name(name.data());
     }
 
-    nonstd::optional<bpstd::string_view> name() const noexcept
+    const char *name() const noexcept
     {
-        const auto name = bt_stream_get_name(this->libObjPtr());
-
-        if (name) {
-            return name;
-        }
-
-        return nonstd::nullopt;
+        return bt_stream_get_name(this->libObjPtr());
     }
 
     template <typename LibValT>
@@ -652,25 +625,18 @@ private:
     using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
     using typename BorrowedObject<LibObjT>::_LibObjPtr;
     using _Spec = internal::CommonTraceSpec<LibObjT>;
-    using _ThisCommonTrace = CommonTrace<LibObjT>;
-
-    using _Stream =
-        typename std::conditional<std::is_const<LibObjT>::value, CommonStream<const bt_stream>,
-                                  CommonStream<bt_stream>>::type;
+    using _Stream = internal::DepStream<LibObjT>;
 
 public:
-    using Shared = SharedObject<_ThisCommonTrace, LibObjT, internal::TraceRefFuncs>;
+    using Shared = SharedObject<CommonTrace, LibObjT, internal::TraceRefFuncs>;
+    using UserAttributes = internal::DepUserAttrs<LibObjT>;
 
-    using Class = typename std::conditional<std::is_const<LibObjT>::value,
-                                            CommonTraceClass<const bt_trace_class>,
-                                            CommonTraceClass<bt_trace_class>>::type;
-
-    using UserAttributes =
-        typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
+    using Class = internal::DepType<LibObjT, CommonTraceClass<bt_trace_class>,
+                                    CommonTraceClass<const bt_trace_class>>;
 
     struct ConstEnvironmentEntry
     {
-        bpstd::string_view name;
+        const char *name;
         ConstValue value;
     };
 
@@ -684,7 +650,7 @@ public:
     }
 
     template <typename OtherLibObjT>
-    _ThisCommonTrace& operator=(const CommonTrace<OtherLibObjT> trace) noexcept
+    CommonTrace operator=(const CommonTrace<OtherLibObjT> trace) noexcept
     {
         _ThisBorrowedObject::operator=(trace);
         return *this;
@@ -713,31 +679,25 @@ public:
         this->name(name.data());
     }
 
-    nonstd::optional<bpstd::string_view> name() const noexcept
+    const char *name() const noexcept
     {
-        const auto name = bt_trace_get_name(this->libObjPtr());
-
-        if (name) {
-            return name;
-        }
-
-        return nonstd::nullopt;
+        return bt_trace_get_name(this->libObjPtr());
     }
 
-    void uuid(const bt2_common::UuidView& uuid) const noexcept
+    void uuid(const bt2c::UuidView& uuid) const noexcept
     {
         bt_trace_set_uuid(this->libObjPtr(), uuid.begin());
     }
 
-    nonstd::optional<bt2_common::UuidView> uuid() const noexcept
+    bt2s::optional<bt2c::UuidView> uuid() const noexcept
     {
         const auto uuid = bt_trace_get_uuid(this->libObjPtr());
 
         if (uuid) {
-            return bt2_common::UuidView {uuid};
+            return bt2c::UuidView {uuid};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     std::uint64_t length() const noexcept
@@ -750,7 +710,7 @@ public:
         return _Stream {_Spec::streamByIndex(this->libObjPtr(), index)};
     }
 
-    nonstd::optional<_Stream> streamById(const std::uint64_t id) const noexcept
+    bt2s::optional<_Stream> streamById(const std::uint64_t id) const noexcept
     {
         const auto libObjPtr = _Spec::streamById(this->libObjPtr(), id);
 
@@ -758,7 +718,7 @@ public:
             return _Stream {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     void environmentEntry(const char * const name, const std::int64_t val) const
@@ -818,7 +778,7 @@ public:
         return ConstEnvironmentEntry {name, ConstValue {libObjPtr}};
     }
 
-    nonstd::optional<ConstValue> environmentEntry(const char * const name) const noexcept
+    bt2s::optional<ConstValue> environmentEntry(const char * const name) const noexcept
     {
         const auto libObjPtr =
             bt_trace_borrow_environment_entry_value_by_name_const(this->libObjPtr(), name);
@@ -827,10 +787,10 @@ public:
             return ConstValue {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
-    nonstd::optional<ConstValue> environmentEntry(const std::string& name) const noexcept
+    bt2s::optional<ConstValue> environmentEntry(const std::string& name) const noexcept
     {
         return this->environmentEntry(name.data());
     }
@@ -952,6 +912,9 @@ struct CommonEventClassSpec<const bt_event_class> final
     }
 };
 
+template <typename LibObjT>
+using DepStructFc = DepType<LibObjT, StructureFieldClass, ConstStructureFieldClass>;
+
 } /* namespace internal */
 
 template <typename LibObjT>
@@ -961,21 +924,14 @@ private:
     using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
     using typename BorrowedObject<LibObjT>::_LibObjPtr;
     using _Spec = internal::CommonEventClassSpec<LibObjT>;
-    using _ThisCommonEventClass = CommonEventClass<LibObjT>;
+    using _StructureFieldClass = internal::DepStructFc<LibObjT>;
 
-    using _StreamClass = typename std::conditional<std::is_const<LibObjT>::value,
-                                                   CommonStreamClass<const bt_stream_class>,
-                                                   CommonStreamClass<bt_stream_class>>::type;
-
-    using _StructureFieldClass =
-        typename std::conditional<std::is_const<LibObjT>::value, ConstStructureFieldClass,
-                                  StructureFieldClass>::type;
+    using _StreamClass = internal::DepType<LibObjT, CommonStreamClass<bt_stream_class>,
+                                           CommonStreamClass<const bt_stream_class>>;
 
 public:
-    using Shared = SharedObject<_ThisCommonEventClass, LibObjT, internal::EventClassRefFuncs>;
-
-    using UserAttributes =
-        typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
+    using Shared = SharedObject<CommonEventClass, LibObjT, internal::EventClassRefFuncs>;
+    using UserAttributes = internal::DepUserAttrs<LibObjT>;
 
     enum class LogLevel
     {
@@ -1007,7 +963,7 @@ public:
     }
 
     template <typename OtherLibObjT>
-    _ThisCommonEventClass& operator=(const CommonEventClass<OtherLibObjT> eventClass) noexcept
+    CommonEventClass operator=(const CommonEventClass<OtherLibObjT> eventClass) noexcept
     {
         _ThisBorrowedObject::operator=(eventClass);
         return *this;
@@ -1041,15 +997,9 @@ public:
         this->name(name.data());
     }
 
-    nonstd::optional<bpstd::string_view> name() const noexcept
+    const char *name() const noexcept
     {
-        const auto name = bt_event_class_get_name(this->libObjPtr());
-
-        if (name) {
-            return name;
-        }
-
-        return nonstd::nullopt;
+        return bt_event_class_get_name(this->libObjPtr());
     }
 
     void logLevel(const LogLevel logLevel) const noexcept
@@ -1060,7 +1010,7 @@ public:
                                      static_cast<bt_event_class_log_level>(logLevel));
     }
 
-    nonstd::optional<LogLevel> logLevel() const noexcept
+    bt2s::optional<LogLevel> logLevel() const noexcept
     {
         bt_event_class_log_level libLogLevel;
         const auto avail = bt_event_class_get_log_level(this->libObjPtr(), &libLogLevel);
@@ -1069,7 +1019,7 @@ public:
             return static_cast<LogLevel>(libLogLevel);
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     void emfUri(const char * const emfUri) const
@@ -1088,15 +1038,9 @@ public:
         this->emfUri(emfUri.data());
     }
 
-    nonstd::optional<bpstd::string_view> emfUri() const noexcept
+    const char *emfUri() const noexcept
     {
-        const auto emfUri = bt_event_class_get_emf_uri(this->libObjPtr());
-
-        if (emfUri) {
-            return emfUri;
-        }
-
-        return nonstd::nullopt;
+        return bt_event_class_get_emf_uri(this->libObjPtr());
     }
 
     void payloadFieldClass(const StructureFieldClass fc) const
@@ -1111,7 +1055,7 @@ public:
         }
     }
 
-    nonstd::optional<_StructureFieldClass> payloadFieldClass() const noexcept
+    bt2s::optional<_StructureFieldClass> payloadFieldClass() const noexcept
     {
         const auto libObjPtr = _Spec::payloadFieldClass(this->libObjPtr());
 
@@ -1119,7 +1063,7 @@ public:
             return _StructureFieldClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     void specificContextFieldClass(const StructureFieldClass fc) const
@@ -1134,7 +1078,7 @@ public:
         }
     }
 
-    nonstd::optional<_StructureFieldClass> specificContextFieldClass() const noexcept
+    bt2s::optional<_StructureFieldClass> specificContextFieldClass() const noexcept
     {
         const auto libObjPtr = _Spec::specificContextFieldClass(this->libObjPtr());
 
@@ -1142,7 +1086,7 @@ public:
             return _StructureFieldClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     template <typename LibValT>
@@ -1306,28 +1250,19 @@ private:
     using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
     using typename BorrowedObject<LibObjT>::_LibObjPtr;
     using _Spec = internal::CommonStreamClassSpec<LibObjT>;
-    using _ThisCommonStreamClass = CommonStreamClass<LibObjT>;
+    using _StructureFieldClass = internal::DepStructFc<LibObjT>;
 
-    using _TraceClass = typename std::conditional<std::is_const<LibObjT>::value,
-                                                  CommonTraceClass<const bt_trace_class>,
-                                                  CommonTraceClass<bt_trace_class>>::type;
+    using _TraceClass = internal::DepType<LibObjT, CommonTraceClass<bt_trace_class>,
+                                          CommonTraceClass<const bt_trace_class>>;
 
-    using _EventClass = typename std::conditional<std::is_const<LibObjT>::value,
-                                                  CommonEventClass<const bt_event_class>,
-                                                  CommonEventClass<bt_event_class>>::type;
+    using _EventClass = internal::DepType<LibObjT, CommonEventClass<bt_event_class>,
+                                          CommonEventClass<const bt_event_class>>;
 
-    using _StructureFieldClass =
-        typename std::conditional<std::is_const<LibObjT>::value, ConstStructureFieldClass,
-                                  StructureFieldClass>::type;
-
-    using _ClockClass =
-        typename std::conditional<std::is_const<LibObjT>::value, ConstClockClass, ClockClass>::type;
+    using _ClockClass = internal::DepType<LibObjT, ClockClass, ConstClockClass>;
 
 public:
-    using Shared = SharedObject<_ThisCommonStreamClass, LibObjT, internal::StreamClassRefFuncs>;
-
-    using UserAttributes =
-        typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
+    using Shared = SharedObject<CommonStreamClass, LibObjT, internal::StreamClassRefFuncs>;
+    using UserAttributes = internal::DepUserAttrs<LibObjT>;
 
     explicit CommonStreamClass(const _LibObjPtr libObjPtr) noexcept :
         _ThisBorrowedObject {libObjPtr}
@@ -1341,7 +1276,7 @@ public:
     }
 
     template <typename OtherLibObjT>
-    _ThisCommonStreamClass& operator=(const CommonStreamClass<OtherLibObjT> streamClass) noexcept
+    CommonStreamClass operator=(const CommonStreamClass<OtherLibObjT> streamClass) noexcept
     {
         _ThisBorrowedObject::operator=(streamClass);
         return *this;
@@ -1420,15 +1355,9 @@ public:
         this->name(name.data());
     }
 
-    nonstd::optional<bpstd::string_view> name() const noexcept
+    const char *name() const noexcept
     {
-        const auto name = bt_stream_class_get_name(this->libObjPtr());
-
-        if (name) {
-            return name;
-        }
-
-        return nonstd::nullopt;
+        return bt_stream_class_get_name(this->libObjPtr());
     }
 
     void assignsAutomaticEventClassId(const bool val) const noexcept
@@ -1544,7 +1473,7 @@ public:
         BT_ASSERT(status == BT_STREAM_CLASS_SET_DEFAULT_CLOCK_CLASS_STATUS_OK);
     }
 
-    nonstd::optional<_ClockClass> defaultClockClass() const noexcept
+    bt2s::optional<_ClockClass> defaultClockClass() const noexcept
     {
         const auto libObjPtr = _Spec::defaultClockClass(this->libObjPtr());
 
@@ -1552,7 +1481,7 @@ public:
             return _ClockClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     std::uint64_t length() const noexcept
@@ -1565,7 +1494,7 @@ public:
         return _EventClass {_Spec::eventClassByIndex(this->libObjPtr(), index)};
     }
 
-    nonstd::optional<_EventClass> eventClassById(const std::uint64_t id) const noexcept
+    bt2s::optional<_EventClass> eventClassById(const std::uint64_t id) const noexcept
     {
         const auto libObjPtr = _Spec::eventClassById(this->libObjPtr(), id);
 
@@ -1573,7 +1502,7 @@ public:
             return _EventClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     void packetContextFieldClass(const StructureFieldClass fc) const
@@ -1589,7 +1518,7 @@ public:
         }
     }
 
-    nonstd::optional<_StructureFieldClass> packetContextFieldClass() const noexcept
+    bt2s::optional<_StructureFieldClass> packetContextFieldClass() const noexcept
     {
         const auto libObjPtr = _Spec::packetContextFieldClass(this->libObjPtr());
 
@@ -1597,7 +1526,7 @@ public:
             return _StructureFieldClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     void eventCommonContextFieldClass(const StructureFieldClass fc) const
@@ -1613,7 +1542,7 @@ public:
         }
     }
 
-    nonstd::optional<_StructureFieldClass> eventCommonContextFieldClass() const noexcept
+    bt2s::optional<_StructureFieldClass> eventCommonContextFieldClass() const noexcept
     {
         const auto libObjPtr = _Spec::eventCommonContextFieldClass(this->libObjPtr());
 
@@ -1621,7 +1550,7 @@ public:
             return _StructureFieldClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     template <typename LibValT>
@@ -1751,17 +1680,13 @@ private:
     using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
     using typename BorrowedObject<LibObjT>::_LibObjPtr;
     using _Spec = internal::CommonTraceClassSpec<LibObjT>;
-    using _ThisCommonTraceClass = CommonTraceClass<LibObjT>;
 
-    using _StreamClass = typename std::conditional<std::is_const<LibObjT>::value,
-                                                   CommonStreamClass<const bt_stream_class>,
-                                                   CommonStreamClass<bt_stream_class>>::type;
+    using _StreamClass = internal::DepType<LibObjT, CommonStreamClass<bt_stream_class>,
+                                           CommonStreamClass<const bt_stream_class>>;
 
 public:
-    using Shared = SharedObject<_ThisCommonTraceClass, LibObjT, internal::TraceClassRefFuncs>;
-
-    using UserAttributes =
-        typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
+    using Shared = SharedObject<CommonTraceClass, LibObjT, internal::TraceClassRefFuncs>;
+    using UserAttributes = internal::DepUserAttrs<LibObjT>;
 
     explicit CommonTraceClass(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr}
     {
@@ -1774,7 +1699,7 @@ public:
     }
 
     template <typename OtherLibObjT>
-    _ThisCommonTraceClass& operator=(const CommonTraceClass<OtherLibObjT> traceClass) noexcept
+    CommonTraceClass operator=(const CommonTraceClass<OtherLibObjT> traceClass) noexcept
     {
         _ThisBorrowedObject::operator=(traceClass);
         return *this;
@@ -2055,7 +1980,7 @@ public:
         return _StreamClass {_Spec::streamClassByIndex(this->libObjPtr(), index)};
     }
 
-    nonstd::optional<_StreamClass> streamClassById(const std::uint64_t id) const noexcept
+    bt2s::optional<_StreamClass> streamClassById(const std::uint64_t id) const noexcept
     {
         const auto libObjPtr = _Spec::streamClassById(this->libObjPtr(), id);
 
@@ -2063,7 +1988,7 @@ public:
             return _StreamClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     template <typename LibValT>
This page took 0.033241 seconds and 4 git commands to generate.