HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
unicode_line_break.hpp
Go to the documentation of this file.
1// Copyright Take Vos 2022.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
8#pragma once
9
10#include "unicode_break_opportunity.hpp"
11#include "ucd_general_categories.hpp"
12#include "ucd_grapheme_cluster_breaks.hpp"
13#include "ucd_line_break_classes.hpp"
14#include "ucd_east_asian_widths.hpp"
15#include "../utility/utility.hpp"
16#include "../macros.hpp"
17#include <cstdint>
18#include <vector>
19#include <algorithm>
20#include <numeric>
21
22hi_export_module(hikogui.unicode.unicode_line_break);
23
24
25hi_export namespace hi::inline v1 {
26namespace detail {
27
31 unicode_line_break_class original_class = unicode_line_break_class::XX;
32 unicode_line_break_class current_class = unicode_line_break_class::XX;
33 bool is_extended_pictographic = false;
34 bool is_Cn = false;
35 unicode_east_asian_width east_asian_width = unicode_east_asian_width::A;
36
37 constexpr unicode_line_break_info() noexcept = default;
38 constexpr unicode_line_break_info(unicode_line_break_info const&) noexcept = default;
39 constexpr unicode_line_break_info(unicode_line_break_info&&) noexcept = default;
40 constexpr unicode_line_break_info& operator=(unicode_line_break_info const&) noexcept = default;
41 constexpr unicode_line_break_info& operator=(unicode_line_break_info&&) noexcept = default;
42
43 constexpr explicit unicode_line_break_info(
44 unicode_line_break_class break_class,
45 bool is_Cn,
46 bool is_extended_pictographic,
47 unicode_east_asian_width east_asian_width) noexcept :
48 original_class(break_class),
49 current_class(break_class),
50 is_Cn(is_Cn),
51 is_extended_pictographic(is_extended_pictographic),
52 east_asian_width(east_asian_width)
53 {
54 }
55
56 constexpr explicit operator unicode_line_break_class() const noexcept
57 {
58 return current_class;
59 }
60
61 constexpr unicode_line_break_info& operator|=(unicode_line_break_class rhs) noexcept
62 {
63 current_class = rhs;
64 return *this;
65 }
66
67 [[nodiscard]] constexpr bool operator==(unicode_line_break_class rhs) const noexcept
68 {
69 return current_class == rhs;
70 }
71
72 [[nodiscard]] constexpr bool operator==(unicode_east_asian_width rhs) const noexcept
73 {
74 return east_asian_width == rhs;
75 }
76};
77
79using unicode_line_break_info_iterator = unicode_line_break_info_vector::iterator;
80using unicode_line_break_info_const_iterator = unicode_line_break_info_vector::const_iterator;
81
82template<typename It, typename ItEnd, typename CodePointFunc>
83[[nodiscard]] constexpr std::vector<unicode_line_break_info>
84unicode_LB1(It first, ItEnd last, CodePointFunc const& code_point_func) noexcept
85{
87 r.reserve(std::distance(first, last));
88
89 for (auto it = first; it != last; ++it) {
90 auto const code_point = code_point_func(*it);
91 auto const east_asian_width = ucd_get_east_asian_width(code_point);
92 auto const break_class = ucd_get_line_break_class(code_point);
93 auto const general_category = ucd_get_general_category(code_point);
94 auto const grapheme_cluster_break = ucd_get_grapheme_cluster_break(code_point);
95
96 auto const resolved_break_class = [&]() {
97 switch (break_class) {
98 using enum unicode_line_break_class;
99 case AI:
100 case SG:
101 case XX:
102 return AL;
103 case CJ:
104 return NS;
105 case SA:
106 return is_Mn_or_Mc(general_category) ? CM : AL;
107 default:
108 return break_class;
109 }
110 }();
111
112 r.emplace_back(
113 resolved_break_class,
114 general_category == unicode_general_category::Cn,
115 grapheme_cluster_break == unicode_grapheme_cluster_break::Extended_Pictographic,
116 east_asian_width);
117 }
118
119 return r;
120}
121
122constexpr void unicode_LB2_3(unicode_break_vector& opportunities) noexcept
123{
124 hi_axiom(not opportunities.empty());
125 // LB2
126 opportunities.front() = unicode_break_opportunity::no;
127 // LB3
128 opportunities.back() = unicode_break_opportunity::mandatory;
129}
130
131template<typename MatchFunc>
132constexpr void unicode_LB_walk(
133 unicode_break_vector& opportunities,
135 MatchFunc match_func) noexcept
136{
137 using enum unicode_line_break_class;
138
139 if (infos.empty()) {
140 return;
141 }
142
143 auto cur = infos.begin();
144 auto const last = infos.end() - 1;
145 auto const last2 = infos.end();
146 auto opportunity = opportunities.begin() + 1;
147
148 auto cur_sp_class = XX;
149 auto cur_nu_class = XX;
150 auto prev_class = XX;
151 auto num_ri = 0_uz;
152 while (cur != last) {
153 auto const next = cur + 1;
154 auto const cur_class = unicode_line_break_class{*cur};
155 auto const next2_class = cur + 2 == last2 ? XX : unicode_line_break_class{*(cur + 2)};
156
157 // Keep track of classes followed by zero or more SP.
158 if (cur_class != SP) {
159 cur_sp_class = cur_class;
160 }
161
162 // Keep track of a "NU (NU|SY|IS)*" and "NU (NU|SY|IS)* (CL|CP)?".
163 if (cur_nu_class == CL) {
164 // Only a single CL|CP class may be at the end, then the number is closed.
165 cur_nu_class = XX;
166 } else if (cur_nu_class == NU) {
167 if (cur_class == CL or cur_class == CP) {
168 cur_nu_class = CL;
169 } else if (cur_class != NU and cur_class != SY and cur_class != IS) {
170 cur_nu_class = XX;
171 }
172 } else if (cur_class == NU) {
173 cur_nu_class = NU;
174 }
175
176 // Keep track of consecutive RI, but only count the actual RIs.
177 if (cur->original_class == RI) {
178 ++num_ri;
179 } else if (*cur != RI) {
180 num_ri = 0;
181 }
182
183 if (*opportunity == unicode_break_opportunity::unassigned) {
184 *opportunity = match_func(prev_class, cur, next, next2_class, cur_sp_class, cur_nu_class, num_ri);
185 }
186
187 prev_class = cur_class;
188 cur = next;
189 ++opportunity;
190 }
191}
192
193constexpr void unicode_LB4_8a(unicode_break_vector& opportunities, std::vector<unicode_line_break_info> const& infos) noexcept
194{
195 unicode_LB_walk(
196 opportunities, infos, [](auto const prev, auto const cur, auto const next, auto const next2, auto const cur_sp, auto const cur_nu, auto const num_ri) {
197 using enum unicode_break_opportunity;
198 using enum unicode_line_break_class;
199 if (*cur == BK) {
200 return mandatory; // LB4: 4.0
201 } else if (*cur == CR and *next == LF) {
202 return no; // LB5: 5.01
203 } else if (*cur == CR or *cur == LF or *cur == NL) {
204 return mandatory; // LB5: 5.02, 5.03, 5.04
205 } else if (*next == BK or *next == CR or *next == LF or *next == NL) {
206 return no; // LB6: 6.0
207 } else if (*next == SP or *next == ZW) {
208 return no; // LB7: 7.01, 7.02
209 } else if (cur_sp == ZW) {
210 return yes; // LB8: 8.0
211 } else if (*cur == ZWJ) {
212 return no; // LB8a: 8.1
213 } else {
214 return unassigned;
215 }
216 });
217}
218
219constexpr void unicode_LB9(unicode_break_vector& opportunities, std::vector<unicode_line_break_info>& infos) noexcept
220{
221 using enum unicode_line_break_class;
222 using enum unicode_break_opportunity;
223
224 if (infos.empty()) {
225 return;
226 }
227
228 auto cur = infos.begin();
229 auto const last = infos.end() - 1;
230 auto opportunity = opportunities.begin() + 1;
231
232 auto X = XX;
233 while (cur != last) {
234 auto const next = cur + 1;
235
236 if ((*cur == CM or *cur == ZWJ) and X != XX) {
237 // Treat all CM/ZWJ as X (if there is an X).
238 *cur |= X;
239 } else {
240 // Reset X on non-CM/ZWJ.
241 X = XX;
242 }
243
244 if ((*cur != BK and *cur != CR and *cur != LF and *cur != NL and *cur != SP and *cur != ZW) and
245 (*next == CM or *next == ZWJ)) {
246 // [^BK CR LF NL SP ZW] x [CM ZWJ]*
247 *opportunity = no;
248
249 if (X == XX) {
250 // The first character of [^BK CR LF NL SP ZW] x [CM ZWJ]* => X
251 X = static_cast<unicode_line_break_class>(*cur);
252 }
253 }
254
255 cur = next;
256 ++opportunity;
257 }
258}
259
260constexpr void unicode_LB10(std::vector<unicode_line_break_info>& infos) noexcept
261{
262 using enum unicode_line_break_class;
263
264 for (auto& x : infos) {
265 if (x == CM or x == ZWJ) {
266 x |= AL;
267 }
268 }
269}
270
271constexpr void unicode_LB11_31(unicode_break_vector& opportunities, std::vector<unicode_line_break_info> const& infos) noexcept
272{
273 unicode_LB_walk(
274 opportunities, infos, [&](auto const prev, auto const cur, auto const next, auto const next2, auto const cur_sp, auto const cur_nu, auto const num_ri) {
275 using enum unicode_break_opportunity;
276 using enum unicode_line_break_class;
277 using enum unicode_east_asian_width;
278
279 if (*cur == WJ or *next == WJ) {
280 return no; // LB11: 11.01, 11.02
281 } else if (*cur == GL) {
282 return no; // LB12: 12.0
283 } else if (*cur != SP and *cur != BA and *cur != HY and *next == GL) {
284 return no; // LB12a: 12.1
285 } else if (*next == CL or *next == CP or *next == EX or *next == IS or *next == SY) {
286 return no; // LB13: 13.0
287 } else if (cur_sp == OP) {
288 return no; // LB14: 14.0
289 } else if (cur_sp == QU and *next == OP) {
290 return no; // LB15: 15.0
291 } else if ((cur_sp == CL or cur_sp == CP) and *next == NS) {
292 return no; // LB16: 16.0
293 } else if (cur_sp == B2 and *next == B2) {
294 return no; // LB17: 17.0
295 } else if (*cur == SP) {
296 return yes; // LB18: 18.0
297 } else if (*cur == QU or *next == QU) {
298 return no; // LB19: 19.01, 19.02
299 } else if (*cur == CB or *next == CB) {
300 return yes; // LB20: 20.01, 20.02
301 } else if (*cur == BB or *next == BA or *next == HY or *next == NS) {
302 return no; // LB21: 21.01, 21.02, 21.03, 21.04
303 } else if (prev == HL and (*cur == HY or *cur == BA)) {
304 return no; // LB21a: 21.1
305 } else if (*cur == SY and *next == HL) {
306 return no; // LB21b: 21.2
307 } else if (*next == IN) {
308 return no; // LB22: 22.0
309 } else if ((*cur == AL or *cur == HL) and *next == NU) {
310 return no; // LB23: 23.02
311 } else if (*cur == NU and (*next == AL or *next == HL)) {
312 return no; // LB23: 23.03
313 } else if (*cur == PR and (*next == ID or *next == EB or *next == EM)) {
314 return no; // LB23a: 23.12
315 } else if ((*cur == ID or *cur == EB or *cur == EM) and *next == PO) {
316 return no; // LB23a: 23.13
317 } else if ((*cur == PR or *cur == PO) and (*next == AL or *next == HL)) {
318 return no; // LB24: 24.02
319 } else if ((*cur == AL or *cur == HL) and (*next == PR or *next == PO)) {
320 return no; // LB24: 24.03
321 } else if (
322 (*cur == PR or *cur == PO) and ((*next == OP and next2 == NU) or (*next == HY and next2 == NU) or *next == NU)) {
323 return no; // LB25: 25.01
324 } else if ((*cur == OP or *cur == HY) and *next == NU) {
325 return no; // LB25: 25.02
326 } else if (*cur == NU and (*next == NU or *next == SY or *next == IS)) {
327 return no; // LB25: 25.03
328 } else if (cur_nu == NU and (*next == NU or *next == SY or *next == IS or *next == CL or *next == CP)) {
329 return no; // LB25: 25.04
330 } else if ((cur_nu == NU or cur_nu == CL) and (*next == PO or *next == PR)) {
331 return no; // LB25: 25.05
332 } else if (*cur == JL and (*next == JL or *next == JV or *next == H2 or *next == H3)) {
333 return no; // LB26: 26.01
334 } else if ((*cur == JV or *cur == H2) and (*next == JV or *next == JT)) {
335 return no; // LB26: 26.02
336 } else if ((*cur == JT or *cur == H3) and *next == JT) {
337 return no; // LB26: 26.03
338 } else if ((*cur == JL or *cur == JV or *cur == JT or *cur == H2 or *cur == H3) and *next == PO) {
339 return no; // LB27: 27.01
340 } else if (*cur == PR and (*next == JL or *next == JV or *next == JT or *next == H2 or *next == H3)) {
341 return no; // LB27: 27.02
342 } else if ((*cur == AL or *cur == HL) and (*next == AL or *next == HL)) {
343 return no; // LB28: 28.0
344 } else if (*cur == IS and (*next == AL or *next == HL)) {
345 return no; // LB29: 29.0
346 } else if ((*cur == AL or *cur == HL or *cur == NU) and (*next == OP and *next != F and *next != W and *next != H)) {
347 return no; // LB30: 30.01
348 } else if ((*cur == CP and *cur != F and *cur != W and *cur != H) and (*next == AL or *next == HL or *next == NU)) {
349 return no; // LB30: 30.02
350 } else if (*cur == RI and *next == RI and (num_ri % 2) == 1) {
351 return no; // LB30a: 30.11, 30.12, 30.13
352 } else if (*cur == EB and *next == EM) {
353 return no; // LB30b: 30.21
354 } else if (cur->is_extended_pictographic and cur->is_Cn and *next == EM) {
355 return no; // LB30b: 30.22
356 } else {
357 return yes; // LB31: 999.0
358 }
359 });
360}
361
368[[nodiscard]] constexpr float
369unicode_LB_width(std::vector<float>::const_iterator first, std::vector<float>::const_iterator last) noexcept
370{
371 if (first == last) {
372 return 0.0f;
373 }
374
375 auto rfirst = std::make_reverse_iterator(last);
376 auto rlast = std::make_reverse_iterator(first);
377
378 auto it = std::find_if(rfirst, rlast, [](auto const& width) {
379 return width >= 0.0;
380 });
381 return std::accumulate(it, rlast, 0.0f, [](float acc, auto const& width) {
382 return acc + abs(width);
383 });
384}
385
392[[nodiscard]] constexpr float unicode_LB_width(std::vector<float> const& widths, std::vector<size_t> const& lengths)
393{
394 auto max_width = 0.0f;
395 auto it = widths.begin();
396 for (auto length : lengths) {
397 inplace_max(max_width, unicode_LB_width(it, it + length));
398 it += length;
399 }
400 return max_width;
401}
402
410[[nodiscard]] constexpr bool
411unicode_LB_width_check(std::vector<float> const& widths, std::vector<size_t> const& lengths, float maximum_line_width) noexcept
412{
413 auto it = widths.begin();
414 for (auto length : lengths) {
415 if (unicode_LB_width(it, it + length) > maximum_line_width) {
416 return false;
417 }
418 it += length;
419 }
420 return true;
421}
422
427[[nodiscard]] constexpr std::vector<size_t> unicode_LB_mandatory_lines(unicode_break_vector const& opportunities) noexcept
428{
429 auto r = std::vector<size_t>{};
430
431 auto length = 0_uz;
432 for (auto it = opportunities.begin() + 1; it != opportunities.end(); ++it) {
433 ++length;
434 if (*it == unicode_break_opportunity::mandatory) {
435 r.push_back(length);
436 length = 0_uz;
437 }
438 }
439
440 return r;
441}
442
447[[nodiscard]] constexpr std::vector<size_t> unicode_LB_optional_lines(unicode_break_vector const& opportunities) noexcept
448{
449 auto r = std::vector<size_t>{};
450
451 auto length = 0_uz;
452 for (auto it = opportunities.begin() + 1; it != opportunities.end(); ++it) {
453 ++length;
454 if (*it != unicode_break_opportunity::no) {
455 r.push_back(length);
456 length = 0_uz;
457 }
458 }
459
460 return r;
461}
462
463[[nodiscard]] constexpr unicode_break_const_iterator unicode_LB_fast_fit_line(
464 unicode_break_const_iterator opportunity_it,
465 std::vector<float>::const_iterator width_it,
466 float maximum_line_width) noexcept
467{
468 using enum unicode_break_opportunity;
469
470 auto width = 0.0f;
471 auto end_of_line = opportunity_it;
472 while (true) {
473 width += abs(*width_it);
474 if (width > maximum_line_width) {
475 // This character makes the width too long.
476 return end_of_line;
477
478 } else if (*opportunity_it == mandatory) {
479 // This character is an end-of-line.
480 return opportunity_it;
481
482 } else if (*opportunity_it == yes) {
483 // This character is a valid break opportunity.
484 end_of_line = opportunity_it;
485 }
486
487 ++opportunity_it;
488 ++width_it;
489 }
490 std::unreachable();
491}
492
493[[nodiscard]] constexpr unicode_break_const_iterator unicode_LB_slow_fit_line(
494 unicode_break_const_iterator first,
495 unicode_break_const_iterator end_of_line,
496 std::vector<float>::const_iterator first_width,
497 float maximum_line_width) noexcept
498{
499 using enum unicode_break_opportunity;
500
501 // Carefully look forward for a break opportunity.
502 auto it = end_of_line;
503 while (true) {
504 auto const num_characters = std::distance(first, it + 1);
505 auto const line_width = unicode_LB_width(first_width, first_width + num_characters);
506
507 if (line_width <= maximum_line_width) {
508 if (*it == mandatory) {
509 // The next mandatory break fits in the maximum width.
510 return it;
511
512 } else if (*it == yes) {
513 // The next break opportunity fits in the maximum width.
514 end_of_line = it;
515 }
516 } else {
517 // This break opportunity doesn't fit within the maximum width. Use the previous break opportunity.
518 return end_of_line;
519 }
520
521 ++it;
522 }
523 std::unreachable();
524}
525
526[[nodiscard]] constexpr unicode_break_const_iterator
527unicode_LB_finish_fit_line(unicode_break_const_iterator first, unicode_break_const_iterator end_of_line) noexcept
528{
529 if (first == end_of_line) {
530 // We couldn't break the line to fit the maximum line width.
531 while (*end_of_line == unicode_break_opportunity::no) {
532 ++end_of_line;
533 }
534 }
535
536 // Return iterator past the end-of-line.
537 return end_of_line + 1;
538}
539
545 unicode_break_vector const& opportunities,
546 std::vector<float> const& widths,
547 float maximum_line_width) noexcept
548{
549 using enum unicode_break_opportunity;
550
551 auto r = std::vector<size_t>{};
552 if (widths.empty()) {
553 return r;
554 }
555
556 auto opportunity_it = opportunities.begin() + 1;
557 auto width_it = widths.begin();
558 while (width_it != widths.end()) {
559 // First quickly find when the line is too long.
560 auto opportunity_eol = unicode_LB_fast_fit_line(opportunity_it, width_it, maximum_line_width);
561 opportunity_eol = unicode_LB_slow_fit_line(opportunity_it, opportunity_eol, width_it, maximum_line_width);
562 opportunity_eol = unicode_LB_finish_fit_line(opportunity_it, opportunity_eol);
563
564 auto const num_characters = std::distance(opportunity_it, opportunity_eol);
565 r.push_back(num_characters);
566 opportunity_it += num_characters;
567 width_it += num_characters;
568 }
569
570 return r;
571}
572
581[[nodiscard]] constexpr std::pair<float, std::vector<size_t>>
582unicode_LB_maximum_width(unicode_break_vector const& opportunities, std::vector<float> const& char_widths)
583{
584 auto line_lengths = detail::unicode_LB_mandatory_lines(opportunities);
585 auto const width = detail::unicode_LB_width(char_widths, line_lengths);
586 return {width, std::move(line_lengths)};
587}
588
597[[nodiscard]] constexpr std::pair<float, std::vector<size_t>>
598unicode_LB_minimum_width(unicode_break_vector const& opportunities, std::vector<float> const& char_widths)
599{
600 auto line_lengths = detail::unicode_LB_optional_lines(opportunities);
601 auto const width = detail::unicode_LB_width(char_widths, line_lengths);
602 return {width, std::move(line_lengths)};
603}
604
614[[nodiscard]] constexpr std::pair<float, std::vector<size_t>>
615unicode_LB_width(unicode_break_vector const& opportunities, std::vector<float> const& char_widths, float maximum_line_width)
616{
617 auto line_lengths = detail::unicode_LB_fit_lines(opportunities, char_widths, maximum_line_width);
618 auto const width = detail::unicode_LB_width(char_widths, line_lengths);
619 return {width, std::move(line_lengths)};
620}
621
622} // namespace detail
623
631template<typename It, typename ItEnd, typename CodePointFunc>
632[[nodiscard]] inline unicode_break_vector
633unicode_line_break(It first, ItEnd last, CodePointFunc const& code_point_func) noexcept
634{
635 auto size = narrow_cast<size_t>(std::distance(first, last));
636 auto r = unicode_break_vector{size + 1, unicode_break_opportunity::unassigned};
637
638 auto infos = detail::unicode_LB1(first, last, code_point_func);
639 detail::unicode_LB2_3(r);
640 detail::unicode_LB4_8a(r, infos);
641 detail::unicode_LB9(r, infos);
642 detail::unicode_LB10(infos);
643 detail::unicode_LB11_31(r, infos);
644 return r;
645}
646
654[[nodiscard]] constexpr std::vector<size_t>
655unicode_line_break(unicode_break_vector const& opportunities, std::vector<float> const& widths, float maximum_line_width)
656{
657 // See if the lines after mandatory breaks will fit the width and return.
658 auto r = detail::unicode_LB_mandatory_lines(opportunities);
659 if (detail::unicode_LB_width_check(widths, r, maximum_line_width)) {
660 return r;
661 }
662
663 r = detail::unicode_LB_fit_lines(opportunities, widths, maximum_line_width);
664 hi_axiom(detail::unicode_LB_width_check(widths, r, maximum_line_width));
665 return r;
666}
667
668
669} // namespace hi::inline v1
constexpr float unicode_LB_width(std::vector< float >::const_iterator first, std::vector< float >::const_iterator last) noexcept
Calculate the width of a line.
Definition unicode_line_break.hpp:369
constexpr std::vector< size_t > unicode_LB_mandatory_lines(unicode_break_vector const &opportunities) noexcept
Get the length of each line when broken with mandatory breaks.
Definition unicode_line_break.hpp:427
constexpr std::vector< size_t > unicode_LB_optional_lines(unicode_break_vector const &opportunities) noexcept
Get the length of each line when broken with mandatory and optional breaks.
Definition unicode_line_break.hpp:447
constexpr std::pair< float, std::vector< size_t > > unicode_LB_minimum_width(unicode_break_vector const &opportunities, std::vector< float > const &char_widths)
Get the minimum width of the text.
Definition unicode_line_break.hpp:598
constexpr std::pair< float, std::vector< size_t > > unicode_LB_maximum_width(unicode_break_vector const &opportunities, std::vector< float > const &char_widths)
Get the maximum width of the text.
Definition unicode_line_break.hpp:582
constexpr std::vector< size_t > unicode_LB_fit_lines(unicode_break_vector const &opportunities, std::vector< float > const &widths, float maximum_line_width) noexcept
Get the length of each line when broken after folding text to a maximum width.
Definition unicode_line_break.hpp:544
constexpr bool unicode_LB_width_check(std::vector< float > const &widths, std::vector< size_t > const &lengths, float maximum_line_width) noexcept
Check if all the lines in the text fit the maximum width.
Definition unicode_line_break.hpp:411
unicode_line_break_class
Unicode line break class.
Definition ucd_line_break_classes.hpp:1017
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
unicode_break_vector unicode_line_break(It first, ItEnd last, CodePointFunc const &code_point_func) noexcept
The unicode line break algorithm UAX #14.
Definition unicode_line_break.hpp:633
Combined unicode_line_break_class and unicode_line_break_opportunity.
Definition unicode_line_break.hpp:30
T accumulate(T... args)
T begin(T... args)
T distance(T... args)
T find_if(T... args)
T move(T... args)
T next(T... args)
T push_back(T... args)
T reserve(T... args)