YSTest: variadic.hpp 源文件

YSTest PreAlpha_b900_20201012 The YSLib Test Project

variadic.hpp
浏览该文件的文档.
1 /*
2 © 2012-2016, 2018-2019 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YB_INC_ystdex_variadic_hpp_
29 #define YB_INC_ystdex_variadic_hpp_ 1
30
31 #include "meta.hpp" // for "type_traits.hpp", _t, size_t, empty_base,
32 // false_, size_t_, is_same, false_, true_, are_same, integral_constant,
33 // conditional_t, cond_t;
34
35 namespace ystdex
36 {
37
63 namespace fseq
65 {
66
72 template<typename _type, typename... _types>
73 yconstfn identity<_type>
74 front(empty_base<_type, _types...>) ynothrow
75 {
76 return {};
77 }
78
79 template<typename _type, typename... _types>
80 yconstfn empty_base<_types...>
81 pop_front(empty_base<_type, _types...>) ynothrow
82 {
83 return {};
84 }
85
86 template<typename _func, typename _tState>
87 yconstfn _tState
88 fold(_func, _tState s, empty_base<>) ynothrow
89 {
90 return s;
91 }
92 template<typename _func, typename _tState, typename _type, typename... _types>
93 yconstfn auto
94 fold(_func f, _tState s, empty_base<_type, _types...> xs) ynothrow
95 -> decltype(fold(f, f(s, front(xs)), pop_front(xs)))
96 {
97 return fold(f, f(s, front(xs)), pop_front(xs));
98 }
99
100
101 template<typename _func, typename _tState>
102 yconstfn _tState
103 vfold(_func, _tState s) ynothrow
104 {
105 return s;
106 }
107 template<typename _func, typename _tState, typename _type, typename... _types>
108 yconstfn _tState
109 vfold(_func f, _tState s, _type x, _types... xs) ynothrow
110 {
111 return vfold(f, f(s, x), xs...);
112 }
114
115 } // namespace fseq;
116
118 namespace vseq
119 {
120
133 template<class _func, typename... _tParams>
134 using apply = typename _func::template apply<_tParams...>;
135
136 template<class _func, typename... _tParams>
137 using apply_t = _t<apply<_func, _tParams...>>;
139
140
141 #define YB_Impl_Variadic_SeqOp(_n, _tparams, _targs) \
142 template<_tparams, typename = void> \
143 struct _n : _n<_targs, when<true>> \
144 {}; \
145 \
146 template<_tparams, typename _tEnabler = void> \
147 using _n##_t = _t<_n<_targs, _tEnabler>>;
148 #define YB_Impl_Variadic_SeqOpU(_n) \
149 YB_Impl_Variadic_SeqOp(_n, class _tSeq, _tSeq)
150 #define YB_Impl_Variadic_SeqOpB(_n) YB_Impl_Variadic_SeqOp(_n, class _tSeq1 \
151 YPP_Comma class _tSeq2, _tSeq1 YPP_Comma _tSeq2)
152 #define YB_Impl_Variadic_SeqOpI(_n) YB_Impl_Variadic_SeqOp(_n, class _tSeq \
153 YPP_Comma size_t _vIdx, _tSeq YPP_Comma _vIdx)
154 #define YB_Impl_Variadic_SeqOpN(_n) YB_Impl_Variadic_SeqOp(_n, size_t _vN \
155 YPP_Comma class _tSeq, _vN YPP_Comma _tSeq)
156
157
163 YB_Impl_Variadic_SeqOp(defer, template<typename...> class _gOp YPP_Comma class
164 _tSeq, _gOp YPP_Comma _tSeq)
165
166 template<template<typename...> class _gOp, class _tSeq>
168 struct defer<_gOp, _tSeq, when<true>>
169 {};
170
171 template<template<typename...> class _gOp, template<typename...> class _gSeq,
172 typename... _types>
173 struct defer<_gOp, _gSeq<_types...>, when_valid<_gOp<_types...>>>
174 {
175 using type = _gOp<_types...>;
176 };
177
178
179 YB_Impl_Variadic_SeqOp(defer_i, typename _type YPP_Comma template<_type...>
180 class _gOp YPP_Comma class _tSeq, _type YPP_Comma _gOp YPP_Comma _tSeq)
181
182 template<typename _tInt, template<_tInt...> class _gOp,
183 template<typename, _tInt...> class _gSeq, _tInt... _vSeq>
184 struct defer_i<_tInt, _gOp, _gSeq<_tInt, _vSeq...>, when_valid<_gOp<_vSeq...>>>
185 {
186 using type = _gOp<_vSeq...>;
187 };
189
190
196 template<template<typename...> class _gOp, typename... _types>
197 struct vdefer : defer<_gOp, empty_base<_types...>>
198 {};
199
201 template<class _func, class _tParamsList>
202 using defer_apply_t = _t<defer_t<_func::template apply, _tParamsList>>;
204
205
216
218 template<class _func, typename... _tParams>
219 struct bind_back
220 {
221 template<typename... _types>
222 using apply = vseq::apply<_func, _types..., _tParams...>;
223 };
224
225
226 template<class _func, typename... _tParams>
227 struct bind_front
228 {
229 template<typename... _types>
230 using apply = vseq::apply<_func, _tParams..., _types...>;
231 };
233
234
245 template<template<typename...> class _gOp>
246 struct _a
247 {
248 template<typename... _types>
249 using apply = vdefer<_gOp, _types...>;
250 };
251
252
258 template<class _func>
259 struct _q
260 {
261 // NOTE: Ideally, the template argument should be limited to enable check.
262 // However this is impossible since the arity of '_func::apply' is
263 // unknown.
264 template<typename... _types>
265 using apply = vdefer<apply, _func, _types...>;
266 };
268
269
270
272
273
284 YB_Impl_Variadic_SeqOpU(ctor_of)
285
286 template<class _tSeq>
288 struct ctor_of<_tSeq, when<true>>
289 {};
290
292 template<template<typename...> class _gSeq, typename... _types>
293 struct ctor_of<_gSeq<_types...>, when<true>>
294 {
295 using type = _a<_gSeq>;
296 };
298
299
307 YB_Impl_Variadic_SeqOpU(params_of)
308
309 template<class _tSeq>
311 struct params_of<_tSeq, when<true>>
312 {};
313
315 template<template<typename...> class _gSeq, typename... _types>
316 struct params_of<_gSeq<_types...>, when<true>>
317 {
318 using type = empty_base<_types...>;
319 };
321
322
323
325 template<class _tSeq, class _tParamsList>
326 using instance_apply_t = defer_apply_t<ctor_of_t<_tSeq>, _tParamsList>;
327
328
336 template<class, typename = void>
337 struct is_instance : false_
338 {};
339
340 template<class _tSeq>
341 struct is_instance<_tSeq, enable_if_t<is_same<_tSeq, _t<
342 vdefer<instance_apply_t, _tSeq, params_of_t<_tSeq>>>>::value>> : true_
343 {};
345
346
347 template<class... _tSeqs>
348 using same_instance = are_same<ctor_of_t<_tSeqs>...>;
349
350
356 template<typename... _tSeqs>
357 using enable_for_instances = enable_when<and_<is_instance<_tSeqs>...,
358 same_instance<_tSeqs...>>::value>;
360
361
363
364
366 YB_Impl_Variadic_SeqOpU(clear)
367
368 template<class _tSeq>
370 struct clear<_tSeq, when<true>>
371 {
372 using type = apply_t<ctor_of_t<_tSeq>>;
373 };
375
376
382 YB_Impl_Variadic_SeqOpB(concat)
383
384
386 template<typename... _types1, typename... _types2>
387 struct concat<empty_base<_types1...>, empty_base<_types2...>>
388 {
389 using type = empty_base<_types1..., _types2...>;
390 };
391
392 template<class _tSeq1, class _tSeq2>
393 struct concat<_tSeq1, _tSeq2, enable_for_instances<_tSeq1, _tSeq2>>
394 {
395 using type = instance_apply_t<_tSeq1,
396 concat_t<params_of_t<_tSeq1>, params_of_t<_tSeq2>>>;
397 };
399
400
406 YB_Impl_Variadic_SeqOp(fmap, class _tCtor YPP_Comma class _tSeq,
407 _tCtor YPP_Comma _tSeq)
408
409 template<class _tCtor, typename... _types>
411 struct fmap<_tCtor, empty_base<_types...>>
412 {
413 using type = apply_t<_tCtor, _types...>;
414 };
415
417 template<class _tCtor, class _tSeq>
418 struct fmap<_tCtor, _tSeq, enable_for_instances<_tSeq>>
419 {
420 using type = defer_apply_t<_tCtor, params_of_t<_tSeq>>;
421 };
423
424
430 YB_Impl_Variadic_SeqOpU(front)
431
432 template<typename _tHead, typename... _tTail>
434 struct front<empty_base<_tHead, _tTail...>>
435 {
436 using type = _tHead;
437 };
438
440 template<class _tSeq>
441 struct front<_tSeq, enable_for_instances<_tSeq>>
442 {
443 using type = front_t<params_of_t<_tSeq>>;
444 };
446
447
453 YB_Impl_Variadic_SeqOpU(pop_front)
454
455 template<typename _tHead, typename... _tTail>
457 struct pop_front<empty_base<_tHead, _tTail...>>
458 {
459 using type = empty_base<_tTail...>;
460 };
461
463 template<class _tSeq>
464 struct pop_front<_tSeq, enable_for_instances<_tSeq>>
465 {
466 using type = instance_apply_t<_tSeq, pop_front_t<params_of_t<_tSeq>>>;
467 };
469
470
476 YB_Impl_Variadic_SeqOp(push_back, class _tSeq YPP_Comma typename _tItem,
477 _tSeq YPP_Comma _tItem)
478
479 template<typename... _types, typename _type>
481 struct push_back<empty_base<_types...>, _type>
482 {
483 using type = empty_base<_types..., _type>;
484 };
485
487 template<class _tSeq, typename _type>
488 struct push_back<_tSeq, _type, enable_for_instances<_tSeq>>
489 {
490 using type
491 = instance_apply_t<_tSeq, push_back_t<params_of_t<_tSeq>, _type>>;
492 };
494
495
501 YB_Impl_Variadic_SeqOp(push_front, class _tSeq YPP_Comma typename _tItem,
503 _tSeq YPP_Comma _tItem)
504
505 template<typename... _types, typename _type>
507 struct push_front<empty_base<_types...>, _type>
508 {
509 using type = empty_base<_type, _types...>;
510 };
511
513 template<class _tSeq, typename _type>
514 struct push_front<_tSeq, _type, enable_for_instances<_tSeq>>
515 {
516 using type
517 = instance_apply_t<_tSeq, push_front_t<params_of_t<_tSeq>, _type>>;
518 };
520
521
527 YB_Impl_Variadic_SeqOpU(seq_size)
528
529 template<typename... _types>
531 struct seq_size<empty_base<_types...>> : size_t_<sizeof...(_types)>
532 {};
533
535 template<class _tSeq>
536 struct seq_size<_tSeq, enable_for_instances<_tSeq>>
537 : seq_size_t<params_of_t<_tSeq>>
538 {};
540
541
542
548 YB_Impl_Variadic_SeqOpI(at)
549
550 template<class _tSeq, size_t _vIdx>
552 struct at<_tSeq, _vIdx, when<true>>
553 : at<pop_front_t<_tSeq>, _vIdx - 1>
554 {};
555
557 template<class _tSeq>
558 struct at<_tSeq, 0, when<true>> : front<_tSeq>
559 {};
561
562
568 YB_Impl_Variadic_SeqOpU(back)
569
570 template<class _tSeq>
572 struct back<_tSeq, when<true>> : at<_tSeq, seq_size<_tSeq>::value - 1>
573 {};
575
576
582 YB_Impl_Variadic_SeqOpN(split_n)
583
584
586 template<size_t _vN, class _tSeq>
588 struct split_n<_vN, _tSeq, when<true>>
589 {
590 private:
591 using half = split_n<_vN / 2, _tSeq>;
592 using last = split_n<_vN - _vN / 2, typename half::tail>;
593
594 public:
595 using type = concat_t<_t<half>, _t<last>>;
596 using tail = typename last::tail;
597 };
598
599 template<class _tSeq>
600 struct split_n<0, _tSeq, when<true>>
601 {
602 using type = clear_t<_tSeq>;
603 using tail = _tSeq;
604 };
605
606 template<class _tSeq>
607 struct split_n<1, _tSeq, when<true>>
608 {
609 using type = push_front_t<clear_t<_tSeq>, front_t<_tSeq>>;
610 using tail = pop_front_t<_tSeq>;
611 };
613
614
615
621 YB_Impl_Variadic_SeqOpU(pop_back)
622
623 template<class _tSeq>
625 struct pop_back<_tSeq, when<true>> : split_n<seq_size<_tSeq>::value - 1, _tSeq>
626 {};
628
629
635 YB_Impl_Variadic_SeqOp(erase, class _tSeq YPP_Comma size_t _vIdx YPP_Comma
636 size_t _vEnd = _vIdx + 1, _tSeq YPP_Comma _vIdx YPP_Comma _vEnd)
637
638 template<class _tSeq, size_t _vIdx, size_t _vEnd>
640 struct erase<_tSeq, _vIdx, _vEnd, when<true>>
641 {
642 static_assert(_vIdx <= _vEnd, "Invalid range found.");
643
644 public:
645 using type = concat_t<split_n_t<_vIdx, _tSeq>,
646 typename split_n<_vEnd, _tSeq>::tail>;
647 };
649
650
656 YB_Impl_Variadic_SeqOp(find, class _tSeq YPP_Comma typename _type,
657 _tSeq YPP_Comma _type)
658
659 namespace details
660 {
661
662 template<size_t _vN, class _tSeq, typename _type>
663 struct find
664 {
665 static yconstexpr const size_t value = is_same<front_t<_tSeq>, _type>::value
666 ? 0 : find<_vN - 1, pop_front_t<_tSeq>, _type>::value + 1;
667 };
668
669 template<class _tSeq, typename _type>
670 struct find<0, _tSeq, _type>
671 {
672 static yconstexpr const size_t value = 0;
673 };
674
675 } // namespace details;
676
678 template<class _tSeq, typename _type>
679 struct find<_tSeq, _type, when<true>>
680 : size_t_<details::find<seq_size<_tSeq>::value, _tSeq, _type>::value>
681 {};
683
684
691 YB_Impl_Variadic_SeqOpU(deduplicate)
692
693 namespace details
694 {
695
696 template<size_t, class _tSeq>
697 struct deduplicate
698 {
699 private:
700 using head = front_t<_tSeq>;
701 using tail = pop_front_t<_tSeq>;
702 using sub = deduplicate_t<tail>;
703
704 public:
705 using type = conditional_t<vseq::find<tail, head>::value
706 == seq_size<tail>::value, push_front_t<sub, head>, sub>;
707 };
708
709 template<class _tSeq>
710 struct deduplicate<0, _tSeq>
711 {
712 using type = _tSeq;
713 };
714
715 template<class _tSeq>
716 struct deduplicate<1, _tSeq>
717 {
718 using type = _tSeq;
719 };
720
721 } // namespace details;
722
724 template<class _tSeq>
725 struct deduplicate<_tSeq, when<true>>
726 {
727 using type = _t<details::deduplicate<seq_size<_tSeq>::value, _tSeq>>;
728 };
730
731
737 YB_Impl_Variadic_SeqOpN(join_n)
738
739
743 template<size_t _vN, class _tSeq>
744 struct join_n<_vN, _tSeq, when<true>>
745 {
746 private:
747 using unit = _tSeq;
748 using half = join_n_t<_vN / 2, unit>;
749
750 public:
751 using type = concat_t<concat_t<half, half>, join_n_t<_vN % 2, unit>>;
752 };
753
754 template<class _tSeq>
755 struct join_n<0, _tSeq>
756 {
757 using type = clear_t<_tSeq>;
758 };
759
760 template<class _tSeq>
761 struct join_n<1, _tSeq>
762 {
763 using type = _tSeq;
764 };
766
767
772 YB_Impl_Variadic_SeqOp(project, class _tSeq YPP_Comma class _tIdxSeq,
773 _tSeq YPP_Comma _tIdxSeq)
774
775
776
781 YB_Impl_Variadic_SeqOpU(reverse)
782
784 template<class _tSeq>
785 struct reverse<_tSeq, when<true>>
786 {
787 using type = conditional_t<seq_size<_tSeq>::value == 0, clear_t<_tSeq>,
788 concat_t<reverse_t<pop_front_t<_tSeq>>, front_t<_tSeq>>>;
789 };
791
792
798 YB_Impl_Variadic_SeqOpU(unique)
799
800 namespace details
801 {
802
808 template<class _tSeq, size_t _vN = seq_size<_tSeq>::value>
809 struct unique
810 {
811 private:
812 using split = split_n<_vN / 2, _tSeq>;
813 using half = _t<unique<typename split::type>>;
814 using last = _t<unique<typename split::tail>>;
815 using half_back = back_t<half>;
816 using last_front = front_t<last>;
817
818 public:
819 using type = concat_t<half, cond_t<is_same<half_back, last_front>,
820 pop_front_t<last>, last>>;
821 };
822
823 template<class _tSeq>
824 struct unique<_tSeq, 0>
825 {
826 using type = clear_t<_tSeq>;
827 };
828
829 template<class _tSeq>
830 struct unique<_tSeq, 1>
831 {
832 using type = _tSeq;
833 };
835
836 } // namespace details;
837
839 template<class _tSeq>
840 struct unique<_tSeq, when<true>>
841 {
842 using type = _t<details::unique<_tSeq>>;
843 };
844
845
852 YB_Impl_Variadic_SeqOp(fold, class _fBinary YPP_Comma typename _tState YPP_Comma
853 class _tSeq, _fBinary YPP_Comma _tState YPP_Comma _tSeq)
854
855
857 namespace details
858 {
859
861 template<class _fBinary, typename _tState, typename _tSeq, size_t _vSize>
862 struct fold
863 {
864 private:
865 using parts = split_n<_vSize / 2, _tSeq>;
866 using head = _t<parts>;
867 using tail = typename parts::tail;
868
869 public:
870 using type = fold_t<_fBinary, fold_t<_fBinary, _tState, head>, tail>;
871 };
872
873 template<class _fBinary, typename _tState, typename _tSeq>
874 struct fold<_fBinary, _tState, _tSeq, 0>
875 {
876 using type = _tState;
877 };
878
879 template<class _fBinary, typename _tState, typename _tSeq>
880 struct fold<_fBinary, _tState, _tSeq, 1>
881 {
882 using type = apply_t<_fBinary, _tState, front_t<_tSeq>>;
883 };
884
885 } // namespace details;
886
887 template<class _fBinary, typename _tState, typename _tSeq>
888 struct fold<_fBinary, _tState, _tSeq, enable_for_instances<_tSeq>>
889 : details::fold<_fBinary, _tState, _tSeq, seq_size_t<_tSeq>::value>
890 {};
892
893
894
896
897 YB_Impl_Variadic_SeqOpB(vec_add)
899
900
901 YB_Impl_Variadic_SeqOpB(vec_subtract)
904
905 #undef YB_Impl_Variadic_SeqOpN
906 #undef YB_Impl_Variadic_SeqOpI
907 #undef YB_Impl_Variadic_SeqOpU
908 #undef YB_Impl_Variadic_SeqOp
909
910
911 } // namespace vseq;
912
914 using vseq::vdefer;
915
916 } // namespace ystdex;
917
918 #endif
919
meta.hpp
通用元编程设施。
ystdex::vseq::seq_size
取序列元素数。
Definition: variadic.hpp:527
ystdex::vseq::deduplicate
取合并相同元素后的序列。
Definition: variadic.hpp:691
ystdex::vseq::details::fold< _fBinary, _tState, _tSeq, 0 >::type
_tState type
Definition: variadic.hpp:876
ystdex::vseq::apply_t
_t< apply< _func, _tParams... > > apply_t
Definition: variadic.hpp:137
ystdex::vseq::join_n
重复连接序列元素。
Definition: variadic.hpp:737
ystdex::fseq::front
identity< _type > front(empty_base< _type, _types... >)
Definition: variadic.hpp:74
ystdex::vseq::reverse
取逆序列。
Definition: variadic.hpp:781
x
const EncapsulationBase & x
Definition: NPLA1Forms.cpp:1536
ystdex::vseq::params_of_t
_t< params_of< _tSeq, _tEnabler > > params_of_t
Definition: variadic.hpp:307
ystdex::empty_base
空基类模板。
Definition: ydef.h:1424
ystdex::cpp2014::conditional_t
typename conditional< _bCond, _type, _type2 >::type conditional_t
Definition: meta.hpp:202
ystdex::vseq::enable_for_instances
enable_when< and_< is_instance< _tSeqs >..., same_instance< _tSeqs... > >::value > enable_for_instances
Definition: variadic.hpp:358
ystdex::vseq::defer_i
Definition: variadic.hpp:180
ystdex::vseq::join_n< 1, _tSeq >::type
_tSeq type
Definition: variadic.hpp:763
ystdex::vseq::fold
二元操作合并应用。
Definition: variadic.hpp:853
ystdex::vseq::_a
构造具有 apply 成员的一阶元函数。
Definition: variadic.hpp:247
ystdex::vseq::vec_add
序列作为向量的加法。
Definition: variadic.hpp:898
ystdex::vseq::defer_apply_t
_t< defer_t< _func::template apply, _tParamsList > > defer_apply_t
Definition: variadic.hpp:202
ystdex::vseq::fmap
函子映射：使用指定类型构造器和序列参数构造新的类型。
Definition: variadic.hpp:407
ystdex::vseq::apply
typename _func::template apply< _tParams... > apply
元函数应用。
Definition: variadic.hpp:134
ystdex::vseq::params_of
取类型构造器参数。
Definition: variadic.hpp:307
ystdex::vseq::clear
单位元：取空序列。
Definition: variadic.hpp:366
yconstexpr
#define yconstexpr
指定编译时常量表达式。
Definition: ydef.h:1072
YB_Impl_Variadic_SeqOpB
#define YB_Impl_Variadic_SeqOpB(_n)
Definition: variadic.hpp:150
ystdex::vseq::details::deduplicate::sub
deduplicate_t< tail > sub
Definition: variadic.hpp:702
ystdex::fseq::vfold
_tState vfold(_func, _tState s)
Definition: variadic.hpp:103
YB_Impl_Variadic_SeqOpI
#define YB_Impl_Variadic_SeqOpI(_n)
Definition: variadic.hpp:152
ystdex::vseq::join_n< _vN, _tSeq, when< true > >::half
join_n_t< _vN/2, unit > half
Definition: variadic.hpp:748
ystdex::vseq::join_n< _vN, _tSeq, when< true > >::type
concat_t< concat_t< half, half >, join_n_t< _vN % 2, unit > > type
Definition: variadic.hpp:751
ystdex::vseq::pop_front_t
_t< pop_front< _tSeq, _tEnabler > > pop_front_t
Definition: variadic.hpp:453
ystdex::cpp2014::enable_if_t
typename enable_if< _bCond, _type >::type enable_if_t
Definition: meta.hpp:199
ystdex::vseq::fmap< _tCtor, _tSeq, enable_for_instances< _tSeq > >::type
defer_apply_t< _tCtor, params_of_t< _tSeq > > type
Definition: variadic.hpp:420
ystdex::vseq::push_front_t
_t< push_front< _tSeq, _tItem, _tEnabler > > push_front_t
Definition: variadic.hpp:503
ystdex::vseq::_q::apply
vdefer< apply, _func, _types... > apply
Definition: variadic.hpp:265
ystdex::fseq::fold
_tState fold(_func, _tState s, integer_sequence< _tInt >)
Definition: integer_sequence.hpp:98
ystdex::when_valid
well_formed_t< when< true >, _types... > when_valid
类似 void_t 的元函数，但具有较低匹配优先级，避免偏特化歧义。
Definition: meta.hpp:313
YPP_Comma
#define YPP_Comma
替换为逗号的预处理记号。
Definition: ydef.h:370
ystdex::vseq::front< empty_base< _tHead, _tTail... > >::type
_tHead type
Definition: variadic.hpp:436
ystdex::vseq::details::unique< _tSeq, 1 >::type
_tSeq type
Definition: variadic.hpp:832
ystdex::vseq::reverse< _tSeq, when< true > >::type
conditional_t< seq_size< _tSeq >::value==0, clear_t< _tSeq >, concat_t< reverse_t< pop_front_t< _tSeq > >, front_t< _tSeq > >> type
Definition: variadic.hpp:788
ystdex::vseq::push_front
取序列第一个元素以外的元素的序列。
Definition: variadic.hpp:503
ystdex::vseq::split_n< 1, _tSeq, when< true > >::tail
pop_front_t< _tSeq > tail
Definition: variadic.hpp:610
CHRLib::f
f(d, s)
ystdex::vseq::fmap< _tCtor, empty_base< _types... > >::type
apply_t< _tCtor, _types... > type
Definition: variadic.hpp:413
ystdex::vseq::details::fold< _fBinary, _tState, _tSeq, 1 >::type
apply_t< _fBinary, _tState, front_t< _tSeq > > type
Definition: variadic.hpp:882
ystdex::vseq::pop_back
取序列最后元素以外的元素的序列。
Definition: variadic.hpp:621
ystdex::vseq::details::find
Definition: variadic.hpp:664
ystdex::vseq::details::deduplicate< 1, _tSeq >::type
_tSeq type
Definition: variadic.hpp:718
ystdex::vseq::unique
取合并相邻相同元素后的序列。
Definition: variadic.hpp:798
ystdex::are_same
判断第一参数和之后的参数指定的类型相同。
Definition: meta.hpp:768
ystdex::vseq::instance_apply_t
defer_apply_t< ctor_of_t< _tSeq >, _tParamsList > instance_apply_t
使用构造器应用指定列表参数。
Definition: variadic.hpp:326
ystdex::vseq::ctor_of
取类型构造器：具有 apply 成员，结果的嵌套 type 类型为构造类型的元函数。
Definition: variadic.hpp:284
ystdex::vseq::defer
延迟求值。
Definition: variadic.hpp:164
ystdex::vseq::vdefer
可变参数类型列表延迟求值。
Definition: variadic.hpp:198
ystdex::vseq::join_n< 0, _tSeq >::type
clear_t< _tSeq > type
Definition: variadic.hpp:757
ystdex::vseq::concat
连接：合并序列。
Definition: variadic.hpp:382
ystdex::vseq::push_back
取在序列末尾插入一个元素的序列。
Definition: variadic.hpp:477
ystdex::vseq::unique< _tSeq, when< true > >::type
_t< details::unique< _tSeq > > type
Definition: variadic.hpp:842
ystdex::vseq::split_n< 0, _tSeq, when< true > >::tail
_tSeq tail
Definition: variadic.hpp:603
ystdex::vseq::details::fold< _fBinary, _tState, _tSeq, seq_size_t< _tSeq >::value >::tail
typename parts::tail tail
Definition: variadic.hpp:867
ystdex::vseq::bind_front::apply
vseq::apply< _func, _tParams..., _types... > apply
Definition: variadic.hpp:230
ystdex::vseq::erase
删除指定位置的元素。
Definition: variadic.hpp:636
ystdex::vseq::seq_size_t
_t< seq_size< _tSeq, _tEnabler > > seq_size_t
Definition: variadic.hpp:527
ystdex::vseq::deduplicate_t
_t< deduplicate< _tSeq, _tEnabler > > deduplicate_t
Definition: variadic.hpp:691
ystdex::vseq::details::unique::last
_t< unique< typename split::tail > > last
Definition: variadic.hpp:814
ystdex::vseq::project
投影操作。
Definition: variadic.hpp:773
ystdex::vseq::details::deduplicate< 0, _tSeq >::type
_tSeq type
Definition: variadic.hpp:712
ystdex::vseq::bind_front
Definition: variadic.hpp:228
ystdex::vseq::split_n< _vN, _tSeq, when< true > >::tail
typename last::tail tail
Definition: variadic.hpp:596
ystdex::vseq::details::fold< _fBinary, _tState, _tSeq, seq_size_t< _tSeq >::value >::head
_t< parts > head
Definition: variadic.hpp:866
ystdex::vseq::join_n< _vN, _tSeq, when< true > >::unit
_tSeq unit
Definition: variadic.hpp:747
ystdex::vseq::details::unique::type
concat_t< half, cond_t< is_same< half_back, last_front >, pop_front_t< last >, last > > type
Definition: variadic.hpp:820
ystdex::enable_when
enable_if_t< _bCond, when< true > > enable_when
类似 enable_if_t 的元函数，但具有较低匹配优先级，避免偏特化歧义。
Definition: meta.hpp:322
ystdex::size_t_
integral_constant< size_t, _vInt > size_t_
Definition: integral_constant.hpp:103
ystdex::vseq::concat< _tSeq1, _tSeq2, enable_for_instances< _tSeq1, _tSeq2 > >::type
instance_apply_t< _tSeq1, concat_t< params_of_t< _tSeq1 >, params_of_t< _tSeq2 > >> type
Definition: variadic.hpp:396
ystdex::vseq::details::deduplicate::tail
pop_front_t< _tSeq > tail
Definition: variadic.hpp:701
ystdex::when
类似 void_t 的元函数，具有较低匹配优先级，避免偏特化歧义；但使用条件表达式。
Definition: meta.hpp:305
ystdex::vseq::join_n_t
_t< join_n< _vN, _tSeq, _tEnabler > > join_n_t
Definition: variadic.hpp:737
ystdex::vseq::fold_t
_t< fold< _fBinary, _tState, _tSeq, _tEnabler > > fold_t
Definition: variadic.hpp:853
ystdex::vseq::defer< _gOp, _gSeq< _types... >, when_valid< _gOp< _types... > > >::type
_gOp< _types... > type
Definition: variadic.hpp:175
ystdex::vseq::vec_subtract
序列作为向量的减法。
Definition: variadic.hpp:902
ystdex::vseq::details::fold
Definition: variadic.hpp:863
ystdex::true_
bool_< true > true_
Definition: integral_constant.hpp:109
ystdex::vseq::clear< _tSeq, when< true > >::type
apply_t< ctor_of_t< _tSeq > > type
Definition: variadic.hpp:372
ystdex::vseq::details::unique< _tSeq, 0 >::type
clear_t< _tSeq > type
Definition: variadic.hpp:826
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:143
ystdex::vseq::details::deduplicate::head
front_t< _tSeq > head
Definition: variadic.hpp:700
ystdex::vseq::split_n< 1, _tSeq, when< true > >::type
push_front_t< clear_t< _tSeq >, front_t< _tSeq > > type
Definition: variadic.hpp:609
ystdex::vseq::push_back< _tSeq, _type, enable_for_instances< _tSeq > >::type
instance_apply_t< _tSeq, push_back_t< params_of_t< _tSeq >, _type > > type
Definition: variadic.hpp:491
ystdex::vseq::deduplicate< _tSeq, when< true > >::type
_t< details::deduplicate< seq_size< _tSeq >::value, _tSeq > > type
Definition: variadic.hpp:727
platform::tail
_tString ystdex::string_traits< _tString >::const_pointer tail
Definition: YCLib/FileSystem.h:465
ystdex::vseq::details::fold< _fBinary, _tState, _tSeq, seq_size_t< _tSeq >::value >::type
fold_t< _fBinary, fold_t< _fBinary, _tState, head >, tail > type
Definition: variadic.hpp:870
ystdex
<memory> 特性测试宏。
Definition: ydef.h:1262
ystdex::vseq::back_t
_t< back< _tSeq, _tEnabler > > back_t
Definition: variadic.hpp:568
YB_Impl_Variadic_SeqOpU
#define YB_Impl_Variadic_SeqOpU(_n)
Definition: variadic.hpp:148
ystdex::vseq::pop_front< _tSeq, enable_for_instances< _tSeq > >::type
instance_apply_t< _tSeq, pop_front_t< params_of_t< _tSeq > >> type
Definition: variadic.hpp:466
ystdex::vseq::split_n< 0, _tSeq, when< true > >::type
clear_t< _tSeq > type
Definition: variadic.hpp:602
YSLib::_tParams
YB_ATTR_nodiscard YB_PURE typename _tParams
Definition: ValueNode.h:1294
ystdex::vseq::front< _tSeq, enable_for_instances< _tSeq > >::type
front_t< params_of_t< _tSeq > > type
Definition: variadic.hpp:443
ystdex::vseq::pop_front
取序列第一个元素以外的元素的序列。
Definition: variadic.hpp:453
ystdex::_t
typename _type::type _t
嵌套类型别名。
Definition: meta.hpp:45
ystdex::vseq::back
取序列最后一个元素。
Definition: variadic.hpp:568
ystdex::vseq::find
查找元素。
Definition: variadic.hpp:657
YB_Impl_Variadic_SeqOp
#define YB_Impl_Variadic_SeqOp(_n, _tparams, _targs)
Definition: variadic.hpp:141
ystdex::vseq::details::deduplicate
Definition: variadic.hpp:698
ystdex::vseq::push_front< _tSeq, _type, enable_for_instances< _tSeq > >::type
instance_apply_t< _tSeq, push_front_t< params_of_t< _tSeq >, _type > > type
Definition: variadic.hpp:517
ystdex::vseq::details::unique::half_back
back_t< half > half_back
Definition: variadic.hpp:815
ystdex::vseq::front_t
_t< front< _tSeq, _tEnabler > > front_t
Definition: variadic.hpp:430
ystdex::vseq::bind_back::apply
vseq::apply< _func, _types..., _tParams... > apply
Definition: variadic.hpp:222
ystdex::vseq::_q
引用：延迟求值变换。
Definition: variadic.hpp:260
ystdex::vseq::details::deduplicate::type
conditional_t< vseq::find< tail, head >::value==seq_size< tail >::value, push_front_t< sub, head >, sub > type
Definition: variadic.hpp:706
ystdex::vseq::details::unique::half
_t< unique< typename split::type > > half
Definition: variadic.hpp:813
ystdex::false_
bool_< false > false_
Definition: integral_constant.hpp:110
ystdex::vseq::front
取序列第一个元素。
Definition: variadic.hpp:430
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:1199
ystdex::vseq::at
取指定位置的元素。
Definition: variadic.hpp:548
ystdex::vseq::split_n
拆分序列前若干元素。
Definition: variadic.hpp:582
YB_Impl_Variadic_SeqOpN
#define YB_Impl_Variadic_SeqOpN(_n)
Definition: variadic.hpp:154
ystdex::vseq::clear_t
_t< clear< _tSeq, _tEnabler > > clear_t
Definition: variadic.hpp:366
ystdex::fseq::pop_front
integer_sequence< _tInt, _vSeq... > pop_front(integer_sequence< _tInt, _vInt, _vSeq... >)
Definition: integer_sequence.hpp:91
ystdex::vseq::details::unique
Definition: variadic.hpp:810
ystdex::vseq::details::unique::last_front
front_t< last > last_front
Definition: variadic.hpp:816
ystdex::vseq::erase< _tSeq, _vIdx, _vEnd, when< true > >::type
concat_t< split_n_t< _vIdx, _tSeq >, typename split_n< _vEnd, _tSeq >::tail > type
Definition: variadic.hpp:646
ystdex::vseq::defer_i< _tInt, _gOp, _gSeq< _tInt, _vSeq... >, when_valid< _gOp< _vSeq... > > >::type
_gOp< _vSeq... > type
Definition: variadic.hpp:186
ystdex::vseq::split_n< _vN, _tSeq, when< true > >::type
concat_t< _t< half >, _t< last > > type
Definition: variadic.hpp:595
ystdex::vseq::bind_back
部分应用。
Definition: variadic.hpp:220
yconstfn
#define yconstfn
指定编译时常量函数。
Definition: ydef.h:1073
ystdex::vseq::is_instance
判断是否可匹配类型实例。
Definition: variadic.hpp:338
ystdex::vseq::concat_t
_t< concat< _tSeq1, _tSeq2, _tEnabler > > concat_t
Definition: variadic.hpp:382