YSTest: variadic.hpp 源文件

YSTest PreAlpha_b800_20170810 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_, 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, template<typename...> class _gSeq,
167 typename... _types>
168 struct defer<_gOp, _gSeq<_types...>, when_valid<_gOp<_types...>>>
169 {
170 using type = _gOp<_types...>;
171 };
172
173
174 YB_Impl_Variadic_SeqOp(defer_i, typename _type YPP_Comma template<_type...>
175 class _gOp YPP_Comma class _tSeq, _type YPP_Comma _gOp YPP_Comma _tSeq)
176
177 template<typename _tInt, template<_tInt...> class _gOp,
178 template<typename, _tInt...> class _gSeq, _tInt... _vSeq>
179 struct defer_i<_tInt, _gOp, _gSeq<_tInt, _vSeq...>, when_valid<_gOp<_vSeq...>>>
180 {
181 using type = _gOp<_vSeq...>;
182 };
184
185
191 template<template<typename...> class _gOp, typename... _types>
192 struct vdefer : defer<_gOp, empty_base<_types...>>
193 {};
194
196 template<class _func, class _tParamsList>
197 using defer_apply_t = _t<defer_t<_func::template apply, _tParamsList>>;
199
200
211
213 template<class _func, typename... _tParams>
214 struct bind_back
215 {
216 template<typename... _types>
217 using apply = vseq::apply<_func, _types..., _tParams...>;
218 };
219
220
221 template<class _func, typename... _tParams>
222 struct bind_front
223 {
224 template<typename... _types>
225 using apply = vseq::apply<_func, _tParams..., _types...>;
226 };
228
229
240 template<template<typename...> class _gOp>
241 struct _a
242 {
243 template<typename... _types>
244 using apply = vdefer<_gOp, _types...>;
245 };
246
247
253 template<class _func>
254 struct _q
255 {
256 // NOTE: Ideally, the template argument should be limited to enable check.
257 // However this is impossible since the arity of '_func::apply' is
258 // unknown.
259 template<typename... _types>
260 using apply = vdefer<apply, _func, _types...>;
261 };
263
264
265
267
268
279 YB_Impl_Variadic_SeqOpU(ctor_of)
280
281 template<template<typename...> class _gSeq, typename... _types>
282 struct ctor_of<_gSeq<_types...>>
283 {
284 using type = _a<_gSeq>;
285 };
287
288
296 YB_Impl_Variadic_SeqOpU(params_of)
297
298 template<template<typename...> class _gSeq, typename... _types>
299 struct params_of<_gSeq<_types...>>
300 {
301 using type = empty_base<_types...>;
302 };
304
305
306
308 template<class _tSeq, class _tParamsList>
309 using instance_apply_t = defer_apply_t<ctor_of_t<_tSeq>, _tParamsList>;
310
311
319 template<class, typename = void>
320 struct is_instance : false_
321 {};
322
323 template<class _tSeq>
324 struct is_instance<_tSeq, enable_if_t<is_same<_tSeq, _t<
325 vdefer<instance_apply_t, _tSeq, params_of_t<_tSeq>>>>::value>> : true_
326 {};
328
329
330 template<class... _tSeqs>
331 using same_instance = are_same<ctor_of_t<_tSeqs>...>;
332
333
339 template<typename... _tSeqs>
340 using enable_for_instances = enable_when<and_<is_instance<_tSeqs>...,
341 same_instance<_tSeqs...>>::value>;
343
344
346
347
349 YB_Impl_Variadic_SeqOpU(clear)
350
351 template<class _tSeq>
353 struct clear<_tSeq, when<true>>
354 {
355 using type = apply_t<ctor_of_t<_tSeq>>;
356 };
358
359
365 YB_Impl_Variadic_SeqOpB(concat)
366
367
369 template<typename... _types1, typename... _types2>
370 struct concat<empty_base<_types1...>, empty_base<_types2...>>
371 {
372 using type = empty_base<_types1..., _types2...>;
373 };
374
375 template<class _tSeq1, class _tSeq2>
376 struct concat<_tSeq1, _tSeq2, enable_for_instances<_tSeq1, _tSeq2>>
377 {
378 using type = instance_apply_t<_tSeq1,
379 concat_t<params_of_t<_tSeq1>, params_of_t<_tSeq2>>>;
380 };
382
383
389 YB_Impl_Variadic_SeqOp(fmap, class _tCtor YPP_Comma class _tSeq,
390 _tCtor YPP_Comma _tSeq)
391
392 template<class _tCtor, typename... _types>
394 struct fmap<_tCtor, empty_base<_types...>>
395 {
396 using type = apply_t<_tCtor, _types...>;
397 };
398
400 template<class _tCtor, class _tSeq>
401 struct fmap<_tCtor, _tSeq, enable_for_instances<_tSeq>>
402 {
403 using type = defer_apply_t<_tCtor, params_of_t<_tSeq>>;
404 };
406
407
413 YB_Impl_Variadic_SeqOpU(front)
414
415 template<typename _tHead, typename... _tTail>
417 struct front<empty_base<_tHead, _tTail...>>
418 {
419 using type = _tHead;
420 };
421
423 template<class _tSeq>
424 struct front<_tSeq, enable_for_instances<_tSeq>>
425 {
426 using type = front_t<params_of_t<_tSeq>>;
427 };
429
430
436 YB_Impl_Variadic_SeqOpU(pop_front)
437
438 template<typename _tHead, typename... _tTail>
440 struct pop_front<empty_base<_tHead, _tTail...>>
441 {
442 using type = empty_base<_tTail...>;
443 };
444
446 template<class _tSeq>
447 struct pop_front<_tSeq, enable_for_instances<_tSeq>>
448 {
449 using type = instance_apply_t<_tSeq, pop_front_t<params_of_t<_tSeq>>>;
450 };
452
453
459 YB_Impl_Variadic_SeqOp(push_back, class _tSeq YPP_Comma typename _tItem,
460 _tSeq YPP_Comma _tItem)
461
462 template<typename... _types, typename _type>
464 struct push_back<empty_base<_types...>, _type>
465 {
466 using type = empty_base<_types..., _type>;
467 };
468
470 template<class _tSeq, typename _type>
471 struct push_back<_tSeq, _type, enable_for_instances<_tSeq>>
472 {
473 using type
474 = instance_apply_t<_tSeq, push_back_t<params_of_t<_tSeq>, _type>>;
475 };
477
478
484 YB_Impl_Variadic_SeqOp(push_front, class _tSeq YPP_Comma typename _tItem,
486 _tSeq YPP_Comma _tItem)
487
488 template<typename... _types, typename _type>
490 struct push_front<empty_base<_types...>, _type>
491 {
492 using type = empty_base<_type, _types...>;
493 };
494
496 template<class _tSeq, typename _type>
497 struct push_front<_tSeq, _type, enable_for_instances<_tSeq>>
498 {
499 using type
500 = instance_apply_t<_tSeq, push_front_t<params_of_t<_tSeq>, _type>>;
501 };
503
504
510 YB_Impl_Variadic_SeqOpU(seq_size)
511
512 template<typename... _types>
514 struct seq_size<empty_base<_types...>> : size_t_<sizeof...(_types)>
515 {};
516
518 template<class _tSeq>
519 struct seq_size<_tSeq, enable_for_instances<_tSeq>>
520 : seq_size_t<params_of_t<_tSeq>>
521 {};
523
524
525
531 YB_Impl_Variadic_SeqOpI(at)
532
533 template<class _tSeq, size_t _vIdx>
535 struct at<_tSeq, _vIdx, when<true>>
536 : at<pop_front_t<_tSeq>, _vIdx - 1>
537 {};
538
540 template<class _tSeq>
541 struct at<_tSeq, 0, when<true>> : front<_tSeq>
542 {};
544
545
551 YB_Impl_Variadic_SeqOpU(back)
552
553 template<class _tSeq>
555 struct back<_tSeq, when<true>> : at<_tSeq, seq_size<_tSeq>::value - 1>
556 {};
558
559
565 YB_Impl_Variadic_SeqOpN(split_n)
566
567
569 template<size_t _vN, class _tSeq>
571 struct split_n<_vN, _tSeq, when<true>>
572 {
573 private:
574 using half = split_n<_vN / 2, _tSeq>;
575 using last = split_n<_vN - _vN / 2, typename half::tail>;
576
577 public:
578 using type = concat_t<_t<half>, _t<last>>;
579 using tail = typename last::tail;
580 };
581
582 template<class _tSeq>
583 struct split_n<0, _tSeq, when<true>>
584 {
585 using type = clear_t<_tSeq>;
586 using tail = _tSeq;
587 };
588
589 template<class _tSeq>
590 struct split_n<1, _tSeq, when<true>>
591 {
592 using type = push_front_t<clear_t<_tSeq>, front_t<_tSeq>>;
593 using tail = pop_front_t<_tSeq>;
594 };
596
597
598
604 YB_Impl_Variadic_SeqOpU(pop_back)
605
606 template<class _tSeq>
608 struct pop_back<_tSeq, when<true>> : split_n<seq_size<_tSeq>::value - 1, _tSeq>
609 {};
611
612
618 YB_Impl_Variadic_SeqOp(erase, class _tSeq YPP_Comma size_t _vIdx YPP_Comma
619 size_t _vEnd = _vIdx + 1, _tSeq YPP_Comma _vIdx YPP_Comma _vEnd)
620
621 template<class _tSeq, size_t _vIdx, size_t _vEnd>
623 struct erase<_tSeq, _vIdx, _vEnd, when<true>>
624 {
625 static_assert(_vIdx <= _vEnd, "Invalid range found.");
626
627 public:
628 using type = concat_t<split_n_t<_vIdx, _tSeq>,
629 typename split_n<_vEnd, _tSeq>::tail>;
630 };
632
633
639 YB_Impl_Variadic_SeqOp(find, class _tSeq YPP_Comma typename _type,
640 _tSeq YPP_Comma _type)
641
642 namespace details
643 {
644
645 template<size_t _vN, class _tSeq, typename _type>
646 struct find
647 {
648 static yconstexpr const size_t value = is_same<front_t<_tSeq>, _type>::value
649 ? 0 : find<_vN - 1, pop_front_t<_tSeq>, _type>::value + 1;
650 };
651
652 template<class _tSeq, typename _type>
653 struct find<0, _tSeq, _type>
654 {
655 static yconstexpr const size_t value = 0;
656 };
657
658 } // namespace details;
659
661 template<class _tSeq, typename _type>
662 struct find<_tSeq, _type, when<true>>
663 : size_t_<details::find<seq_size<_tSeq>::value, _tSeq, _type>::value>
664 {};
666
667
674 YB_Impl_Variadic_SeqOpU(deduplicate)
675
676 namespace details
677 {
678
679 template<size_t, class _tSeq>
680 struct deduplicate
681 {
682 private:
683 using head = front_t<_tSeq>;
684 using tail = pop_front_t<_tSeq>;
685 using sub = deduplicate_t<tail>;
686
687 public:
688 using type = conditional_t<vseq::find<tail, head>::value
689 == seq_size<tail>::value, push_front_t<sub, head>, sub>;
690 };
691
692 template<class _tSeq>
693 struct deduplicate<0, _tSeq>
694 {
695 using type = _tSeq;
696 };
697
698 template<class _tSeq>
699 struct deduplicate<1, _tSeq>
700 {
701 using type = _tSeq;
702 };
703
704 } // namespace details;
705
707 template<class _tSeq>
708 struct deduplicate<_tSeq, when<true>>
709 {
710 using type = _t<details::deduplicate<seq_size<_tSeq>::value, _tSeq>>;
711 };
713
714
720 YB_Impl_Variadic_SeqOpN(join_n)
721
722
726 template<size_t _vN, class _tSeq>
727 struct join_n<_vN, _tSeq, when<true>>
728 {
729 private:
730 using unit = _tSeq;
731 using half = join_n_t<_vN / 2, unit>;
732
733 public:
734 using type = concat_t<concat_t<half, half>, join_n_t<_vN % 2, unit>>;
735 };
736
737 template<class _tSeq>
738 struct join_n<0, _tSeq>
739 {
740 using type = clear_t<_tSeq>;
741 };
742
743 template<class _tSeq>
744 struct join_n<1, _tSeq>
745 {
746 using type = _tSeq;
747 };
749
750
755 YB_Impl_Variadic_SeqOp(project, class _tSeq YPP_Comma class _tIdxSeq,
756 _tSeq YPP_Comma _tIdxSeq)
757
758
759
764 YB_Impl_Variadic_SeqOpU(reverse)
765
767 template<class _tSeq>
768 struct reverse<_tSeq, when<true>>
769 {
770 using type = conditional_t<seq_size<_tSeq>::value == 0, clear_t<_tSeq>,
771 concat_t<reverse_t<pop_front_t<_tSeq>>, front_t<_tSeq>>>;
772 };
774
775
781 YB_Impl_Variadic_SeqOpU(unique)
782
783 namespace details
784 {
785
791 template<class _tSeq, size_t _vN = seq_size<_tSeq>::value>
792 struct unique
793 {
794 private:
795 using split = split_n<_vN / 2, _tSeq>;
796 using half = _t<unique<typename split::type>>;
797 using last = _t<unique<typename split::tail>>;
798 using half_back = back_t<half>;
799 using last_front = front_t<last>;
800
801 public:
802 using type = concat_t<half, cond_t<is_same<half_back, last_front>,
803 pop_front_t<last>, last>>;
804 };
805
806 template<class _tSeq>
807 struct unique<_tSeq, 0>
808 {
809 using type = clear_t<_tSeq>;
810 };
811
812 template<class _tSeq>
813 struct unique<_tSeq, 1>
814 {
815 using type = _tSeq;
816 };
818
819 } // namespace details;
820
822 template<class _tSeq>
823 struct unique<_tSeq, when<true>>
824 {
825 using type = _t<details::unique<_tSeq>>;
826 };
827
828
835 YB_Impl_Variadic_SeqOp(fold, class _fBinary YPP_Comma typename _tState YPP_Comma
836 class _tSeq, _fBinary YPP_Comma _tState YPP_Comma _tSeq)
837
838
840 namespace details
841 {
842
844 template<class _fBinary, typename _tState, typename _tSeq, size_t _vSize>
845 struct fold
846 {
847 private:
848 using parts = split_n<_vSize / 2, _tSeq>;
849 using head = _t<parts>;
850 using tail = typename parts::tail;
851
852 public:
853 using type = fold_t<_fBinary, fold_t<_fBinary, _tState, head>, tail>;
854 };
855
856 template<class _fBinary, typename _tState, typename _tSeq>
857 struct fold<_fBinary, _tState, _tSeq, 0>
858 {
859 using type = _tState;
860 };
861
862 template<class _fBinary, typename _tState, typename _tSeq>
863 struct fold<_fBinary, _tState, _tSeq, 1>
864 {
865 using type = apply_t<_fBinary, _tState, front_t<_tSeq>>;
866 };
867
868 } // namespace details;
869
870 template<class _fBinary, typename _tState, typename _tSeq>
871 struct fold<_fBinary, _tState, _tSeq, enable_for_instances<_tSeq>>
872 : details::fold<_fBinary, _tState, _tSeq, seq_size_t<_tSeq>::value>
873 {};
875
876
877
879
880 YB_Impl_Variadic_SeqOpB(vec_add)
882
883
884 YB_Impl_Variadic_SeqOpB(vec_subtract)
887
888 #undef YB_Impl_Variadic_SeqOpN
889 #undef YB_Impl_Variadic_SeqOpI
890 #undef YB_Impl_Variadic_SeqOpU
891 #undef YB_Impl_Variadic_SeqOp
892
893
894 } // namespace vseq;
895
897 using vseq::vdefer;
898
899 } // namespace ystdex;
900
901 #endif
902
YB_Impl_Variadic_SeqOp
#define YB_Impl_Variadic_SeqOp(_n, _tparams, _targs)
Definition: variadic.hpp:141
ystdex::vseq::details::unique
Definition: variadic.hpp:792
YB_Impl_Variadic_SeqOpI
#define YB_Impl_Variadic_SeqOpI(_n)
Definition: variadic.hpp:152
ystdex::vseq::defer_i< _tInt, _gOp, _gSeq< _tInt, _vSeq... >, when_valid< _gOp< _vSeq... > > >::type
_gOp< _vSeq... > type
Definition: variadic.hpp:181
ystdex::vseq::front< empty_base< _tHead, _tTail... > >::type
_tHead type
Definition: variadic.hpp:419
ystdex::fseq::pop_front
empty_base< _types... > pop_front(empty_base< _type, _types... >)
Definition: variadic.hpp:81
ystdex::vseq::join_n< 0, _tSeq >::type
clear_t< _tSeq > type
Definition: variadic.hpp:740
ystdex::vseq::bind_back::apply
vseq::apply< _func, _types..., _tParams... > apply
Definition: variadic.hpp:217
ystdex::vseq::fmap< _tCtor, _tSeq, enable_for_instances< _tSeq > >::type
defer_apply_t< _tCtor, params_of_t< _tSeq >> type
Definition: variadic.hpp:403
ystdex::vseq::concat
连接：合并序列。
Definition: variadic.hpp:365
ystdex::vseq::details::unique::last_front
front_t< last > last_front
Definition: variadic.hpp:799
ystdex::true_
bool_< true > true_
Definition: type_traits.hpp:391
yconstfn
#define yconstfn
指定编译时常量函数。
Definition: ydef.h:680
ystdex::vseq::at
取指定位置的元素。
Definition: variadic.hpp:531
ystdex::vseq::details::unique< _tSeq, 1 >::type
_tSeq type
Definition: variadic.hpp:815
ystdex::vseq::ctor_of
取类型构造器：具有 apply 成员，结果的嵌套 type 类型为构造类型的元函数。
Definition: variadic.hpp:279
YB_Impl_Variadic_SeqOpB
#define YB_Impl_Variadic_SeqOpB(_n)
Definition: variadic.hpp:150
ystdex::vseq::defer_i
Definition: variadic.hpp:175
ystdex::vseq::deduplicate
取合并相同元素后的序列。
Definition: variadic.hpp:674
ystdex::vseq::clear
单位元：取空序列。
Definition: variadic.hpp:349
ystdex::vseq::clear_t
_t< clear< _tSeq, _tEnabler >> clear_t
Definition: variadic.hpp:349
ystdex::vseq::front
取序列第一个元素。
Definition: variadic.hpp:413
YB_Impl_Variadic_SeqOpU
#define YB_Impl_Variadic_SeqOpU(_n)
Definition: variadic.hpp:148
platform::tail
_tString ystdex::string_traits< _tString >::const_pointer tail
Definition: YCLib/FileSystem.h:286
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:449
ystdex::vseq::split_n< _vN, _tSeq, when< true > >::type
concat_t< _t< half >, _t< last >> type
Definition: variadic.hpp:578
ystdex::vseq::details::unique< _tSeq, 0 >::type
clear_t< _tSeq > type
Definition: variadic.hpp:809
ystdex::vseq::join_n< _vN, _tSeq, when< true > >::half
join_n_t< _vN/2, unit > half
Definition: variadic.hpp:731
NPL::x
const TermNode &term ynothrow const TermNode &term ynothrow const TermNode &term ynothrow TermNode &term const TermNode &term ValueNode &node const ValueNode &node const _type & x
Definition: SContext.h:94
ystdex::vseq::join_n< 1, _tSeq >::type
_tSeq type
Definition: variadic.hpp:746
ystdex::vseq::front_t
_t< front< _tSeq, _tEnabler >> front_t
Definition: variadic.hpp:413
ystdex::vseq::bind_back
部分应用。
Definition: variadic.hpp:214
ystdex::vseq::defer< _gOp, _gSeq< _types... >, when_valid< _gOp< _types... > > >::type
_gOp< _types... > type
Definition: variadic.hpp:170
ystdex::false_
bool_< false > false_
Definition: type_traits.hpp:392
CHRLib::f
f(d, s)
ystdex::vseq::defer
延迟求值。
Definition: variadic.hpp:164
ystdex::vseq::split_n< _vN, _tSeq, when< true > >::tail
typename last::tail tail
Definition: variadic.hpp:579
ystdex::vseq::pop_front
取序列第一个元素以外的元素的序列。
Definition: variadic.hpp:436
YB_Impl_Variadic_SeqOpN
#define YB_Impl_Variadic_SeqOpN(_n)
Definition: variadic.hpp:154
ystdex::vseq::join_n< _vN, _tSeq, when< true > >::unit
_tSeq unit
Definition: variadic.hpp:730
ystdex::fseq::fold
_tState fold(_func, _tState s, integer_sequence< _tInt >)
Definition: integer_sequence.hpp:96
ystdex::vseq::back_t
_t< back< _tSeq, _tEnabler >> back_t
Definition: variadic.hpp:551
ystdex::vseq::pop_front_t
_t< pop_front< _tSeq, _tEnabler >> pop_front_t
Definition: variadic.hpp:436
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:771
ystdex::cpp2014::enable_if_t
typename enable_if< _bCond, _type >::type enable_if_t
Definition: type_traits.hpp:343
yconstexpr
#define yconstexpr
指定编译时常量表达式。
Definition: ydef.h:679
ystdex::vseq::details::fold< _fBinary, _tState, _tSeq, seq_size_t< _tSeq >::value >::head
_t< parts > head
Definition: variadic.hpp:849
ystdex::fseq::vfold
_tState vfold(_func, _tState s)
Definition: variadic.hpp:103
ystdex::vseq::details::fold< _fBinary, _tState, _tSeq, 0 >::type
_tState type
Definition: variadic.hpp:859
ystdex::vseq::details::fold< _fBinary, _tState, _tSeq, 1 >::type
apply_t< _fBinary, _tState, front_t< _tSeq >> type
Definition: variadic.hpp:865
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:853
ystdex::vseq::pop_back
取序列最后元素以外的元素的序列。
Definition: variadic.hpp:604
ystdex::vseq::deduplicate_t
_t< deduplicate< _tSeq, _tEnabler >> deduplicate_t
Definition: variadic.hpp:674
ystdex::vseq::fold_t
_t< fold< _fBinary, _tState, _tSeq, _tEnabler >> fold_t
Definition: variadic.hpp:836
ystdex::vseq::unique
取合并相邻相同元素后的序列。
Definition: variadic.hpp:781
ystdex::vseq::push_front_t
_t< push_front< _tSeq, _tItem, _tEnabler >> push_front_t
Definition: variadic.hpp:486
ystdex::vseq::join_n_t
_t< join_n< _vN, _tSeq, _tEnabler >> join_n_t
Definition: variadic.hpp:720
ystdex::vseq::bind_front::apply
vseq::apply< _func, _tParams..., _types... > apply
Definition: variadic.hpp:225
ystdex::vseq::split_n< 1, _tSeq, when< true > >::type
push_front_t< clear_t< _tSeq >, front_t< _tSeq >> type
Definition: variadic.hpp:592
ystdex::vseq::fmap< _tCtor, empty_base< _types... > >::type
apply_t< _tCtor, _types... > type
Definition: variadic.hpp:396
ystdex::vseq::vec_add
序列作为向量的加法。
Definition: variadic.hpp:881
ystdex::vseq::front< _tSeq, enable_for_instances< _tSeq > >::type
front_t< params_of_t< _tSeq >> type
Definition: variadic.hpp:426
ystdex::vseq::_a
构造具有 apply 成员的一阶元函数。
Definition: variadic.hpp:241
ystdex::vseq::details::deduplicate::head
front_t< _tSeq > head
Definition: variadic.hpp:683
ystdex::vseq::back
取序列最后一个元素。
Definition: variadic.hpp:551
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:689
ystdex::vseq::details::deduplicate::sub
deduplicate_t< tail > sub
Definition: variadic.hpp:685
ystdex::vseq::params_of_t
_t< params_of< _tSeq, _tEnabler >> params_of_t
Definition: variadic.hpp:296
ystdex::vseq::seq_size_t
_t< seq_size< _tSeq, _tEnabler >> seq_size_t
Definition: variadic.hpp:510
ystdex::vseq::instance_apply_t
defer_apply_t< ctor_of_t< _tSeq >, _tParamsList > instance_apply_t
使用构造器应用指定列表参数。
Definition: variadic.hpp:309
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:766
type_traits.hpp
ISO C++ 类型特征扩展。
ystdex::vseq::vdefer
可变参数类型列表延迟求值。
Definition: variadic.hpp:192
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:140
ystdex::vseq::details::deduplicate::tail
pop_front_t< _tSeq > tail
Definition: variadic.hpp:684
ystdex
特性测试宏。
Definition: ydef.h:822
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:379
ystdex::vseq::details::find
Definition: variadic.hpp:646
ystdex::vseq::details::fold
Definition: variadic.hpp:845
ystdex::size_t_
std::integral_constant< size_t, _vInt > size_t_
Definition: type_traits.hpp:385
ystdex::vseq::bind_front
Definition: variadic.hpp:222
ystdex::vseq::deduplicate< _tSeq, when< true > >::type
_t< details::deduplicate< seq_size< _tSeq >::value, _tSeq >> type
Definition: variadic.hpp:710
ystdex::vseq::vec_subtract
序列作为向量的减法。
Definition: variadic.hpp:885
ystdex::vseq::details::deduplicate
Definition: variadic.hpp:680
ystdex::_t
typename _type::type _t
嵌套类型别名。
Definition: type_traits.hpp:97
ystdex::fseq::front
identity< _type > front(empty_base< _type, _types... >)
Definition: variadic.hpp:74
ystdex::vseq::split_n< 1, _tSeq, when< true > >::tail
pop_front_t< _tSeq > tail
Definition: variadic.hpp:593
ystdex::vseq::split_n< 0, _tSeq, when< true > >::tail
_tSeq tail
Definition: variadic.hpp:586
ystdex::vseq::erase
删除指定位置的元素。
Definition: variadic.hpp:619
ystdex::vseq::details::deduplicate< 0, _tSeq >::type
_tSeq type
Definition: variadic.hpp:695
ystdex::vseq::is_instance
判断是否可匹配类型实例。
Definition: variadic.hpp:320
ystdex::vseq::enable_for_instances
enable_when< and_< is_instance< _tSeqs >..., same_instance< _tSeqs... >>::value > enable_for_instances
Definition: variadic.hpp:341
ystdex::vseq::split_n
拆分序列前若干元素。
Definition: variadic.hpp:565
ystdex::when
类似 void_t 的元函数，具有较低匹配优先级，避免偏特化歧义；但使用条件表达式。
Definition: type_traits.hpp:616
ystdex::empty_base
空基类模板。
Definition: ydef.h:928
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:803
ystdex::when_valid
well_formed_t< when< true >, _types... > when_valid
类似 void_t 的元函数，但具有较低匹配优先级，避免偏特化歧义。
Definition: type_traits.hpp:624
ystdex::vseq::project
投影操作。
Definition: variadic.hpp:756
vseq
ystdex::vseq::_q::apply
vdefer< apply, _func, _types... > apply
Definition: variadic.hpp:260
ystdex::vseq::details::deduplicate< 1, _tSeq >::type
_tSeq type
Definition: variadic.hpp:701
ystdex::vseq::seq_size
取序列元素数。
Definition: variadic.hpp:510
ystdex::vseq::params_of
取类型构造器参数。
Definition: variadic.hpp:296
ystdex::enable_when
enable_if_t< _bCond, when< true >> enable_when
类似 enable_if_t 的元函数，但具有较低匹配优先级，避免偏特化歧义。
Definition: type_traits.hpp:633
YPP_Comma
#define YPP_Comma
替换为逗号的预处理记号。
Definition: ydef.h:225
ystdex::are_same
判断第一个参数和之后的参数指定的类型相同。
Definition: type_traits.hpp:972
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:734
ystdex::vseq::apply
typename _func::template apply< _tParams... > apply
元函数应用。
Definition: variadic.hpp:134
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:474
ystdex::vseq::details::unique::last
_t< unique< typename split::tail >> last
Definition: variadic.hpp:797
ystdex::vseq::join_n
重复连接序列元素。
Definition: variadic.hpp:720
ystdex::vseq::details::unique::half_back
back_t< half > half_back
Definition: variadic.hpp:798
ystdex::vseq::details::fold< _fBinary, _tState, _tSeq, seq_size_t< _tSeq >::value >::tail
typename parts::tail tail
Definition: variadic.hpp:850
ystdex::vseq::push_back
取在序列末尾插入一个元素的序列。
Definition: variadic.hpp:460
ystdex::vseq::push_front
取序列第一个元素以外的元素的序列。
Definition: variadic.hpp:486
ystdex::vseq::unique< _tSeq, when< true > >::type
_t< details::unique< _tSeq >> type
Definition: variadic.hpp:825
ystdex::vseq::reverse
取逆序列。
Definition: variadic.hpp:764
ystdex::vseq::apply_t
_t< apply< _func, _tParams... >> apply_t
Definition: variadic.hpp:137
ystdex::vseq::clear< _tSeq, when< true > >::type
apply_t< ctor_of_t< _tSeq >> type
Definition: variadic.hpp:355
ystdex::vseq::defer_apply_t
_t< defer_t< _func::template apply, _tParamsList >> defer_apply_t
Definition: variadic.hpp:197
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:629
ystdex::vseq::split_n< 0, _tSeq, when< true > >::type
clear_t< _tSeq > type
Definition: variadic.hpp:585
ystdex::vseq::details::unique::half
_t< unique< typename split::type >> half
Definition: variadic.hpp:796
ystdex::vseq::fmap
函子映射：使用指定类型构造器和序列参数构造新的类型。
Definition: variadic.hpp:390
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:500
ystdex::vseq::_q
引用：延迟求值变换。
Definition: variadic.hpp:254
ystdex::vseq::concat_t
_t< concat< _tSeq1, _tSeq2, _tEnabler >> concat_t
Definition: variadic.hpp:365
ystdex::vseq::find
查找元素。
Definition: variadic.hpp:640
ystdex::vseq::fold
二元操作合并应用。
Definition: variadic.hpp:836