@@ -39,6 +39,27 @@ class closed_channel : public std::runtime_error {
3939template <typename T>
4040using default_storage = queue_storage<T>;
4141
42+ /* *
43+ * @brief Trait to check if a type is supported by msd::channel.
44+ *
45+ * This trait ensures the type meets all requirements to be safely used
46+ * within the channel:
47+ * - Default constructible: must be able to create a default instance.
48+ * - Move constructible: must be movable to allow efficient element transfer.
49+ * - Move assignable: must support move assignment for storage management.
50+ * - Destructible: must have a valid destructor.
51+ *
52+ * @tparam T The type to check.
53+ */
54+ template <typename T>
55+ struct is_supported_type {
56+ /* *
57+ * @brief Indicates if the type meets all channel requirements.
58+ */
59+ static constexpr bool value = std::is_default_constructible<T>::value && std::is_move_constructible<T>::value &&
60+ std::is_move_assignable<T>::value && std::is_destructible<T>::value;
61+ };
62+ 4263/* *
4364 * @brief Trait to check if a storage type has a static **capacity** member.
4465 */
@@ -65,6 +86,8 @@ struct is_static_storage<Storage, decltype((void)Storage::capacity, void())> : s
6586template <typename T, typename Storage = default_storage<T>>
6687class channel {
6788 public:
89+ static_assert (is_supported_type<T>::value, " Type T does not meet all requirements." );
90+ 6891 /* *
6992 * @brief The type of elements stored in the channel.
7093 */
0 commit comments