cpp-common: add `bt2s::optional`, alias of `nonstd::optional`
[babeltrace.git] / src / cpp-common / bt2 / trace-ir.hpp
index 1026600e6b5089495b21e5f46a97a73f5db51267..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,17 +150,22 @@ 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;
     }
 
+    CommonEvent<const bt_event> asConst() const noexcept
+    {
+        return CommonEvent<const bt_event> {*this};
+    }
+
     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());
 
@@ -175,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());
 
@@ -186,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());
 
@@ -197,7 +195,7 @@ public:
             return _StructureField {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 };
 
@@ -277,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}
     {
@@ -299,15 +291,20 @@ public:
     }
 
     template <typename OtherLibObjT>
-    _ThisCommonPacket& operator=(const CommonPacket<OtherLibObjT> packet) noexcept
+    CommonPacket operator=(const CommonPacket<OtherLibObjT> packet) noexcept
     {
         _ThisBorrowedObject::operator=(packet);
         return *this;
     }
 
+    CommonPacket<const bt_packet> asConst() const noexcept
+    {
+        return CommonPacket<const bt_packet> {*this};
+    }
+
     _Stream stream() const noexcept;
 
-    nonstd::optional<_StructureField> contextField() const noexcept
+    bt2s::optional<_StructureField> contextField() const noexcept
     {
         const auto libObjPtr = _Spec::contextField(this->libObjPtr());
 
@@ -315,7 +312,7 @@ public:
             return _StructureField {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     Shared shared() const noexcept
@@ -348,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());
 
@@ -357,7 +353,7 @@ CommonEvent<LibObjT>::packet() const noexcept
         return _Packet {libObjPtr};
     }
 
-    return nonstd::nullopt;
+    return bt2s::nullopt;
 }
 
 namespace internal {
@@ -427,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 Shared = SharedObject<CommonStream, LibObjT, internal::StreamRefFuncs>;
+    using UserAttributes = internal::DepUserAttrs<LibObjT>;
 
-    using Class = typename std::conditional<std::is_const<LibObjT>::value,
-                                            CommonStreamClass<const bt_stream_class>,
-                                            CommonStreamClass<bt_stream_class>>::type;
-
-    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}
     {
@@ -453,15 +442,20 @@ public:
     }
 
     template <typename OtherLibObjT>
-    _ThisCommonStream& operator=(const CommonStream<OtherLibObjT> stream) noexcept
+    CommonStream operator=(const CommonStream<OtherLibObjT> stream) noexcept
     {
         _ThisBorrowedObject::operator=(stream);
         return *this;
     }
 
+    CommonStream<const bt_stream> asConst() const noexcept
+    {
+        return CommonStream<const bt_stream> {*this};
+    }
+
     Packet::Shared createPacket() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstStream`.");
 
         const auto libObjPtr = bt_packet_create(this->libObjPtr());
 
@@ -479,7 +473,7 @@ public:
 
     void name(const char * const name) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstStream`.");
 
         const auto status = bt_stream_set_name(this->libObjPtr(), name);
 
@@ -493,21 +487,15 @@ 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>
     void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstStream`.");
 
         bt_stream_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
     }
@@ -633,32 +621,22 @@ struct CommonTraceSpec<const bt_trace> final
 template <typename LibObjT>
 class CommonTrace final : public BorrowedObject<LibObjT>
 {
-    /* Allow instantiate() to call `trace.libObjPtr()` */
-    friend class CommonStreamClass<bt_stream_class>;
-
 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;
     };
 
@@ -672,17 +650,22 @@ public:
     }
 
     template <typename OtherLibObjT>
-    _ThisCommonTrace& operator=(const CommonTrace<OtherLibObjT> trace) noexcept
+    CommonTrace operator=(const CommonTrace<OtherLibObjT> trace) noexcept
     {
         _ThisBorrowedObject::operator=(trace);
         return *this;
     }
 
+    CommonTrace<const bt_trace> asConst() const noexcept
+    {
+        return CommonTrace<const bt_trace> {*this};
+    }
+
     Class cls() const noexcept;
 
     void name(const char * const name) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
 
         const auto status = bt_trace_set_name(this->libObjPtr(), name);
 
@@ -696,34 +679,28 @@ 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 size() const noexcept
+    std::uint64_t length() const noexcept
     {
         return bt_trace_get_stream_count(this->libObjPtr());
     }
@@ -733,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);
 
@@ -741,12 +718,12 @@ public:
             return _Stream {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     void environmentEntry(const char * const name, const std::int64_t val) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
 
         const auto status = bt_trace_set_environment_entry_integer(this->libObjPtr(), name, val);
 
@@ -762,7 +739,7 @@ public:
 
     void environmentEntry(const char * const name, const char * const val) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
 
         const auto status = bt_trace_set_environment_entry_string(this->libObjPtr(), name, val);
 
@@ -801,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);
@@ -810,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());
     }
@@ -821,7 +798,7 @@ public:
     template <typename LibValT>
     void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
 
         bt_trace_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
     }
@@ -935,6 +912,9 @@ struct CommonEventClassSpec<const bt_event_class> final
     }
 };
 
+template <typename LibObjT>
+using DepStructFc = DepType<LibObjT, StructureFieldClass, ConstStructureFieldClass>;
+
 } /* namespace internal */
 
 template <typename LibObjT>
@@ -944,21 +924,14 @@ private:
     using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
     using typename BorrowedObject<LibObjT>::_LibObjPtr;
     using _Spec = internal::CommonEventClassSpec<LibObjT>;
-    using _ThisCommonEventClass = CommonEventClass<LibObjT>;
-
-    using _StreamClass = typename std::conditional<std::is_const<LibObjT>::value,
-                                                   CommonStreamClass<const bt_stream_class>,
-                                                   CommonStreamClass<bt_stream_class>>::type;
+    using _StructureFieldClass = internal::DepStructFc<LibObjT>;
 
-    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
     {
@@ -990,12 +963,17 @@ public:
     }
 
     template <typename OtherLibObjT>
-    _ThisCommonEventClass& operator=(const CommonEventClass<OtherLibObjT> eventClass) noexcept
+    CommonEventClass operator=(const CommonEventClass<OtherLibObjT> eventClass) noexcept
     {
         _ThisBorrowedObject::operator=(eventClass);
         return *this;
     }
 
+    CommonEventClass<const bt_event_class> asConst() const noexcept
+    {
+        return CommonEventClass<const bt_event_class> {*this};
+    }
+
     _StreamClass streamClass() const noexcept;
 
     std::uint64_t id() const noexcept
@@ -1005,7 +983,7 @@ public:
 
     void name(const char * const name) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
 
         const auto status = bt_event_class_set_name(this->libObjPtr(), name);
 
@@ -1019,26 +997,20 @@ 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
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
 
         bt_event_class_set_log_level(this->libObjPtr(),
                                      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);
@@ -1047,12 +1019,12 @@ public:
             return static_cast<LogLevel>(libLogLevel);
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     void emfUri(const char * const emfUri) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
 
         const auto status = bt_event_class_set_emf_uri(this->libObjPtr(), emfUri);
 
@@ -1066,20 +1038,14 @@ 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
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
 
         const auto status =
             bt_event_class_set_payload_field_class(this->libObjPtr(), fc.libObjPtr());
@@ -1089,7 +1055,7 @@ public:
         }
     }
 
-    nonstd::optional<_StructureFieldClass> payloadFieldClass() const noexcept
+    bt2s::optional<_StructureFieldClass> payloadFieldClass() const noexcept
     {
         const auto libObjPtr = _Spec::payloadFieldClass(this->libObjPtr());
 
@@ -1097,12 +1063,12 @@ public:
             return _StructureFieldClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     void specificContextFieldClass(const StructureFieldClass fc) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
 
         const auto status =
             bt_event_class_set_specific_context_field_class(this->libObjPtr(), fc.libObjPtr());
@@ -1112,7 +1078,7 @@ public:
         }
     }
 
-    nonstd::optional<_StructureFieldClass> specificContextFieldClass() const noexcept
+    bt2s::optional<_StructureFieldClass> specificContextFieldClass() const noexcept
     {
         const auto libObjPtr = _Spec::specificContextFieldClass(this->libObjPtr());
 
@@ -1120,13 +1086,13 @@ public:
             return _StructureFieldClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     template <typename LibValT>
     void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
 
         bt_event_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
     }
@@ -1284,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}
@@ -1319,15 +1276,21 @@ public:
     }
 
     template <typename OtherLibObjT>
-    _ThisCommonStreamClass& operator=(const CommonStreamClass<OtherLibObjT> streamClass) noexcept
+    CommonStreamClass operator=(const CommonStreamClass<OtherLibObjT> streamClass) noexcept
     {
         _ThisBorrowedObject::operator=(streamClass);
         return *this;
     }
 
+    CommonStreamClass<const bt_stream_class> asConst() const noexcept
+    {
+        return CommonStreamClass<const bt_stream_class> {*this};
+    }
+
     Stream::Shared instantiate(const Trace trace) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         const auto libObjPtr = bt_stream_create(this->libObjPtr(), trace.libObjPtr());
 
@@ -1337,7 +1300,8 @@ public:
 
     Stream::Shared instantiate(const Trace trace, const std::uint64_t id) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         const auto libObjPtr = bt_stream_create_with_id(this->libObjPtr(), trace.libObjPtr(), id);
 
@@ -1347,7 +1311,8 @@ public:
 
     EventClass::Shared createEventClass() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         const auto libObjPtr = bt_event_class_create(this->libObjPtr());
 
@@ -1357,7 +1322,8 @@ public:
 
     EventClass::Shared createEventClass(const std::uint64_t id) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         const auto libObjPtr = bt_event_class_create_with_id(this->libObjPtr(), id);
 
@@ -1374,7 +1340,8 @@ public:
 
     void name(const char * const name) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         const auto status = bt_stream_class_set_name(this->libObjPtr(), name);
 
@@ -1388,20 +1355,15 @@ 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
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         bt_stream_class_set_assigns_automatic_event_class_id(this->libObjPtr(),
                                                              static_cast<bt_bool>(val));
@@ -1415,7 +1377,8 @@ public:
 
     void assignsAutomaticStreamId(const bool val) const noexcept
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         bt_stream_class_set_assigns_automatic_stream_id(this->libObjPtr(),
                                                         static_cast<bt_bool>(val));
@@ -1429,7 +1392,8 @@ public:
     void supportsPackets(const bool supportsPackets, const bool withBeginningDefaultClkSnapshot,
                          const bool withEndDefaultClkSnapshot) const noexcept
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         bt_stream_class_set_supports_packets(this->libObjPtr(),
                                              static_cast<bt_bool>(supportsPackets),
@@ -1457,7 +1421,8 @@ public:
     void supportsDiscardedEvents(const bool supportsDiscardedEvents,
                                  const bool withDefaultClkSnapshots) const noexcept
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         bt_stream_class_set_supports_discarded_events(
             this->libObjPtr(), static_cast<bt_bool>(supportsDiscardedEvents),
@@ -1478,7 +1443,8 @@ public:
     void supportsDiscardedPackets(const bool supportsDiscardedPackets,
                                   const bool withDefaultClkSnapshots) const noexcept
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         bt_stream_class_set_supports_discarded_packets(
             this->libObjPtr(), static_cast<bt_bool>(supportsDiscardedPackets),
@@ -1498,7 +1464,8 @@ public:
 
     void defaultClockClass(const ClockClass clkCls) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         const auto status =
             bt_stream_class_set_default_clock_class(this->libObjPtr(), clkCls.libObjPtr());
@@ -1506,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());
 
@@ -1514,10 +1481,10 @@ public:
             return _ClockClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
-    std::uint64_t size() const noexcept
+    std::uint64_t length() const noexcept
     {
         return bt_stream_class_get_event_class_count(this->libObjPtr());
     }
@@ -1527,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);
 
@@ -1535,12 +1502,13 @@ public:
             return _EventClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     void packetContextFieldClass(const StructureFieldClass fc) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         const auto status =
             bt_stream_class_set_packet_context_field_class(this->libObjPtr(), fc.libObjPtr());
@@ -1550,7 +1518,7 @@ public:
         }
     }
 
-    nonstd::optional<_StructureFieldClass> packetContextFieldClass() const noexcept
+    bt2s::optional<_StructureFieldClass> packetContextFieldClass() const noexcept
     {
         const auto libObjPtr = _Spec::packetContextFieldClass(this->libObjPtr());
 
@@ -1558,12 +1526,13 @@ public:
             return _StructureFieldClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     void eventCommonContextFieldClass(const StructureFieldClass fc) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         const auto status =
             bt_stream_class_set_event_common_context_field_class(this->libObjPtr(), fc.libObjPtr());
@@ -1573,7 +1542,7 @@ public:
         }
     }
 
-    nonstd::optional<_StructureFieldClass> eventCommonContextFieldClass() const noexcept
+    bt2s::optional<_StructureFieldClass> eventCommonContextFieldClass() const noexcept
     {
         const auto libObjPtr = _Spec::eventCommonContextFieldClass(this->libObjPtr());
 
@@ -1581,13 +1550,14 @@ public:
             return _StructureFieldClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     template <typename LibValT>
     void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
 
         bt_stream_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
     }
@@ -1710,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}
     {
@@ -1733,15 +1699,20 @@ public:
     }
 
     template <typename OtherLibObjT>
-    _ThisCommonTraceClass& operator=(const CommonTraceClass<OtherLibObjT> traceClass) noexcept
+    CommonTraceClass operator=(const CommonTraceClass<OtherLibObjT> traceClass) noexcept
     {
         _ThisBorrowedObject::operator=(traceClass);
         return *this;
     }
 
+    CommonTraceClass<const bt_trace_class> asConst() const noexcept
+    {
+        return CommonTraceClass<const bt_trace_class> {*this};
+    }
+
     Trace::Shared instantiate() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_trace_create(this->libObjPtr());
 
@@ -1751,7 +1722,7 @@ public:
 
     StreamClass::Shared createStreamClass() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_stream_class_create(this->libObjPtr());
 
@@ -1761,7 +1732,7 @@ public:
 
     StreamClass::Shared createStreamClass(const std::uint64_t id) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_stream_class_create_with_id(this->libObjPtr(), id);
 
@@ -1771,7 +1742,7 @@ public:
 
     FieldClass::Shared createBoolFieldClass() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_bool_create(this->libObjPtr());
 
@@ -1781,7 +1752,7 @@ public:
 
     BitArrayFieldClass::Shared createBitArrayFieldClass(const std::uint64_t length) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_bit_array_create(this->libObjPtr(), length);
 
@@ -1791,7 +1762,7 @@ public:
 
     IntegerFieldClass::Shared createUnsignedIntegerFieldClass() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_integer_unsigned_create(this->libObjPtr());
 
@@ -1801,7 +1772,7 @@ public:
 
     IntegerFieldClass::Shared createSignedIntegerFieldClass() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_integer_signed_create(this->libObjPtr());
 
@@ -1811,7 +1782,7 @@ public:
 
     UnsignedEnumerationFieldClass::Shared createUnsignedEnumerationFieldClass() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_enumeration_unsigned_create(this->libObjPtr());
 
@@ -1821,7 +1792,7 @@ public:
 
     SignedEnumerationFieldClass::Shared createSignedEnumerationFieldClass() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_enumeration_signed_create(this->libObjPtr());
 
@@ -1831,7 +1802,7 @@ public:
 
     FieldClass::Shared createSinglePrecisionRealFieldClass() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_real_single_precision_create(this->libObjPtr());
 
@@ -1841,7 +1812,7 @@ public:
 
     FieldClass::Shared createDoublePrecisionRealFieldClass() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_real_double_precision_create(this->libObjPtr());
 
@@ -1851,7 +1822,7 @@ public:
 
     FieldClass::Shared createStringFieldClass() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_string_create(this->libObjPtr());
 
@@ -1862,7 +1833,7 @@ public:
     StaticArrayFieldClass::Shared createStaticArrayFieldClass(const FieldClass elementFieldClass,
                                                               const std::uint64_t length) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_array_static_create(
             this->libObjPtr(), elementFieldClass.libObjPtr(), length);
@@ -1873,7 +1844,7 @@ public:
 
     ArrayFieldClass::Shared createDynamicArrayFieldClass(const FieldClass elementFieldClass) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_array_dynamic_create(
             this->libObjPtr(), elementFieldClass.libObjPtr(), nullptr);
@@ -1886,7 +1857,7 @@ public:
     createDynamicArrayFieldClass(const FieldClass elementFieldClass,
                                  const IntegerFieldClass lengthFieldClass) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_array_dynamic_create(
             this->libObjPtr(), elementFieldClass.libObjPtr(), lengthFieldClass.libObjPtr());
@@ -1897,7 +1868,7 @@ public:
 
     StructureFieldClass::Shared createStructureFieldClass() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_structure_create(this->libObjPtr());
 
@@ -1907,7 +1878,7 @@ public:
 
     OptionFieldClass::Shared createOptionFieldClass(const FieldClass optionalFieldClass) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_option_without_selector_create(
             this->libObjPtr(), optionalFieldClass.libObjPtr());
@@ -1920,7 +1891,7 @@ public:
     createOptionWithBoolSelectorFieldClass(const FieldClass optionalFieldClass,
                                            const FieldClass selectorFieldClass) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_option_with_selector_field_bool_create(
             this->libObjPtr(), optionalFieldClass.libObjPtr(), selectorFieldClass.libObjPtr());
@@ -1934,7 +1905,7 @@ public:
         const FieldClass optionalFieldClass, const IntegerFieldClass selectorFieldClass,
         const ConstUnsignedIntegerRangeSet ranges) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_option_with_selector_field_integer_unsigned_create(
             this->libObjPtr(), optionalFieldClass.libObjPtr(), selectorFieldClass.libObjPtr(),
@@ -1949,7 +1920,7 @@ public:
                                                     const IntegerFieldClass selectorFieldClass,
                                                     const ConstSignedIntegerRangeSet ranges) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_option_with_selector_field_integer_signed_create(
             this->libObjPtr(), optionalFieldClass.libObjPtr(), selectorFieldClass.libObjPtr(),
@@ -1961,7 +1932,7 @@ public:
 
     VariantWithoutSelectorFieldClass::Shared createVariantFieldClass() const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr = bt_field_class_variant_create(this->libObjPtr(), nullptr);
 
@@ -1987,7 +1958,7 @@ public:
 
     void assignsAutomaticStreamClassId(const bool val) const noexcept
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         bt_trace_class_set_assigns_automatic_stream_class_id(this->libObjPtr(),
                                                              static_cast<bt_bool>(val));
@@ -1999,7 +1970,7 @@ public:
             bt_trace_class_assigns_automatic_stream_class_id(this->libObjPtr()));
     }
 
-    std::uint64_t size() const noexcept
+    std::uint64_t length() const noexcept
     {
         return bt_trace_class_get_stream_class_count(this->libObjPtr());
     }
@@ -2009,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);
 
@@ -2017,13 +1988,13 @@ public:
             return _StreamClass {libObjPtr};
         }
 
-        return nonstd::nullopt;
+        return bt2s::nullopt;
     }
 
     template <typename LibValT>
     void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         bt_trace_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
     }
@@ -2043,7 +2014,7 @@ private:
     typename ObjT::Shared
     _createVariantWithIntegerSelectorFieldClass(const IntegerFieldClass selectorFieldClass) const
     {
-        static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
 
         const auto libObjPtr =
             bt_field_class_variant_create(this->libObjPtr(), selectorFieldClass.libObjPtr());
This page took 0.040942 seconds and 4 git commands to generate.