YSTest: variadic.hpp 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

variadic.hpp
浏览该文件的文档.
1 /*
2 © 2012-2015 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 "type_traits.hpp" // for "type_traits.hpp", _t, size_t, empty_base,
32 // false_type, is_same, true_type, are_same, integral_constant, conditional_t,
33 // cond_t;
34
35 namespace ystdex
36 {
37
52 namespace vseq
54 {
55
68 template<class _func, typename... _tParams>
69 using apply = typename _func::template apply<_tParams...>;
70
71 template<class _func, typename... _tParams>
72 using apply_t = _t<apply<_func, _tParams...>>;
74
75
76 #define YB_Impl_Variadic_SeqOp(_n, _tparams, _targs) \
77 template<_tparams, typename = void> \
78 struct _n : _n<_targs, when<true>> \
79 {}; \
80 \
81 template<_tparams, typename _tEnabler = void> \
82 using _n##_t = _t<_n<_targs, _tEnabler>>;
83 #define YB_Impl_Variadic_SeqOpU(_n) \
84 YB_Impl_Variadic_SeqOp(_n, class _tSeq, _tSeq)
85 #define YB_Impl_Variadic_SeqOpB(_n) YB_Impl_Variadic_SeqOp(_n, class _tSeq1 \
86 YPP_Comma class _tSeq2, _tSeq1 YPP_Comma _tSeq2)
87 #define YB_Impl_Variadic_SeqOpI(_n) YB_Impl_Variadic_SeqOp(_n, class _tSeq \
88 YPP_Comma size_t _vIdx, _tSeq YPP_Comma _vIdx)
89 #define YB_Impl_Variadic_SeqOpN(_n) YB_Impl_Variadic_SeqOp(_n, size_t _vN \
90 YPP_Comma class _tSeq, _vN YPP_Comma _tSeq)
91
92
98 YB_Impl_Variadic_SeqOp(defer, template<typename...> class _gOp YPP_Comma class
99 _tSeq, _gOp YPP_Comma _tSeq)
100
101 template<template<typename...> class _gOp, template<typename...> class _gSeq,
102 typename... _types>
103 struct defer<_gOp, _gSeq<_types...>, when_valid<_gOp<_types...>>>
104 {
105 using type = _gOp<_types...>;
106 };
107
108
109 YB_Impl_Variadic_SeqOp(defer_i, typename _type YPP_Comma template<_type...>
110 class _gOp YPP_Comma class _tSeq, _type YPP_Comma _gOp YPP_Comma _tSeq)
111
112 template<typename _tInt, template<_tInt...> class _gOp,
113 template<typename, _tInt...> class _gSeq, _tInt... _vSeq>
114 struct defer_i<_tInt, _gOp, _gSeq<_tInt, _vSeq...>, when_valid<_gOp<_vSeq...>>>
115 {
116 using type = _gOp<_vSeq...>;
117 };
119
120
126 template<template<typename...> class _gOp, typename... _types>
127 struct vdefer : defer<_gOp, empty_base<_types...>>
128 {};
129
131 template<class _func, class _tParamsList>
132 using defer_apply_t = _t<defer_t<_func::template apply, _tParamsList>>;
134
135
146
148 template<class _func, typename... _tParams>
149 struct bind_back
150 {
151 template<typename... _types>
152 using apply = vseq::apply<_func, _types..., _tParams...>;
153 };
154
155
156 template<class _func, typename... _tParams>
157 struct bind_front
158 {
159 template<typename... _types>
160 using apply = vseq::apply<_func, _tParams..., _types...>;
161 };
163
164
175 template<template<typename...> class _gOp>
176 struct _a
177 {
178 template<typename... _types>
179 using apply = vdefer<_gOp, _types...>;
180 };
181
182
188 template<class _func>
189 struct _q
190 {
191 // NOTE: Ideally, the template argument should be limited to enable check.
192 // However this is impossible since the arity of '_func::apply' is
193 // unknown.
194 template<typename... _types>
195 using apply = vdefer<apply, _func, _types...>;
196 };
198
199
200
202
203
214 YB_Impl_Variadic_SeqOpU(ctor_of)
215
216 template<template<typename...> class _gSeq, typename... _types>
217 struct ctor_of<_gSeq<_types...>>
218 {
219 using type = _a<_gSeq>;
220 };
222
223
231 YB_Impl_Variadic_SeqOpU(params_of)
232
233 template<template<typename...> class _gSeq, typename... _types>
234 struct params_of<_gSeq<_types...>>
235 {
236 using type = empty_base<_types...>;
237 };
239
240
241
243 template<class _tSeq, class _tParamsList>
244 using instance_apply_t = defer_apply_t<ctor_of_t<_tSeq>, _tParamsList>;
245
246
254 template<class, typename = void>
255 struct is_instance : false_type
256 {};
257
258 template<class _tSeq>
259 struct is_instance<_tSeq, enable_if_t<is_same<_tSeq, _t<
260 vdefer<instance_apply_t, _tSeq, params_of_t<_tSeq>>>>::value>> : true_type
261 {};
263
264
265 template<class... _tSeqs>
266 using same_instance = are_same<ctor_of_t<_tSeqs>...>;
267
268
274 template<typename... _tSeqs>
275 using enable_for_instances = enable_when<and_<is_instance<_tSeqs>...,
276 same_instance<_tSeqs...>>::value>;
278
279
281
282
284 YB_Impl_Variadic_SeqOpU(clear)
285
286 template<class _tSeq>
288 struct clear<_tSeq, when<true>>
289 {
290 using type = apply_t<ctor_of_t<_tSeq>>;
291 };
293
294
300 YB_Impl_Variadic_SeqOpB(concat)
301
302
304 template<typename... _types1, typename... _types2>
305 struct concat<empty_base<_types1...>, empty_base<_types2...>>
306 {
307 using type = empty_base<_types1..., _types2...>;
308 };
309
310 template<class _tSeq1, class _tSeq2>
311 struct concat<_tSeq1, _tSeq2, enable_for_instances<_tSeq1, _tSeq2>>
312 {
313 using type = instance_apply_t<_tSeq1,
314 concat_t<params_of_t<_tSeq1>, params_of_t<_tSeq2>>>;
315 };
317
318
324 YB_Impl_Variadic_SeqOp(fmap, class _tCtor YPP_Comma class _tSeq,
325 _tCtor YPP_Comma _tSeq)
326
327 template<class _tCtor, typename... _types>
329 struct fmap<_tCtor, empty_base<_types...>>
330 {
331 using type = apply_t<_tCtor, _types...>;
332 };
333
335 template<class _tCtor, class _tSeq>
336 struct fmap<_tCtor, _tSeq, enable_for_instances<_tSeq>>
337 {
338 using type = defer_apply_t<_tCtor, params_of_t<_tSeq>>;
339 };
341
342
348 YB_Impl_Variadic_SeqOpU(front)
349
350 template<typename _tHead, typename... _tTail>
352 struct front<empty_base<_tHead, _tTail...>>
353 {
354 using type = _tHead;
355 };
356
358 template<class _tSeq>
359 struct front<_tSeq, enable_for_instances<_tSeq>>
360 {
361 using type = front_t<params_of_t<_tSeq>>;
362 };
364
365
371 YB_Impl_Variadic_SeqOpU(pop_front)
372
373 template<typename _tHead, typename... _tTail>
375 struct pop_front<empty_base<_tHead, _tTail...>>
376 {
377 using type = empty_base<_tTail...>;
378 };
379
381 template<class _tSeq>
382 struct pop_front<_tSeq, enable_for_instances<_tSeq>>
383 {
384 using type = instance_apply_t<_tSeq, pop_front_t<params_of_t<_tSeq>>>;
385 };
387
388
394 YB_Impl_Variadic_SeqOp(push_back, class _tSeq YPP_Comma typename _tItem,
395 _tSeq YPP_Comma _tItem)
396
397 template<typename... _types, typename _type>
399 struct push_back<empty_base<_types...>, _type>
400 {
401 using type = empty_base<_types..., _type>;
402 };
403
405 template<class _tSeq, typename _type>
406 struct push_back<_tSeq, _type, enable_for_instances<_tSeq>>
407 {
408 using type
409 = instance_apply_t<_tSeq, push_back_t<params_of_t<_tSeq>, _type>>;
410 };
412
413
419 YB_Impl_Variadic_SeqOp(push_front, class _tSeq YPP_Comma typename _tItem,
421 _tSeq YPP_Comma _tItem)
422
423 template<typename... _types, typename _type>
425 struct push_front<empty_base<_types...>, _type>
426 {
427 using type = empty_base<_type, _types...>;
428 };
429
431 template<class _tSeq, typename _type>
432 struct push_front<_tSeq, _type, enable_for_instances<_tSeq>>
433 {
434 using type
435 = instance_apply_t<_tSeq, push_front_t<params_of_t<_tSeq>, _type>>;
436 };
438
439
445 YB_Impl_Variadic_SeqOpU(seq_size)
446
447 template<typename... _types>
449 struct seq_size<empty_base<_types...>>
450 : integral_constant<size_t, sizeof...(_types)>
451 {};
452
454 template<class _tSeq>
455 struct seq_size<_tSeq, enable_for_instances<_tSeq>>
456 : seq_size_t<params_of_t<_tSeq>>
457 {};
459
460
461
467 YB_Impl_Variadic_SeqOpI(at)
468
469 template<class _tSeq, size_t _vIdx>
471 struct at<_tSeq, _vIdx, when<true>>
472 : at<pop_front_t<_tSeq>, _vIdx - 1>
473 {};
474
476 template<class _tSeq>
477 struct at<_tSeq, 0, when<true>> : front<_tSeq>
478 {};
480
481
487 YB_Impl_Variadic_SeqOpU(back)
488
489 template<class _tSeq>
491 struct back<_tSeq, when<true>> : at<_tSeq, seq_size<_tSeq>::value - 1>
492 {};
494
495
501 YB_Impl_Variadic_SeqOpN(split_n)
502
503
505 template<size_t _vN, class _tSeq>
507 struct split_n<_vN, _tSeq, when<true>>
508 {
509 private:
510 using half = split_n<_vN / 2, _tSeq>;
511 using last = split_n<_vN - _vN / 2, typename half::tail>;
512
513 public:
514 using type = concat_t<_t<half>, _t<last>>;
515 using tail = typename last::tail;
516 };
517
518 template<class _tSeq>
519 struct split_n<0, _tSeq, when<true>>
520 {
521 using type = clear_t<_tSeq>;
522 using tail = _tSeq;
523 };
524
525 template<class _tSeq>
526 struct split_n<1, _tSeq, when<true>>
527 {
528 using type = push_front_t<clear_t<_tSeq>, front_t<_tSeq>>;
529 using tail = pop_front_t<_tSeq>;
530 };
532
533
534
540 YB_Impl_Variadic_SeqOpU(pop_back)
541
542 template<class _tSeq>
544 struct pop_back<_tSeq, when<true>> : split_n<seq_size<_tSeq>::value - 1, _tSeq>
545 {};
547
548
554 YB_Impl_Variadic_SeqOp(erase, class _tSeq YPP_Comma size_t _vIdx YPP_Comma
555 size_t _vEnd = _vIdx + 1, _tSeq YPP_Comma _vIdx YPP_Comma _vEnd)
556
557 template<class _tSeq, size_t _vIdx, size_t _vEnd>
559 struct erase<_tSeq, _vIdx, _vEnd, when<true>>
560 {
561 static_assert(_vIdx <= _vEnd, "Invalid range found.");
562
563 public:
564 using type = concat_t<split_n_t<_vIdx, _tSeq>,
565 typename split_n<_vEnd, _tSeq>::tail>;
566 };
568
569
575 YB_Impl_Variadic_SeqOp(find, class _tSeq YPP_Comma typename _type,
576 _tSeq YPP_Comma _type)
577
578 namespace details
579 {
580
581 template<size_t _vN, class _tSeq, typename _type>
582 struct find
583 {
584 static yconstexpr const size_t value = is_same<front_t<_tSeq>, _type>::value
585 ? 0 : find<_vN - 1, pop_front_t<_tSeq>, _type>::value + 1;
586 };
587
588 template<class _tSeq, typename _type>
589 struct find<0, _tSeq, _type>
590 {
591 static yconstexpr const size_t value = 0;
592 };
593
594 } // namespace details;
595
597 template<class _tSeq, typename _type>
598 struct find<_tSeq, _type, when<true>> : integral_constant<size_t,
599 details::find<seq_size<_tSeq>::value, _tSeq, _type>::value>
600 {};
602
603
610 YB_Impl_Variadic_SeqOpU(deduplicate)
611
612 namespace details
613 {
614
615 template<size_t, class _tSeq>
616 struct deduplicate
617 {
618 private:
619 using head = front_t<_tSeq>;
620 using tail = pop_front_t<_tSeq>;
621 using sub = deduplicate_t<tail>;
622
623 public:
624 using type = conditional_t<vseq::find<tail, head>::value
625 == seq_size<tail>::value, push_front_t<sub, head>, sub>;
626 };
627
628 template<class _tSeq>
629 struct deduplicate<0, _tSeq>
630 {
631 using type = _tSeq;
632 };
633
634 template<class _tSeq>
635 struct deduplicate<1, _tSeq>
636 {
637 using type = _tSeq;
638 };
639
640 } // namespace details;
641
643 template<class _tSeq>
644 struct deduplicate<_tSeq, when<true>>
645 {
646 using type = _t<details::deduplicate<seq_size<_tSeq>::value, _tSeq>>;
647 };
649
650
656 YB_Impl_Variadic_SeqOpN(join_n)
657
658
662 template<size_t _vN, class _tSeq>
663 struct join_n<_vN, _tSeq, when<true>>
664 {
665 private:
666 using unit = _tSeq;
667 using half = join_n_t<_vN / 2, unit>;
668
669 public:
670 using type = concat_t<concat_t<half, half>, join_n_t<_vN % 2, unit>>;
671 };
672
673 template<class _tSeq>
674 struct join_n<0, _tSeq>
675 {
676 using type = clear_t<_tSeq>;
677 };
678
679 template<class _tSeq>
680 struct join_n<1, _tSeq>
681 {
682 using type = _tSeq;
683 };
685
686
691 YB_Impl_Variadic_SeqOp(project, class _tSeq YPP_Comma class _tIdxSeq,
692 _tSeq YPP_Comma _tIdxSeq)
693
694
695
700 YB_Impl_Variadic_SeqOpU(reverse)
701
703 template<class _tSeq>
704 struct reverse<_tSeq, when<true>>
705 {
706 using type = conditional_t<seq_size<_tSeq>::value == 0, clear_t<_tSeq>,
707 concat_t<reverse_t<pop_front_t<_tSeq>>, front_t<_tSeq>>>;
708 };
710
711
717 YB_Impl_Variadic_SeqOpU(unique)
718
719 namespace details
720 {
721
727 template<class _tSeq, size_t _vN = seq_size<_tSeq>::value>
728 struct unique
729 {
730 private:
731 using split = split_n<_vN / 2, _tSeq>;
732 using half = _t<unique<typename split::type>>;
733 using last = _t<unique<typename split::tail>>;
734 using half_back = back_t<half>;
735 using last_front = front_t<last>;
736
737 public:
738 using type = concat_t<half, cond_t<is_same<half_back, last_front>,
739 pop_front_t<last>, last>>;
740 };
741
742 template<class _tSeq>
743 struct unique<_tSeq, 0>
744 {
745 using type = clear_t<_tSeq>;
746 };
747
748 template<class _tSeq>
749 struct unique<_tSeq, 1>
750 {
751 using type = _tSeq;
752 };
754
755 } // namespace details;
756
758 template<class _tSeq>
759 struct unique<_tSeq, when<true>>
760 {
761 using type = _t<details::unique<_tSeq>>;
762 };
763
764
771 YB_Impl_Variadic_SeqOp(fold, class _fBinary YPP_Comma typename _tState YPP_Comma
772 class _tSeq, _fBinary YPP_Comma _tState YPP_Comma _tSeq)
773
774
776 namespace details
777 {
778
780 template<class _fBinary, typename _tState, typename _tSeq, size_t _vSize>
781 struct fold
782 {
783 private:
784 using parts = split_n<_vSize / 2, _tSeq>;
785 using head = _t<parts>;
786 using tail = typename parts::tail;
787
788 public:
789 using type = fold_t<_fBinary, fold_t<_fBinary, _tState, head>, tail>;
790 };
791
792 template<class _fBinary, typename _tState, typename _tSeq>
793 struct fold<_fBinary, _tState, _tSeq, 0>
794 {
795 using type = _tState;
796 };
797
798 template<class _fBinary, typename _tState, typename _tSeq>
799 struct fold<_fBinary, _tState, _tSeq, 1>
800 {
801 using type = apply_t<_fBinary, _tState, front_t<_tSeq>>;
802 };
803
804 } // namespace details;
805
806 template<class _fBinary, typename _tState, typename _tSeq>
807 struct fold<_fBinary, _tState, _tSeq, enable_for_instances<_tSeq>>
808 : details::fold<_fBinary, _tState, _tSeq, seq_size_t<_tSeq>::value>
809 {};
811
812
813
815
816 YB_Impl_Variadic_SeqOpB(vec_add)
818
819
820 YB_Impl_Variadic_SeqOpB(vec_subtract)
823
824 #undef YB_Impl_Variadic_SeqOpN
825 #undef YB_Impl_Variadic_SeqOpI
826 #undef YB_Impl_Variadic_SeqOpU
827 #undef YB_Impl_Variadic_SeqOp
828
829
830 } // namespace vseq;
831
833 using vseq::vdefer;
834
835 } // namespace ystdex;
836
837 #endif
838
ystdex::vseq::enable_for_instances
enable_when< and_< is_instance< _tSeqs >..., same_instance< _tSeqs... >>::value > enable_for_instances
Definition: variadic.hpp:276
ystdex::vseq::vec_add
序列作为向量的加法。
Definition: variadic.hpp:817
ystdex::vseq::details::deduplicate::head
front_t< _tSeq > head
Definition: variadic.hpp:619
ystdex::vseq::bind_back
部分应用。
Definition: variadic.hpp:149
ystdex::vseq::apply_t
_t< apply< _func, _tParams... >> apply_t
Definition: variadic.hpp:72
ystdex::vseq::details::unique
Definition: variadic.hpp:728
ystdex::when
类似 void_t 的元函数，具有较低匹配优先级，避免偏特化歧义；但使用条件表达式。
Definition: type_traits.hpp:591
ystdex::vseq::vec_subtract
序列作为向量的减法。
Definition: variadic.hpp:821
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:789
ystdex::vseq::defer
延迟求值。
Definition: variadic.hpp:99
ystdex::vseq::clear< _tSeq, when< true > >::type
apply_t< ctor_of_t< _tSeq >> type
Definition: variadic.hpp:290
ystdex::vseq::clear
单位元：取空序列。
Definition: variadic.hpp:284
yconstexpr
#define yconstexpr
指定编译时常量表达式。
Definition: ydef.h:653
ystdex::vseq::details::deduplicate
Definition: variadic.hpp:616
ystdex::vseq::push_front_t
_t< push_front< _tSeq, _tItem, _tEnabler >> push_front_t
Definition: variadic.hpp:421
ystdex::vseq::fmap< _tCtor, empty_base< _types... > >::type
apply_t< _tCtor, _types... > type
Definition: variadic.hpp:331
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:625
ystdex::vseq::split_n< 0, _tSeq, when< true > >::tail
_tSeq tail
Definition: variadic.hpp:522
ystdex::vseq::clear_t
_t< clear< _tSeq, _tEnabler >> clear_t
Definition: variadic.hpp:284
ystdex::vseq::details::unique< _tSeq, 1 >::type
_tSeq type
Definition: variadic.hpp:751
ystdex::vseq::front_t
_t< front< _tSeq, _tEnabler >> front_t
Definition: variadic.hpp:348
ystdex::vseq::details::unique< _tSeq, 0 >::type
clear_t< _tSeq > type
Definition: variadic.hpp:745
ystdex::vseq::bind_front
Definition: variadic.hpp:157
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:435
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:384
ystdex::vseq::front
取序列第一个元素。
Definition: variadic.hpp:348
ystdex::cpp2014::enable_if_t
typename enable_if< _bCond, _type >::type enable_if_t
Definition: type_traits.hpp:350
ystdex::vseq::concat
连接：合并序列。
Definition: variadic.hpp:300
ystdex::vseq::details::fold< _fBinary, _tState, _tSeq, seq_size_t< _tSeq >::value >::tail
typename parts::tail tail
Definition: variadic.hpp:786
ystdex::vseq::join_n< _vN, _tSeq, when< true > >::half
join_n_t< _vN/2, unit > half
Definition: variadic.hpp:667
ystdex::vseq::erase
删除指定位置的元素。
Definition: variadic.hpp:555
ystdex::vseq::details::unique::half_back
back_t< half > half_back
Definition: variadic.hpp:734
ystdex::vseq::defer_i< _tInt, _gOp, _gSeq< _tInt, _vSeq... >, when_valid< _gOp< _vSeq... > > >::type
_gOp< _vSeq... > type
Definition: variadic.hpp:116
YB_Impl_Variadic_SeqOpN
#define YB_Impl_Variadic_SeqOpN(_n)
Definition: variadic.hpp:89
ystdex::vseq::split_n
拆分序列前若干元素。
Definition: variadic.hpp:501
ystdex::vseq::bind_back::apply
vseq::apply< _func, _types..., _tParams... > apply
Definition: variadic.hpp:152
YB_Impl_Variadic_SeqOpU
#define YB_Impl_Variadic_SeqOpU(_n)
Definition: variadic.hpp:83
ystdex::vseq::unique< _tSeq, when< true > >::type
_t< details::unique< _tSeq >> type
Definition: variadic.hpp:761
ystdex::vseq::details::fold< _fBinary, _tState, _tSeq, 1 >::type
apply_t< _fBinary, _tState, front_t< _tSeq >> type
Definition: variadic.hpp:801
ystdex::vseq::push_back
取在序列末尾插入一个元素的序列。
Definition: variadic.hpp:395
ystdex::vseq::deduplicate< _tSeq, when< true > >::type
_t< details::deduplicate< seq_size< _tSeq >::value, _tSeq >> type
Definition: variadic.hpp:646
YB_Impl_Variadic_SeqOp
#define YB_Impl_Variadic_SeqOp(_n, _tparams, _targs)
Definition: variadic.hpp:76
YB_Impl_Variadic_SeqOpB
#define YB_Impl_Variadic_SeqOpB(_n)
Definition: variadic.hpp:85
ystdex::vseq::fmap< _tCtor, _tSeq, enable_for_instances< _tSeq > >::type
defer_apply_t< _tCtor, params_of_t< _tSeq >> type
Definition: variadic.hpp:338
ystdex::vseq::defer_apply_t
_t< defer_t< _func::template apply, _tParamsList >> defer_apply_t
Definition: variadic.hpp:132
ystdex::vseq::is_instance
判断是否可匹配类型实例。
Definition: variadic.hpp:255
ystdex::vseq::vdefer
可变参数类型列表延迟求值。
Definition: variadic.hpp:127
ystdex::vseq::defer< _gOp, _gSeq< _types... >, when_valid< _gOp< _types... > > >::type
_gOp< _types... > type
Definition: variadic.hpp:105
ystdex::vseq::_a
构造具有 apply 成员的一阶元函数。
Definition: variadic.hpp:176
ystdex::vseq::split_n< 0, _tSeq, when< true > >::type
clear_t< _tSeq > type
Definition: variadic.hpp:521
ystdex::vseq::at
取指定位置的元素。
Definition: variadic.hpp:467
ystdex::vseq::join_n< 0, _tSeq >::type
clear_t< _tSeq > type
Definition: variadic.hpp:676
ystdex::vseq::front< empty_base< _tHead, _tTail... > >::type
_tHead type
Definition: variadic.hpp:354
ystdex::vseq::join_n< _vN, _tSeq, when< true > >::unit
_tSeq unit
Definition: variadic.hpp:666
ystdex::vseq::details::fold< _fBinary, _tState, _tSeq, 0 >::type
_tState type
Definition: variadic.hpp:795
ystdex::vseq::details::deduplicate< 0, _tSeq >::type
_tSeq type
Definition: variadic.hpp:631
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:314
ystdex::_t
typename _type::type _t
嵌套类型别名。
Definition: type_traits.hpp:96
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:409
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:739
ystdex::vseq::details::fold
Definition: variadic.hpp:781
ystdex::vseq::details::find
Definition: variadic.hpp:582
ystdex::vseq::fold_t
_t< fold< _fBinary, _tState, _tSeq, _tEnabler >> fold_t
Definition: variadic.hpp:772
ystdex::vseq::params_of_t
_t< params_of< _tSeq, _tEnabler >> params_of_t
Definition: variadic.hpp:231
vseq
ystdex::vseq::push_front
取序列第一个元素以外的元素的序列。
Definition: variadic.hpp:421
ystdex::vseq::project
投影操作。
Definition: variadic.hpp:692
ystdex
特性测试宏。
Definition: ydef.h:796
ystdex::vseq::join_n_t
_t< join_n< _vN, _tSeq, _tEnabler >> join_n_t
Definition: variadic.hpp:656
ystdex::vseq::details::fold< _fBinary, _tState, _tSeq, seq_size_t< _tSeq >::value >::head
_t< parts > head
Definition: variadic.hpp:785
ystdex::vseq::ctor_of
取类型构造器：具有 apply 成员，结果的嵌套 type 类型为构造类型的元函数。
Definition: variadic.hpp:214
ystdex::vseq::join_n< 1, _tSeq >::type
_tSeq type
Definition: variadic.hpp:682
ystdex::vseq::join_n
重复连接序列元素。
Definition: variadic.hpp:656
ystdex::when_valid
well_formed_t< when< true >, _types... > when_valid
类似 void_t 的元函数，但具有较低匹配优先级，避免偏特化歧义。
Definition: type_traits.hpp:599
type_traits.hpp
ISO C++ 类型特征扩展。
ystdex::vseq::seq_size
取序列元素数。
Definition: variadic.hpp:445
YPP_Comma
#define YPP_Comma
替换为逗号的预处理记号。
Definition: ydef.h:225
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:707
ystdex::vseq::defer_i
Definition: variadic.hpp:110
ystdex::vseq::split_n< _vN, _tSeq, when< true > >::type
concat_t< _t< half >, _t< last >> type
Definition: variadic.hpp:514
ystdex::vseq::deduplicate
取合并相同元素后的序列。
Definition: variadic.hpp:610
ystdex::enable_when
enable_if_t< _bCond, when< true >> enable_when
类似 enable_if_t 的元函数，但具有较低匹配优先级，避免偏特化歧义。
Definition: type_traits.hpp:608
ystdex::empty_base
空基类模板。
Definition: ydef.h:902
ystdex::vseq::apply
typename _func::template apply< _tParams... > apply
元函数应用。
Definition: variadic.hpp:69
ystdex::vseq::back_t
_t< back< _tSeq, _tEnabler >> back_t
Definition: variadic.hpp:487
ystdex::vseq::pop_front_t
_t< pop_front< _tSeq, _tEnabler >> pop_front_t
Definition: variadic.hpp:371
ystdex::vseq::_q::apply
vdefer< apply, _func, _types... > apply
Definition: variadic.hpp:195
ystdex::vseq::params_of
取类型构造器参数。
Definition: variadic.hpp:231
ystdex::vseq::pop_front
取序列第一个元素以外的元素的序列。
Definition: variadic.hpp:371
ystdex::vseq::reverse
取逆序列。
Definition: variadic.hpp:700
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:670
ystdex::vseq::unique
取合并相邻相同元素后的序列。
Definition: variadic.hpp:717
ystdex::vseq::back
取序列最后一个元素。
Definition: variadic.hpp:487
ystdex::are_same
判断第一个参数和之后的参数指定的类型相同。
Definition: type_traits.hpp:934
ystdex::vseq::concat_t
_t< concat< _tSeq1, _tSeq2, _tEnabler >> concat_t
Definition: variadic.hpp:300
ystdex::vseq::deduplicate_t
_t< deduplicate< _tSeq, _tEnabler >> deduplicate_t
Definition: variadic.hpp:610
ystdex::vseq::instance_apply_t
defer_apply_t< ctor_of_t< _tSeq >, _tParamsList > instance_apply_t
使用构造器应用指定列表参数。
Definition: variadic.hpp:244
ystdex::vseq::split_n< 1, _tSeq, when< true > >::type
push_front_t< clear_t< _tSeq >, front_t< _tSeq >> type
Definition: variadic.hpp:528
YB_Impl_Variadic_SeqOpI
#define YB_Impl_Variadic_SeqOpI(_n)
Definition: variadic.hpp:87
ystdex::vseq::details::unique::last
_t< unique< typename split::tail >> last
Definition: variadic.hpp:733
ystdex::vseq::details::deduplicate::tail
pop_front_t< _tSeq > tail
Definition: variadic.hpp:620
ystdex::vseq::seq_size_t
_t< seq_size< _tSeq, _tEnabler >> seq_size_t
Definition: variadic.hpp:445
ystdex::vseq::split_n< _vN, _tSeq, when< true > >::tail
typename last::tail tail
Definition: variadic.hpp:515
ystdex::vseq::split_n< 1, _tSeq, when< true > >::tail
pop_front_t< _tSeq > tail
Definition: variadic.hpp:529
ystdex::vseq::pop_back
取序列最后元素以外的元素的序列。
Definition: variadic.hpp:540
ystdex::vseq::details::deduplicate< 1, _tSeq >::type
_tSeq type
Definition: variadic.hpp:637
ystdex::vseq::details::unique::half
_t< unique< typename split::type >> half
Definition: variadic.hpp:732
ystdex::vseq::details::unique::last_front
front_t< last > last_front
Definition: variadic.hpp:735
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:565
ystdex::vseq::fmap
函子映射：使用指定类型构造器和序列参数构造新的类型。
Definition: variadic.hpp:325
ystdex::vseq::_q
引用：延迟求值变换。
Definition: variadic.hpp:189
ystdex::vseq::fold
二元操作合并应用。
Definition: variadic.hpp:772
ystdex::vseq::front< _tSeq, enable_for_instances< _tSeq > >::type
front_t< params_of_t< _tSeq >> type
Definition: variadic.hpp:361
ystdex::vseq::find
查找元素。
Definition: variadic.hpp:576
ystdex::vseq::details::deduplicate::sub
deduplicate_t< tail > sub
Definition: variadic.hpp:621
ystdex::vseq::bind_front::apply
vseq::apply< _func, _tParams..., _types... > apply
Definition: variadic.hpp:160