50namespace multibuf::internal {
57constexpr bool PropertiesAreInOrderWithoutDuplicates() {
61constexpr bool PropertiesAreInOrderWithoutDuplicates() {
62 return (kLhs < kRhs) &&
63 PropertiesAreInOrderWithoutDuplicates<kRhs, kOthers...>();
69constexpr bool PropertiesAreValid() {
70 if constexpr (
sizeof...(kProperties) != 0) {
71 static_assert(PropertiesAreInOrderWithoutDuplicates<kProperties...>(),
72 "Properties must be specified in the following order, "
73 "without duplicates: kConst, kLayerable, kObservable");
88template <
typename From,
typename To>
89using EnableIfConvertible =
90 std::enable_if_t<std::is_same_v<To, GenericMultiBuf> ||
94 (!From::is_const() || To::is_const()) &&
96 (From::is_layerable() || !To::is_layerable()) &&
99 (From::is_observable() || !To::is_observable()))>;
103template <
typename From,
typename To>
104static constexpr void AssertIsConvertible() {
105 if constexpr (!std::is_same_v<To, GenericMultiBuf>) {
107 "Only conversion to other MultiBuf types are supported.");
108 static_assert(!From::is_const() || To::is_const(),
109 "Read-only data cannot be converted to mutable data.");
110 static_assert(From::is_layerable() || !To::is_layerable(),
111 "Flat MultiBufs do not have layer-related methods.");
112 static_assert(From::is_observable() || !To::is_observable(),
113 "Untracked MultiBufs do not have observer-related methods.");
Definition: multibuf_v2.h:185
Property
Basic properties of a MultiBuf.
Definition: properties.h:25
The Pigweed namespace.
Definition: alignment.h:27
Type trait to identify MultiBuf types.
Definition: properties.h:80