+private:
+ /*
+ * Provides `val` which indicates whether or not you can assign this
+ * object from a borrowed object of type `OtherLibObjT`.
+ */
+ template <typename OtherLibObjT>
+ struct _AssignableFromConst final
+ {
+ /*
+ * If `LibObjT` is const (for example, `const bt_value`), then
+ * you may always assign from its non-const equivalent (for
+ * example, `bt_value`). In C (correct):
+ *
+ * bt_value * const meow = bt_value_bool_create_init(BT_TRUE);
+ * const bt_value * const mix = meow;
+ *
+ * If `LibObjT` is non-const, then you may not assign from its
+ * const equivalent. In C (not correct):
+ *
+ * const bt_value * const meow =
+ * bt_value_array_borrow_element_by_index_const(some_val, 17);
+ * bt_value * const mix = meow;
+ */
+ static constexpr bool val =
+ std::is_const<LibObjT>::value || !std::is_const<OtherLibObjT>::value;
+ };
+