|
16 | 16 |
|
17 | 17 | namespace o2 |
18 | 18 | { |
| 19 | + |
19 | 20 | namespace header |
20 | 21 | { |
21 | 22 | //__________________________________________________________________________________________________ |
@@ -103,7 +104,11 @@ struct Stack { |
103 | 104 | bufferSize{calculateSize(std::forward<Headers>(headers)...)}, |
104 | 105 | buffer{static_cast<std::byte*>(allocator.resource()->allocate(bufferSize, alignof(std::max_align_t))), freeobj{allocator.resource()}} |
105 | 106 | { |
106 | | - inject(buffer.get(), std::forward<Headers>(headers)...); |
| 107 | + if constexpr (sizeof...(headers) > 1) { |
| 108 | + injectAll(buffer.get(), std::forward<Headers>(headers)...); |
| 109 | + } else if (sizeof...(headers) == 1) { |
| 110 | + injectBool(buffer.get(), std::forward<Headers>(headers)..., false); |
| 111 | + } |
107 | 112 | } |
108 | 113 |
|
109 | 114 | //______________________________________________________________________________________________ |
@@ -144,7 +149,7 @@ struct Stack { |
144 | 149 |
|
145 | 150 | //______________________________________________________________________________________________ |
146 | 151 | template <typename T> |
147 | | - static std::byte* inject(std::byte* here, T&& h, bool more = false) noexcept |
| 152 | + static std::byte* injectBool(std::byte* here, T&& h, bool more) noexcept |
148 | 153 | { |
149 | 154 | using headerType = typename std::remove_cv<typename std::remove_reference<T>::type>::type; |
150 | 155 | if (here == nullptr) { |
@@ -189,11 +194,15 @@ struct Stack { |
189 | 194 |
|
190 | 195 | //______________________________________________________________________________________________ |
191 | 196 | template <typename T, typename... Args> |
192 | | - static std::byte* inject(std::byte* here, T&& h, Args&&... args) noexcept |
| 197 | + static std::byte* injectAll(std::byte* here, T&& h, Args&&... args) noexcept |
193 | 198 | { |
194 | 199 | bool more = hasNonEmptyArg(args...); |
195 | | - auto alsohere = inject(here, h, more); |
196 | | - return inject(alsohere, args...); |
| 200 | + auto alsohere = injectBool(here, h, more); |
| 201 | + if constexpr (sizeof...(args) > 1) { |
| 202 | + return injectAll(alsohere, args...); |
| 203 | + } else { |
| 204 | + return injectBool(alsohere, args..., false); |
| 205 | + } |
197 | 206 | } |
198 | 207 |
|
199 | 208 | //______________________________________________________________________________________________ |
|
0 commit comments