| 89 | |
| 90 | template <typename T> |
| 91 | constexpr std::size_t alignment_impl() { |
| 92 | if constexpr (struct_pack::detail::is_compatible_v<T>) { |
| 93 | return 0; |
| 94 | } |
| 95 | else if constexpr (struct_pack::alignment_v<T> == 0 && |
| 96 | struct_pack::pack_alignment_v<T> == 0) { |
| 97 | return default_alignment_v<T>; |
| 98 | } |
| 99 | else if constexpr (struct_pack::alignment_v<T> != 0) { |
| 100 | if constexpr (is_trivial_serializable<T>::value) { |
| 101 | static_assert(default_alignment_v<T> == alignment_v<T>); |
| 102 | } |
| 103 | constexpr auto ret = struct_pack::alignment_v<T>; |
| 104 | static_assert( |
| 105 | [](std::size_t align) constexpr { |
| 106 | while (align % 2 == 0) { |
| 107 | align /= 2; |
| 108 | } |
| 109 | return align == 1; |
| 110 | }(ret), |
| 111 | "alignment should be power of 2"); |
| 112 | return ret; |
| 113 | } |
| 114 | else { |
| 115 | if constexpr (is_trivial_serializable<T>::value) { |
| 116 | return default_alignment_v<T>; |
| 117 | } |
| 118 | else { |
| 119 | return pack_alignment_v<T>; |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | template <typename P, typename T, std::size_t I> |
| 124 | struct calculate_trival_obj_size { |
| 125 | constexpr void operator()(std::size_t &total); |
nothing calls this directly
no outgoing calls
no test coverage detected