Compare commits
1793 Commits
release_30
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9a6a9c08e4 | ||
![]() |
199bee0ea7 | ||
![]() |
85df7a8775 | ||
![]() |
c8f54c2396 | ||
![]() |
d6a12b3861 | ||
![]() |
0710b55e29 | ||
![]() |
a3d6b126d2 | ||
![]() |
6ba21565bd | ||
![]() |
e39f4b996e | ||
![]() |
8459d20624 | ||
![]() |
ed99798624 | ||
![]() |
90e328c271 | ||
![]() |
d18b496f7e | ||
![]() |
b6621c5259 | ||
![]() |
633fe505fe | ||
![]() |
563647a240 | ||
![]() |
bbca174790 | ||
![]() |
9b452384d4 | ||
![]() |
28c02db8d7 | ||
![]() |
76d2446cf4 | ||
![]() |
5be047d322 | ||
![]() |
a846b11cd8 | ||
![]() |
a3866e4c89 | ||
![]() |
ea972908a3 | ||
![]() |
c180f34dd3 | ||
![]() |
5c2fabf7f7 | ||
![]() |
c666b13c85 | ||
![]() |
8254964ef0 | ||
![]() |
b5599c682f | ||
![]() |
a3e7f528a2 | ||
![]() |
14ba0ad689 | ||
![]() |
5a579cfea4 | ||
![]() |
eefcf8206e | ||
![]() |
5e00a713ed | ||
![]() |
a660757c72 | ||
![]() |
d8717289a6 | ||
![]() |
55dbcdab7f | ||
![]() |
99b6e56ae9 | ||
![]() |
f60d092766 | ||
![]() |
ffc9c61015 | ||
![]() |
15a326c525 | ||
![]() |
7b7c9ec355 | ||
![]() |
fe99a30bd0 | ||
![]() |
98984f23c6 | ||
![]() |
3f159e874c | ||
![]() |
94d9b1c5b2 | ||
![]() |
e1c5c419f5 | ||
![]() |
1bae7a868b | ||
![]() |
55d741c32e | ||
![]() |
a28344c08b | ||
![]() |
cc2e93cff0 | ||
![]() |
6b6407a6db | ||
![]() |
84bdf2cbe4 | ||
![]() |
579b42b413 | ||
![]() |
fa62fbe63f | ||
![]() |
e9ef988b08 | ||
![]() |
6455d85714 | ||
![]() |
a3b25f81d1 | ||
![]() |
746572b91d | ||
![]() |
38e7a30143 | ||
![]() |
970a9e5866 | ||
![]() |
223df2ef0f | ||
![]() |
c010bd6289 | ||
![]() |
25bcb0a5a9 | ||
![]() |
48bcd27b67 | ||
![]() |
59b5ea57c3 | ||
![]() |
fe11cfdd65 | ||
![]() |
94611a888b | ||
![]() |
9d6ca4962b | ||
![]() |
8aadda9a19 | ||
![]() |
0cff2318f5 | ||
![]() |
1f98e313a1 | ||
![]() |
dd2fe4de1d | ||
![]() |
28ce1c847a | ||
![]() |
fb7b97cfbb | ||
![]() |
8997b87133 | ||
![]() |
9533a4a80f | ||
![]() |
88fa03a06e | ||
![]() |
175cb20bfb | ||
![]() |
332ab91947 | ||
![]() |
dbef2bb1d0 | ||
![]() |
fd33deb083 | ||
![]() |
25037cf729 | ||
![]() |
e6d05b65b2 | ||
![]() |
601d2c1165 | ||
![]() |
1cf5a81b89 | ||
![]() |
5d5b59b826 | ||
![]() |
ac042ab93d | ||
![]() |
8f6e763c49 | ||
![]() |
99290c6ec8 | ||
![]() |
1d3716a633 | ||
![]() |
a7780301d8 | ||
![]() |
bb856cc357 | ||
![]() |
7b081f6bc5 | ||
![]() |
b9aebae3dc | ||
![]() |
89c7ec3512 | ||
![]() |
a317a1b7cf | ||
![]() |
d1e2a83a5e | ||
![]() |
2bc8f6ceeb | ||
![]() |
8cbf020fdc | ||
![]() |
56c1f9b8e5 | ||
![]() |
f0cd203bdc | ||
![]() |
a4ae16b67a | ||
![]() |
a6622799b4 | ||
![]() |
499d87881a | ||
![]() |
4f01aa8fb8 | ||
![]() |
b3b00818e5 | ||
![]() |
3759bed447 | ||
![]() |
44d1476b6d | ||
![]() |
73ffc78616 | ||
![]() |
218d017400 | ||
![]() |
6bed14b343 | ||
![]() |
bf64c23851 | ||
![]() |
cb23a49e40 | ||
![]() |
42b89c7e05 | ||
![]() |
ea33904773 | ||
![]() |
de66c515de | ||
![]() |
8b7a6b8995 | ||
![]() |
9f4f08db91 | ||
![]() |
e35e663f73 | ||
![]() |
f2b3629dbf | ||
![]() |
26a70eccf2 | ||
![]() |
f650ea7131 | ||
![]() |
ff7ba4da7d | ||
![]() |
45bae0b7dc | ||
![]() |
1883b40a07 | ||
![]() |
759cd0e86b | ||
![]() |
4ccd90dd42 | ||
![]() |
ddbf08114a | ||
![]() |
4faa3944c6 | ||
![]() |
325c37a20f | ||
![]() |
f82f4f3f07 | ||
![]() |
1bbbd60ea7 | ||
![]() |
ceeace9a60 | ||
![]() |
72d7577b34 | ||
![]() |
d20ca91968 | ||
![]() |
a09319b898 | ||
![]() |
d8b2456344 | ||
![]() |
d2a59ae0e1 | ||
![]() |
5142fe4401 | ||
![]() |
d06b33e5d0 | ||
![]() |
2d2757fe70 | ||
![]() |
0d2d92e98e | ||
![]() |
fa8c64946a | ||
![]() |
ba4775171e | ||
![]() |
f956599e0e | ||
![]() |
960bd0c6f8 | ||
![]() |
f8941c14a4 | ||
![]() |
25daee702e | ||
![]() |
74a6450793 | ||
![]() |
6f287e9053 | ||
![]() |
7ed093bde7 | ||
![]() |
e3898a2187 | ||
![]() |
423ca20f24 | ||
![]() |
d95ca09be4 | ||
![]() |
9698ac5a68 | ||
![]() |
5289b0d698 | ||
![]() |
237206bfda | ||
![]() |
49abdbcca3 | ||
![]() |
6a85e8a355 | ||
![]() |
da3ca86451 | ||
![]() |
514c831504 | ||
![]() |
bf94e48216 | ||
![]() |
842e3f6f51 | ||
![]() |
6b0e4195eb | ||
![]() |
0b4ab6f08a | ||
![]() |
2897e786b4 | ||
![]() |
41a04d69c4 | ||
![]() |
c2d317f1a2 | ||
![]() |
af9a44f256 | ||
![]() |
65a6f64221 | ||
![]() |
b22481a33b | ||
![]() |
5d514c01f5 | ||
![]() |
7ec94be3df | ||
![]() |
82c5745451 | ||
![]() |
4b5169ad0b | ||
![]() |
1aa96e8679 | ||
![]() |
cf829c9688 | ||
![]() |
9641982206 | ||
![]() |
bf54da76b9 | ||
![]() |
e3ec600c01 | ||
![]() |
46f9f326cf | ||
![]() |
6e5b234c63 | ||
![]() |
0dec9d519c | ||
![]() |
a189974948 | ||
![]() |
6d9da5891f | ||
![]() |
cae4caba73 | ||
![]() |
408369b7c9 | ||
![]() |
9eddf6e1f5 | ||
![]() |
e2d4892682 | ||
![]() |
87813277b3 | ||
![]() |
ba3e81f6a8 | ||
![]() |
aff153a8cd | ||
![]() |
031a3d203a | ||
![]() |
5ec04a92d2 | ||
![]() |
4f241823a2 | ||
![]() |
044df63102 | ||
![]() |
5ea443059f | ||
![]() |
961269db1b | ||
![]() |
e94b4840ef | ||
![]() |
f1626ad28d | ||
![]() |
db8a5fd864 | ||
![]() |
3dfc10d4b1 | ||
![]() |
6d51f6c58c | ||
![]() |
7bcd5704d9 | ||
![]() |
4add27b763 | ||
![]() |
5e91fa1eec | ||
![]() |
6804e8bfa0 | ||
![]() |
70e8f59884 | ||
![]() |
bb2f28e15d | ||
![]() |
d686dda62e | ||
![]() |
a276cb01be | ||
![]() |
a73d0926fc | ||
![]() |
2fdc443f37 | ||
![]() |
b9f425a434 | ||
![]() |
dc68c69e32 | ||
![]() |
ed65d0dba5 | ||
![]() |
3d46eb0f6d | ||
![]() |
66d7d70263 | ||
![]() |
db61736491 | ||
![]() |
fae0070cfc | ||
![]() |
4c4d1aac49 | ||
![]() |
f4d8ff9d93 | ||
![]() |
672575dadc | ||
![]() |
de56f74611 | ||
![]() |
85b6661a44 | ||
![]() |
0a6d1e2938 | ||
![]() |
00f4a49b0b | ||
![]() |
8966350d61 | ||
![]() |
35a6c564bf | ||
![]() |
faa9a31aef | ||
![]() |
a8dca5f978 | ||
![]() |
f99b59c784 | ||
![]() |
286e0a491b | ||
![]() |
3b1fb53a65 | ||
![]() |
34172f7f1b | ||
![]() |
d434e2a535 | ||
![]() |
8e030714ff | ||
![]() |
0376dfaca0 | ||
![]() |
85d45f6c0d | ||
![]() |
af961ed8cf | ||
![]() |
fc93ce7349 | ||
![]() |
1efadf976d | ||
![]() |
ba865ff66b | ||
![]() |
bed1d91bf2 | ||
![]() |
d08dbfc12e | ||
![]() |
9a3c689b8a | ||
![]() |
c0e7971986 | ||
![]() |
6a85d5c674 | ||
![]() |
fe5102c83e | ||
![]() |
76581dc450 | ||
![]() |
65a1d45c0a | ||
![]() |
7175a07921 | ||
![]() |
26d2390a8d | ||
![]() |
eb6e2eac6c | ||
![]() |
0934c750ed | ||
![]() |
36dc080bf6 | ||
![]() |
5514d36c43 | ||
![]() |
8b93263784 | ||
![]() |
e1be30b7e1 | ||
![]() |
d74dee9255 | ||
![]() |
aa9b5e37f7 | ||
![]() |
a37957634c | ||
![]() |
91eeba8d26 | ||
![]() |
3baabab827 | ||
![]() |
2576c29dab | ||
![]() |
dd29a02911 | ||
![]() |
b47a434d60 | ||
![]() |
bfb46e486d | ||
![]() |
12ddf2cbd2 | ||
![]() |
48aa2cf9f3 | ||
![]() |
568bd0222f | ||
![]() |
3a59ae6783 | ||
![]() |
db8c4fd8c7 | ||
![]() |
5b3a4593da | ||
![]() |
9962ddfa24 | ||
![]() |
45f63bc07e | ||
![]() |
7cc7106776 | ||
![]() |
938c96ef53 | ||
![]() |
40766f70a4 | ||
![]() |
f544330f34 | ||
![]() |
bbe4245e63 | ||
![]() |
166dadbcbe | ||
![]() |
fd9bbf52cd | ||
![]() |
6af41ab8c2 | ||
![]() |
18dbed9596 | ||
![]() |
b0be44f963 | ||
![]() |
02bb4bdb49 | ||
![]() |
47c5dae573 | ||
![]() |
212714f805 | ||
![]() |
3a07a2f4f3 | ||
![]() |
462410703d | ||
![]() |
7b86ce5cc4 | ||
![]() |
692177d022 | ||
![]() |
0f7221ccb8 | ||
![]() |
7d439a455d | ||
![]() |
12c6d9cd93 | ||
![]() |
3f339e65df | ||
![]() |
40853eac80 | ||
![]() |
2af7d42fe3 | ||
![]() |
7efdd69688 | ||
![]() |
cd6ed54fed | ||
![]() |
73f131f210 | ||
![]() |
83de1012a9 | ||
![]() |
22dff5382a | ||
![]() |
92679178a5 | ||
![]() |
26edd804ba | ||
![]() |
119ed47999 | ||
![]() |
7d914d1bff | ||
![]() |
f301a117e1 | ||
![]() |
8f7fe5cd8e | ||
![]() |
4f55ef701a | ||
![]() |
0ce05a9f86 | ||
![]() |
f3a1a187a1 | ||
![]() |
c6e466911f | ||
![]() |
faaf5ee349 | ||
![]() |
0c5dd15e09 | ||
![]() |
7c1ebcf6fd | ||
![]() |
9e97eb890c | ||
![]() |
b81d6f5b8d | ||
![]() |
5a426e50d0 | ||
![]() |
5706c375d5 | ||
![]() |
933bf68f0a | ||
![]() |
58113db00c | ||
![]() |
07546f3b93 | ||
![]() |
abadb458d0 | ||
![]() |
f3c8fb22ec | ||
![]() |
715339ab55 | ||
![]() |
323ade3e70 | ||
![]() |
4428584a88 | ||
![]() |
8c42c8cb46 | ||
![]() |
1224e8972b | ||
![]() |
46d06b90c1 | ||
![]() |
cb126215aa | ||
![]() |
c41133728d | ||
![]() |
3d08766099 | ||
![]() |
b05f0599c0 | ||
![]() |
4983580dc5 | ||
![]() |
6f08111102 | ||
![]() |
fdae69aa13 | ||
![]() |
3a0e430cd4 | ||
![]() |
6d7a2cb57d | ||
![]() |
b7fc49f828 | ||
![]() |
bc1e44d14e | ||
![]() |
eeeada1c77 | ||
![]() |
724b5ab350 | ||
![]() |
7726a348df | ||
![]() |
56a599b976 | ||
![]() |
f54ca46a7b | ||
![]() |
4356f6392e | ||
![]() |
64c6248499 | ||
![]() |
c912c0ce7c | ||
![]() |
127db91f3e | ||
![]() |
7b193f7797 | ||
![]() |
bbf87b1c34 | ||
![]() |
b957bac1da | ||
![]() |
22f6c0532d | ||
![]() |
c2a3137671 | ||
![]() |
f0324bcaa1 | ||
![]() |
8731c5da46 | ||
![]() |
708b86b5f9 | ||
![]() |
56523ff60e | ||
![]() |
fa97c2e8bc | ||
![]() |
c4324b2b94 | ||
![]() |
ebc31694e8 | ||
![]() |
bf0460e0a0 | ||
![]() |
0620fc865b | ||
![]() |
60784f62de | ||
![]() |
fc3a3ffc69 | ||
![]() |
83f8153b22 | ||
![]() |
14c616af09 | ||
![]() |
970d9f7768 | ||
![]() |
2cd0a2e4e7 | ||
![]() |
ee6bfb2117 | ||
![]() |
8f1d85fde5 | ||
![]() |
7242d18811 | ||
![]() |
b5b66923e3 | ||
![]() |
ecec10efd9 | ||
![]() |
97092d6a5c | ||
![]() |
19158f2fa1 | ||
![]() |
bae11add65 | ||
![]() |
1a7ccb14e8 | ||
![]() |
5d663441e7 | ||
![]() |
d539803d4b | ||
![]() |
5486fac53c | ||
![]() |
a985b8cc79 | ||
![]() |
5dce73dd6e | ||
![]() |
02be74588a | ||
![]() |
f4c97290fc | ||
![]() |
e7b12e343b | ||
![]() |
e62560a9b6 | ||
![]() |
bc9ccda541 | ||
![]() |
c7c52f913d | ||
![]() |
de76389219 | ||
![]() |
c42668278d | ||
![]() |
21f5b24e2d | ||
![]() |
b6d12a2b3a | ||
![]() |
4f8edc478b | ||
![]() |
5e5e11d90d | ||
![]() |
22a6d5aede | ||
![]() |
56a8c6438a | ||
![]() |
a5ad9ac48b | ||
![]() |
0ad232a882 | ||
![]() |
928735abf1 | ||
![]() |
488025c316 | ||
![]() |
3607f8640d | ||
![]() |
dbaf7a0d31 | ||
![]() |
d20675f970 | ||
![]() |
cd13782c22 | ||
![]() |
4b23a3324a | ||
![]() |
14dbb25449 | ||
![]() |
3e879e3d3f | ||
![]() |
7ceff4ef43 | ||
![]() |
46a7ec9a3d | ||
![]() |
8f916f1c7c | ||
![]() |
71ed9f00d2 | ||
![]() |
c254b36c29 | ||
![]() |
e9d030687d | ||
![]() |
3a4964aef3 | ||
![]() |
66302c650b | ||
![]() |
6be02cb83f | ||
![]() |
1d55ecf513 | ||
![]() |
2cea80b137 | ||
![]() |
088ed9fe94 | ||
![]() |
bf9653d85f | ||
![]() |
f68d637860 | ||
![]() |
3accbf03e2 | ||
![]() |
86319f01df | ||
![]() |
4bd15469a9 | ||
![]() |
4f274d0633 | ||
![]() |
91220d1043 | ||
![]() |
28cf403441 | ||
![]() |
faa65e99a8 | ||
![]() |
fd4de45e66 | ||
![]() |
abd06b4c9b | ||
![]() |
43dbeea66f | ||
![]() |
3f86893b6c | ||
![]() |
70e13a9ca8 | ||
![]() |
b58f517af7 | ||
![]() |
e199924809 | ||
![]() |
efdefb2cef | ||
![]() |
2d9feb59f0 | ||
![]() |
ffbfbcda66 | ||
![]() |
02c24c1d3b | ||
![]() |
64befb5bc5 | ||
![]() |
2d24d89e9b | ||
![]() |
537876b98e | ||
![]() |
71aa376ede | ||
![]() |
0b6f8ed1c7 | ||
![]() |
9959bf0850 | ||
![]() |
9be398d6c1 | ||
![]() |
62a06f9fba | ||
![]() |
13858ee056 | ||
![]() |
4d23cc6f55 | ||
![]() |
8e706d2c3e | ||
![]() |
061244c8fb | ||
![]() |
aa8a52c934 | ||
![]() |
eda3fcaaed | ||
![]() |
84b6c1f402 | ||
![]() |
438a5c9fdf | ||
![]() |
94d09faa93 | ||
![]() |
f77031db26 | ||
![]() |
561d3322c2 | ||
![]() |
95e5c0a0e7 | ||
![]() |
b33ae5ba7d | ||
![]() |
6fb33ea8fb | ||
![]() |
0251f0fd11 | ||
![]() |
6272ae58fe | ||
![]() |
761d98d2f7 | ||
![]() |
07a4bec1dd | ||
![]() |
c6c1a1ee75 | ||
![]() |
681abae7dc | ||
![]() |
4c42c4e688 | ||
![]() |
21876f739e | ||
![]() |
e5a356a891 | ||
![]() |
63e70b67eb | ||
![]() |
9f4f2215b7 | ||
![]() |
131219802f | ||
![]() |
6e63e2974b | ||
![]() |
3c7b80131b | ||
![]() |
d07fcd66b9 | ||
![]() |
2020d8ac89 | ||
![]() |
cebeadf30b | ||
![]() |
ca27dd0a23 | ||
![]() |
ab2b9f526c | ||
![]() |
03e3302cc1 | ||
![]() |
ad98e210c6 | ||
![]() |
3b1d283788 | ||
![]() |
e917d804db | ||
![]() |
8291a76087 | ||
![]() |
9c8e663ced | ||
![]() |
174b2b8acf | ||
![]() |
c0b166e944 | ||
![]() |
3ff0531e95 | ||
![]() |
7710603b64 | ||
![]() |
83d7735487 | ||
![]() |
a14f7cb412 | ||
![]() |
59ac38ccd1 | ||
![]() |
fec08372b8 | ||
![]() |
40310ac76c | ||
![]() |
a0ac177bea | ||
![]() |
14861507bc | ||
![]() |
da1818a08c | ||
![]() |
45969ecfcd | ||
![]() |
43c1f2368e | ||
![]() |
74f95a01cd | ||
![]() |
d75a44ba24 | ||
![]() |
8a8aae4618 | ||
![]() |
6b5a5e52f0 | ||
![]() |
784fa1eeba | ||
![]() |
f063052fe1 | ||
![]() |
59f573f670 | ||
![]() |
a46f5ce5bb | ||
![]() |
cc3ea928ae | ||
![]() |
ceead9c855 | ||
![]() |
3f370b0a55 | ||
![]() |
89465dce7c | ||
![]() |
13b96fdfbd | ||
![]() |
19efe015fb | ||
![]() |
f1b30c41ad | ||
![]() |
846a4a0a65 | ||
![]() |
6bcbced54f | ||
![]() |
c3068a136a | ||
![]() |
4205190e07 | ||
![]() |
1bd299a58e | ||
![]() |
f2e36ef093 | ||
![]() |
7f59a88431 | ||
![]() |
451ae6e21c | ||
![]() |
bdb73f1f8b | ||
![]() |
35e462ddee | ||
![]() |
e7d392585e | ||
![]() |
3024f86865 | ||
![]() |
a11e2cf183 | ||
![]() |
578c9e8f46 | ||
![]() |
566739170a | ||
![]() |
1a633ca404 | ||
![]() |
f42a8e6003 | ||
![]() |
47b9a9a286 | ||
![]() |
5495e2efb9 | ||
![]() |
7f9cc52faf | ||
![]() |
c3231d213a | ||
![]() |
31cb7fe75e | ||
![]() |
f17cecb13f | ||
![]() |
062d0a6dfc | ||
![]() |
8492cd84ff | ||
![]() |
75fdf0ea7c | ||
![]() |
70e0af45ae | ||
![]() |
e64ec52760 | ||
![]() |
3727be521a | ||
![]() |
aaf0b548fb | ||
![]() |
08fe42c473 | ||
![]() |
f6ed0311fb | ||
![]() |
015fb24be6 | ||
![]() |
4668566a60 | ||
![]() |
35f1c499e4 | ||
![]() |
40f8695e54 | ||
![]() |
cdc7bb55df | ||
![]() |
c6893aecfd | ||
![]() |
57947ca867 | ||
![]() |
9e0197634f | ||
![]() |
665613f5be | ||
![]() |
a0ec4b7c85 | ||
![]() |
4c2684ccf9 | ||
![]() |
e809f4ce45 | ||
![]() |
7743dddc8c | ||
![]() |
0c71f582b5 | ||
![]() |
c49fb89ff4 | ||
![]() |
e3eda9d453 | ||
![]() |
5e56c30413 | ||
![]() |
df00d5e5ad | ||
![]() |
eea9d20edb | ||
![]() |
01c1c6fcc7 | ||
![]() |
a769d7ff49 | ||
![]() |
db5d6af29b | ||
![]() |
a4449da43c | ||
![]() |
e1a6c17251 | ||
![]() |
a7dcd3a3e1 | ||
![]() |
e9d4b23051 | ||
![]() |
a1bca66d28 | ||
![]() |
bfad86e967 | ||
![]() |
b9bf4a2185 | ||
![]() |
f51d676a0e | ||
![]() |
447c76d9ee | ||
![]() |
3150c3547a | ||
![]() |
dd7a4836e3 | ||
![]() |
0243015f64 | ||
![]() |
07b133f2a7 | ||
![]() |
b3289a0c88 | ||
![]() |
e93e0347a6 | ||
![]() |
9ef5d45b2c | ||
![]() |
02f6369a6b | ||
![]() |
33f50fb940 | ||
![]() |
28a058bd51 | ||
![]() |
ae8bc6b3ef | ||
![]() |
cbc84977aa | ||
![]() |
818911cc85 | ||
![]() |
66ffe01f97 | ||
![]() |
7df8e62258 | ||
![]() |
00a620eb3b | ||
![]() |
88b2a86232 | ||
![]() |
583f2e7093 | ||
![]() |
33459617e7 | ||
![]() |
fcd02b85a5 | ||
![]() |
fa08adae13 | ||
![]() |
7819fd7108 | ||
![]() |
6f599cea0e | ||
![]() |
f1b1b7f8fe | ||
![]() |
083e011d6c | ||
![]() |
fe079256b2 | ||
![]() |
141dd0c245 | ||
![]() |
e42202138c | ||
![]() |
13e2966c91 | ||
![]() |
6b913d7c52 | ||
![]() |
aa66357f48 | ||
![]() |
6027993c28 | ||
![]() |
a09f3444e6 | ||
![]() |
1fdd937c0a | ||
![]() |
c7e395f338 | ||
![]() |
674e07d3c8 | ||
![]() |
87d03942c4 | ||
![]() |
b15298338c | ||
![]() |
58d4e04168 | ||
![]() |
27a1a2c84a | ||
![]() |
0588c74a87 | ||
![]() |
21b03d7189 | ||
![]() |
8f1ac0fb3d | ||
![]() |
fd8ed7fa85 | ||
![]() |
c101738156 | ||
![]() |
656850f03e | ||
![]() |
7a033ca056 | ||
![]() |
60b3df404e | ||
![]() |
e26488fd83 | ||
![]() |
4eb5b6d5ee | ||
![]() |
71dc14e864 | ||
![]() |
0b16e8e05a | ||
![]() |
814b625303 | ||
![]() |
4778eed34f | ||
![]() |
a90c6dd460 | ||
![]() |
669a8a5a19 | ||
![]() |
bd8adae47f | ||
![]() |
b8e76804f1 | ||
![]() |
4975bad299 | ||
![]() |
6cf4f15970 | ||
![]() |
7797c867d3 | ||
![]() |
a1a4db3fe5 | ||
![]() |
a2ef609ff1 | ||
![]() |
e51267e2d1 | ||
![]() |
cde7ca0a97 | ||
![]() |
ab3c50593c | ||
![]() |
e3e7054f48 | ||
![]() |
9acbcee2c6 | ||
![]() |
984f8f6e43 | ||
![]() |
ae9fec0bdf | ||
![]() |
01f6a1410c | ||
![]() |
08e3a7887f | ||
![]() |
5030eaf65d | ||
![]() |
2f2daa1436 | ||
![]() |
cddec8a9dd | ||
![]() |
d9144e8d17 | ||
![]() |
952438bf70 | ||
![]() |
f2bd5a0fe1 | ||
![]() |
453a50040b | ||
![]() |
8283709e91 | ||
![]() |
4ad67e08cb | ||
![]() |
fff544efbd | ||
![]() |
2764d046a1 | ||
![]() |
427f1a3014 | ||
![]() |
cd83c78703 | ||
![]() |
2050be27a4 | ||
![]() |
74e7af0d75 | ||
![]() |
83313c7ee8 | ||
![]() |
c934ca7237 | ||
![]() |
7330ed3228 | ||
![]() |
a245f9b263 | ||
![]() |
93cfd7fc4e | ||
![]() |
2bd5ffd330 | ||
![]() |
6317e9b85a | ||
![]() |
6cb69ffa0a | ||
![]() |
bd0000808d | ||
![]() |
e6e69df598 | ||
![]() |
877409a1c7 | ||
![]() |
1567ac850c | ||
![]() |
aeff14fc74 | ||
![]() |
5980ce383f | ||
![]() |
2c7a32ff0f | ||
![]() |
c5e361d024 | ||
![]() |
19fdbe53b7 | ||
![]() |
03c6791dc6 | ||
![]() |
ab5bd89de1 | ||
![]() |
c2f0e465ca | ||
![]() |
33c5db58e7 | ||
![]() |
221907d782 | ||
![]() |
0bb95849ec | ||
![]() |
1f8e21c6a3 | ||
![]() |
f2215ae626 | ||
![]() |
af2976deb3 | ||
![]() |
b1d7c713b4 | ||
![]() |
7683fe2b7a | ||
![]() |
9a4997ba29 | ||
![]() |
e52b63237a | ||
![]() |
48b428d540 | ||
![]() |
4b3ca8c249 | ||
![]() |
36628eb77a | ||
![]() |
cfeac66f8c | ||
![]() |
88aae920ef | ||
![]() |
275b6bbe1c | ||
![]() |
9a1468f79e | ||
![]() |
8e2855ce0b | ||
![]() |
0364baca04 | ||
![]() |
017e1aab88 | ||
![]() |
1383dc5bd0 | ||
![]() |
fd2848735a | ||
![]() |
50ada3a8f7 | ||
![]() |
d759095887 | ||
![]() |
1c3b15d339 | ||
![]() |
71915c132a | ||
![]() |
44678f4058 | ||
![]() |
05123a8d9f | ||
![]() |
2138b18080 | ||
![]() |
1cf810b81b | ||
![]() |
3f5579f0b2 | ||
![]() |
c7b233d1de | ||
![]() |
ac23805464 | ||
![]() |
3f305aefa0 | ||
![]() |
1e895c1fd7 | ||
![]() |
b6e0ef2deb | ||
![]() |
341b59021c | ||
![]() |
69697c8506 | ||
![]() |
829a84308e | ||
![]() |
72aab5f478 | ||
![]() |
1de15f518f | ||
![]() |
26aa8c9254 | ||
![]() |
3be7f19317 | ||
![]() |
f53135f39b | ||
![]() |
3fdac97f2a | ||
![]() |
a01a62391c | ||
![]() |
522aaf67ea | ||
![]() |
cf85245c08 | ||
![]() |
2b0f03a2a7 | ||
![]() |
4889a16c9f | ||
![]() |
bff83f9aab | ||
![]() |
62a0e01343 | ||
![]() |
e4e883e6c8 | ||
![]() |
b991975439 | ||
![]() |
1d306de1a7 | ||
![]() |
129e07fe99 | ||
![]() |
5636e63563 | ||
![]() |
79578cd14f | ||
![]() |
29151f64e4 | ||
![]() |
a0ab096796 | ||
![]() |
4d2413ca4b | ||
![]() |
4e7d53664d | ||
![]() |
9b82e151fe | ||
![]() |
3de9baafba | ||
![]() |
4a655fdde5 | ||
![]() |
8148fdb5d2 | ||
![]() |
499b1ad671 | ||
![]() |
cb7e32c290 | ||
![]() |
f4c53dacaf | ||
![]() |
38d9005902 | ||
![]() |
9b53c1095f | ||
![]() |
9071bc098b | ||
![]() |
950ee77d24 | ||
![]() |
66d529f0ad | ||
![]() |
798b2ac28f | ||
![]() |
a43d1141b9 | ||
![]() |
bbc7c74fbb | ||
![]() |
df9722ecf1 | ||
![]() |
4c88839716 | ||
![]() |
8758796fc9 | ||
![]() |
300da4f9b0 | ||
![]() |
d132bf4ef1 | ||
![]() |
6a5a8abe2f | ||
![]() |
5ffb8d0fbe | ||
![]() |
6d9505ad8a | ||
![]() |
01c6bbd947 | ||
![]() |
bb9902ec97 | ||
![]() |
d402a4da6b | ||
![]() |
270f8e01e8 | ||
![]() |
4413ab09d5 | ||
![]() |
86d311c5f3 | ||
![]() |
12929a957b | ||
![]() |
d1fae17224 | ||
![]() |
546eca8dc6 | ||
![]() |
7ba3c57565 | ||
![]() |
baed05dd37 | ||
![]() |
8d86b2e686 | ||
![]() |
d634a2c404 | ||
![]() |
217bdc189a | ||
![]() |
60a74bd69d | ||
![]() |
26f472d1dd | ||
![]() |
0f4ca8b340 | ||
![]() |
5907f03123 | ||
![]() |
464da3b76c | ||
![]() |
438d2cb25d | ||
![]() |
837cfe50fe | ||
![]() |
fc685481dc | ||
![]() |
cb093955e9 | ||
![]() |
7d7b9944b2 | ||
![]() |
497f912ab2 | ||
![]() |
50508334bf | ||
![]() |
0991323677 | ||
![]() |
c5780651c3 | ||
![]() |
b9420936a4 | ||
![]() |
e33e03e558 | ||
![]() |
b26c966174 | ||
![]() |
9dc353cf11 | ||
![]() |
116c819cc2 | ||
![]() |
32050e1e69 | ||
![]() |
861f1e95fd | ||
![]() |
4de32048f5 | ||
![]() |
a564dc53dd | ||
![]() |
69e7c05783 | ||
![]() |
1070916643 | ||
![]() |
ae6e58c561 | ||
![]() |
2c26213103 | ||
![]() |
4f26672043 | ||
![]() |
501561910a | ||
![]() |
51642a4e81 | ||
![]() |
f523693f3f | ||
![]() |
682132b4cc | ||
![]() |
bc4bcf051b | ||
![]() |
63648cffc0 | ||
![]() |
6f10d47bbc | ||
![]() |
6661ad10f2 | ||
![]() |
978faa00df | ||
![]() |
da98ce033e | ||
![]() |
caf1c029cb | ||
![]() |
781448f48a | ||
![]() |
25a1516832 | ||
![]() |
dfe5e72ed3 | ||
![]() |
b4b32a02fa | ||
![]() |
09d8c46f30 | ||
![]() |
efefe8ba34 | ||
![]() |
101e2f3e06 | ||
![]() |
98c4e404ca | ||
![]() |
c808961618 | ||
![]() |
31b9c44aa7 | ||
![]() |
f3b5f0e134 | ||
![]() |
5b34a5f584 | ||
![]() |
f4124610c2 | ||
![]() |
35d775d0e4 | ||
![]() |
b9536101dc | ||
![]() |
e48b0c40ad | ||
![]() |
67740670f9 | ||
![]() |
e8b4232e33 | ||
![]() |
ddcbcd6b5e | ||
![]() |
5eb396a8e6 | ||
![]() |
ae39e4f795 | ||
![]() |
2af66e9851 | ||
![]() |
095c3dd23e | ||
![]() |
fca038e133 | ||
![]() |
f2e8c04540 | ||
![]() |
ea8ed833fe | ||
![]() |
c09c2865b9 | ||
![]() |
529d303340 | ||
![]() |
b4ed5ca01e | ||
![]() |
f0f1bca861 | ||
![]() |
a1d32fcd0e | ||
![]() |
32d4b65d56 | ||
![]() |
b127e600c4 | ||
![]() |
c72b49ba0c | ||
![]() |
d3d01eac01 | ||
![]() |
3ab406107d | ||
![]() |
6f8821df70 | ||
![]() |
c5eb69601b | ||
![]() |
15269a8796 | ||
![]() |
05d116eb87 | ||
![]() |
1757386944 | ||
![]() |
e515bbda1b | ||
![]() |
0d1965d8c2 | ||
![]() |
0c6d1a88de | ||
![]() |
3ee7233c80 | ||
![]() |
9020c08989 | ||
![]() |
08b8506930 | ||
![]() |
2a52a3237f | ||
![]() |
de2404b16c | ||
![]() |
cc160f5c15 | ||
![]() |
cb8757aca7 | ||
![]() |
db5e54d2a3 | ||
![]() |
3c2eac62c3 | ||
![]() |
d5549ccac1 | ||
![]() |
b1a40264dc | ||
![]() |
8fcc27286f | ||
![]() |
9b2b60cab8 | ||
![]() |
ad250c17df | ||
![]() |
2b44e3dd49 | ||
![]() |
7ef03b79f9 | ||
![]() |
48e7e9f403 | ||
![]() |
a64392627e | ||
![]() |
7778249d2d | ||
![]() |
bbeca21f26 | ||
![]() |
484728789e | ||
![]() |
51349536aa | ||
![]() |
3a61b30f3a | ||
![]() |
2f9e714071 | ||
![]() |
394451db81 | ||
![]() |
c8c7abae66 | ||
![]() |
81aa3a745c | ||
![]() |
44ead61237 | ||
![]() |
ba6dbf4866 | ||
![]() |
e4694b4129 | ||
![]() |
04035d66d0 | ||
![]() |
164b297099 | ||
![]() |
0bd40d6c3d | ||
![]() |
675dd5cc4f | ||
![]() |
37025e1b32 | ||
![]() |
c1345e3262 | ||
![]() |
c743921e51 | ||
![]() |
5520bf5cbe | ||
![]() |
281918b6aa | ||
![]() |
20f0955062 | ||
![]() |
73c1fce21c | ||
![]() |
0707b67ac3 | ||
![]() |
981b01d9d0 | ||
![]() |
0211e86a5e | ||
![]() |
5a54699578 | ||
![]() |
4d9f97b40b | ||
![]() |
8db32cc2ac | ||
![]() |
d2f0b5c9ae | ||
![]() |
4074d6ea30 | ||
![]() |
360f3196d7 | ||
![]() |
e39915bdc5 | ||
![]() |
3c122d81be | ||
![]() |
d32add4a48 | ||
![]() |
fcafd80ace | ||
![]() |
4f3368e269 | ||
![]() |
52a708fbca | ||
![]() |
6b7e6921e2 | ||
![]() |
117563c516 | ||
![]() |
f33ffcc651 | ||
![]() |
7fac8f6b9f | ||
![]() |
08f8ac6951 | ||
![]() |
ec34c48976 | ||
![]() |
5fda8338b2 | ||
![]() |
bdfc0ad2ea | ||
![]() |
1f50f2d64b | ||
![]() |
6b5be703db | ||
![]() |
55622073f4 | ||
![]() |
5f64a2b3c3 | ||
![]() |
34b571bd88 | ||
![]() |
398c9d882b | ||
![]() |
067e91d29e | ||
![]() |
88dd258984 | ||
![]() |
a178c13419 | ||
![]() |
f1d10875d7 | ||
![]() |
6601516af8 | ||
![]() |
7d4d519f0b | ||
![]() |
ed5394a8f9 | ||
![]() |
140e8f52c3 | ||
![]() |
f1264e7c9e | ||
![]() |
3f357193cb | ||
![]() |
0835e16c6d | ||
![]() |
992f9d5017 | ||
![]() |
874ec678c0 | ||
![]() |
e4915d9b46 | ||
![]() |
81339cff83 | ||
![]() |
6fdde87640 | ||
![]() |
c030063cc2 | ||
![]() |
8a71d23633 | ||
![]() |
b0767852f7 | ||
![]() |
f4c0c708a3 | ||
![]() |
ab5e0a72d5 | ||
![]() |
bce096d34d | ||
![]() |
c0bf6f5369 | ||
![]() |
ef7b63bce1 | ||
![]() |
f9f95be930 | ||
![]() |
cb036e3f2c | ||
![]() |
1a5e2cb621 | ||
![]() |
d4245e7e91 | ||
![]() |
55f667ce64 | ||
![]() |
eb547816ea | ||
![]() |
89a52ffd54 | ||
![]() |
6875f3b6e4 | ||
![]() |
5a8e27b5b3 | ||
![]() |
668a1d8c44 | ||
![]() |
be3d117702 | ||
![]() |
b1ead689be | ||
![]() |
d3849253ce | ||
![]() |
7db57339fb | ||
![]() |
3ebf26f90d | ||
![]() |
6dbaaa99a8 | ||
![]() |
179e9455a5 | ||
![]() |
9863083ee0 | ||
![]() |
f7b63d646b | ||
![]() |
caaa1412b0 | ||
![]() |
d14101758a | ||
![]() |
b90686c1ec | ||
![]() |
471f3c67db | ||
![]() |
9d3d032c7d | ||
![]() |
48c74700ec | ||
![]() |
24b29a02f1 | ||
![]() |
0d6dcb5569 | ||
![]() |
ebd6c2b81d | ||
![]() |
23ef151614 | ||
![]() |
8d4ce30c79 | ||
![]() |
cbb9305c26 | ||
![]() |
a6057a525a | ||
![]() |
5ba85af029 | ||
![]() |
ab9da1a78f | ||
![]() |
8f20e52a2b | ||
![]() |
a93b5e27a8 | ||
![]() |
be8a99ad0f | ||
![]() |
53c0e72d5c | ||
![]() |
0c60b0a686 | ||
![]() |
50fe0c7d61 | ||
![]() |
3fef95b10d | ||
![]() |
ff137e9145 | ||
![]() |
37a9ca6fb2 | ||
![]() |
02ca8af10b | ||
![]() |
ec7009afe8 | ||
![]() |
103af3478e | ||
![]() |
d3ac046ba5 | ||
![]() |
e75439f54b | ||
![]() |
cc4759288b | ||
![]() |
8e554d93da | ||
![]() |
4ffb67eca5 | ||
![]() |
db9d0da3b4 | ||
![]() |
c4a47e14b9 | ||
![]() |
0648cc5316 | ||
![]() |
f84f6118b3 | ||
![]() |
e0f8672e7a | ||
![]() |
d81d83f098 | ||
![]() |
9dacb2f713 | ||
![]() |
9d9463a355 | ||
![]() |
a2df82b98e | ||
![]() |
8eb5acc3c7 | ||
![]() |
b88d7cc71c | ||
![]() |
224dec238c | ||
![]() |
d2060f06b5 | ||
![]() |
117cbb307b | ||
![]() |
71e699dda5 | ||
![]() |
ebfc50ee89 | ||
![]() |
cf7278afd7 | ||
![]() |
a3dc8f3b8b | ||
![]() |
08356fbee7 | ||
![]() |
13fbe9d5e3 | ||
![]() |
e1678a18d9 | ||
![]() |
a612c62740 | ||
![]() |
28754d0378 | ||
![]() |
708dd84a4e | ||
![]() |
a4c0d87a84 | ||
![]() |
15066f21f1 | ||
![]() |
1a383b9755 | ||
![]() |
e3c9d52d6d | ||
![]() |
97f50f6c5e | ||
![]() |
63fbfd6883 | ||
![]() |
5f58b89ecd | ||
![]() |
98760c18f8 | ||
![]() |
beee5e48b3 | ||
![]() |
928bb68bb2 | ||
![]() |
2f78c0d9f9 | ||
![]() |
8896ac3cdd | ||
![]() |
72fe0ae7cf | ||
![]() |
0efd9dcfa0 | ||
![]() |
4a07e0e159 | ||
![]() |
908b5d7f92 | ||
![]() |
af6cd294aa | ||
![]() |
0ea7f8cfb3 | ||
![]() |
4c6acb5ecd | ||
![]() |
6c27250223 | ||
![]() |
c8d1bbab02 | ||
![]() |
a71f9562f0 | ||
![]() |
854a7a02b4 | ||
![]() |
3f44c407b6 | ||
![]() |
239bc42b53 | ||
![]() |
f1ebe26bdb | ||
![]() |
8f48c23568 | ||
![]() |
bfd68bf0c7 | ||
![]() |
1c398696b0 | ||
![]() |
73b46a7248 | ||
![]() |
b671fc9b2d | ||
![]() |
615100223e | ||
![]() |
1b92188a82 | ||
![]() |
ebedffde9a | ||
![]() |
e27dbcf2dc | ||
![]() |
6daf534441 | ||
![]() |
a7d46056b0 | ||
![]() |
92b327712b | ||
![]() |
061d0cc4db | ||
![]() |
bfaafd539c | ||
![]() |
37d0212c57 | ||
![]() |
016d4e847a | ||
![]() |
16c76a2107 | ||
![]() |
2ccffefaff | ||
![]() |
81241a9440 | ||
![]() |
15c04bedad | ||
![]() |
35080eae90 | ||
![]() |
1823bea43a | ||
![]() |
c26c385592 | ||
![]() |
0cdbe60481 | ||
![]() |
ec5714f27a | ||
![]() |
c4962b3f44 | ||
![]() |
65173fee34 | ||
![]() |
0c6a583e2a | ||
![]() |
6b7c2aeb00 | ||
![]() |
525a0fb982 | ||
![]() |
3f81e9eeba | ||
![]() |
a46a0ad9e5 | ||
![]() |
29250b7ec8 | ||
![]() |
fe2a561fca | ||
![]() |
3de5086dc7 | ||
![]() |
ecc8d7b334 | ||
![]() |
5ffe591d55 | ||
![]() |
3b3108ec59 | ||
![]() |
d8a8f57387 | ||
![]() |
ad2a600c2a | ||
![]() |
76a8670ce4 | ||
![]() |
09f8550e1c | ||
![]() |
4259337da2 | ||
![]() |
65ccddb341 | ||
![]() |
0f7afe7b8e | ||
![]() |
33ae2337e2 | ||
![]() |
a36451371c | ||
![]() |
8a43fca8ed | ||
![]() |
0ac5cce17c | ||
![]() |
aa87532fee | ||
![]() |
71b52152a9 | ||
![]() |
9de3d4cab3 | ||
![]() |
0f91166ef8 | ||
![]() |
61a8422ffa | ||
![]() |
5f2d5b95e6 | ||
![]() |
206ce1faaf | ||
![]() |
1206720869 | ||
![]() |
b8dd5caf5a | ||
![]() |
dab89a1412 | ||
![]() |
16f13a0b84 | ||
![]() |
3f433cdb8e | ||
![]() |
4a0555a9d4 | ||
![]() |
ece95914ac | ||
![]() |
d0d308f54b | ||
![]() |
40455c65da | ||
![]() |
ae2b90b86d | ||
![]() |
e064055942 | ||
![]() |
35a98a00b3 | ||
![]() |
2bcdf5e9a0 | ||
![]() |
de3cac777d | ||
![]() |
69bf761909 | ||
![]() |
2faa02fc3d | ||
![]() |
79d8c99a62 | ||
![]() |
320c80fecf | ||
![]() |
8d9dd7a968 | ||
![]() |
1d927e38d1 | ||
![]() |
520dc52b4a | ||
![]() |
adb73b1701 | ||
![]() |
5a8b5783f8 | ||
![]() |
9844b6796b | ||
![]() |
1e564246ec | ||
![]() |
f677bc4165 | ||
![]() |
f7555069ab | ||
![]() |
66a8fcecd9 | ||
![]() |
8df0320334 | ||
![]() |
4c81b00f75 | ||
![]() |
f7eb5738f6 | ||
![]() |
19e7862eb8 | ||
![]() |
bd444af850 | ||
![]() |
ff7546e974 | ||
![]() |
179fa78da3 | ||
![]() |
9738cafa4f | ||
![]() |
6db12cb037 | ||
![]() |
4af78bb10b | ||
![]() |
42389d214f | ||
![]() |
cb55b18fa9 | ||
![]() |
91008752ed | ||
![]() |
d1754fb3e9 | ||
![]() |
fc910cb9a0 | ||
![]() |
de589f2f8f | ||
![]() |
dcc6a0bc44 | ||
![]() |
0836f87fb9 | ||
![]() |
23e470c348 | ||
![]() |
ba898e4208 | ||
![]() |
8127758024 | ||
![]() |
bd64f140d4 | ||
![]() |
ef5aa93b9c | ||
![]() |
cd942f1840 | ||
![]() |
a49a2c9deb | ||
![]() |
37c4acfe5e | ||
![]() |
d885143d5c | ||
![]() |
6ecf7f2d54 | ||
![]() |
94d3f6b518 | ||
![]() |
27a1c252e3 | ||
![]() |
f4107076e4 | ||
![]() |
6dff618d7d | ||
![]() |
599e60d2f7 | ||
![]() |
f9d2680e19 | ||
![]() |
7f9f52e6c6 | ||
![]() |
49d596d412 | ||
![]() |
24a7e331f1 | ||
![]() |
e00f53bcfb | ||
![]() |
6398343bfc | ||
![]() |
ac04e1f5bf | ||
![]() |
955f2c88a1 | ||
![]() |
ab04aadaf4 | ||
![]() |
62f34be0ba | ||
![]() |
058655b28a | ||
![]() |
f2a137d360 | ||
![]() |
656ed3ca8d | ||
![]() |
2a258956b0 | ||
![]() |
9e613ca1b3 | ||
![]() |
1b5f3adcef | ||
![]() |
85bbdcdad4 | ||
![]() |
05fe12bc44 | ||
![]() |
01afa5c6e4 | ||
![]() |
c64c980140 | ||
![]() |
8a1fc89cf9 | ||
![]() |
8ecb95fdec | ||
![]() |
713f4db2e5 | ||
![]() |
9e9d076879 | ||
![]() |
d179407288 | ||
![]() |
cb0e6b65a8 | ||
![]() |
09da3c053c | ||
![]() |
161a9bf447 | ||
![]() |
5143722d14 | ||
![]() |
04a2c71d67 | ||
![]() |
24bf4b8597 | ||
![]() |
a96d22b85d | ||
![]() |
1c2e46bd56 | ||
![]() |
a78b369b66 | ||
![]() |
08b4f3f99b | ||
![]() |
83179a788f | ||
![]() |
5f36c68cb0 | ||
![]() |
e42f184a76 | ||
![]() |
af74651f61 | ||
![]() |
5ec0ff81ce | ||
![]() |
e1c5f9ec1b | ||
![]() |
bce2a4752a | ||
![]() |
fc3f80badf | ||
![]() |
5e57142c59 | ||
![]() |
5d5f9f9786 | ||
![]() |
499cea12bb | ||
![]() |
e31c432a33 | ||
![]() |
5b7519eb15 | ||
![]() |
641d3d8b4c | ||
![]() |
9a894d93de | ||
![]() |
1c44f51de7 | ||
![]() |
8a1df3ca0c | ||
![]() |
d7cddf6519 | ||
![]() |
585b48ddf6 | ||
![]() |
5c316a6d04 | ||
![]() |
2a34052dac | ||
![]() |
802daf6e16 | ||
![]() |
cd17d90cbb | ||
![]() |
78afc05b45 | ||
![]() |
9c07b14797 | ||
![]() |
de8fc6b2b1 | ||
![]() |
7f76450ee9 | ||
![]() |
3e005bf6b2 | ||
![]() |
811e7130db | ||
![]() |
e75599557a | ||
![]() |
9b86fc17a0 | ||
![]() |
68b4025292 | ||
![]() |
2df3700879 | ||
![]() |
198a2a59ee | ||
![]() |
bf6eda0b1e | ||
![]() |
5da3087628 | ||
![]() |
5cfc6ab2b8 | ||
![]() |
23d1ccc3dc | ||
![]() |
6ef840818d | ||
![]() |
0931015f01 | ||
![]() |
83e40c4a80 | ||
![]() |
8634fc5494 | ||
![]() |
6b229e1ad1 | ||
![]() |
deb471c3c6 | ||
![]() |
437cdcf813 | ||
![]() |
5d4807742f | ||
![]() |
7a4e374280 | ||
![]() |
4a0a98166c | ||
![]() |
0f678bd69e | ||
![]() |
80e19ac90f | ||
![]() |
5ea5d31f6d | ||
![]() |
bd7b48a628 | ||
![]() |
051c848e88 | ||
![]() |
a4e87abbb9 | ||
![]() |
a709c823f7 | ||
![]() |
70730d8f1c | ||
![]() |
d8bfe7ba56 | ||
![]() |
193ef03eb5 | ||
![]() |
b92ee614f2 | ||
![]() |
52ad482edc | ||
![]() |
0f164c9d75 | ||
![]() |
36ba399a33 | ||
![]() |
ab61b2c9f1 | ||
![]() |
f68b46f0c9 | ||
![]() |
32c0969361 | ||
![]() |
c29e1b949c | ||
![]() |
f9c29e160c | ||
![]() |
5a11f94583 | ||
![]() |
65d2e6a392 | ||
![]() |
824c19963e | ||
![]() |
8b00e6c960 | ||
![]() |
e9df0a5c6c | ||
![]() |
56dcf0b809 | ||
![]() |
eb34122153 | ||
![]() |
a61e6f8705 | ||
![]() |
0777473911 | ||
![]() |
832b304076 | ||
![]() |
f890d9bfaa | ||
![]() |
0bb0a7c9ea | ||
![]() |
d5bfe9030f | ||
![]() |
ff46409221 | ||
![]() |
b87922c2c5 | ||
![]() |
f182038521 | ||
![]() |
39213641f4 | ||
![]() |
152343260f | ||
![]() |
cd59accbf5 | ||
![]() |
ed14a76beb | ||
![]() |
01fbfc2fa6 | ||
![]() |
b8e0d9086e | ||
![]() |
da0a0e8a1b | ||
![]() |
8fc4f5a251 | ||
![]() |
f7777e8554 | ||
![]() |
206f6cdc33 | ||
![]() |
01a0e90783 | ||
![]() |
1e1d05121d | ||
![]() |
1f96a4df58 | ||
![]() |
ac93d0ebf2 | ||
![]() |
e8029e54f1 | ||
![]() |
ef7a7b730c | ||
![]() |
e840208989 | ||
![]() |
37c17ed07d | ||
![]() |
809e93f7f2 | ||
![]() |
7670f7d1ed | ||
![]() |
171771a9f5 | ||
![]() |
e2735d1df0 | ||
![]() |
d29bb4b7c4 | ||
![]() |
0769e6a785 | ||
![]() |
d712a59c7f | ||
![]() |
9b128e06ed | ||
![]() |
b66e1c3f96 | ||
![]() |
e008d4eecc | ||
![]() |
4dca0440f5 | ||
![]() |
933afa9761 | ||
![]() |
42e55e932e | ||
![]() |
24ae8f8e5b | ||
![]() |
fb5511027b | ||
![]() |
9a06b9d017 | ||
![]() |
4573565de0 | ||
![]() |
839ae58c2e | ||
![]() |
6a683bfb5f | ||
![]() |
725ae713f2 | ||
![]() |
dbc8cf059e | ||
![]() |
eaffd0a8ff | ||
![]() |
fd7481e96d | ||
![]() |
7ec46bc422 | ||
![]() |
11b87182b0 | ||
![]() |
099dec1ba0 | ||
![]() |
c05e98660f | ||
![]() |
312926eed4 | ||
![]() |
09ca5d49e1 | ||
![]() |
a9602d56de | ||
![]() |
f491e51ebd | ||
![]() |
ab135d7f4e | ||
![]() |
c1ecd97f00 | ||
![]() |
e57b7c445b | ||
![]() |
918f2a80ab | ||
![]() |
b9d9fb4a17 | ||
![]() |
9dcdcdee25 | ||
![]() |
2c39cbe020 | ||
![]() |
29f7432ff3 | ||
![]() |
81381a932f | ||
![]() |
c7a39cf584 | ||
![]() |
fcd8db7133 | ||
![]() |
7a6b7cedcb | ||
![]() |
70342b99e2 | ||
![]() |
ee749a403c | ||
![]() |
9360e9f944 | ||
![]() |
ddb4e4cbb1 | ||
![]() |
8f72d5ce16 | ||
![]() |
a71a952634 | ||
![]() |
67444034ed | ||
![]() |
9e98b34a8c | ||
![]() |
6287c65a03 | ||
![]() |
e27e907403 | ||
![]() |
b3585e8226 | ||
![]() |
bb3a0acf93 | ||
![]() |
9f8f524541 | ||
![]() |
be764c946c | ||
![]() |
b30abdd07a | ||
![]() |
5328cd307c | ||
![]() |
a7f5c1bcd8 | ||
![]() |
ecc9742f27 | ||
![]() |
5f1286f574 | ||
![]() |
dd854b2c4e | ||
![]() |
8c23819220 | ||
![]() |
74f4da7219 | ||
![]() |
e58bc12f2a | ||
![]() |
34cb066fa2 | ||
![]() |
63d8f7e341 | ||
![]() |
15467189c3 | ||
![]() |
867deb8e06 | ||
![]() |
155f06018e | ||
![]() |
a9b94f1337 | ||
![]() |
912438c272 | ||
![]() |
d3b5b6b9f4 | ||
![]() |
006ab1e213 | ||
![]() |
df4182153c | ||
![]() |
a5f0e6c5c1 | ||
![]() |
05e7d24b3d | ||
![]() |
c5e6aa5f5c | ||
![]() |
f9e75aef34 | ||
![]() |
9493e27c0f | ||
![]() |
c52fb8d7bf | ||
![]() |
9c2ce95063 | ||
![]() |
08dd25303e | ||
![]() |
5544f7e0c7 | ||
![]() |
b4e67cfd42 | ||
![]() |
2062f37772 | ||
![]() |
61fe0ac9b3 | ||
![]() |
4313ec3975 | ||
![]() |
ae57a1ab1d | ||
![]() |
993248935c | ||
![]() |
4f67100219 | ||
![]() |
a5733b3ad3 | ||
![]() |
0795931dee | ||
![]() |
6dcaf3ee1a | ||
![]() |
e1e96cb840 | ||
![]() |
79a35570a5 | ||
![]() |
128f7bf4fa | ||
![]() |
c5e8961a35 | ||
![]() |
4aa8b06e67 | ||
![]() |
cf31d3864e | ||
![]() |
b777d6a4b2 | ||
![]() |
11a50ac497 | ||
![]() |
d4c96a6c89 | ||
![]() |
f6bdda044c | ||
![]() |
a1985ebbc8 | ||
![]() |
9d00ed5d87 | ||
![]() |
fc2f021bdd | ||
![]() |
8b25c00ef1 | ||
![]() |
302fa82a1c | ||
![]() |
db4d478ff4 | ||
![]() |
742fecbd2a | ||
![]() |
2c0d3edf68 | ||
![]() |
34d36f39b0 | ||
![]() |
32d40f5f44 | ||
![]() |
02d5e18917 | ||
![]() |
d1c0082675 | ||
![]() |
c3a9b81e67 | ||
![]() |
3fbd1dfb24 | ||
![]() |
d9cdb2dcfd | ||
![]() |
782da33d1c | ||
![]() |
c1ca2e1e8b | ||
![]() |
295891fdc2 | ||
![]() |
0d01eb54e7 | ||
![]() |
f5f4684e71 | ||
![]() |
ae7bf9daac | ||
![]() |
9976b5511a | ||
![]() |
06d8bf6ce2 | ||
![]() |
9b145da078 | ||
![]() |
04bd79b23a | ||
![]() |
bdea27ba8f | ||
![]() |
b74309e3ad | ||
![]() |
903439f735 | ||
![]() |
c19fe86743 | ||
![]() |
53e2763966 | ||
![]() |
dab9b2eb32 | ||
![]() |
dece7fe670 | ||
![]() |
a22d2addb1 | ||
![]() |
e33c2d1926 | ||
![]() |
e47bc9bc4f | ||
![]() |
c7cbe502db | ||
![]() |
c789025a5a | ||
![]() |
6319f1462d | ||
![]() |
23fb972520 | ||
![]() |
707f318787 | ||
![]() |
83eade6abb | ||
![]() |
cc7bdae931 | ||
![]() |
3101474720 | ||
![]() |
11a31d0583 | ||
![]() |
fae54b9c14 | ||
![]() |
4a0e74fff8 | ||
![]() |
0560f786fe | ||
![]() |
76aa2ef017 | ||
![]() |
0dee9cd5ad | ||
![]() |
3bc6a98c3e | ||
![]() |
6b875ef374 | ||
![]() |
af4d161908 | ||
![]() |
af69f47e86 | ||
![]() |
b85dea35b0 | ||
![]() |
8eba41324c | ||
![]() |
1608b64881 | ||
![]() |
fe14b970ac | ||
![]() |
5920cfc403 | ||
![]() |
b18165e704 | ||
![]() |
d854ce6bfa | ||
![]() |
9ae96d0f21 | ||
![]() |
635bbbb6d1 | ||
![]() |
46c49d19aa | ||
![]() |
88c3190d6c | ||
![]() |
6afc7ad3eb | ||
![]() |
fd329a445e | ||
![]() |
b73568dc24 | ||
![]() |
66a48c5ad5 | ||
![]() |
7fa0ca75e5 | ||
![]() |
88dec1ef5c | ||
![]() |
6b8b9922f0 | ||
![]() |
cedb7fcc10 | ||
![]() |
a38e2c9d1a | ||
![]() |
5f4841fb83 | ||
![]() |
43807c2fba | ||
![]() |
4cceb7a5e8 | ||
![]() |
8b9eee35d8 | ||
![]() |
548d392d5d | ||
![]() |
c8e1889601 | ||
![]() |
edfb05351e | ||
![]() |
aac8dd8331 | ||
![]() |
a5b51964c1 | ||
![]() |
81d1ef7a3f | ||
![]() |
cccf25579a | ||
![]() |
54e2fff2e1 | ||
![]() |
e0f0bfb5e6 | ||
![]() |
7173a501bb | ||
![]() |
7b9d6a8d40 | ||
![]() |
78f0de22db | ||
![]() |
5ce391e336 | ||
![]() |
0b93963db7 | ||
![]() |
b05a55675f | ||
![]() |
1b031c947f | ||
![]() |
3e3ae9ec41 | ||
![]() |
b4ebb0e415 | ||
![]() |
750039f50c | ||
![]() |
f619e230cc | ||
![]() |
304c31b355 | ||
![]() |
83e2c4d877 | ||
![]() |
6ae47055f9 | ||
![]() |
8226d0b7c5 | ||
![]() |
239e341c94 | ||
![]() |
ba1920fe4b | ||
![]() |
002a984948 | ||
![]() |
159b9ba4ce | ||
![]() |
0e0bc1cfe8 | ||
![]() |
352bd3a273 | ||
![]() |
db8a030bd3 | ||
![]() |
ed9f69d342 | ||
![]() |
bbda4db0d5 | ||
![]() |
d1a7479763 | ||
![]() |
21772ec063 | ||
![]() |
2328902ab1 | ||
![]() |
5f767b7b28 | ||
![]() |
bf68bdc4ed | ||
![]() |
0aa900e94f | ||
![]() |
c6e54b964f | ||
![]() |
27c836ff3a | ||
![]() |
3793a7d202 | ||
![]() |
ee717d8c44 | ||
![]() |
b2f2b68143 | ||
![]() |
a46482e8bb | ||
![]() |
3d4f92c08a | ||
![]() |
0a69fa14d2 | ||
![]() |
7fa77a701f | ||
![]() |
a358fbe504 | ||
![]() |
53008d8b0c | ||
![]() |
af01e708aa | ||
![]() |
b0895ff8ae | ||
![]() |
641f6c1f65 | ||
![]() |
8a9c5ea750 | ||
![]() |
984f10fdc0 | ||
![]() |
537b2fa6b8 | ||
![]() |
faa17162e9 | ||
![]() |
0919dbaab3 | ||
![]() |
9bae2a9dc5 | ||
![]() |
9d5e9d3d66 | ||
![]() |
22b781bf0c | ||
![]() |
ff9267709d | ||
![]() |
73c85c7725 | ||
![]() |
4af2cf38f0 | ||
![]() |
9c0df1416f | ||
![]() |
eac2a01863 | ||
![]() |
1c0be3864a | ||
![]() |
999fc97ef2 | ||
![]() |
1dc6f7ab97 | ||
![]() |
75536baae7 | ||
![]() |
95c0e9f9e1 | ||
![]() |
155ff6e95a | ||
![]() |
8d36c432f2 | ||
![]() |
c25d158c62 | ||
![]() |
c004e2e7d7 | ||
![]() |
3c6fefdf44 | ||
![]() |
2d3f4ee99f | ||
![]() |
a585de645c | ||
![]() |
7eb9f1e3a3 | ||
![]() |
6cb977bf0c | ||
![]() |
33be35effe | ||
![]() |
5c90cbad38 | ||
![]() |
460b4cadde | ||
![]() |
cf115d2cc6 | ||
![]() |
c417a802ed | ||
![]() |
70e441a9b0 | ||
![]() |
a5160283a4 | ||
![]() |
3882d397c4 | ||
![]() |
37bdf0e6bd | ||
![]() |
d57de091c3 | ||
![]() |
d305d3c1a2 | ||
![]() |
ec423cb8d4 | ||
![]() |
e7d59f2601 | ||
![]() |
8540d4c9d2 | ||
![]() |
08a0b48c09 | ||
![]() |
ffab05833f | ||
![]() |
96c60b482e | ||
![]() |
a0852ffbe8 | ||
![]() |
4ae952ab9a | ||
![]() |
364e94575b | ||
![]() |
2a03b71f09 | ||
![]() |
e87514aa94 | ||
![]() |
4490c4aaed | ||
![]() |
584db4287b | ||
![]() |
e103a3d69b | ||
![]() |
6886dd19c4 | ||
![]() |
4b2f4203a2 | ||
![]() |
cd99236231 | ||
![]() |
069bdd52c1 | ||
![]() |
63b2f4f2dc | ||
![]() |
ef793f2513 | ||
![]() |
403f91ad2c | ||
![]() |
6d39f9f356 | ||
![]() |
ee7a0bf265 | ||
![]() |
65f059b842 | ||
![]() |
7a7b6d8283 | ||
![]() |
30055c68d4 | ||
![]() |
5fec82dc0d | ||
![]() |
116ce6a312 | ||
![]() |
afcac1ac46 | ||
![]() |
8b5bb3c5af | ||
![]() |
ca8eb830dd | ||
![]() |
f3d62ea57f | ||
![]() |
0405cc4ae0 | ||
![]() |
8131a01a9c | ||
![]() |
8bf01ddd30 | ||
![]() |
6e1d851be8 | ||
![]() |
c8f7413908 | ||
![]() |
499c61f999 | ||
![]() |
46623a09ee | ||
![]() |
f57bd564fd | ||
![]() |
bd143086ac | ||
![]() |
410f2def47 | ||
![]() |
c83960a9e4 | ||
![]() |
fe4c9dd747 | ||
![]() |
d06a640ba7 | ||
![]() |
08bce1754d | ||
![]() |
03d7181b0e | ||
![]() |
e41f475a44 | ||
![]() |
7d87f6be1b | ||
![]() |
af3473404e | ||
![]() |
c425307238 | ||
![]() |
473f838128 | ||
![]() |
1ca23672a0 | ||
![]() |
591e32d624 | ||
![]() |
d586248597 | ||
![]() |
a58402abb9 | ||
![]() |
46e9493c68 | ||
![]() |
384608e90d | ||
![]() |
90d8723476 | ||
![]() |
74f26f251b | ||
![]() |
4eebfc3394 | ||
![]() |
5394c1ed30 | ||
![]() |
a0b5befbd3 | ||
![]() |
9b12f23e30 | ||
![]() |
cac0c46abb | ||
![]() |
71499ad176 | ||
![]() |
7a44515588 | ||
![]() |
820e00755a | ||
![]() |
518d150040 | ||
![]() |
2d62229b96 | ||
![]() |
67c8082a18 | ||
![]() |
fe59276f04 | ||
![]() |
f9b6e7eeef | ||
![]() |
caee2b093f | ||
![]() |
dbd9eacde0 | ||
![]() |
6467aeb7c9 | ||
![]() |
cbdd0896d3 | ||
![]() |
635ce1d127 | ||
![]() |
3e3e5ebc72 | ||
![]() |
51065657aa | ||
![]() |
9b763e0945 | ||
![]() |
0855ddeb24 | ||
![]() |
f20f0d3fc5 | ||
![]() |
e9e4b855b8 | ||
![]() |
762657693d | ||
![]() |
ffa7fbef7b | ||
![]() |
b3cf4b5b54 | ||
![]() |
f867f6326b | ||
![]() |
d2da6d2322 | ||
![]() |
f07a529b77 | ||
![]() |
87073e4bfb | ||
![]() |
c756f5b4e8 | ||
![]() |
9efdc0bd5f | ||
![]() |
300c67ab92 | ||
![]() |
6186c7fe6a | ||
![]() |
b2292091cb | ||
![]() |
d3eca759a2 | ||
![]() |
1ee87fa41a | ||
![]() |
0341c820a0 | ||
![]() |
616e92d748 | ||
![]() |
2a5349ba66 | ||
![]() |
271a1c03c3 | ||
![]() |
8efd3dac5d | ||
![]() |
60cb7d267f | ||
![]() |
2cf89a71df | ||
![]() |
27b4fd30ef | ||
![]() |
dc1345fd44 | ||
![]() |
9aa4e11451 | ||
![]() |
87c61a61fe | ||
![]() |
1378397721 | ||
![]() |
21a84cfb8f | ||
![]() |
f2533a8798 | ||
![]() |
b407d45d83 | ||
![]() |
558ae17391 | ||
![]() |
05b57d5cdf | ||
![]() |
b56a4ada33 | ||
![]() |
b6e7c305d4 | ||
![]() |
26cba271cb | ||
![]() |
fcbaf48f21 | ||
![]() |
d0ed21e94d | ||
![]() |
ea2741973a | ||
![]() |
997e454139 | ||
![]() |
f2b2cc6440 | ||
![]() |
8fa14e97ca | ||
![]() |
1e8b3f96c0 | ||
![]() |
4a13b2dce9 | ||
![]() |
0438ea241e | ||
![]() |
a231c37df7 | ||
![]() |
9d84832741 | ||
![]() |
8417c46f8d | ||
![]() |
896baa2547 | ||
![]() |
4300839b5f | ||
![]() |
b9344c218b | ||
![]() |
7786188d15 | ||
![]() |
3fadda314a | ||
![]() |
d41b60b2b4 | ||
![]() |
335b1518e4 | ||
![]() |
e0c3b1e55c | ||
![]() |
3074a05cdc | ||
![]() |
6df1412ca6 | ||
![]() |
3508b3836b | ||
![]() |
01198b313c | ||
![]() |
e1642e1c00 | ||
![]() |
1e9f55f2d2 | ||
![]() |
2848444954 | ||
![]() |
b04ad4162d | ||
![]() |
d7a2ad6a99 | ||
![]() |
e5285fd6b6 | ||
![]() |
b0bfd9bdd6 | ||
![]() |
5f3f35fe64 | ||
![]() |
982331b66e | ||
![]() |
67872dde14 | ||
![]() |
3c8432fb5b | ||
![]() |
dea7f39af1 | ||
![]() |
b1bc0c4975 | ||
![]() |
1dd5ccf06c | ||
![]() |
a18778751c | ||
![]() |
6e4971fafe | ||
![]() |
798e880364 | ||
![]() |
ca1f44d19f | ||
![]() |
b9b932fdef | ||
![]() |
fcf7bd1ffe | ||
![]() |
e1a7b04c58 | ||
![]() |
ae8b16e047 | ||
![]() |
571994088f | ||
![]() |
e4d24cec24 | ||
![]() |
8292d74270 | ||
![]() |
5586c020c9 | ||
![]() |
6cc99fa338 | ||
![]() |
83b2c84a3c | ||
![]() |
8e84350ebf | ||
![]() |
0a63119a76 | ||
![]() |
8e50a9cf73 | ||
![]() |
f8880d0b85 | ||
![]() |
d4cf215e08 | ||
![]() |
c00f75dc75 | ||
![]() |
40c13d31c5 | ||
![]() |
cf2654bae7 | ||
![]() |
2891675aad | ||
![]() |
62453ea71d | ||
![]() |
f836d531b4 | ||
![]() |
e814a90f74 | ||
![]() |
f6d875f7f5 | ||
![]() |
438377c051 | ||
![]() |
ec3773c2da | ||
![]() |
9996844df0 | ||
![]() |
66c6f9733b | ||
![]() |
34869adacb | ||
![]() |
0dd0b4d758 | ||
![]() |
704f09b212 | ||
![]() |
91a8272cbd | ||
![]() |
c13b147280 | ||
![]() |
ce6884cc76 | ||
![]() |
6cd051bc34 | ||
![]() |
9f8884e6c1 | ||
![]() |
8faa95ff8c | ||
![]() |
78b6828f14 | ||
![]() |
f46fc939cb | ||
![]() |
8db4acad3b | ||
![]() |
08e17472e4 |
4
.arcconfig
Normal file
4
.arcconfig
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"project_id" : "libcxx",
|
||||||
|
"conduit_uri" : "http://reviews.llvm.org/"
|
||||||
|
}
|
54
.gitignore
vendored
Normal file
54
.gitignore
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
env/
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
#lib/ # We actually have things checked in to lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.coverage
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
target/
|
422
CMakeLists.txt
422
CMakeLists.txt
@ -3,20 +3,27 @@
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Setup Project
|
# Setup Project
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
|
if(POLICY CMP0042)
|
||||||
|
cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default
|
||||||
|
endif()
|
||||||
|
if(POLICY CMP0022)
|
||||||
|
cmake_policy(SET CMP0022 NEW) # Required when interacting with LLVM and Clang
|
||||||
|
endif()
|
||||||
|
|
||||||
project(libcxx CXX C)
|
project(libcxx CXX C)
|
||||||
cmake_minimum_required(VERSION 2.8)
|
|
||||||
|
|
||||||
set(PACKAGE_NAME libcxx)
|
set(PACKAGE_NAME libcxx)
|
||||||
set(PACKAGE_VERSION trunk-svn)
|
set(PACKAGE_VERSION trunk-svn)
|
||||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||||
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
|
set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org")
|
||||||
|
|
||||||
# Add path for custom modules
|
# Add path for custom modules
|
||||||
set(CMAKE_MODULE_PATH
|
set(CMAKE_MODULE_PATH
|
||||||
${CMAKE_MODULE_PATH}
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
|
||||||
|
${CMAKE_MODULE_PATH}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Require out of source build.
|
# Require out of source build.
|
||||||
@ -26,134 +33,371 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
|
|||||||
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
|
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Find the LLVM sources and simulate LLVM CMake options.
|
||||||
|
include(HandleOutOfTreeLLVM)
|
||||||
|
if (LIBCXX_BUILT_STANDALONE AND NOT LLVM_FOUND)
|
||||||
|
message(WARNING "UNSUPPORTED LIBCXX CONFIGURATION DETECTED: "
|
||||||
|
"llvm-config not found and LLVM_PATH not defined.\n"
|
||||||
|
"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
|
||||||
|
"or -DLLVM_PATH=path/to/llvm-source-root.")
|
||||||
|
endif()
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Setup CMake Options
|
# Setup CMake Options
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
# Define options.
|
# Basic options ---------------------------------------------------------------
|
||||||
|
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
||||||
|
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
||||||
|
|
||||||
|
option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
|
||||||
|
option(LIBCXX_INCLUDE_DOCS "Build the libc++ documentation." ${LLVM_INCLUDE_DOCS})
|
||||||
|
set(LIBCXX_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
|
||||||
|
"Define suffix of library directory name (32/64)")
|
||||||
|
option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
|
||||||
|
option(LIBCXX_INSTALL_LIBRARY "Install the libc++ library." ON)
|
||||||
|
option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
|
||||||
|
set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.")
|
||||||
|
option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
|
||||||
|
|
||||||
|
# ABI Library options ---------------------------------------------------------
|
||||||
|
set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
|
||||||
|
"Specify C++ ABI library to use." FORCE)
|
||||||
|
set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++)
|
||||||
|
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
|
||||||
|
|
||||||
|
# Setup the default options if LIBCXX_CXX_ABI is not specified.
|
||||||
|
if (NOT LIBCXX_CXX_ABI)
|
||||||
|
if (NOT DEFINED LIBCXX_BUILT_STANDALONE AND
|
||||||
|
IS_DIRECTORY "${CMAKE_SOURCE_DIR}/projects/libcxxabi")
|
||||||
|
set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
|
||||||
|
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${CMAKE_SOURCE_DIR}/projects/libcxxabi/include")
|
||||||
|
set(LIBCXX_CXX_ABI_INTREE 1)
|
||||||
|
else ()
|
||||||
|
set(LIBCXX_CXX_ABI_LIBNAME "none")
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Use a static copy of the ABI library when linking libc++. This option
|
||||||
|
# cannot be used with LIBCXX_ENABLE_ABI_LINKER_SCRIPT.
|
||||||
|
option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF)
|
||||||
|
|
||||||
|
# Generate and install a linker script inplace of libc++.so. The linker script
|
||||||
|
# will link libc++ to the correct ABI library. This option is on by default
|
||||||
|
# On UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY'
|
||||||
|
# is on. This option is also disabled when the ABI library is not specified
|
||||||
|
# or is specified to be "none".
|
||||||
|
set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF)
|
||||||
|
if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_ENABLE_STATIC_ABI_LIBRARY
|
||||||
|
AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"
|
||||||
|
AND PYTHONINTERP_FOUND)
|
||||||
|
set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT
|
||||||
|
"Use and install a linker script for the given ABI library"
|
||||||
|
${ENABLE_LINKER_SCRIPT_DEFAULT_VALUE})
|
||||||
|
|
||||||
|
# Build libc++abi with libunwind. We need this option to determine whether to
|
||||||
|
# link with libunwind or libgcc_s while running the test cases.
|
||||||
|
option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
|
||||||
|
|
||||||
|
# Target options --------------------------------------------------------------
|
||||||
|
option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})
|
||||||
|
set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.")
|
||||||
|
set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.")
|
||||||
|
|
||||||
|
# Feature options -------------------------------------------------------------
|
||||||
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
|
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
|
||||||
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
|
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
|
||||||
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
option(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE "Build libc++ with support for the global filesystem namespace." ON)
|
||||||
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
|
option(LIBCXX_ENABLE_STDIN "Build libc++ with support for stdin/std::cin." ON)
|
||||||
|
option(LIBCXX_ENABLE_STDOUT "Build libc++ with support for stdout/std::cout." ON)
|
||||||
|
option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
|
||||||
|
option(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS "Build libc++ with support for thread-unsafe C functions" ON)
|
||||||
|
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
|
||||||
|
"Build libc++ with support for a monotonic clock.
|
||||||
|
This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
|
||||||
|
option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" OFF)
|
||||||
|
|
||||||
|
# Misc options ----------------------------------------------------------------
|
||||||
|
# FIXME: Turn -pedantic back ON. It is currently off because it warns
|
||||||
|
# about #include_next which is used everywhere.
|
||||||
|
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." OFF)
|
||||||
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
||||||
option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
|
|
||||||
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
option(LIBCXX_GENERATE_COVERAGE "Enable generating code coverage." OFF)
|
||||||
|
set(LIBCXX_COVERAGE_LIBRARY "" CACHE STRING
|
||||||
|
"The Profile-rt library used to build with code coverage")
|
||||||
|
|
||||||
|
# Don't allow a user to accidentally overwrite the system libc++ installation on Darwin.
|
||||||
|
# If the user specifies -DCMAKE_INSTALL_PREFIX=/usr the install rules for libc++
|
||||||
|
# will not be generated and a warning will be issued.
|
||||||
|
option(LIBCXX_OVERRIDE_DARWIN_INSTALL "Enable overwriting darwins libc++ installation." OFF)
|
||||||
|
mark_as_advanced(LIBCXX_OVERRIDE_DARWIN_INSTALL) # Don't show this option by default.
|
||||||
|
|
||||||
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT LIBCXX_OVERRIDE_DARWIN_INSTALL)
|
||||||
|
if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
|
||||||
|
message(WARNING "Disabling libc++ install rules because installation would "
|
||||||
|
"overwrite the systems installation. Configure with "
|
||||||
|
"-DLIBCXX_OVERRIDE_DARWIN_INSTALL=ON to suppress this behaviour.")
|
||||||
|
mark_as_advanced(CLEAR LIBCXX_OVERRIDE_DARWIN_INSTALL) # Show the override option.
|
||||||
|
set(LIBCXX_INSTALL_HEADERS OFF)
|
||||||
|
set(LIBCXX_INSTALL_LIBRARY OFF)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LIBCXX_CONFIGURE_IDE_DEFAULT OFF)
|
||||||
|
if (XCODE OR MSVC_IDE)
|
||||||
|
set(LIBCXX_CONFIGURE_IDE_DEFAULT ON)
|
||||||
|
endif()
|
||||||
|
option(LIBCXX_CONFIGURE_IDE "Configure libcxx for use within an IDE"
|
||||||
|
${LIBCXX_CONFIGURE_IDE_DEFAULT})
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# Check option configurations
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
# Ensure LIBCXX_ENABLE_MONOTONIC_CLOCK is set to ON only when
|
||||||
|
# LIBCXX_ENABLE_THREADS is on.
|
||||||
|
if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_ENABLE_MONOTONIC_CLOCK)
|
||||||
|
message(FATAL_ERROR "LIBCXX_ENABLE_MONOTONIC_CLOCK can only be set to OFF"
|
||||||
|
" when LIBCXX_ENABLE_THREADS is also set to OFF.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE
|
||||||
|
# is ON.
|
||||||
|
if (LLVM_USE_SANITIZER AND LIBCXX_GENERATE_COVERAGE)
|
||||||
|
message(FATAL_ERROR "LLVM_USE_SANITIZER cannot be used with LIBCXX_GENERATE_COVERAGE")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set LIBCXX_BUILD_32_BITS to (LIBCXX_BUILD_32_BITS OR LLVM_BUILD_32_BITS)
|
||||||
|
# and check that we can build with 32 bits if requested.
|
||||||
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
|
||||||
|
if (LIBCXX_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM
|
||||||
|
message(STATUS "Building 32 bits executables and libraries.")
|
||||||
|
endif()
|
||||||
|
elseif(LIBCXX_BUILD_32_BITS)
|
||||||
|
message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Check that this option is not enabled on Apple and emit a usage warning.
|
||||||
|
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
|
||||||
|
if (APPLE)
|
||||||
|
message(FATAL_ERROR "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is not supported on OS X")
|
||||||
|
else()
|
||||||
|
message(WARNING "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is an experimental option")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
|
||||||
|
if (APPLE)
|
||||||
|
message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT cannot be used on APPLE targets")
|
||||||
|
endif()
|
||||||
|
if (NOT PYTHONINTERP_FOUND)
|
||||||
|
message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT requires python but it was not found.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
|
||||||
|
message(FATAL_ERROR "Conflicting options given.
|
||||||
|
LIBCXX_ENABLE_STATIC_ABI_LIBRARY cannot be specified with
|
||||||
|
LIBCXX_ENABLE_ABI_LINKER_SCRIPT")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (LIBCXX_HAS_MUSL_LIBC AND NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
|
||||||
|
message(FATAL_ERROR "LIBCXX_INSTALL_SUPPORT_HEADERS can not be turned off"
|
||||||
|
"when building for Musl with LIBCXX_HAS_MUSL_LIBC.")
|
||||||
|
endif()
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Configure System
|
# Configure System
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
# Get triples.
|
set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER})
|
||||||
include(GetTriple)
|
set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
get_host_triple(LIBCXX_HOST_TRIPLE
|
set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
LIBCXX_HOST_ARCH
|
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
|
||||||
LIBCXX_HOST_VENDOR
|
|
||||||
LIBCXX_HOST_OS
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
|
||||||
)
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
|
||||||
set(LIBCXX_HOST_TRIPLE ${LIBCXX_HOST_TRIPLE} CACHE STRING "Host triple.")
|
|
||||||
get_target_triple(LIBCXX_TARGET_TRIPLE
|
# Declare libc++ configuration variables.
|
||||||
LIBCXX_TARGET_ARCH
|
# They are intended for use as follows:
|
||||||
LIBCXX_TARGET_VENDOR
|
# LIBCXX_CXX_FLAGS: General flags for both the compiler and linker.
|
||||||
LIBCXX_TARGET_OS
|
# LIBCXX_COMPILE_FLAGS: Compile only flags.
|
||||||
)
|
# LIBCXX_LINK_FLAGS: Linker only flags.
|
||||||
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
|
set(LIBCXX_COMPILE_FLAGS "")
|
||||||
|
set(LIBCXX_LINK_FLAGS "")
|
||||||
|
set(LIBCXX_LIBRARIES "")
|
||||||
|
|
||||||
# Configure compiler.
|
# Configure compiler.
|
||||||
include(config-ix)
|
include(config-ix)
|
||||||
|
|
||||||
|
# Configure coverage options.
|
||||||
|
if (LIBCXX_GENERATE_COVERAGE)
|
||||||
|
include(CodeCoverage)
|
||||||
|
set(CMAKE_BUILD_TYPE "COVERAGE" CACHE STRING "" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Setup Compiler Flags
|
# Setup Compiler Flags
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
# Get required flags.
|
include(HandleLibCXXABI) # Steup the ABI library flags
|
||||||
# On all systems the system c++ standard library headers need to be excluded.
|
|
||||||
if (MSVC)
|
# Include macros for adding and removing libc++ flags.
|
||||||
# MSVC only has -X, which disables all default includes; including the crt.
|
include(HandleLibcxxFlags)
|
||||||
# Thus, we do nothing and hope we don't accidentally include any of the C++
|
|
||||||
# headers.
|
# Remove flags that may have snuck in.
|
||||||
else()
|
remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG
|
||||||
if (LIBCXX_HAS_NOSTDINCXX_FLAG)
|
-stdlib=libc++ -stdlib=libstdc++ -lc++abi -m32)
|
||||||
set(LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++)
|
|
||||||
endif()
|
# FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEDANTIC.
|
||||||
if (LIBCXX_ENABLE_CXX0X AND LIBCXX_HAS_STDCXX0X_FLAG)
|
# Remove the -pedantic flag and -Wno-pedantic and -pedantic-errors
|
||||||
list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -std=c++0x)
|
# so they don't get transformed into -Wno and -errors respectivly.
|
||||||
endif()
|
remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
|
||||||
|
|
||||||
|
# Required flags ==============================================================
|
||||||
|
add_compile_flags_if_supported(-std=c++11)
|
||||||
|
if (NOT MSVC AND NOT LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG)
|
||||||
|
message(FATAL_ERROR "C++11 is required but the compiler does not support -std=c++11")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
macro(append_if list condition var)
|
# On all systems the system c++ standard library headers need to be excluded.
|
||||||
if (${condition})
|
# MSVC only has -X, which disables all default includes; including the crt.
|
||||||
list(APPEND ${list} ${var})
|
# Thus, we do nothing and hope we don't accidentally include any of the C++
|
||||||
endif()
|
# headers
|
||||||
endmacro()
|
add_compile_flags_if_supported(-nostdinc++)
|
||||||
|
|
||||||
# Get warning flags
|
# Target flags ================================================================
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
|
add_flags_if(LIBCXX_BUILD_32_BITS -m32)
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
|
add_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
|
add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
|
add_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
|
|
||||||
|
# Warning flags ===============================================================
|
||||||
|
add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
add_compile_flags_if_supported(
|
||||||
|
-Wall -W -Wwrite-strings
|
||||||
|
-Wno-unused-parameter -Wno-long-long
|
||||||
|
-Werror=return-type)
|
||||||
if (LIBCXX_ENABLE_WERROR)
|
if (LIBCXX_ENABLE_WERROR)
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
|
add_compile_flags_if_supported(-Werror)
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
|
add_compile_flags_if_supported(-WX)
|
||||||
|
else()
|
||||||
|
# TODO(EricWF) Remove this. We shouldn't be suppressing errors when -Werror is
|
||||||
|
# added elsewhere.
|
||||||
|
add_compile_flags_if_supported(-Wno-error)
|
||||||
endif()
|
endif()
|
||||||
if (LIBCXX_ENABLE_PEDANTIC)
|
if (LIBCXX_ENABLE_PEDANTIC)
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
|
add_compile_flags_if_supported(-pedantic)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Get feature flags.
|
# Exception flags =============================================================
|
||||||
# Exceptions
|
|
||||||
if (LIBCXX_ENABLE_EXCEPTIONS)
|
if (LIBCXX_ENABLE_EXCEPTIONS)
|
||||||
# Catches C++ exceptions only and tells the compiler to assume that extern C
|
# Catches C++ exceptions only and tells the compiler to assume that extern C
|
||||||
# functions never throw a C++ exception.
|
# functions never throw a C++ exception.
|
||||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
|
add_compile_flags_if_supported(-EHsc)
|
||||||
else()
|
else()
|
||||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
|
add_definitions(-D_LIBCPP_NO_EXCEPTIONS)
|
||||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
|
add_compile_flags_if_supported(-EHs- -EHa-)
|
||||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
|
add_compile_flags_if_supported(-fno-exceptions)
|
||||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
|
|
||||||
endif()
|
endif()
|
||||||
# RTTI
|
|
||||||
|
# RTTI flags ==================================================================
|
||||||
if (NOT LIBCXX_ENABLE_RTTI)
|
if (NOT LIBCXX_ENABLE_RTTI)
|
||||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_RTTI)
|
add_definitions(-D_LIBCPP_NO_RTTI)
|
||||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
|
add_compile_flags_if_supported(-GR-)
|
||||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
|
add_compile_flags_if_supported(-fno-rtti)
|
||||||
endif()
|
endif()
|
||||||
# Assert
|
|
||||||
if (LLVM_ENABLE_ASSERTIONS)
|
# Assertion flags =============================================================
|
||||||
|
define_if(LIBCXX_ENABLE_ASSERTIONS -UNDEBUG)
|
||||||
|
define_if_not(LIBCXX_ENABLE_ASSERTIONS -DNDEBUG)
|
||||||
|
if (LIBCXX_ENABLE_ASSERTIONS)
|
||||||
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
||||||
if (NOT MSVC)
|
define_if_not(MSVC -D_DEBUG)
|
||||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
|
endif()
|
||||||
endif()
|
|
||||||
# On Release builds cmake automatically defines NDEBUG, so we
|
# Feature flags ===============================================================
|
||||||
# explicitly undefine it:
|
define_if(MSVC -D_CRT_SECURE_NO_WARNINGS)
|
||||||
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
|
||||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -UNDEBUG)
|
# Sanitizer flags =============================================================
|
||||||
endif()
|
|
||||||
else()
|
# Configure for sanitizers. If LIBCXX_BUILT_STANDALONE then we have to do
|
||||||
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
# the flag translation ourselves. Othewise LLVM's CMakeList.txt will handle it.
|
||||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
|
if (LIBCXX_BUILT_STANDALONE)
|
||||||
|
set(LLVM_USE_SANITIZER "" CACHE STRING
|
||||||
|
"Define the sanitizer used to build the library and tests")
|
||||||
|
# NOTE: LLVM_USE_SANITIZER checks for a UNIX like system instead of MSVC.
|
||||||
|
# But we don't have LLVM_ON_UNIX so checking for MSVC is the best we can do.
|
||||||
|
if (LLVM_USE_SANITIZER AND NOT MSVC)
|
||||||
|
add_flags_if_supported("-fno-omit-frame-pointer")
|
||||||
|
add_flags_if_supported("-gline-tables-only")
|
||||||
|
|
||||||
|
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" AND
|
||||||
|
NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
|
||||||
|
add_flags_if_supported("-gline-tables-only")
|
||||||
|
endif()
|
||||||
|
if (LLVM_USE_SANITIZER STREQUAL "Address")
|
||||||
|
add_flags("-fsanitize=address")
|
||||||
|
elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?")
|
||||||
|
add_flags(-fsanitize=memory)
|
||||||
|
if (LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins")
|
||||||
|
add_flags("-fsanitize-memory-track-origins")
|
||||||
|
endif()
|
||||||
|
elseif (LLVM_USE_SANITIZER STREQUAL "Undefined")
|
||||||
|
add_flags("-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all")
|
||||||
|
elseif (LLVM_USE_SANITIZER STREQUAL "Thread")
|
||||||
|
add_flags(-fsanitize=thread)
|
||||||
|
else()
|
||||||
|
message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
|
||||||
|
endif()
|
||||||
|
elseif(LLVM_USE_SANITIZER AND MSVC)
|
||||||
|
message(WARNING "LLVM_USE_SANITIZER is not supported on this platform.")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# This is the _ONLY_ place where add_definitions is called.
|
# Configuration file flags =====================================================
|
||||||
add_definitions(
|
if (NOT LIBCXX_ABI_VERSION EQUAL "1")
|
||||||
${LIBCXX_CXX_REQUIRED_FLAGS}
|
config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
|
||||||
${LIBCXX_CXX_WARNING_FLAGS}
|
endif()
|
||||||
${LIBCXX_CXX_FEATURE_FLAGS}
|
config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)
|
||||||
)
|
|
||||||
|
config_define_if_not(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE)
|
||||||
|
config_define_if_not(LIBCXX_ENABLE_STDIN _LIBCPP_HAS_NO_STDIN)
|
||||||
|
config_define_if_not(LIBCXX_ENABLE_STDOUT _LIBCPP_HAS_NO_STDOUT)
|
||||||
|
config_define_if_not(LIBCXX_ENABLE_THREADS _LIBCPP_HAS_NO_THREADS)
|
||||||
|
config_define_if_not(LIBCXX_ENABLE_MONOTONIC_CLOCK _LIBCPP_HAS_NO_MONOTONIC_CLOCK)
|
||||||
|
config_define_if_not(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS)
|
||||||
|
|
||||||
|
config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC)
|
||||||
|
|
||||||
|
if (LIBCXX_NEEDS_SITE_CONFIG)
|
||||||
|
configure_file(
|
||||||
|
include/__config_site.in
|
||||||
|
${LIBCXX_BINARY_DIR}/__config_site
|
||||||
|
@ONLY)
|
||||||
|
# Provide the config definitions by included the generated __config_site
|
||||||
|
# file at compile time.
|
||||||
|
add_compile_flags("-include ${LIBCXX_BINARY_DIR}/__config_site")
|
||||||
|
endif()
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Setup Source Code
|
# Setup Source Code And Tests
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
|
add_subdirectory(include)
|
||||||
# Add source code. This also contains all of the logic for deciding linker flags
|
|
||||||
# soname, etc...
|
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
|
|
||||||
#===============================================================================
|
if (LIBCXX_INCLUDE_TESTS)
|
||||||
# Setup Tests
|
add_subdirectory(test)
|
||||||
#===============================================================================
|
endif()
|
||||||
|
if (LIBCXX_INCLUDE_DOCS)
|
||||||
add_subdirectory(test)
|
add_subdirectory(docs)
|
||||||
|
endif()
|
||||||
|
130
CREDITS.TXT
130
CREDITS.TXT
@ -8,27 +8,131 @@ beautification by scripts. The fields are: name (N), email (E), web-address
|
|||||||
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
|
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
|
||||||
(S).
|
(S).
|
||||||
|
|
||||||
N: Howard Hinnant
|
N: Saleem Abdulrasool
|
||||||
E: hhinnant@apple.com
|
E: compnerd@compnerd.org
|
||||||
D: Architect and primary author of libc++
|
D: Minor patches and Linux fixes.
|
||||||
|
|
||||||
N: Marshall Clow
|
N: Dan Albert
|
||||||
E: marshall@idio.com
|
E: danalbert@google.com
|
||||||
E: mclow@qualcomm.com
|
D: Android support and test runner improvements.
|
||||||
D: Minor patches and bug fixes.
|
|
||||||
|
|
||||||
N: Bjorn Reese
|
N: Dimitry Andric
|
||||||
E: breese@users.sourceforge.net
|
E: dimitry@andric.com
|
||||||
D: Initial regex prototype
|
D: Visibility fixes, minor FreeBSD portability patches.
|
||||||
|
|
||||||
N: David Chisnall
|
N: Holger Arnold
|
||||||
E: theraven at theravensnest dot org
|
E: holgerar@gmail.com
|
||||||
D: FreeBSD port and libcxxrt support.
|
D: Minor fix.
|
||||||
|
|
||||||
N: Ruben Van Boxem
|
N: Ruben Van Boxem
|
||||||
E: vanboxem dot ruben at gmail dot com
|
E: vanboxem dot ruben at gmail dot com
|
||||||
D: Initial Windows patches.
|
D: Initial Windows patches.
|
||||||
|
|
||||||
|
N: David Chisnall
|
||||||
|
E: theraven at theravensnest dot org
|
||||||
|
D: FreeBSD and Solaris ports, libcxxrt support, some atomics work.
|
||||||
|
|
||||||
|
N: Marshall Clow
|
||||||
|
E: mclow.lists@gmail.com
|
||||||
|
E: marshall@idio.com
|
||||||
|
D: C++14 support, patches and bug fixes.
|
||||||
|
|
||||||
|
N: Eric Fiselier
|
||||||
|
E: eric@efcs.ca
|
||||||
|
D: LFTS support, patches and bug fixes.
|
||||||
|
|
||||||
|
N: Bill Fisher
|
||||||
|
E: william.w.fisher@gmail.com
|
||||||
|
D: Regex bug fixes.
|
||||||
|
|
||||||
|
N: Matthew Dempsky
|
||||||
|
E: matthew@dempsky.org
|
||||||
|
D: Minor patches and bug fixes.
|
||||||
|
|
||||||
|
N: Google Inc.
|
||||||
|
D: Copyright owner and contributor of the CityHash algorithm
|
||||||
|
|
||||||
|
N: Howard Hinnant
|
||||||
|
E: hhinnant@apple.com
|
||||||
|
D: Architect and primary author of libc++
|
||||||
|
|
||||||
|
N: Hyeon-bin Jeong
|
||||||
|
E: tuhertz@gmail.com
|
||||||
|
D: Minor patches and bug fixes.
|
||||||
|
|
||||||
|
N: Argyrios Kyrtzidis
|
||||||
|
E: kyrtzidis@apple.com
|
||||||
|
D: Bug fixes.
|
||||||
|
|
||||||
|
N: Bruce Mitchener, Jr.
|
||||||
|
E: bruce.mitchener@gmail.com
|
||||||
|
D: Emscripten-related changes.
|
||||||
|
|
||||||
|
N: Michel Morin
|
||||||
|
E: mimomorin@gmail.com
|
||||||
|
D: Minor patches to is_convertible.
|
||||||
|
|
||||||
|
N: Andrew Morrow
|
||||||
|
E: andrew.c.morrow@gmail.com
|
||||||
|
D: Minor patches and Linux fixes.
|
||||||
|
|
||||||
N: Arvid Picciani
|
N: Arvid Picciani
|
||||||
E: aep at exys dot org
|
E: aep at exys dot org
|
||||||
D: Minor patches and musl port.
|
D: Minor patches and musl port.
|
||||||
|
|
||||||
|
N: Bjorn Reese
|
||||||
|
E: breese@users.sourceforge.net
|
||||||
|
D: Initial regex prototype
|
||||||
|
|
||||||
|
N: Nico Rieck
|
||||||
|
E: nico.rieck@gmail.com
|
||||||
|
D: Windows fixes
|
||||||
|
|
||||||
|
N: Jon Roelofs
|
||||||
|
E: jonathan@codesourcery.com
|
||||||
|
D: Remote testing, Newlib port, baremetal/single-threaded support.
|
||||||
|
|
||||||
|
N: Jonathan Sauer
|
||||||
|
D: Minor patches, mostly related to constexpr
|
||||||
|
|
||||||
|
N: Craig Silverstein
|
||||||
|
E: csilvers@google.com
|
||||||
|
D: Implemented Cityhash as the string hash function on 64-bit machines
|
||||||
|
|
||||||
|
N: Richard Smith
|
||||||
|
D: Minor patches.
|
||||||
|
|
||||||
|
N: Joerg Sonnenberger
|
||||||
|
E: joerg@NetBSD.org
|
||||||
|
D: NetBSD port.
|
||||||
|
|
||||||
|
N: Stephan Tolksdorf
|
||||||
|
E: st@quanttec.com
|
||||||
|
D: Minor <atomic> fix
|
||||||
|
|
||||||
|
N: Michael van der Westhuizen
|
||||||
|
E: r1mikey at gmail dot com
|
||||||
|
|
||||||
|
N: Larisse Voufo
|
||||||
|
D: Minor patches.
|
||||||
|
|
||||||
|
N: Klaas de Vries
|
||||||
|
E: klaas at klaasgaaf dot nl
|
||||||
|
D: Minor bug fix.
|
||||||
|
|
||||||
|
N: Zhang Xiongpang
|
||||||
|
E: zhangxiongpang@gmail.com
|
||||||
|
D: Minor patches and bug fixes.
|
||||||
|
|
||||||
|
N: Xing Xue
|
||||||
|
E: xingxue@ca.ibm.com
|
||||||
|
D: AIX port
|
||||||
|
|
||||||
|
N: Zhihao Yuan
|
||||||
|
E: lichray@gmail.com
|
||||||
|
D: Standard compatibility fixes.
|
||||||
|
|
||||||
|
N: Jeffrey Yasskin
|
||||||
|
E: jyasskin@gmail.com
|
||||||
|
E: jyasskin@google.com
|
||||||
|
D: Linux fixes.
|
||||||
|
@ -14,7 +14,7 @@ Full text of the relevant licenses is included below.
|
|||||||
University of Illinois/NCSA
|
University of Illinois/NCSA
|
||||||
Open Source License
|
Open Source License
|
||||||
|
|
||||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
62
Makefile
62
Makefile
@ -1,5 +1,5 @@
|
|||||||
##
|
##
|
||||||
# libcpp Makefile
|
# libc++ Makefile
|
||||||
##
|
##
|
||||||
|
|
||||||
SRCDIRS = .
|
SRCDIRS = .
|
||||||
@ -14,9 +14,12 @@ ifeq (,$(RC_INDIGO))
|
|||||||
else
|
else
|
||||||
INSTALL_PREFIX="$(SDKROOT)"
|
INSTALL_PREFIX="$(SDKROOT)"
|
||||||
endif
|
endif
|
||||||
|
INSTALL_DIR=$(DSTROOT)/$(INSTALL_PREFIX)
|
||||||
|
|
||||||
|
.PHONY: help installsrc clean installheaders install
|
||||||
|
|
||||||
help::
|
help::
|
||||||
echo Use make install DSTROOT=<destination>
|
@echo "Use make install DSTROOT=<destination>"
|
||||||
|
|
||||||
installsrc:: $(SRCROOT)
|
installsrc:: $(SRCROOT)
|
||||||
|
|
||||||
@ -27,42 +30,27 @@ installsrc:: $(SRCROOT)
|
|||||||
|
|
||||||
clean::
|
clean::
|
||||||
|
|
||||||
installhdrs::
|
# The installheaders target is used by clang's runtime/libcxx makefile.
|
||||||
|
installheaders::
|
||||||
|
mkdir -p $(HEADER_DIR)/c++/v1/ext
|
||||||
|
(cd $(SRCDIRS)/include && \
|
||||||
|
tar cf - --exclude=".*" --exclude=support \
|
||||||
|
--exclude=CMakeLists.txt *) | \
|
||||||
|
(cd $(HEADER_DIR)/c++/v1 && tar xf -)
|
||||||
|
chmod 755 $(HEADER_DIR)/c++/v1
|
||||||
|
chmod 644 $(HEADER_DIR)/c++/v1/*
|
||||||
|
chmod 755 $(HEADER_DIR)/c++/v1/ext
|
||||||
|
chmod 644 $(HEADER_DIR)/c++/v1/ext/*
|
||||||
|
chmod 755 $(HEADER_DIR)/c++/v1/experimental
|
||||||
|
chmod 644 $(HEADER_DIR)/c++/v1/experimental/*
|
||||||
|
|
||||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
install::
|
||||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
|
|
||||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
|
||||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
|
||||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/
|
|
||||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/
|
|
||||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/
|
|
||||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/
|
|
||||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++
|
|
||||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++
|
|
||||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++
|
|
||||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++
|
|
||||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1
|
|
||||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1
|
|
||||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1
|
|
||||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1
|
|
||||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/*
|
|
||||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/*
|
|
||||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/*
|
|
||||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/*
|
|
||||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
|
||||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
|
|
||||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
|
||||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
|
||||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext/*
|
|
||||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext/*
|
|
||||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext/*
|
|
||||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext/*
|
|
||||||
|
|
||||||
install:: installhdrs $(DESTDIR)
|
|
||||||
|
|
||||||
cd lib && ./buildit
|
cd lib && ./buildit
|
||||||
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||||
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM $(SYMROOT)/usr/lib/libc++.1.dylib
|
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM \
|
||||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib
|
$(SYMROOT)/usr/lib/libc++.1.dylib
|
||||||
strip -S -o $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
mkdir -p $(INSTALL_DIR)/usr/lib
|
||||||
cd $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib && ln -s libc++.1.dylib libc++.dylib
|
strip -S -o $(INSTALL_DIR)/usr/lib/libc++.1.dylib \
|
||||||
|
$(SYMROOT)/usr/lib/libc++.1.dylib
|
||||||
|
cd $(INSTALL_DIR)/usr/lib && ln -s libc++.1.dylib libc++.dylib
|
||||||
|
56
TODO.TXT
Normal file
56
TODO.TXT
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
This is meant to be a general place to list things that should be done "someday"
|
||||||
|
|
||||||
|
3.8 Release Goals
|
||||||
|
=================
|
||||||
|
* LFTS v1 (EricWF, MClow)
|
||||||
|
* Filesystem TS (EricWF)
|
||||||
|
* ASIO TS (MClow)
|
||||||
|
* <regex> Improvements (MClow)
|
||||||
|
* Setup ABI Versioning policy (EricWF)
|
||||||
|
* Fix PR19302 - Fix UB in list and __tree.
|
||||||
|
|
||||||
|
|
||||||
|
ABI Related Tasks
|
||||||
|
=================
|
||||||
|
* Explicitly manage and verify symbols exported from the dylib.
|
||||||
|
* Explore using namespaces for managing symbol visibility.
|
||||||
|
* Introduce and document ABI versioning/evolution policy.
|
||||||
|
|
||||||
|
CXX Runtime Library Tasks
|
||||||
|
=========================
|
||||||
|
* Cleanup #ifdef hell in sources files that supports the different ABI libraries.
|
||||||
|
* Fix that CMake always link to /usr/lib/libc++abi.dylib on OS X.
|
||||||
|
* Fix selection of ABI symbol list on OS X.
|
||||||
|
* Have CMake generate linker scripts for libc++.so that it properly links the
|
||||||
|
runtime library.
|
||||||
|
* Look into mirroring libsupc++'s typeinfo vtable layout when libsupc++/libstdc++
|
||||||
|
is used as the runtime library.
|
||||||
|
* Audit libraries that CMake links into libc++. Are they all required?
|
||||||
|
* Investigate and document interoperability between libc++ and libstdc++ on
|
||||||
|
linux. Do this for every supported c++ runtime library.
|
||||||
|
|
||||||
|
Atomic Related Tasks
|
||||||
|
====================
|
||||||
|
* Enable mixing of clang and GCC atomics internally. Currently some
|
||||||
|
parts of libc++ use atomics only when clang provides them.
|
||||||
|
(see memory@5380 for an example)
|
||||||
|
* Audit use of libatomic builtins in <atomic> with GCC.
|
||||||
|
* future should use <atomic> for synchronization.
|
||||||
|
|
||||||
|
Test Suite Tasks
|
||||||
|
================
|
||||||
|
* Move all libc++ specific tests from test/std into test/libcxx.
|
||||||
|
* Improve how LIT handles compiler warnings.
|
||||||
|
* Improve the quality and portability of the locale test data.
|
||||||
|
* Convert failure tests to use Clang Verify.
|
||||||
|
|
||||||
|
Misc Tasks
|
||||||
|
==========
|
||||||
|
* Find all sequences of >2 underscores and eradicate them.
|
||||||
|
* run clang-tidy on libc++
|
||||||
|
* Document the "conditionally-supported" bits of libc++
|
||||||
|
* Look at basic_string's move assignment operator, re LWG 2063 and POCMA
|
||||||
|
* libc++ is missing try_emplace
|
||||||
|
* Put a static_assert in std::allocator to deny const/volatile types (LWG 2447)
|
||||||
|
* Document support (or lack of) for C++11 libraries in C++03.
|
||||||
|
* Document supported compilers.
|
36
cmake/Modules/CodeCoverage.cmake
Normal file
36
cmake/Modules/CodeCoverage.cmake
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
find_program(CODE_COVERAGE_LCOV lcov)
|
||||||
|
if (NOT CODE_COVERAGE_LCOV)
|
||||||
|
message(FATAL_ERROR "Cannot find lcov...")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_program(CODE_COVERAGE_GENHTML genhtml)
|
||||||
|
if (NOT CODE_COVERAGE_GENHTML)
|
||||||
|
message(FATAL_ERROR "Cannot find genhtml...")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage")
|
||||||
|
|
||||||
|
function(setup_lcov_test_target_coverage target_name output_dir capture_dirs source_dirs)
|
||||||
|
file(MAKE_DIRECTORY ${output_dir})
|
||||||
|
|
||||||
|
set(CAPTURE_DIRS "")
|
||||||
|
foreach(cdir ${capture_dirs})
|
||||||
|
list(APPEND CAPTURE_DIRS "-d;${cdir}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(EXTRACT_DIRS "")
|
||||||
|
foreach(sdir ${source_dirs})
|
||||||
|
list(APPEND EXTRACT_DIRS "'${sdir}/*'")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
message(STATUS "Capture Directories: ${CAPTURE_DIRS}")
|
||||||
|
message(STATUS "Extract Directories: ${EXTRACT_DIRS}")
|
||||||
|
|
||||||
|
add_custom_target(generate-lib${target_name}-coverage
|
||||||
|
COMMAND ${CODE_COVERAGE_LCOV} --capture ${CAPTURE_DIRS} -o test_coverage.info
|
||||||
|
COMMAND ${CODE_COVERAGE_LCOV} --extract test_coverage.info ${EXTRACT_DIRS} -o test_coverage.info
|
||||||
|
COMMAND ${CODE_COVERAGE_GENHTML} --demangle-cpp test_coverage.info -o test_coverage
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove test_coverage.info
|
||||||
|
WORKING_DIRECTORY ${output_dir}
|
||||||
|
COMMENT "Generating coverage results")
|
||||||
|
endfunction()
|
@ -1,53 +0,0 @@
|
|||||||
# Define functions to get the host and target triple.
|
|
||||||
|
|
||||||
function(get_host_triple out out_arch out_vendor out_os)
|
|
||||||
# Get the architecture.
|
|
||||||
set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
|
||||||
if (arch STREQUAL "x86")
|
|
||||||
set(arch "i686")
|
|
||||||
endif()
|
|
||||||
# Get the vendor.
|
|
||||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
|
||||||
set(vendor "apple")
|
|
||||||
else()
|
|
||||||
set(vendor "pc")
|
|
||||||
endif()
|
|
||||||
# Get os.
|
|
||||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
|
||||||
set(os "win32")
|
|
||||||
else()
|
|
||||||
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} os)
|
|
||||||
endif()
|
|
||||||
set(triple "${arch}-${vendor}-${os}")
|
|
||||||
set(${out} ${triple} PARENT_SCOPE)
|
|
||||||
set(${out_arch} ${arch} PARENT_SCOPE)
|
|
||||||
set(${out_vendor} ${vendor} PARENT_SCOPE)
|
|
||||||
set(${out_os} ${os} PARENT_SCOPE)
|
|
||||||
message(STATUS "Host triple: ${triple}")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(get_target_triple out out_arch out_vendor out_os)
|
|
||||||
# Get the architecture.
|
|
||||||
set(arch ${CMAKE_SYSTEM_PROCESSOR})
|
|
||||||
if (arch STREQUAL "x86")
|
|
||||||
set(arch "i686")
|
|
||||||
endif()
|
|
||||||
# Get the vendor.
|
|
||||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
|
||||||
set(vendor "apple")
|
|
||||||
else()
|
|
||||||
set(vendor "pc")
|
|
||||||
endif()
|
|
||||||
# Get os.
|
|
||||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
||||||
set(os "win32")
|
|
||||||
else()
|
|
||||||
string(TOLOWER ${CMAKE_SYSTEM_NAME} os)
|
|
||||||
endif()
|
|
||||||
set(triple "${arch}-${vendor}-${os}")
|
|
||||||
set(${out} ${triple} PARENT_SCOPE)
|
|
||||||
set(${out_arch} ${arch} PARENT_SCOPE)
|
|
||||||
set(${out_vendor} ${vendor} PARENT_SCOPE)
|
|
||||||
set(${out_os} ${os} PARENT_SCOPE)
|
|
||||||
message(STATUS "Target triple: ${triple}")
|
|
||||||
endfunction()
|
|
108
cmake/Modules/HandleLibCXXABI.cmake
Normal file
108
cmake/Modules/HandleLibCXXABI.cmake
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# Add an ABI library if appropriate
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
#
|
||||||
|
# _setup_abi: Set up the build to use an ABI library
|
||||||
|
#
|
||||||
|
# Parameters:
|
||||||
|
# abidefines: A list of defines needed to compile libc++ with the ABI library
|
||||||
|
# abilib : The ABI library to link against.
|
||||||
|
# abifiles : A list of files (which may be relative paths) to copy into the
|
||||||
|
# libc++ build tree for the build. These files will also be
|
||||||
|
# installed alongside the libc++ headers.
|
||||||
|
# abidirs : A list of relative paths to create under an include directory
|
||||||
|
# in the libc++ build directory.
|
||||||
|
#
|
||||||
|
macro(setup_abi_lib abidefines abilib abifiles abidirs)
|
||||||
|
list(APPEND LIBCXX_COMPILE_FLAGS ${abidefines})
|
||||||
|
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_CXX_ABI_INCLUDE_PATHS}"
|
||||||
|
CACHE PATH
|
||||||
|
"Paths to C++ ABI header directories separated by ';'." FORCE
|
||||||
|
)
|
||||||
|
|
||||||
|
set(LIBCXX_CXX_ABI_LIBRARY ${abilib})
|
||||||
|
|
||||||
|
set(LIBCXX_ABILIB_FILES ${abifiles})
|
||||||
|
|
||||||
|
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
|
||||||
|
foreach(_d ${abidirs})
|
||||||
|
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/${_d}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
foreach(fpath ${LIBCXX_ABILIB_FILES})
|
||||||
|
set(found FALSE)
|
||||||
|
foreach(incpath ${LIBCXX_CXX_ABI_INCLUDE_PATHS})
|
||||||
|
if (EXISTS "${incpath}/${fpath}")
|
||||||
|
set(found TRUE)
|
||||||
|
get_filename_component(dstdir ${fpath} PATH)
|
||||||
|
get_filename_component(ifile ${fpath} NAME)
|
||||||
|
file(COPY "${incpath}/${fpath}"
|
||||||
|
DESTINATION "${CMAKE_BINARY_DIR}/include/${dstdir}"
|
||||||
|
)
|
||||||
|
if (LIBCXX_INSTALL_HEADERS)
|
||||||
|
install(FILES "${CMAKE_BINARY_DIR}/include/${fpath}"
|
||||||
|
DESTINATION include/c++/v1/${dstdir}
|
||||||
|
COMPONENT libcxx
|
||||||
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
list(APPEND abilib_headers "${CMAKE_BINARY_DIR}/include/${fpath}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if (NOT found)
|
||||||
|
message(WARNING "Failed to find ${fpath}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
add_custom_target(LIBCXX_CXX_ABI_DEPS DEPENDS ${abilib_headers})
|
||||||
|
include_directories("${CMAKE_BINARY_DIR}/include")
|
||||||
|
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
# Configure based on the selected ABI library.
|
||||||
|
if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++" OR
|
||||||
|
"${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libsupc++")
|
||||||
|
set(_LIBSUPCXX_INCLUDE_FILES
|
||||||
|
cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h
|
||||||
|
bits/cxxabi_tweaks.h bits/cxxabi_forced.h
|
||||||
|
)
|
||||||
|
if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++")
|
||||||
|
set(_LIBSUPCXX_DEFINES "-DLIBSTDCXX")
|
||||||
|
set(_LIBSUPCXX_LIBNAME stdc++)
|
||||||
|
else()
|
||||||
|
set(_LIBSUPCXX_DEFINES "")
|
||||||
|
set(_LIBSUPCXX_LIBNAME supc++)
|
||||||
|
endif()
|
||||||
|
setup_abi_lib(
|
||||||
|
"-D__GLIBCXX__ ${_LIBSUPCXX_DEFINES}"
|
||||||
|
"${_LIBSUPCXX_LIBNAME}" "${_LIBSUPCXX_INCLUDE_FILES}" "bits"
|
||||||
|
)
|
||||||
|
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
|
||||||
|
if (LIBCXX_CXX_ABI_INTREE)
|
||||||
|
# Link against just-built "cxxabi" target.
|
||||||
|
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
|
||||||
|
set(CXXABI_LIBNAME cxxabi_static)
|
||||||
|
else()
|
||||||
|
set(CXXABI_LIBNAME cxxabi_shared)
|
||||||
|
endif()
|
||||||
|
set(LIBCXX_LIBCPPABI_VERSION "2" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
# Assume c++abi is installed in the system, rely on -lc++abi link flag.
|
||||||
|
set(CXXABI_LIBNAME "c++abi")
|
||||||
|
endif()
|
||||||
|
setup_abi_lib("-DLIBCXX_BUILDING_LIBCXXABI"
|
||||||
|
${CXXABI_LIBNAME} "cxxabi.h;__cxxabi_config.h" ""
|
||||||
|
)
|
||||||
|
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
|
||||||
|
setup_abi_lib("-DLIBCXXRT"
|
||||||
|
"cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""
|
||||||
|
)
|
||||||
|
elseif (NOT "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "none")
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Currently libstdc++, libsupc++, libcxxabi, libcxxrt and none are "
|
||||||
|
"supported for c++ abi."
|
||||||
|
)
|
||||||
|
endif ()
|
169
cmake/Modules/HandleLibcxxFlags.cmake
Normal file
169
cmake/Modules/HandleLibcxxFlags.cmake
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
# HandleLibcxxFlags - A set of macros used to setup the flags used to compile
|
||||||
|
# and link libc++. These macros add flags to the following CMake variables.
|
||||||
|
# - LIBCXX_COMPILE_FLAGS: flags used to compile libc++
|
||||||
|
# - LIBCXX_LINK_FLAGS: flags used to link libc++
|
||||||
|
# - LIBCXX_LIBRARIES: libraries to link libc++ to.
|
||||||
|
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
|
||||||
|
unset(add_flag_if_supported)
|
||||||
|
|
||||||
|
# Mangle the name of a compiler flag into a valid CMake identifier.
|
||||||
|
# Ex: --std=c++11 -> STD_EQ_CXX11
|
||||||
|
macro(mangle_name str output)
|
||||||
|
string(STRIP "${str}" strippedStr)
|
||||||
|
string(REGEX REPLACE "^/" "" strippedStr "${strippedStr}")
|
||||||
|
string(REGEX REPLACE "^-+" "" strippedStr "${strippedStr}")
|
||||||
|
string(REGEX REPLACE "-+$" "" strippedStr "${strippedStr}")
|
||||||
|
string(REPLACE "-" "_" strippedStr "${strippedStr}")
|
||||||
|
string(REPLACE "=" "_EQ_" strippedStr "${strippedStr}")
|
||||||
|
string(REPLACE "+" "X" strippedStr "${strippedStr}")
|
||||||
|
string(TOUPPER "${strippedStr}" ${output})
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Remove a list of flags from all CMake variables that affect compile flags.
|
||||||
|
# This can be used to remove unwanted flags specified on the command line
|
||||||
|
# or added in other parts of LLVM's cmake configuration.
|
||||||
|
macro(remove_flags)
|
||||||
|
foreach(var ${ARGN})
|
||||||
|
string(REPLACE "${var}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
string(REPLACE "${var}" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||||
|
string(REPLACE "${var}" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
||||||
|
string(REPLACE "${var}" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||||
|
string(REPLACE "${var}" "" CMAKE_SHARED_MODULE_FLAGS "${CMAKE_SHARED_MODULE_FLAGS}")
|
||||||
|
remove_definitions(${var})
|
||||||
|
endforeach()
|
||||||
|
endmacro(remove_flags)
|
||||||
|
|
||||||
|
# Add a macro definition if condition is true.
|
||||||
|
macro(define_if condition def)
|
||||||
|
if (${condition})
|
||||||
|
add_definitions(${def})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Add a macro definition if condition is not true.
|
||||||
|
macro(define_if_not condition def)
|
||||||
|
if (NOT ${condition})
|
||||||
|
add_definitions(${def})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Add a macro definition to the __config_site file if the specified condition
|
||||||
|
# is 'true'. Note that '-D${def}' is not added. Instead it is expected that
|
||||||
|
# the build include the '__config_site' header.
|
||||||
|
macro(config_define_if condition def)
|
||||||
|
if (${condition})
|
||||||
|
set(${def} ON)
|
||||||
|
set(LIBCXX_NEEDS_SITE_CONFIG ON)
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(config_define_if_not condition def)
|
||||||
|
if (NOT ${condition})
|
||||||
|
set(${def} ON)
|
||||||
|
set(LIBCXX_NEEDS_SITE_CONFIG ON)
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(config_define value def)
|
||||||
|
set(${def} ${value})
|
||||||
|
set(LIBCXX_NEEDS_SITE_CONFIG ON)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Add a specified list of flags to both 'LIBCXX_COMPILE_FLAGS' and
|
||||||
|
# 'LIBCXX_LINK_FLAGS'.
|
||||||
|
macro(add_flags)
|
||||||
|
foreach(value ${ARGN})
|
||||||
|
list(APPEND LIBCXX_COMPILE_FLAGS ${value})
|
||||||
|
list(APPEND LIBCXX_LINK_FLAGS ${value})
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# If the specified 'condition' is true then add a list of flags to both
|
||||||
|
# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'.
|
||||||
|
macro(add_flags_if condition)
|
||||||
|
if (${condition})
|
||||||
|
add_flags(${ARGN})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Add each flag in the list to LIBCXX_COMPILE_FLAGS and LIBCXX_LINK_FLAGS
|
||||||
|
# if that flag is supported by the current compiler.
|
||||||
|
macro(add_flags_if_supported)
|
||||||
|
foreach(flag ${ARGN})
|
||||||
|
mangle_name("${flag}" flagname)
|
||||||
|
check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
|
||||||
|
add_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${flag})
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Add a list of flags to 'LIBCXX_COMPILE_FLAGS'.
|
||||||
|
macro(add_compile_flags)
|
||||||
|
foreach(f ${ARGN})
|
||||||
|
list(APPEND LIBCXX_COMPILE_FLAGS ${f})
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# If 'condition' is true then add the specified list of flags to
|
||||||
|
# 'LIBCXX_COMPILE_FLAGS'
|
||||||
|
macro(add_compile_flags_if condition)
|
||||||
|
if (${condition})
|
||||||
|
add_compile_flags(${ARGN})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# For each specified flag, add that flag to 'LIBCXX_COMPILE_FLAGS' if the
|
||||||
|
# flag is supported by the C++ compiler.
|
||||||
|
macro(add_compile_flags_if_supported)
|
||||||
|
foreach(flag ${ARGN})
|
||||||
|
mangle_name("${flag}" flagname)
|
||||||
|
check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
|
||||||
|
add_compile_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${flag})
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Add a list of flags to 'LIBCXX_LINK_FLAGS'.
|
||||||
|
macro(add_link_flags)
|
||||||
|
foreach(f ${ARGN})
|
||||||
|
list(APPEND LIBCXX_LINK_FLAGS ${f})
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# If 'condition' is true then add the specified list of flags to
|
||||||
|
# 'LIBCXX_LINK_FLAGS'
|
||||||
|
macro(add_link_flags_if condition)
|
||||||
|
if (${condition})
|
||||||
|
add_link_flags(${ARGN})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# For each specified flag, add that flag to 'LIBCXX_LINK_FLAGS' if the
|
||||||
|
# flag is supported by the C++ compiler.
|
||||||
|
macro(add_link_flags_if_supported)
|
||||||
|
foreach(flag ${ARGN})
|
||||||
|
mangle_name("${flag}" flagname)
|
||||||
|
check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
|
||||||
|
add_link_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${flag})
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Add a list of libraries or link flags to 'LIBCXX_LIBRARIES'.
|
||||||
|
macro(add_library_flags)
|
||||||
|
foreach(lib ${ARGN})
|
||||||
|
list(APPEND LIBCXX_LIBRARIES ${lib})
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# if 'condition' is true then add the specified list of libraries and flags
|
||||||
|
# to 'LIBCXX_LIBRARIES'.
|
||||||
|
macro(add_library_flags_if condition)
|
||||||
|
if(${condition})
|
||||||
|
add_library_flags(${ARGN})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Turn a comma separated CMake list into a space separated string.
|
||||||
|
macro(split_list listname)
|
||||||
|
string(REPLACE ";" " " ${listname} "${${listname}}")
|
||||||
|
endmacro()
|
138
cmake/Modules/HandleOutOfTreeLLVM.cmake
Normal file
138
cmake/Modules/HandleOutOfTreeLLVM.cmake
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
macro(find_llvm_parts)
|
||||||
|
# Rely on llvm-config.
|
||||||
|
set(CONFIG_OUTPUT)
|
||||||
|
find_program(LLVM_CONFIG "llvm-config")
|
||||||
|
if(DEFINED LLVM_PATH)
|
||||||
|
set(LLVM_INCLUDE_DIR ${LLVM_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
|
||||||
|
set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree")
|
||||||
|
set(LLVM_MAIN_SRC_DIR ${LLVM_PATH})
|
||||||
|
set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules")
|
||||||
|
elseif(LLVM_CONFIG)
|
||||||
|
message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
|
||||||
|
set(CONFIG_COMMAND ${LLVM_CONFIG}
|
||||||
|
"--includedir"
|
||||||
|
"--prefix"
|
||||||
|
"--src-root")
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CONFIG_COMMAND}
|
||||||
|
RESULT_VARIABLE HAD_ERROR
|
||||||
|
OUTPUT_VARIABLE CONFIG_OUTPUT
|
||||||
|
)
|
||||||
|
if(NOT HAD_ERROR)
|
||||||
|
string(REGEX REPLACE
|
||||||
|
"[ \t]*[\r\n]+[ \t]*" ";"
|
||||||
|
CONFIG_OUTPUT ${CONFIG_OUTPUT})
|
||||||
|
else()
|
||||||
|
string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}")
|
||||||
|
message(STATUS "${CONFIG_COMMAND_STR}")
|
||||||
|
message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(GET CONFIG_OUTPUT 0 INCLUDE_DIR)
|
||||||
|
list(GET CONFIG_OUTPUT 1 LLVM_OBJ_ROOT)
|
||||||
|
list(GET CONFIG_OUTPUT 2 MAIN_SRC_DIR)
|
||||||
|
|
||||||
|
set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
|
||||||
|
set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
|
||||||
|
set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
|
||||||
|
set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake")
|
||||||
|
else()
|
||||||
|
set(LLVM_FOUND OFF)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT EXISTS ${LLVM_MAIN_SRC_DIR})
|
||||||
|
set(LLVM_FOUND OFF)
|
||||||
|
message(WARNING "Not found: ${LLVM_MAIN_SRC_DIR}")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT EXISTS ${LLVM_CMAKE_PATH})
|
||||||
|
set(LLVM_FOUND OFF)
|
||||||
|
message(WARNING "Not found: ${LLVM_CMAKE_PATH}")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
|
||||||
|
|
||||||
|
set(LLVM_FOUND ON)
|
||||||
|
endmacro(find_llvm_parts)
|
||||||
|
|
||||||
|
|
||||||
|
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||||
|
set(LIBCXX_BUILT_STANDALONE 1)
|
||||||
|
message(STATUS "Configuring for standalone build.")
|
||||||
|
|
||||||
|
find_llvm_parts()
|
||||||
|
|
||||||
|
# LLVM Options --------------------------------------------------------------
|
||||||
|
include(FindPythonInterp)
|
||||||
|
if( NOT PYTHONINTERP_FOUND )
|
||||||
|
message(WARNING "Failed to find python interpreter. "
|
||||||
|
"The libc++ test suite will be disabled.")
|
||||||
|
set(LLVM_INCLUDE_TESTS OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT DEFINED LLVM_INCLUDE_TESTS)
|
||||||
|
set(LLVM_INCLUDE_TESTS ${LLVM_FOUND})
|
||||||
|
endif()
|
||||||
|
if (NOT DEFINED LLVM_INCLUDE_DOCS)
|
||||||
|
set(LLVM_INCLUDE_DOCS ${LLVM_FOUND})
|
||||||
|
endif()
|
||||||
|
if (NOT DEFINED LLVM_ENABLE_SPHINX)
|
||||||
|
set(LLVM_ENABLE_SPHINX OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Required LIT Configuration ------------------------------------------------
|
||||||
|
# Define the default arguments to use with 'lit', and an option for the user
|
||||||
|
# to override.
|
||||||
|
set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
|
||||||
|
if (MSVC OR XCODE)
|
||||||
|
set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
|
||||||
|
endif()
|
||||||
|
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
|
||||||
|
|
||||||
|
# Make sure we can use the console pool for recent cmake and ninja > 1.5
|
||||||
|
# Needed for add_lit_testsuite
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
|
||||||
|
set(cmake_3_2_USES_TERMINAL)
|
||||||
|
else()
|
||||||
|
set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Required doc configuration
|
||||||
|
if (LLVM_ENABLE_SPHINX)
|
||||||
|
message(STATUS "Sphinx enabled.")
|
||||||
|
find_package(Sphinx REQUIRED)
|
||||||
|
else()
|
||||||
|
message(STATUS "Sphinx disabled.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# FIXME - This is cribbed from HandleLLVMOptions.cmake.
|
||||||
|
if(WIN32)
|
||||||
|
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
|
||||||
|
if(CYGWIN)
|
||||||
|
set(LLVM_ON_WIN32 0)
|
||||||
|
set(LLVM_ON_UNIX 1)
|
||||||
|
else(CYGWIN)
|
||||||
|
set(LLVM_ON_WIN32 1)
|
||||||
|
set(LLVM_ON_UNIX 0)
|
||||||
|
endif(CYGWIN)
|
||||||
|
else(WIN32)
|
||||||
|
if(UNIX)
|
||||||
|
set(LLVM_ON_WIN32 0)
|
||||||
|
set(LLVM_ON_UNIX 1)
|
||||||
|
if(APPLE)
|
||||||
|
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
|
||||||
|
else(APPLE)
|
||||||
|
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
|
||||||
|
endif(APPLE)
|
||||||
|
else(UNIX)
|
||||||
|
MESSAGE(SEND_ERROR "Unable to determine platform")
|
||||||
|
endif(UNIX)
|
||||||
|
endif(WIN32)
|
||||||
|
|
||||||
|
# Add LLVM Functions --------------------------------------------------------
|
||||||
|
include(AddLLVM OPTIONAL)
|
||||||
|
endif()
|
@ -2,37 +2,18 @@ include(CheckLibraryExists)
|
|||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
|
|
||||||
# Check compiler flags
|
# Check compiler flags
|
||||||
check_cxx_compiler_flag(-std=c++0x LIBCXX_HAS_STDCXX0X_FLAG)
|
|
||||||
check_cxx_compiler_flag(-fPIC LIBCXX_HAS_FPIC_FLAG)
|
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
|
||||||
check_cxx_compiler_flag(-nodefaultlibs LIBCXX_HAS_NODEFAULTLIBS_FLAG)
|
check_cxx_compiler_flag(/WX- LIBCXX_HAS_NO_WX_FLAG)
|
||||||
check_cxx_compiler_flag(-nostdinc++ LIBCXX_HAS_NOSTDINCXX_FLAG)
|
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
|
||||||
check_cxx_compiler_flag(-Wall LIBCXX_HAS_WALL_FLAG)
|
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
|
||||||
check_cxx_compiler_flag(-W LIBCXX_HAS_W_FLAG)
|
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
|
||||||
check_cxx_compiler_flag(-Wno-unused-parameter LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG)
|
check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
|
||||||
check_cxx_compiler_flag(-Wwrite-strings LIBCXX_HAS_WWRITE_STRINGS_FLAG)
|
|
||||||
check_cxx_compiler_flag(-Wno-long-long LIBCXX_HAS_WNO_LONG_LONG_FLAG)
|
|
||||||
check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG)
|
|
||||||
check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG)
|
|
||||||
check_cxx_compiler_flag(-fno-exceptions LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
|
|
||||||
check_cxx_compiler_flag(-fno-rtti LIBCXX_HAS_FNO_RTTI_FLAG)
|
|
||||||
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
|
|
||||||
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
|
|
||||||
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
|
|
||||||
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
|
|
||||||
check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
|
|
||||||
|
|
||||||
# Check libraries
|
# Check libraries
|
||||||
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
|
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
|
||||||
check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
|
check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
|
||||||
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
|
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
|
||||||
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
|
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
|
||||||
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
|
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
|
||||||
|
|
||||||
# Check C++0x features
|
|
||||||
if (LIBCXX_ENABLE_CXX0X)
|
|
||||||
if (LIBCXX_HAS_STDCXX0X_FLAG)
|
|
||||||
set(CMAKE_REQUIRED_DEFINITIONS -std=c++0x)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
set(LIBCXX_HAS_STDCXX0X_FLAG FALSE)
|
|
||||||
endif()
|
|
||||||
|
306
docs/BuildingLibcxx.rst
Normal file
306
docs/BuildingLibcxx.rst
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
|
||||||
|
===============
|
||||||
|
Building libc++
|
||||||
|
===============
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
|
||||||
|
Getting Started
|
||||||
|
===============
|
||||||
|
|
||||||
|
On Mac OS 10.7 (Lion) and later, the easiest way to get this library is to install
|
||||||
|
Xcode 4.2 or later. However if you want to install tip-of-trunk from here
|
||||||
|
(getting the bleeding edge), read on.
|
||||||
|
|
||||||
|
The basic steps needed to build libc++ are:
|
||||||
|
|
||||||
|
#. Checkout LLVM:
|
||||||
|
|
||||||
|
* ``cd where-you-want-llvm-to-live``
|
||||||
|
* ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
|
||||||
|
|
||||||
|
#. Checkout libc++:
|
||||||
|
|
||||||
|
* ``cd where-you-want-llvm-to-live``
|
||||||
|
* ``cd llvm/projects``
|
||||||
|
* ``svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx``
|
||||||
|
|
||||||
|
#. Checkout libc++abi:
|
||||||
|
|
||||||
|
* ``cd where-you-want-llvm-to-live``
|
||||||
|
* ``cd llvm/projects``
|
||||||
|
* ``svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi``
|
||||||
|
|
||||||
|
#. Configure and build libc++ with libc++abi:
|
||||||
|
|
||||||
|
CMake is the only supported configuration system. Unlike other LLVM
|
||||||
|
projects autotools is not supported for either libc++ or libc++abi.
|
||||||
|
|
||||||
|
Clang is the preferred compiler when building and using libc++.
|
||||||
|
|
||||||
|
* ``cd where you want to build llvm``
|
||||||
|
* ``mkdir build``
|
||||||
|
* ``cd build``
|
||||||
|
* ``cmake -G <generator> [options] <path to llvm sources>``
|
||||||
|
|
||||||
|
For more information about configuring libc++ see :ref:`CMake Options`.
|
||||||
|
|
||||||
|
* ``make cxx`` --- will build libc++ and libc++abi.
|
||||||
|
* ``make check-libcxx check-libcxxabi`` --- will run the test suites.
|
||||||
|
|
||||||
|
Shared libraries for libc++ and libc++ abi should now be present in llvm/build/lib.
|
||||||
|
See :ref:`using an alternate libc++ installation <alternate libcxx>`
|
||||||
|
|
||||||
|
#. **Optional**: Install libc++ and libc++abi
|
||||||
|
|
||||||
|
If your system already provides a libc++ installation it is important to be
|
||||||
|
careful not to replace it. Remember Use the CMake option ``CMAKE_INSTALL_PREFIX`` to
|
||||||
|
select a safe place to install libc++.
|
||||||
|
|
||||||
|
* ``make install-libcxx install-libcxxabi`` --- Will install the libraries and the headers
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
* Replacing your systems libc++ installation could render the system non-functional.
|
||||||
|
* Mac OS X will not boot without a valid copy of ``libc++.1.dylib`` in ``/usr/lib``.
|
||||||
|
|
||||||
|
|
||||||
|
The instructions are for building libc++ on
|
||||||
|
FreeBSD, Linux, or Mac using `libc++abi`_ as the C++ ABI library.
|
||||||
|
On Linux, it is also possible to use :ref:`libsupc++ <libsupcxx>` or libcxxrt.
|
||||||
|
|
||||||
|
It is sometimes beneficial to build outside of the LLVM tree. An out-of-tree
|
||||||
|
build would look like this:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ cd where-you-want-libcxx-to-live
|
||||||
|
$ # Check out llvm, libc++ and libc++abi.
|
||||||
|
$ ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
|
||||||
|
$ ``svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx``
|
||||||
|
$ ``svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi``
|
||||||
|
$ cd where-you-want-to-build
|
||||||
|
$ mkdir build && cd build
|
||||||
|
$ export CC=clang CXX=clang++
|
||||||
|
$ cmake -DLLVM_PATH=path/to/llvm \
|
||||||
|
-DLIBCXX_CXX_ABI=libcxxabi \
|
||||||
|
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=path/to/libcxxabi/include \
|
||||||
|
path/to/libcxx
|
||||||
|
$ make
|
||||||
|
$ make check-libcxx # optional
|
||||||
|
|
||||||
|
|
||||||
|
.. _`libc++abi`: http://libcxxabi.llvm.org/
|
||||||
|
|
||||||
|
|
||||||
|
.. _CMake Options:
|
||||||
|
|
||||||
|
CMake Options
|
||||||
|
=============
|
||||||
|
|
||||||
|
Here are some of the CMake variables that are used often, along with a
|
||||||
|
brief explanation and LLVM-specific notes. For full documentation, check the
|
||||||
|
CMake docs or execute ``cmake --help-variable VARIABLE_NAME``.
|
||||||
|
|
||||||
|
**CMAKE_BUILD_TYPE**:STRING
|
||||||
|
Sets the build type for ``make`` based generators. Possible values are
|
||||||
|
Release, Debug, RelWithDebInfo and MinSizeRel. On systems like Visual Studio
|
||||||
|
the user sets the build type with the IDE settings.
|
||||||
|
|
||||||
|
**CMAKE_INSTALL_PREFIX**:PATH
|
||||||
|
Path where LLVM will be installed if "make install" is invoked or the
|
||||||
|
"INSTALL" target is built.
|
||||||
|
|
||||||
|
**CMAKE_CXX_COMPILER**:STRING
|
||||||
|
The C++ compiler to use when building and testing libc++.
|
||||||
|
|
||||||
|
|
||||||
|
.. _libcxx-specific options:
|
||||||
|
|
||||||
|
libc++ specific options
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
.. option:: LIBCXX_ENABLE_ASSERTIONS:BOOL
|
||||||
|
|
||||||
|
**Default**: ``ON``
|
||||||
|
|
||||||
|
Build libc++ with assertions enabled.
|
||||||
|
|
||||||
|
.. option:: LIBCXX_BUILD_32_BITS:BOOL
|
||||||
|
|
||||||
|
**Default**: ``OFF``
|
||||||
|
|
||||||
|
Build libc++ as a 32 bit library. Also see :option:`LLVM_BUILD_32_BITS`.
|
||||||
|
|
||||||
|
.. option:: LIBCXX_ENABLE_SHARED:BOOL
|
||||||
|
|
||||||
|
**Default**: ``ON``
|
||||||
|
|
||||||
|
Build libc++ as a shared library. If ``OFF`` is specified then libc++ is
|
||||||
|
built as a static library.
|
||||||
|
|
||||||
|
.. option:: LIBCXX_LIBDIR_SUFFIX:STRING
|
||||||
|
|
||||||
|
Extra suffix to append to the directory where libraries are to be installed.
|
||||||
|
This option overrides :option:`LLVM_LIBDIR_SUFFIX`.
|
||||||
|
|
||||||
|
.. _ABI Library Specific Options:
|
||||||
|
|
||||||
|
ABI Library Specific Options
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
.. option:: LIBCXX_CXX_ABI:STRING
|
||||||
|
|
||||||
|
**Values**: ``none``, ``libcxxabi``, ``libcxxrt``, ``libstdc++``, ``libsupc++``.
|
||||||
|
|
||||||
|
Select the ABI library to build libc++ against.
|
||||||
|
|
||||||
|
.. option:: LIBCXX_CXX_ABI_INCLUDE_PATHS:PATHS
|
||||||
|
|
||||||
|
Provide additional search paths for the ABI library headers.
|
||||||
|
|
||||||
|
.. option:: LIBCXX_CXX_ABI_LIBRARY_PATH:PATH
|
||||||
|
|
||||||
|
Provide the path to the ABI library that libc++ should link against.
|
||||||
|
|
||||||
|
.. option:: LIBCXX_ENABLE_STATIC_ABI_LIBRARY:BOOL
|
||||||
|
|
||||||
|
**Default**: ``OFF``
|
||||||
|
|
||||||
|
If this option is enabled, libc++ will try and link the selected ABI library
|
||||||
|
statically.
|
||||||
|
|
||||||
|
.. option:: LIBCXX_ENABLE_ABI_LINKER_SCRIPT:BOOL
|
||||||
|
|
||||||
|
**Default**: ``ON`` by default on UNIX platforms other than Apple unless
|
||||||
|
'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' is ON. Otherwise the default value is ``OFF``.
|
||||||
|
|
||||||
|
This option generate and installs a linker script as ``libc++.so`` which
|
||||||
|
links the correct ABI library.
|
||||||
|
|
||||||
|
.. option:: LIBCXXABI_USE_LLVM_UNWINDER:BOOL
|
||||||
|
|
||||||
|
**Default**: ``OFF``
|
||||||
|
|
||||||
|
Build and use the LLVM unwinder. Note: This option can only be used when
|
||||||
|
libc++abi is the C++ ABI library used.
|
||||||
|
|
||||||
|
|
||||||
|
libc++ Feature options
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
.. option:: LIBCXX_ENABLE_EXCEPTIONS:BOOL
|
||||||
|
|
||||||
|
**Default**: ``ON``
|
||||||
|
|
||||||
|
Build libc++ with exception support.
|
||||||
|
|
||||||
|
.. option:: LIBCXX_ENABLE_RTTI:BOOL
|
||||||
|
|
||||||
|
**Default**: ``ON``
|
||||||
|
|
||||||
|
Build libc++ with run time type information.
|
||||||
|
|
||||||
|
|
||||||
|
libc++ Feature options
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
The following options allow building libc++ for a different ABI version.
|
||||||
|
|
||||||
|
.. option:: LIBCXX_ABI_VERSION:STRING
|
||||||
|
|
||||||
|
**Default**: ``1``
|
||||||
|
|
||||||
|
Defines the target ABI version of libc++.
|
||||||
|
|
||||||
|
.. option:: LIBCXX_ABI_UNSTABLE:BOOL
|
||||||
|
|
||||||
|
**Default**: ``OFF``
|
||||||
|
|
||||||
|
Build the "unstable" ABI version of libc++. Includes all ABI changing features
|
||||||
|
on top of the current stable version.
|
||||||
|
|
||||||
|
.. _LLVM-specific variables:
|
||||||
|
|
||||||
|
LLVM-specific options
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
.. option:: LLVM_LIBDIR_SUFFIX:STRING
|
||||||
|
|
||||||
|
Extra suffix to append to the directory where libraries are to be
|
||||||
|
installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
|
||||||
|
to install libraries to ``/usr/lib64``.
|
||||||
|
|
||||||
|
.. option:: LLVM_BUILD_32_BITS:BOOL
|
||||||
|
|
||||||
|
Build 32-bits executables and libraries on 64-bits systems. This option is
|
||||||
|
available only on some 64-bits unix systems. Defaults to OFF.
|
||||||
|
|
||||||
|
.. option:: LLVM_LIT_ARGS:STRING
|
||||||
|
|
||||||
|
Arguments given to lit. ``make check`` and ``make clang-test`` are affected.
|
||||||
|
By default, ``'-sv --no-progress-bar'`` on Visual C++ and Xcode, ``'-sv'`` on
|
||||||
|
others.
|
||||||
|
|
||||||
|
|
||||||
|
Using Alternate ABI libraries
|
||||||
|
=============================
|
||||||
|
|
||||||
|
|
||||||
|
.. _libsupcxx:
|
||||||
|
|
||||||
|
Using libsupc++ on Linux
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
You will need libstdc++ in order to provide libsupc++.
|
||||||
|
|
||||||
|
Figure out where the libsupc++ headers are on your system. On Ubuntu this
|
||||||
|
is ``/usr/include/c++/<version>`` and ``/usr/include/c++/<version>/<target-triple>``
|
||||||
|
|
||||||
|
You can also figure this out by running
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ echo | g++ -Wp,-v -x c++ - -fsyntax-only
|
||||||
|
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
|
||||||
|
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include"
|
||||||
|
#include "..." search starts here:
|
||||||
|
#include <...> search starts here:
|
||||||
|
/usr/include/c++/4.7
|
||||||
|
/usr/include/c++/4.7/x86_64-linux-gnu
|
||||||
|
/usr/include/c++/4.7/backward
|
||||||
|
/usr/lib/gcc/x86_64-linux-gnu/4.7/include
|
||||||
|
/usr/local/include
|
||||||
|
/usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed
|
||||||
|
/usr/include/x86_64-linux-gnu
|
||||||
|
/usr/include
|
||||||
|
End of search list.
|
||||||
|
|
||||||
|
Note that the first two entries happen to be what we are looking for. This
|
||||||
|
may not be correct on other platforms.
|
||||||
|
|
||||||
|
We can now run CMake:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ CC=clang CXX=clang++ cmake -G "Unix Makefiles" \
|
||||||
|
-DLIBCXX_CXX_ABI=libstdc++ \
|
||||||
|
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="/usr/include/c++/4.7/;/usr/include/c++/4.7/x86_64-linux-gnu/" \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
|
<libc++-source-dir>
|
||||||
|
|
||||||
|
|
||||||
|
You can also substitute ``-DLIBCXX_CXX_ABI=libsupc++``
|
||||||
|
above, which will cause the library to be linked to libsupc++ instead
|
||||||
|
of libstdc++, but this is only recommended if you know that you will
|
||||||
|
never need to link against libstdc++ in the same executable as libc++.
|
||||||
|
GCC ships libsupc++ separately but only as a static library. If a
|
||||||
|
program also needs to link against libstdc++, it will provide its
|
||||||
|
own copy of libsupc++ and this can lead to subtle problems.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ make cxx
|
||||||
|
$ make install
|
||||||
|
|
||||||
|
You can now run clang with -stdlib=libc++.
|
9
docs/CMakeLists.txt
Normal file
9
docs/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
if (LLVM_ENABLE_SPHINX)
|
||||||
|
if (SPHINX_FOUND)
|
||||||
|
include(AddSphinxTarget)
|
||||||
|
if (${SPHINX_OUTPUT_HTML})
|
||||||
|
add_sphinx_target(html libcxx)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
17
docs/DesignDocs/ABIVersioning.rst
Normal file
17
docs/DesignDocs/ABIVersioning.rst
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
====================
|
||||||
|
Libc++ ABI stability
|
||||||
|
====================
|
||||||
|
|
||||||
|
Libc++ aims to preserve stable ABI to avoid subtle bugs when code built to the old ABI
|
||||||
|
is linked with the code build to the new ABI. At the same time, libc++ allows ABI-breaking
|
||||||
|
improvements and bugfixes for the scenarios when ABI change is not a issue.
|
||||||
|
|
||||||
|
To support both cases, libc++ allows specifying the ABI version at the
|
||||||
|
build time. The version is defined with a cmake option
|
||||||
|
LIBCXX_ABI_VERSION. Another option LIBCXX_ABI_UNSTABLE can be used to
|
||||||
|
include all present ABI breaking features. These options translate
|
||||||
|
into C++ macro definitions _LIBCPP_ABI_VERSION, _LIBCPP_ABI_UNSTABLE.
|
||||||
|
|
||||||
|
Any ABI-changing feature is placed under it's own macro, _LIBCPP_ABI_XXX, which is enabled
|
||||||
|
based on the value of _LIBCPP_ABI_VERSION. _LIBCPP_ABI_UNSTABLE, if set, enables all features at once.
|
88
docs/DesignDocs/CapturingConfigInfo.rst
Normal file
88
docs/DesignDocs/CapturingConfigInfo.rst
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
=======================================================
|
||||||
|
Capturing configuration information during installation
|
||||||
|
=======================================================
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
|
||||||
|
The Problem
|
||||||
|
===========
|
||||||
|
|
||||||
|
Currently the libc++ supports building the library with a number of different
|
||||||
|
configuration options. Unfortunately all of that configuration information is
|
||||||
|
lost when libc++ is installed. In order to support "persistent"
|
||||||
|
configurations libc++ needs a mechanism to capture the configuration options
|
||||||
|
in the INSTALLED headers.
|
||||||
|
|
||||||
|
|
||||||
|
Design Goals
|
||||||
|
============
|
||||||
|
|
||||||
|
* The solution should not INSTALL any additional headers. We don't want an extra
|
||||||
|
#include slowing everybody down.
|
||||||
|
|
||||||
|
* The solution should not unduly affect libc++ developers. The problem is limited
|
||||||
|
to installed versions of libc++ and the solution should be as well.
|
||||||
|
|
||||||
|
* The solution should not modify any existing headers EXCEPT during installation.
|
||||||
|
It makes developers lives harder if they have to regenerate the libc++ headers
|
||||||
|
every time they are modified.
|
||||||
|
|
||||||
|
* The solution should not make any of the libc++ headers dependant on
|
||||||
|
files generated by the build system. The headers should be able to compile
|
||||||
|
out of the box without any modification.
|
||||||
|
|
||||||
|
* The solution should not have ANY effect on users who don't need special
|
||||||
|
configuration options. The vast majority of users will never need this so it
|
||||||
|
shouldn't cost them.
|
||||||
|
|
||||||
|
|
||||||
|
The Solution
|
||||||
|
============
|
||||||
|
|
||||||
|
When you first configure libc++ using CMake we check to see if we need to
|
||||||
|
capture any options. If we haven't been given any "persistent" options then
|
||||||
|
we do NOTHING.
|
||||||
|
|
||||||
|
Otherwise we create a custom installation rule that modifies the installed __config
|
||||||
|
header. The rule first generates a dummy "__config_site" header containing the required
|
||||||
|
#defines. The contents of the dummy header are then prependend to the installed
|
||||||
|
__config header. By manually prepending the files we avoid the cost of an
|
||||||
|
extra #include and we allow the __config header to be ignorant of the extra
|
||||||
|
configuration all together. An example "__config" header generated when
|
||||||
|
-DLIBCXX_ENABLE_THREADS=OFF is given to CMake would look something like:
|
||||||
|
|
||||||
|
.. code-block:: cpp
|
||||||
|
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_CONFIG_SITE
|
||||||
|
#define _LIBCPP_CONFIG_SITE
|
||||||
|
|
||||||
|
/* #undef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE */
|
||||||
|
/* #undef _LIBCPP_HAS_NO_STDIN */
|
||||||
|
/* #undef _LIBCPP_HAS_NO_STDOUT */
|
||||||
|
#define _LIBCPP_HAS_NO_THREADS
|
||||||
|
/* #undef _LIBCPP_HAS_NO_MONOTONIC_CLOCK */
|
||||||
|
/* #undef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// -*- C++ -*-
|
||||||
|
//===--------------------------- __config ---------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_CONFIG
|
||||||
|
#define _LIBCPP_CONFIG
|
37
docs/Makefile.sphinx
Normal file
37
docs/Makefile.sphinx
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Makefile for Sphinx documentation
|
||||||
|
#
|
||||||
|
# FIXME: This hack is only in place to allow the libcxx.llvm.org/docs builder
|
||||||
|
# to work with libcxx. This should be removed when that builder supports
|
||||||
|
# out-of-tree builds.
|
||||||
|
|
||||||
|
# You can set these variables from the command line.
|
||||||
|
SPHINXOPTS =
|
||||||
|
SPHINXBUILD = sphinx-build
|
||||||
|
PAPER =
|
||||||
|
BUILDDIR = _build
|
||||||
|
|
||||||
|
# Internal variables.
|
||||||
|
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||||
|
PAPEROPT_letter = -D latex_paper_size=letter
|
||||||
|
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||||
|
# the i18n builder cannot share the environment and doctrees with the others
|
||||||
|
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||||
|
|
||||||
|
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext default
|
||||||
|
|
||||||
|
default: html
|
||||||
|
|
||||||
|
help:
|
||||||
|
@echo "Please use \`make <target>' where <target> is one of"
|
||||||
|
@echo " html to make standalone HTML files"
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-rm -rf $(BUILDDIR)/*
|
||||||
|
|
||||||
|
html:
|
||||||
|
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||||
|
@echo
|
||||||
|
@# FIXME: Remove this `cp` once HTML->Sphinx transition is completed.
|
||||||
|
@# Kind of a hack, but HTML-formatted docs are on the way out anyway.
|
||||||
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||||
|
|
13
docs/README.txt
Normal file
13
docs/README.txt
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
libc++ Documentation
|
||||||
|
====================
|
||||||
|
|
||||||
|
The libc++ documentation is written using the Sphinx documentation generator. It is
|
||||||
|
currently tested with Sphinx 1.1.3.
|
||||||
|
|
||||||
|
To build the documents into html configure libc++ with the following cmake options:
|
||||||
|
|
||||||
|
* -DLLVM_ENABLE_SPHINX=ON
|
||||||
|
* -DLIBCXX_INCLUDE_DOCS=ON
|
||||||
|
|
||||||
|
After configuring libc++ with these options the make rule `docs-libcxx-html`
|
||||||
|
should be available.
|
191
docs/TestingLibcxx.rst
Normal file
191
docs/TestingLibcxx.rst
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
==============
|
||||||
|
Testing libc++
|
||||||
|
==============
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
|
||||||
|
Getting Started
|
||||||
|
===============
|
||||||
|
|
||||||
|
libc++ uses LIT to configure and run its tests. The primary way to run the
|
||||||
|
libc++ tests is by using make check-libcxx. However since libc++ can be used
|
||||||
|
in any number of possible configurations it is important to customize the way
|
||||||
|
LIT builds and runs the tests. This guide provides information on how to use
|
||||||
|
LIT directly to test libc++.
|
||||||
|
|
||||||
|
Please see the `Lit Command Guide`_ for more information about LIT.
|
||||||
|
|
||||||
|
.. _LIT Command Guide: http://llvm.org/docs/CommandGuide/lit.html
|
||||||
|
|
||||||
|
Setting up the Environment
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
After building libc++ you must setup your environment to test libc++ using
|
||||||
|
LIT.
|
||||||
|
|
||||||
|
#. Create a shortcut to the actual lit executable so that you can invoke it
|
||||||
|
easily from the command line.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ alias lit='python path/to/llvm/utils/lit/lit.py'
|
||||||
|
|
||||||
|
#. Tell LIT where to find your build configuration.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ export LIBCXX_SITE_CONFIG=path/to/build-libcxx/test/lit.site.cfg
|
||||||
|
|
||||||
|
Example Usage
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Once you have your environment set up and you have built libc++ you can run
|
||||||
|
parts of the libc++ test suite by simply running `lit` on a specified test or
|
||||||
|
directory. For example:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ cd path/to/src/libcxx
|
||||||
|
$ lit -sv test/std/re # Run all of the std::regex tests
|
||||||
|
$ lit -sv test/std/depr/depr.c.headers/stdlib_h.pass.cpp # Run a single test
|
||||||
|
$ lit -sv test/std/atomics test/std/threads # Test std::thread and std::atomic
|
||||||
|
|
||||||
|
Sometimes you'll want to change the way LIT is running the tests. Custom options
|
||||||
|
can be specified using the `--param=<name>=<val>` flag. The most common option
|
||||||
|
you'll want to change is the standard dialect (ie -std=c++XX). By default the
|
||||||
|
test suite will select the newest C++ dialect supported by the compiler and use
|
||||||
|
that. However if you want to manually specify the option like so:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ lit -sv test/std/containers # Run the tests with the newest -std
|
||||||
|
$ lit -sv --param=std=c++03 test/std/containers # Run the tests in C++03
|
||||||
|
|
||||||
|
Occasionally you'll want to add extra compile or link flags when testing.
|
||||||
|
You can do this as follows:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ lit -sv --param=compile_flags='-Wcustom-warning'
|
||||||
|
$ lit -sv --param=link_flags='-L/custom/library/path'
|
||||||
|
|
||||||
|
Some other common examples include:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# Specify a custom compiler.
|
||||||
|
$ lit -sv --param=cxx_under_test=/opt/bin/g++ test/std
|
||||||
|
|
||||||
|
# Enable warnings in the test suite
|
||||||
|
$ lit -sv --param=enable_warnings=true test/std
|
||||||
|
|
||||||
|
# Use UBSAN when running the tests.
|
||||||
|
$ lit -sv --param=use_sanitizer=Undefined
|
||||||
|
|
||||||
|
|
||||||
|
LIT Options
|
||||||
|
===========
|
||||||
|
|
||||||
|
:program:`lit` [*options*...] [*filenames*...]
|
||||||
|
|
||||||
|
Command Line Options
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
To use these options you pass them on the LIT command line as --param NAME or
|
||||||
|
--param NAME=VALUE. Some options have default values specified during CMake's
|
||||||
|
configuration. Passing the option on the command line will override the default.
|
||||||
|
|
||||||
|
.. program:: lit
|
||||||
|
|
||||||
|
.. option:: cxx_under_test=<path/to/compiler>
|
||||||
|
|
||||||
|
Specify the compiler used to build the tests.
|
||||||
|
|
||||||
|
.. option:: std=<standard version>
|
||||||
|
|
||||||
|
**Values**: c++98, c++03, c++11, c++14, c++1z
|
||||||
|
|
||||||
|
Change the standard version used when building the tests.
|
||||||
|
|
||||||
|
.. option:: libcxx_site_config=<path/to/lit.site.cfg>
|
||||||
|
|
||||||
|
Specify the site configuration to use when running the tests. This option
|
||||||
|
overrides the enviroment variable LIBCXX_SITE_CONFIG.
|
||||||
|
|
||||||
|
.. option:: libcxx_headers=<path/to/headers>
|
||||||
|
|
||||||
|
Specify the libc++ headers that are tested. By default the headers in the
|
||||||
|
source tree are used.
|
||||||
|
|
||||||
|
.. option:: libcxx_library=<path/to/libc++.so>
|
||||||
|
|
||||||
|
Specify the libc++ library that is tested. By default the library in the
|
||||||
|
build directory is used. This option cannot be used when use_system_lib is
|
||||||
|
provided.
|
||||||
|
|
||||||
|
.. option:: use_system_lib=<bool>
|
||||||
|
|
||||||
|
**Default**: False
|
||||||
|
|
||||||
|
Enable or disable testing against the installed version of libc++ library.
|
||||||
|
Note: This does not use the installed headers.
|
||||||
|
|
||||||
|
.. option:: use_lit_shell=<bool>
|
||||||
|
|
||||||
|
Enable or disable the use of LIT's internal shell in ShTests. If the
|
||||||
|
environment variable LIT_USE_INTERNAL_SHELL is present then that is used as
|
||||||
|
the default value. Otherwise the default value is True on Windows and False
|
||||||
|
on every other platform.
|
||||||
|
|
||||||
|
.. option:: no_default_flags=<bool>
|
||||||
|
|
||||||
|
**Default**: False
|
||||||
|
|
||||||
|
Disable all default compile and link flags from being added. When this
|
||||||
|
option is used only flags specified using the compile_flags and link_flags
|
||||||
|
will be used.
|
||||||
|
|
||||||
|
.. option:: compile_flags="<list-of-args>"
|
||||||
|
|
||||||
|
Specify additional compile flags as a space delimited string.
|
||||||
|
Note: This options should not be used to change the standard version used.
|
||||||
|
|
||||||
|
.. option:: link_flags="<list-of-args>"
|
||||||
|
|
||||||
|
Specify additional link flags as a space delimited string.
|
||||||
|
|
||||||
|
.. option:: debug_level=<level>
|
||||||
|
|
||||||
|
**Values**: 0, 1
|
||||||
|
|
||||||
|
Enable the use of debug mode. Level 0 enables assertions and level 1 enables
|
||||||
|
assertions and debugging of iterator misuse.
|
||||||
|
|
||||||
|
.. option:: use_sanitizer=<sanitizer name>
|
||||||
|
|
||||||
|
**Values**: Memory, MemoryWithOrigins, Address, Undefined
|
||||||
|
|
||||||
|
Run the tests using the given sanitizer. If LLVM_USE_SANITIZER was given when
|
||||||
|
building libc++ then that sanitizer will be used by default.
|
||||||
|
|
||||||
|
.. option:: color_diagnostics
|
||||||
|
|
||||||
|
Enable the use of colorized compile diagnostics. If the color_diagnostics
|
||||||
|
option is specified or the environment variable LIBCXX_COLOR_DIAGNOSTICS is
|
||||||
|
present then color diagnostics will be enabled.
|
||||||
|
|
||||||
|
|
||||||
|
Environment Variables
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
.. envvar:: LIBCXX_SITE_CONFIG=<path/to/lit.site.cfg>
|
||||||
|
|
||||||
|
Specify the site configuration to use when running the tests.
|
||||||
|
Also see :option:`libcxx_site_config`.
|
||||||
|
|
||||||
|
.. envvar:: LIBCXX_COLOR_DIAGNOSTICS
|
||||||
|
|
||||||
|
If ``LIBCXX_COLOR_DIAGNOSTICS`` is defined then the test suite will attempt
|
||||||
|
to use color diagnostic outputs from the compiler.
|
||||||
|
Also see :option:`color_diagnostics`.
|
89
docs/UsingLibcxx.rst
Normal file
89
docs/UsingLibcxx.rst
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
============
|
||||||
|
Using libc++
|
||||||
|
============
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
|
||||||
|
Getting Started
|
||||||
|
===============
|
||||||
|
|
||||||
|
If you already have libc++ installed you can use it with clang.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ clang++ -stdlib=libc++ test.cpp
|
||||||
|
$ clang++ -std=c++11 -stdlib=libc++ test.cpp
|
||||||
|
|
||||||
|
On OS X and FreeBSD libc++ is the default standard library
|
||||||
|
and the ``-stdlib=libc++`` is not required.
|
||||||
|
|
||||||
|
.. _alternate libcxx:
|
||||||
|
|
||||||
|
If you want to select an alternate installation of libc++ you
|
||||||
|
can use the following options.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ clang++ -std=c++11 -stdlib=libc++ -nostdinc++ \
|
||||||
|
-I<libcxx-install-prefix>/include/c++/v1 \
|
||||||
|
-L<libcxx-install-prefix>/lib \
|
||||||
|
-Wl,-rpath,<libcxx-install-prefix>/lib \
|
||||||
|
test.cpp
|
||||||
|
|
||||||
|
The option ``-Wl,-rpath,<libcxx-install-prefix>/lib`` adds a runtime library
|
||||||
|
search path. Meaning that the systems dynamic linker will look for libc++ in
|
||||||
|
``<libcxx-install-prefix>/lib`` whenever the program is run. Alternatively the
|
||||||
|
environment variable ``LD_LIBRARY_PATH`` (``DYLD_LIBRARY_PATH`` on OS X) can
|
||||||
|
be used to change the dynamic linkers search paths after a program is compiled.
|
||||||
|
|
||||||
|
An example of using ``LD_LIBRARY_PATH``:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ clang++ -stdlib=libc++ -nostdinc++ \
|
||||||
|
-I<libcxx-install-prefix>/include/c++/v1
|
||||||
|
-L<libcxx-install-prefix>/lib \
|
||||||
|
test.cpp -o
|
||||||
|
$ ./a.out # Searches for libc++ in the systems library paths.
|
||||||
|
$ export LD_LIBRARY_PATH=<libcxx-install-prefix>/lib
|
||||||
|
$ ./a.out # Searches for libc++ along LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Using libc++ on Linux
|
||||||
|
=====================
|
||||||
|
|
||||||
|
On Linux libc++ can typically be used with only '-stdlib=libc++'. However
|
||||||
|
some libc++ installations require the user manually link libc++abi themselves.
|
||||||
|
If you are running into linker errors when using libc++ try adding '-lc++abi'
|
||||||
|
to the link line. For example:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ clang++ -stdlib=libc++ test.cpp -lc++ -lc++abi -lm -lc -lgcc_s -lgcc
|
||||||
|
|
||||||
|
Alternately, you could just add libc++abi to your libraries list, which in
|
||||||
|
most situations will give the same result:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ clang++ -stdlib=libc++ test.cpp -lc++abi
|
||||||
|
|
||||||
|
|
||||||
|
Using libc++ with GCC
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
GCC does not provide a way to switch from libstdc++ to libc++. You must manually
|
||||||
|
configure the compile and link commands.
|
||||||
|
|
||||||
|
In particular you must tell GCC to remove the libstdc++ include directories
|
||||||
|
using ``-nostdinc++`` and to not link libstdc++.so using ``-nodefaultlibs``.
|
||||||
|
|
||||||
|
Note that ``-nodefaultlibs`` removes all of the standard system libraries and
|
||||||
|
not just libstdc++ so they must be manually linked. For example:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ g++ -nostdinc++ -I<libcxx-install-prefix>/include/c++/v1 \
|
||||||
|
test.cpp -nodefaultlibs -lc++ -lc++abi -lm -lc -lgcc_s -lgcc
|
251
docs/conf.py
Normal file
251
docs/conf.py
Normal file
@ -0,0 +1,251 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# libc++ documentation build configuration file.
|
||||||
|
#
|
||||||
|
# This file is execfile()d with the current directory set to its containing dir.
|
||||||
|
#
|
||||||
|
# Note that not all possible configuration values are present in this
|
||||||
|
# autogenerated file.
|
||||||
|
#
|
||||||
|
# All configuration values have a default; values that are commented out
|
||||||
|
# serve to show the default.
|
||||||
|
|
||||||
|
import sys, os
|
||||||
|
|
||||||
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
|
#sys.path.insert(0, os.path.abspath('.'))
|
||||||
|
|
||||||
|
# -- General configuration -----------------------------------------------------
|
||||||
|
|
||||||
|
# If your documentation needs a minimal Sphinx version, state it here.
|
||||||
|
#needs_sphinx = '1.0'
|
||||||
|
|
||||||
|
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||||
|
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||||
|
extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo']
|
||||||
|
|
||||||
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
|
templates_path = ['_templates']
|
||||||
|
|
||||||
|
# The suffix of source filenames.
|
||||||
|
source_suffix = '.rst'
|
||||||
|
|
||||||
|
# The encoding of source files.
|
||||||
|
#source_encoding = 'utf-8-sig'
|
||||||
|
|
||||||
|
# The master toctree document.
|
||||||
|
master_doc = 'index'
|
||||||
|
|
||||||
|
# General information about the project.
|
||||||
|
project = u'libc++'
|
||||||
|
copyright = u'2011-2015, LLVM Project'
|
||||||
|
|
||||||
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
|
# |version| and |release|, also used in various other places throughout the
|
||||||
|
# built documents.
|
||||||
|
#
|
||||||
|
# The short X.Y version.
|
||||||
|
version = '3.8'
|
||||||
|
# The full version, including alpha/beta/rc tags.
|
||||||
|
release = '3.8'
|
||||||
|
|
||||||
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
|
# for a list of supported languages.
|
||||||
|
#language = None
|
||||||
|
|
||||||
|
# There are two options for replacing |today|: either, you set today to some
|
||||||
|
# non-false value, then it is used:
|
||||||
|
#today = ''
|
||||||
|
# Else, today_fmt is used as the format for a strftime call.
|
||||||
|
today_fmt = '%Y-%m-%d'
|
||||||
|
|
||||||
|
# List of patterns, relative to source directory, that match files and
|
||||||
|
# directories to ignore when looking for source files.
|
||||||
|
exclude_patterns = ['_build']
|
||||||
|
|
||||||
|
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||||
|
#default_role = None
|
||||||
|
|
||||||
|
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||||
|
#add_function_parentheses = True
|
||||||
|
|
||||||
|
# If true, the current module name will be prepended to all description
|
||||||
|
# unit titles (such as .. function::).
|
||||||
|
#add_module_names = True
|
||||||
|
|
||||||
|
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||||
|
# output. They are ignored by default.
|
||||||
|
show_authors = True
|
||||||
|
|
||||||
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
|
pygments_style = 'friendly'
|
||||||
|
|
||||||
|
# A list of ignored prefixes for module index sorting.
|
||||||
|
#modindex_common_prefix = []
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for HTML output ---------------------------------------------------
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
|
# a list of builtin themes.
|
||||||
|
html_theme = 'haiku'
|
||||||
|
|
||||||
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
|
# further. For a list of options available for each theme, see the
|
||||||
|
# documentation.
|
||||||
|
#html_theme_options = {}
|
||||||
|
|
||||||
|
# Add any paths that contain custom themes here, relative to this directory.
|
||||||
|
#html_theme_path = []
|
||||||
|
|
||||||
|
# The name for this set of Sphinx documents. If None, it defaults to
|
||||||
|
# "<project> v<release> documentation".
|
||||||
|
#html_title = None
|
||||||
|
|
||||||
|
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||||
|
#html_short_title = None
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to place at the top
|
||||||
|
# of the sidebar.
|
||||||
|
#html_logo = None
|
||||||
|
|
||||||
|
# The name of an image file (within the static path) to use as favicon of the
|
||||||
|
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||||
|
# pixels large.
|
||||||
|
#html_favicon = None
|
||||||
|
|
||||||
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
|
html_static_path = []
|
||||||
|
|
||||||
|
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||||
|
# using the given strftime format.
|
||||||
|
#html_last_updated_fmt = '%b %d, %Y'
|
||||||
|
|
||||||
|
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||||
|
# typographically correct entities.
|
||||||
|
#html_use_smartypants = True
|
||||||
|
|
||||||
|
# Custom sidebar templates, maps document names to template names.
|
||||||
|
#html_sidebars = {}
|
||||||
|
|
||||||
|
# Additional templates that should be rendered to pages, maps page names to
|
||||||
|
# template names.
|
||||||
|
#html_additional_pages = {}
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#html_domain_indices = True
|
||||||
|
|
||||||
|
# If false, no index is generated.
|
||||||
|
#html_use_index = True
|
||||||
|
|
||||||
|
# If true, the index is split into individual pages for each letter.
|
||||||
|
#html_split_index = False
|
||||||
|
|
||||||
|
# If true, links to the reST sources are added to the pages.
|
||||||
|
#html_show_sourcelink = True
|
||||||
|
|
||||||
|
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||||
|
#html_show_sphinx = True
|
||||||
|
|
||||||
|
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||||
|
#html_show_copyright = True
|
||||||
|
|
||||||
|
# If true, an OpenSearch description file will be output, and all pages will
|
||||||
|
# contain a <link> tag referring to it. The value of this option must be the
|
||||||
|
# base URL from which the finished HTML is served.
|
||||||
|
#html_use_opensearch = ''
|
||||||
|
|
||||||
|
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||||
|
#html_file_suffix = None
|
||||||
|
|
||||||
|
# Output file base name for HTML help builder.
|
||||||
|
htmlhelp_basename = 'libcxxdoc'
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for LaTeX output --------------------------------------------------
|
||||||
|
|
||||||
|
latex_elements = {
|
||||||
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
|
#'papersize': 'letterpaper',
|
||||||
|
|
||||||
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
|
#'pointsize': '10pt',
|
||||||
|
|
||||||
|
# Additional stuff for the LaTeX preamble.
|
||||||
|
#'preamble': '',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||||
|
latex_documents = [
|
||||||
|
('contents', 'libcxx.tex', u'libcxx Documentation',
|
||||||
|
u'LLVM project', 'manual'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
|
# the title page.
|
||||||
|
#latex_logo = None
|
||||||
|
|
||||||
|
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||||
|
# not chapters.
|
||||||
|
#latex_use_parts = False
|
||||||
|
|
||||||
|
# If true, show page references after internal links.
|
||||||
|
#latex_show_pagerefs = False
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
#latex_show_urls = False
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
#latex_appendices = []
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#latex_domain_indices = True
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for manual page output --------------------------------------------
|
||||||
|
|
||||||
|
# One entry per manual page. List of tuples
|
||||||
|
# (source start file, name, description, authors, manual section).
|
||||||
|
man_pages = [
|
||||||
|
('contents', 'libc++', u'libc++ Documentation',
|
||||||
|
[u'LLVM project'], 1)
|
||||||
|
]
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
#man_show_urls = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for Texinfo output ------------------------------------------------
|
||||||
|
|
||||||
|
# Grouping the document tree into Texinfo files. List of tuples
|
||||||
|
# (source start file, target name, title, author,
|
||||||
|
# dir menu entry, description, category)
|
||||||
|
texinfo_documents = [
|
||||||
|
('contents', 'libc++', u'libc++ Documentation',
|
||||||
|
u'LLVM project', 'libc++', 'One line description of project.',
|
||||||
|
'Miscellaneous'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
#texinfo_appendices = []
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#texinfo_domain_indices = True
|
||||||
|
|
||||||
|
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||||
|
#texinfo_show_urls = 'footnote'
|
||||||
|
|
||||||
|
|
||||||
|
# FIXME: Define intersphinx configration.
|
||||||
|
intersphinx_mapping = {}
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for extensions ----------------------------------------------------
|
||||||
|
|
||||||
|
# Enable this if you want TODOs to show up in the generated documentation.
|
||||||
|
todo_include_todos = True
|
185
docs/index.rst
Normal file
185
docs/index.rst
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
.. _index:
|
||||||
|
|
||||||
|
=============================
|
||||||
|
"libc++" C++ Standard Library
|
||||||
|
=============================
|
||||||
|
|
||||||
|
Overview
|
||||||
|
========
|
||||||
|
|
||||||
|
libc++ is a new implementation of the C++ standard library, targeting C++11.
|
||||||
|
|
||||||
|
* Features and Goals
|
||||||
|
|
||||||
|
* Correctness as defined by the C++11 standard.
|
||||||
|
* Fast execution.
|
||||||
|
* Minimal memory use.
|
||||||
|
* Fast compile times.
|
||||||
|
* ABI compatibility with gcc's libstdc++ for some low-level features
|
||||||
|
such as exception objects, rtti and memory allocation.
|
||||||
|
* Extensive unit tests.
|
||||||
|
|
||||||
|
* Design and Implementation:
|
||||||
|
|
||||||
|
* Extensive unit tests
|
||||||
|
* Internal linker model can be dumped/read to textual format
|
||||||
|
* Additional linking features can be plugged in as "passes"
|
||||||
|
* OS specific and CPU specific code factored out
|
||||||
|
|
||||||
|
|
||||||
|
Getting Started with libc++
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
UsingLibcxx
|
||||||
|
BuildingLibcxx
|
||||||
|
TestingLibcxx
|
||||||
|
|
||||||
|
|
||||||
|
Current Status
|
||||||
|
--------------
|
||||||
|
|
||||||
|
After its initial introduction, many people have asked "why start a new
|
||||||
|
library instead of contributing to an existing library?" (like Apache's
|
||||||
|
libstdcxx, GNU's libstdc++, STLport, etc). There are many contributing
|
||||||
|
reasons, but some of the major ones are:
|
||||||
|
|
||||||
|
* From years of experience (including having implemented the standard
|
||||||
|
library before), we've learned many things about implementing
|
||||||
|
the standard containers which require ABI breakage and fundamental changes
|
||||||
|
to how they are implemented. For example, it is generally accepted that
|
||||||
|
building std::string using the "short string optimization" instead of
|
||||||
|
using Copy On Write (COW) is a superior approach for multicore
|
||||||
|
machines (particularly in C++11, which has rvalue references). Breaking
|
||||||
|
ABI compatibility with old versions of the library was
|
||||||
|
determined to be critical to achieving the performance goals of
|
||||||
|
libc++.
|
||||||
|
|
||||||
|
* Mainline libstdc++ has switched to GPL3, a license which the developers
|
||||||
|
of libc++ cannot use. libstdc++ 4.2 (the last GPL2 version) could be
|
||||||
|
independently extended to support C++11, but this would be a fork of the
|
||||||
|
codebase (which is often seen as worse for a project than starting a new
|
||||||
|
independent one). Another problem with libstdc++ is that it is tightly
|
||||||
|
integrated with G++ development, tending to be tied fairly closely to the
|
||||||
|
matching version of G++.
|
||||||
|
|
||||||
|
* STLport and the Apache libstdcxx library are two other popular
|
||||||
|
candidates, but both lack C++11 support. Our experience (and the
|
||||||
|
experience of libstdc++ developers) is that adding support for C++11 (in
|
||||||
|
particular rvalue references and move-only types) requires changes to
|
||||||
|
almost every class and function, essentially amounting to a rewrite.
|
||||||
|
Faced with a rewrite, we decided to start from scratch and evaluate every
|
||||||
|
design decision from first principles based on experience.
|
||||||
|
Further, both projects are apparently abandoned: STLport 5.2.1 was
|
||||||
|
released in Oct'08, and STDCXX 4.2.1 in May'08.
|
||||||
|
|
||||||
|
Platform and Compiler Support
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
libc++ is known to work on the following platforms, using gcc-4.2 and
|
||||||
|
clang (lack of C++11 language support disables some functionality).
|
||||||
|
Note that functionality provided by ``<atomic>`` is only functional with clang
|
||||||
|
and GCC.
|
||||||
|
|
||||||
|
============ ==================== ============ ========================
|
||||||
|
OS Arch Compilers ABI Library
|
||||||
|
============ ==================== ============ ========================
|
||||||
|
Mac OS X i386, x86_64 Clang, GCC libc++abi
|
||||||
|
FreeBSD 10+ i386, x86_64, ARM Clang, GCC libcxxrt, libc++abi
|
||||||
|
Linux i386, x86_64 Clang, GCC libc++abi
|
||||||
|
============ ==================== ============ ========================
|
||||||
|
|
||||||
|
The following minimum compiler versions are strongly recommended.
|
||||||
|
|
||||||
|
* Clang 3.5 and above
|
||||||
|
* GCC 4.7 and above.
|
||||||
|
|
||||||
|
Anything older *may* work.
|
||||||
|
|
||||||
|
C++ Dialect Support
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
* C++11 - Complete
|
||||||
|
* `C++14 - Complete <http://libcxx.llvm.org/cxx1y_status.html>`__
|
||||||
|
* `C++1z - In Progress <http://libcxx.llvm.org/cxx1z_status.html>`__
|
||||||
|
* `Post C++14 Technical Specifications - In Progress <http://libcxx.llvm.org/ts1z_status.html>`__
|
||||||
|
|
||||||
|
Notes and Known Issues
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
This list contains known issues with libc++
|
||||||
|
|
||||||
|
* Building libc++ with ``-fno-rtti`` is not supported. However
|
||||||
|
linking against it with ``-fno-rtti`` is supported.
|
||||||
|
* On OS X v10.8 and older the CMake option ``-DLIBCXX_LIBCPPABI_VERSION=""``
|
||||||
|
must be used during configuration.
|
||||||
|
|
||||||
|
|
||||||
|
A full list of currently open libc++ bugs can be `found here`__.
|
||||||
|
|
||||||
|
.. __: https://llvm.org/bugs/buglist.cgi?component=All%20Bugs&product=libc%2B%2B&query_format=advanced&resolution=---&order=changeddate%20DESC%2Cassigned_to%20DESC%2Cbug_status%2Cpriority%2Cbug_id&list_id=74184
|
||||||
|
|
||||||
|
Design Documents
|
||||||
|
----------------
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 1
|
||||||
|
|
||||||
|
DesignDocs/CapturingConfigInfo
|
||||||
|
DesignDocs/ABIVersioning
|
||||||
|
|
||||||
|
|
||||||
|
* `<atomic> design <http://libcxx.llvm.org/atomic_design.html>`_
|
||||||
|
* `<type_traits> design <http://libcxx.llvm.org/type_traits_design.html>`_
|
||||||
|
* `Status of debug mode <http://libcxx.llvm.org/debug_mode.html>`_
|
||||||
|
* `Notes by Marshall Clow`__
|
||||||
|
|
||||||
|
.. __: https://cplusplusmusings.wordpress.com/2012/07/05/clang-and-standard-libraries-on-mac-os-x/
|
||||||
|
|
||||||
|
Build Bots and Test Coverage
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* `LLVM Buildbot Builders <http://lab.llvm.org:8011/console>`_
|
||||||
|
* `Apple Jenkins Builders <http://lab.llvm.org:8080/green/view/Libcxx/>`_
|
||||||
|
* `EricWF's Nightly Builders <http://ds2.efcs.ca:8080/console>`_
|
||||||
|
* `Code Coverage Results <http://efcs.ca/libcxx-coverage>`_
|
||||||
|
|
||||||
|
Getting Involved
|
||||||
|
================
|
||||||
|
|
||||||
|
First please review our `Developer's Policy <http://llvm.org/docs/DeveloperPolicy.html>`__
|
||||||
|
and `Getting started with LLVM <http://llvm.org/docs/GettingStarted.html>`__.
|
||||||
|
|
||||||
|
**Bug Reports**
|
||||||
|
|
||||||
|
If you think you've found a bug in libc++, please report it using
|
||||||
|
the `LLVM Bugzilla`_. If you're not sure, you
|
||||||
|
can post a message to the `cfe-dev mailing list`_ or on IRC.
|
||||||
|
Please include "libc++" in your subject.
|
||||||
|
|
||||||
|
**Patches**
|
||||||
|
|
||||||
|
If you want to contribute a patch to libc++, the best place for that is
|
||||||
|
`Phabricator <http://llvm.org/docs/Phabricator.html>`_. Please include [libcxx] in the subject and
|
||||||
|
add `cfe-commits` as a subscriber. Also make sure you are subscribed to the
|
||||||
|
`cfe-commits mailing list <http://lists.llvm.org/mailman/listinfo/cfe-commits>`_.
|
||||||
|
|
||||||
|
**Discussion and Questions**
|
||||||
|
|
||||||
|
Send discussions and questions to the
|
||||||
|
`cfe-dev mailing list <http://lists.llvm.org/mailman/listinfo/cfe-dev>`_.
|
||||||
|
Please include [libcxx] in the subject.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Quick Links
|
||||||
|
===========
|
||||||
|
* `LLVM Homepage <http://llvm.org/>`_
|
||||||
|
* `libc++abi Homepage <http://libcxxabi.llvm.org/>`_
|
||||||
|
* `LLVM Bugzilla <http://llvm.org/bugs/>`_
|
||||||
|
* `cfe-commits Mailing List`_
|
||||||
|
* `cfe-dev Mailing List`_
|
||||||
|
* `Browse libc++ -- SVN <http://llvm.org/svn/llvm-project/libcxx/trunk/>`_
|
||||||
|
* `Browse libc++ -- ViewVC <http://llvm.org/viewvc/llvm-project/libcxx/trunk/>`_
|
52
include/CMakeLists.txt
Normal file
52
include/CMakeLists.txt
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
|
||||||
|
set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LIBCXX_HEADER_PATTERN
|
||||||
|
PATTERN "*"
|
||||||
|
PATTERN "CMakeLists.txt" EXCLUDE
|
||||||
|
PATTERN ".svn" EXCLUDE
|
||||||
|
PATTERN "__config_site.in" EXCLUDE
|
||||||
|
${LIBCXX_SUPPORT_HEADER_PATTERN}
|
||||||
|
)
|
||||||
|
|
||||||
|
file(COPY .
|
||||||
|
DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1"
|
||||||
|
FILES_MATCHING
|
||||||
|
${LIBCXX_HEADER_PATTERN}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (LIBCXX_INSTALL_HEADERS)
|
||||||
|
install(DIRECTORY .
|
||||||
|
DESTINATION include/c++/v1
|
||||||
|
COMPONENT libcxx
|
||||||
|
FILES_MATCHING
|
||||||
|
${LIBCXX_HEADER_PATTERN}
|
||||||
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||||
|
)
|
||||||
|
|
||||||
|
if (LIBCXX_NEEDS_SITE_CONFIG)
|
||||||
|
set(UNIX_CAT cat)
|
||||||
|
if (WIN32)
|
||||||
|
set(UNIX_CAT type)
|
||||||
|
endif()
|
||||||
|
# Generate and install a custom __config header. The new header is created
|
||||||
|
# by prepending __config_site to the current __config header.
|
||||||
|
add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${LIBCXX_BINARY_DIR}/__config_site ${LIBCXX_BINARY_DIR}/__generated_config
|
||||||
|
COMMAND ${UNIX_CAT} ${LIBCXX_SOURCE_DIR}/include/__config >> ${LIBCXX_BINARY_DIR}/__generated_config
|
||||||
|
DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config
|
||||||
|
${LIBCXX_BINARY_DIR}/__config_site
|
||||||
|
)
|
||||||
|
# Add a target that executes the generation commands.
|
||||||
|
add_custom_target(generate_config_header ALL
|
||||||
|
DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
|
||||||
|
# Install the generated header as __config.
|
||||||
|
install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
|
||||||
|
DESTINATION include/c++/v1
|
||||||
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||||
|
RENAME __config
|
||||||
|
COMPONENT libcxx)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
@ -14,12 +14,16 @@
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <__undef_min_max>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _C, bool _IsConst> class __bit_iterator;
|
template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator;
|
||||||
template <class _C> class __bit_const_reference;
|
template <class _Cp> class __bit_const_reference;
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
struct __has_storage_type
|
struct __has_storage_type
|
||||||
@ -27,22 +31,22 @@ struct __has_storage_type
|
|||||||
static const bool value = false;
|
static const bool value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _C, bool = __has_storage_type<_C>::value>
|
template <class _Cp, bool = __has_storage_type<_Cp>::value>
|
||||||
class __bit_reference
|
class __bit_reference
|
||||||
{
|
{
|
||||||
typedef typename _C::__storage_type __storage_type;
|
typedef typename _Cp::__storage_type __storage_type;
|
||||||
typedef typename _C::__storage_pointer __storage_pointer;
|
typedef typename _Cp::__storage_pointer __storage_pointer;
|
||||||
|
|
||||||
__storage_pointer __seg_;
|
__storage_pointer __seg_;
|
||||||
__storage_type __mask_;
|
__storage_type __mask_;
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
|
||||||
friend typename _C::__self;
|
friend typename _Cp::__self;
|
||||||
#else
|
#else
|
||||||
friend class _C::__self;
|
friend class _Cp::__self;
|
||||||
#endif
|
#endif
|
||||||
friend class __bit_const_reference<_C>;
|
friend class __bit_const_reference<_Cp>;
|
||||||
friend class __bit_iterator<_C, false>;
|
friend class __bit_iterator<_Cp, false>;
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
|
||||||
{return static_cast<bool>(*__seg_ & __mask_);}
|
{return static_cast<bool>(*__seg_ & __mask_);}
|
||||||
@ -64,76 +68,87 @@ public:
|
|||||||
{return operator=(static_cast<bool>(__x));}
|
{return operator=(static_cast<bool>(__x));}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
|
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const _NOEXCEPT
|
||||||
{return __bit_iterator<_C, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
|
{return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
|
||||||
private:
|
private:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
|
__bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
|
||||||
: __seg_(__s), __mask_(__m) {}
|
: __seg_(__s), __mask_(__m) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp>
|
||||||
class __bit_reference<_C, false>
|
class __bit_reference<_Cp, false>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _C, class _D>
|
template <class _Cp>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
swap(__bit_reference<_C> __x, __bit_reference<_D> __y) _NOEXCEPT
|
swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) _NOEXCEPT
|
||||||
{
|
{
|
||||||
bool __t = __x;
|
bool __t = __x;
|
||||||
__x = __y;
|
__x = __y;
|
||||||
__y = __t;
|
__y = __t;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp, class _Dp>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
swap(__bit_reference<_C> __x, bool& __y) _NOEXCEPT
|
swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT
|
||||||
{
|
{
|
||||||
bool __t = __x;
|
bool __t = __x;
|
||||||
__x = __y;
|
__x = __y;
|
||||||
__y = __t;
|
__y = __t;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
swap(bool& __x, __bit_reference<_C> __y) _NOEXCEPT
|
swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT
|
||||||
{
|
{
|
||||||
bool __t = __x;
|
bool __t = __x;
|
||||||
__x = __y;
|
__x = __y;
|
||||||
__y = __t;
|
__y = __t;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
void
|
||||||
|
swap(bool& __x, __bit_reference<_Cp> __y) _NOEXCEPT
|
||||||
|
{
|
||||||
|
bool __t = __x;
|
||||||
|
__x = __y;
|
||||||
|
__y = __t;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Cp>
|
||||||
class __bit_const_reference
|
class __bit_const_reference
|
||||||
{
|
{
|
||||||
typedef typename _C::__storage_type __storage_type;
|
typedef typename _Cp::__storage_type __storage_type;
|
||||||
typedef typename _C::__const_storage_pointer __storage_pointer;
|
typedef typename _Cp::__const_storage_pointer __storage_pointer;
|
||||||
|
|
||||||
__storage_pointer __seg_;
|
__storage_pointer __seg_;
|
||||||
__storage_type __mask_;
|
__storage_type __mask_;
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
|
||||||
friend typename _C::__self;
|
friend typename _Cp::__self;
|
||||||
#else
|
#else
|
||||||
friend class _C::__self;
|
friend class _Cp::__self;
|
||||||
#endif
|
#endif
|
||||||
friend class __bit_iterator<_C, true>;
|
friend class __bit_iterator<_Cp, true>;
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_const_reference(const __bit_reference<_C>& __x) _NOEXCEPT
|
__bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
|
||||||
: __seg_(__x.__seg_), __mask_(__x.__mask_) {}
|
: __seg_(__x.__seg_), __mask_(__x.__mask_) {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator bool() const _NOEXCEPT
|
||||||
{return static_cast<bool>(*__seg_ & __mask_);}
|
{return static_cast<bool>(*__seg_ & __mask_);}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const _NOEXCEPT
|
||||||
{return __bit_iterator<_C, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
|
{return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
|
||||||
private:
|
private:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
__bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
|
__bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
|
||||||
: __seg_(__s), __mask_(__m) {}
|
: __seg_(__s), __mask_(__m) {}
|
||||||
|
|
||||||
@ -142,11 +157,11 @@ private:
|
|||||||
|
|
||||||
// find
|
// find
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp, bool _IsConst>
|
||||||
__bit_iterator<_C, false>
|
__bit_iterator<_Cp, _IsConst>
|
||||||
__find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
__find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_C, false> _It;
|
typedef __bit_iterator<_Cp, _IsConst> _It;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
// do first partial word
|
// do first partial word
|
||||||
@ -158,6 +173,8 @@ __find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
|||||||
__storage_type __b = *__first.__seg_ & __m;
|
__storage_type __b = *__first.__seg_ & __m;
|
||||||
if (__b)
|
if (__b)
|
||||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||||
|
if (__n == __dn)
|
||||||
|
return __first + __n;
|
||||||
__n -= __dn;
|
__n -= __dn;
|
||||||
++__first.__seg_;
|
++__first.__seg_;
|
||||||
}
|
}
|
||||||
@ -176,11 +193,11 @@ __find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
|||||||
return _It(__first.__seg_, static_cast<unsigned>(__n));
|
return _It(__first.__seg_, static_cast<unsigned>(__n));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp, bool _IsConst>
|
||||||
__bit_iterator<_C, false>
|
__bit_iterator<_Cp, _IsConst>
|
||||||
__find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
__find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_C, false> _It;
|
typedef __bit_iterator<_Cp, _IsConst> _It;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
// do first partial word
|
// do first partial word
|
||||||
@ -189,9 +206,11 @@ __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
|||||||
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
||||||
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
||||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||||
__storage_type __b = ~(*__first.__seg_ & __m);
|
__storage_type __b = ~*__first.__seg_ & __m;
|
||||||
if (__b)
|
if (__b)
|
||||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||||
|
if (__n == __dn)
|
||||||
|
return __first + __n;
|
||||||
__n -= __dn;
|
__n -= __dn;
|
||||||
++__first.__seg_;
|
++__first.__seg_;
|
||||||
}
|
}
|
||||||
@ -206,30 +225,30 @@ __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
|||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
||||||
__storage_type __b = ~(*__first.__seg_ & __m);
|
__storage_type __b = ~*__first.__seg_ & __m;
|
||||||
if (__b)
|
if (__b)
|
||||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||||
}
|
}
|
||||||
return _It(__first.__seg_, static_cast<unsigned>(__n));
|
return _It(__first.__seg_, static_cast<unsigned>(__n));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C, class _Tp>
|
template <class _Cp, bool _IsConst, class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_iterator<_C, false>
|
__bit_iterator<_Cp, _IsConst>
|
||||||
find(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
|
find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
|
||||||
{
|
{
|
||||||
if (static_cast<bool>(__value))
|
if (static_cast<bool>(__value_))
|
||||||
return __find_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
|
return __find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||||
return __find_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
|
return __find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||||
}
|
}
|
||||||
|
|
||||||
// count
|
// count
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp, bool _IsConst>
|
||||||
typename __bit_iterator<_C, false>::difference_type
|
typename __bit_iterator<_Cp, _IsConst>::difference_type
|
||||||
__count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
__count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_C, false> _It;
|
typedef __bit_iterator<_Cp, _IsConst> _It;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
typedef typename _It::difference_type difference_type;
|
typedef typename _It::difference_type difference_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
@ -256,11 +275,11 @@ __count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
|||||||
return __r;
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp, bool _IsConst>
|
||||||
typename __bit_iterator<_C, false>::difference_type
|
typename __bit_iterator<_Cp, _IsConst>::difference_type
|
||||||
__count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
__count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_C, false> _It;
|
typedef __bit_iterator<_Cp, _IsConst> _It;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
typedef typename _It::difference_type difference_type;
|
typedef typename _It::difference_type difference_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
@ -271,7 +290,7 @@ __count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n
|
|||||||
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
||||||
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
||||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||||
__r = _VSTD::__pop_count(~(*__first.__seg_ & __m));
|
__r = _VSTD::__pop_count(~*__first.__seg_ & __m);
|
||||||
__n -= __dn;
|
__n -= __dn;
|
||||||
++__first.__seg_;
|
++__first.__seg_;
|
||||||
}
|
}
|
||||||
@ -282,28 +301,28 @@ __count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n
|
|||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
||||||
__r += _VSTD::__pop_count(~(*__first.__seg_ & __m));
|
__r += _VSTD::__pop_count(~*__first.__seg_ & __m);
|
||||||
}
|
}
|
||||||
return __r;
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C, class _Tp>
|
template <class _Cp, bool _IsConst, class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename __bit_iterator<_C, false>::difference_type
|
typename __bit_iterator<_Cp, _IsConst>::difference_type
|
||||||
count(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
|
count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
|
||||||
{
|
{
|
||||||
if (static_cast<bool>(__value))
|
if (static_cast<bool>(__value_))
|
||||||
return __count_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
|
return __count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||||
return __count_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
|
return __count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||||
}
|
}
|
||||||
|
|
||||||
// fill_n
|
// fill_n
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp>
|
||||||
void
|
void
|
||||||
__fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
__fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_C, false> _It;
|
typedef __bit_iterator<_Cp, false> _It;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
// do first partial word
|
// do first partial word
|
||||||
@ -318,7 +337,7 @@ __fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
|||||||
}
|
}
|
||||||
// do middle whole words
|
// do middle whole words
|
||||||
__storage_type __nw = __n / __bits_per_word;
|
__storage_type __nw = __n / __bits_per_word;
|
||||||
_VSTD::memset(__first.__seg_, 0, __nw * sizeof(__storage_type));
|
_VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), 0, __nw * sizeof(__storage_type));
|
||||||
__n -= __nw * __bits_per_word;
|
__n -= __nw * __bits_per_word;
|
||||||
// do last partial word
|
// do last partial word
|
||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
@ -329,11 +348,11 @@ __fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp>
|
||||||
void
|
void
|
||||||
__fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
__fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_C, false> _It;
|
typedef __bit_iterator<_Cp, false> _It;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
// do first partial word
|
// do first partial word
|
||||||
@ -348,7 +367,7 @@ __fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
|||||||
}
|
}
|
||||||
// do middle whole words
|
// do middle whole words
|
||||||
__storage_type __nw = __n / __bits_per_word;
|
__storage_type __nw = __n / __bits_per_word;
|
||||||
_VSTD::memset(__first.__seg_, -1, __nw * sizeof(__storage_type));
|
_VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), -1, __nw * sizeof(__storage_type));
|
||||||
__n -= __nw * __bits_per_word;
|
__n -= __nw * __bits_per_word;
|
||||||
// do last partial word
|
// do last partial word
|
||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
@ -359,14 +378,14 @@ __fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __value)
|
fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_)
|
||||||
{
|
{
|
||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
if (__value)
|
if (__value_)
|
||||||
__fill_n_true(__first, __n);
|
__fill_n_true(__first, __n);
|
||||||
else
|
else
|
||||||
__fill_n_false(__first, __n);
|
__fill_n_false(__first, __n);
|
||||||
@ -375,22 +394,22 @@ fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __val
|
|||||||
|
|
||||||
// fill
|
// fill
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
fill(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, bool __value)
|
fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value_)
|
||||||
{
|
{
|
||||||
_VSTD::fill_n(__first, static_cast<typename _C::size_type>(__last - __first), __value);
|
_VSTD::fill_n(__first, static_cast<typename _Cp::size_type>(__last - __first), __value_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy
|
// copy
|
||||||
|
|
||||||
template <class _C, bool _IsConst>
|
template <class _Cp, bool _IsConst>
|
||||||
__bit_iterator<_C, false>
|
__bit_iterator<_Cp, false>
|
||||||
__copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
__copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
|
||||||
__bit_iterator<_C, false> __result)
|
__bit_iterator<_Cp, false> __result)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_C, _IsConst> _In;
|
typedef __bit_iterator<_Cp, _IsConst> _In;
|
||||||
typedef typename _In::difference_type difference_type;
|
typedef typename _In::difference_type difference_type;
|
||||||
typedef typename _In::__storage_type __storage_type;
|
typedef typename _In::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _In::__bits_per_word;
|
static const unsigned __bits_per_word = _In::__bits_per_word;
|
||||||
@ -415,7 +434,9 @@ __copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst
|
|||||||
// __first.__ctz_ == 0;
|
// __first.__ctz_ == 0;
|
||||||
// do middle words
|
// do middle words
|
||||||
__storage_type __nw = __n / __bits_per_word;
|
__storage_type __nw = __n / __bits_per_word;
|
||||||
_VSTD::memmove(__result.__seg_, __first.__seg_, __nw * sizeof(__storage_type));
|
_VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
|
||||||
|
_VSTD::__to_raw_pointer(__first.__seg_),
|
||||||
|
__nw * sizeof(__storage_type));
|
||||||
__n -= __nw * __bits_per_word;
|
__n -= __nw * __bits_per_word;
|
||||||
__result.__seg_ += __nw;
|
__result.__seg_ += __nw;
|
||||||
// do last word
|
// do last word
|
||||||
@ -432,12 +453,12 @@ __copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst
|
|||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C, bool _IsConst>
|
template <class _Cp, bool _IsConst>
|
||||||
__bit_iterator<_C, false>
|
__bit_iterator<_Cp, false>
|
||||||
__copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
__copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
|
||||||
__bit_iterator<_C, false> __result)
|
__bit_iterator<_Cp, false> __result)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_C, _IsConst> _In;
|
typedef __bit_iterator<_Cp, _IsConst> _In;
|
||||||
typedef typename _In::difference_type difference_type;
|
typedef typename _In::difference_type difference_type;
|
||||||
typedef typename _In::__storage_type __storage_type;
|
typedef typename _In::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _In::__bits_per_word;
|
static const unsigned __bits_per_word = _In::__bits_per_word;
|
||||||
@ -510,10 +531,10 @@ __copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsCon
|
|||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C, bool _IsConst>
|
template <class _Cp, bool _IsConst>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_iterator<_C, false>
|
__bit_iterator<_Cp, false>
|
||||||
copy(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
||||||
{
|
{
|
||||||
if (__first.__ctz_ == __result.__ctz_)
|
if (__first.__ctz_ == __result.__ctz_)
|
||||||
return __copy_aligned(__first, __last, __result);
|
return __copy_aligned(__first, __last, __result);
|
||||||
@ -522,12 +543,12 @@ copy(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
|||||||
|
|
||||||
// copy_backward
|
// copy_backward
|
||||||
|
|
||||||
template <class _C, bool _IsConst>
|
template <class _Cp, bool _IsConst>
|
||||||
__bit_iterator<_C, false>
|
__bit_iterator<_Cp, false>
|
||||||
__copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
__copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
|
||||||
__bit_iterator<_C, false> __result)
|
__bit_iterator<_Cp, false> __result)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_C, _IsConst> _In;
|
typedef __bit_iterator<_Cp, _IsConst> _In;
|
||||||
typedef typename _In::difference_type difference_type;
|
typedef typename _In::difference_type difference_type;
|
||||||
typedef typename _In::__storage_type __storage_type;
|
typedef typename _In::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _In::__bits_per_word;
|
static const unsigned __bits_per_word = _In::__bits_per_word;
|
||||||
@ -554,7 +575,9 @@ __copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C,
|
|||||||
__storage_type __nw = __n / __bits_per_word;
|
__storage_type __nw = __n / __bits_per_word;
|
||||||
__result.__seg_ -= __nw;
|
__result.__seg_ -= __nw;
|
||||||
__last.__seg_ -= __nw;
|
__last.__seg_ -= __nw;
|
||||||
_VSTD::memmove(__result.__seg_, __last.__seg_, __nw * sizeof(__storage_type));
|
_VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
|
||||||
|
_VSTD::__to_raw_pointer(__last.__seg_),
|
||||||
|
__nw * sizeof(__storage_type));
|
||||||
__n -= __nw * __bits_per_word;
|
__n -= __nw * __bits_per_word;
|
||||||
// do last word
|
// do last word
|
||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
@ -569,12 +592,12 @@ __copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C,
|
|||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C, bool _IsConst>
|
template <class _Cp, bool _IsConst>
|
||||||
__bit_iterator<_C, false>
|
__bit_iterator<_Cp, false>
|
||||||
__copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
__copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
|
||||||
__bit_iterator<_C, false> __result)
|
__bit_iterator<_Cp, false> __result)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_C, _IsConst> _In;
|
typedef __bit_iterator<_Cp, _IsConst> _In;
|
||||||
typedef typename _In::difference_type difference_type;
|
typedef typename _In::difference_type difference_type;
|
||||||
typedef typename _In::__storage_type __storage_type;
|
typedef typename _In::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _In::__bits_per_word;
|
static const unsigned __bits_per_word = _In::__bits_per_word;
|
||||||
@ -633,7 +656,7 @@ __copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_
|
|||||||
{
|
{
|
||||||
__m = ~__storage_type(0) << (__bits_per_word - __n);
|
__m = ~__storage_type(0) << (__bits_per_word - __n);
|
||||||
__storage_type __b = *--__last.__seg_ & __m;
|
__storage_type __b = *--__last.__seg_ & __m;
|
||||||
unsigned __clz_r = __bits_per_word - __result.__ctz_;
|
__clz_r = __bits_per_word - __result.__ctz_;
|
||||||
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
|
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
|
||||||
__m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
|
__m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
|
||||||
*__result.__seg_ &= ~__m;
|
*__result.__seg_ &= ~__m;
|
||||||
@ -655,10 +678,10 @@ __copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_
|
|||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C, bool _IsConst>
|
template <class _Cp, bool _IsConst>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_iterator<_C, false>
|
__bit_iterator<_Cp, false>
|
||||||
copy_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
||||||
{
|
{
|
||||||
if (__last.__ctz_ == __result.__ctz_)
|
if (__last.__ctz_ == __result.__ctz_)
|
||||||
return __copy_backward_aligned(__first, __last, __result);
|
return __copy_backward_aligned(__first, __last, __result);
|
||||||
@ -667,22 +690,22 @@ copy_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst>
|
|||||||
|
|
||||||
// move
|
// move
|
||||||
|
|
||||||
template <class _C, bool _IsConst>
|
template <class _Cp, bool _IsConst>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_iterator<_C, false>
|
__bit_iterator<_Cp, false>
|
||||||
move(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
move(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
||||||
{
|
{
|
||||||
return _VSTD::copy(__first, __last, __result);
|
return _VSTD::copy(__first, __last, __result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// move_backward
|
// move_backward
|
||||||
|
|
||||||
template <class _C, bool _IsConst>
|
template <class _Cp, bool _IsConst>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_iterator<_C, false>
|
__bit_iterator<_Cp, false>
|
||||||
move_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
||||||
{
|
{
|
||||||
return _VSTD::copy(__first, __last, __result);
|
return _VSTD::copy_backward(__first, __last, __result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// swap_ranges
|
// swap_ranges
|
||||||
@ -850,34 +873,39 @@ swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __
|
|||||||
|
|
||||||
// rotate
|
// rotate
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp>
|
||||||
struct __bit_array
|
struct __bit_array
|
||||||
{
|
{
|
||||||
typedef typename _C::difference_type difference_type;
|
typedef typename _Cp::difference_type difference_type;
|
||||||
typedef typename _C::__storage_type __storage_type;
|
typedef typename _Cp::__storage_type __storage_type;
|
||||||
typedef typename _C::iterator iterator;
|
typedef typename _Cp::__storage_pointer __storage_pointer;
|
||||||
static const unsigned __bits_per_word = _C::__bits_per_word;
|
typedef typename _Cp::iterator iterator;
|
||||||
static const unsigned _N = 4;
|
static const unsigned __bits_per_word = _Cp::__bits_per_word;
|
||||||
|
static const unsigned _Np = 4;
|
||||||
|
|
||||||
difference_type __size_;
|
difference_type __size_;
|
||||||
__storage_type __word_[_N];
|
__storage_type __word_[_Np];
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY static difference_type capacity()
|
_LIBCPP_INLINE_VISIBILITY static difference_type capacity()
|
||||||
{return static_cast<difference_type>(_N * __bits_per_word);}
|
{return static_cast<difference_type>(_Np * __bits_per_word);}
|
||||||
_LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {}
|
_LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__word_, 0);}
|
_LIBCPP_INLINE_VISIBILITY iterator begin()
|
||||||
_LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__word_ + __size_ / __bits_per_word,
|
{
|
||||||
static_cast<unsigned>(__size_ % __bits_per_word));}
|
return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]), 0);
|
||||||
|
}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY iterator end()
|
||||||
|
{
|
||||||
|
return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]) + __size_ / __bits_per_word,
|
||||||
|
static_cast<unsigned>(__size_ % __bits_per_word));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp>
|
||||||
__bit_iterator<_C, false>
|
__bit_iterator<_Cp, false>
|
||||||
rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __bit_iterator<_C, false> __last)
|
rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_C, false> _I1;
|
typedef __bit_iterator<_Cp, false> _I1;
|
||||||
typedef typename _I1::difference_type difference_type;
|
typedef typename _I1::difference_type difference_type;
|
||||||
typedef typename _I1::__storage_type __storage_type;
|
|
||||||
static const unsigned __bits_per_word = _I1::__bits_per_word;
|
|
||||||
difference_type __d1 = __middle - __first;
|
difference_type __d1 = __middle - __first;
|
||||||
difference_type __d2 = __last - __middle;
|
difference_type __d2 = __last - __middle;
|
||||||
_I1 __r = __first + __d2;
|
_I1 __r = __first + __d2;
|
||||||
@ -885,16 +913,16 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __
|
|||||||
{
|
{
|
||||||
if (__d1 <= __d2)
|
if (__d1 <= __d2)
|
||||||
{
|
{
|
||||||
if (__d1 <= __bit_array<_C>::capacity())
|
if (__d1 <= __bit_array<_Cp>::capacity())
|
||||||
{
|
{
|
||||||
__bit_array<_C> __b(__d1);
|
__bit_array<_Cp> __b(__d1);
|
||||||
_VSTD::copy(__first, __middle, __b.begin());
|
_VSTD::copy(__first, __middle, __b.begin());
|
||||||
_VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first));
|
_VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__bit_iterator<_C, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
|
__bit_iterator<_Cp, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
|
||||||
__first = __middle;
|
__first = __middle;
|
||||||
__middle = __mp;
|
__middle = __mp;
|
||||||
__d2 -= __d1;
|
__d2 -= __d1;
|
||||||
@ -902,16 +930,16 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (__d2 <= __bit_array<_C>::capacity())
|
if (__d2 <= __bit_array<_Cp>::capacity())
|
||||||
{
|
{
|
||||||
__bit_array<_C> __b(__d2);
|
__bit_array<_Cp> __b(__d2);
|
||||||
_VSTD::copy(__middle, __last, __b.begin());
|
_VSTD::copy(__middle, __last, __b.begin());
|
||||||
_VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last));
|
_VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__bit_iterator<_C, false> __mp = __first + __d2;
|
__bit_iterator<_Cp, false> __mp = __first + __d2;
|
||||||
_VSTD::swap_ranges(__first, __mp, __middle);
|
_VSTD::swap_ranges(__first, __mp, __middle);
|
||||||
__first = __mp;
|
__first = __mp;
|
||||||
__d1 -= __d2;
|
__d1 -= __d2;
|
||||||
@ -923,12 +951,12 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __
|
|||||||
|
|
||||||
// equal
|
// equal
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp, bool _IC1, bool _IC2>
|
||||||
bool
|
bool
|
||||||
__equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
|
__equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
|
||||||
__bit_iterator<_C, true> __first2)
|
__bit_iterator<_Cp, _IC2> __first2)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_C, true> _It;
|
typedef __bit_iterator<_Cp, _IC1> _It;
|
||||||
typedef typename _It::difference_type difference_type;
|
typedef typename _It::difference_type difference_type;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
@ -947,11 +975,15 @@ __equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __
|
|||||||
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
|
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
|
||||||
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
|
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
|
||||||
if (__first2.__ctz_ > __first1.__ctz_)
|
if (__first2.__ctz_ > __first1.__ctz_)
|
||||||
|
{
|
||||||
if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_)))
|
if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_)))
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_)))
|
if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_)))
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
__first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word;
|
__first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word;
|
||||||
__first2.__ctz_ = static_cast<unsigned>((__ddn + __first2.__ctz_) % __bits_per_word);
|
__first2.__ctz_ = static_cast<unsigned>((__ddn + __first2.__ctz_) % __bits_per_word);
|
||||||
__dn -= __ddn;
|
__dn -= __ddn;
|
||||||
@ -1001,12 +1033,12 @@ __equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C>
|
template <class _Cp, bool _IC1, bool _IC2>
|
||||||
bool
|
bool
|
||||||
__equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
|
__equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
|
||||||
__bit_iterator<_C, true> __first2)
|
__bit_iterator<_Cp, _IC2> __first2)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_C, true> _It;
|
typedef __bit_iterator<_Cp, _IC1> _It;
|
||||||
typedef typename _It::difference_type difference_type;
|
typedef typename _It::difference_type difference_type;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
@ -1044,40 +1076,45 @@ __equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __la
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C, bool _IC1, bool _IC2>
|
template <class _Cp, bool _IC1, bool _IC2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
equal(__bit_iterator<_C, _IC1> __first1, __bit_iterator<_C, _IC1> __last1, __bit_iterator<_C, _IC2> __first2)
|
equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2)
|
||||||
{
|
{
|
||||||
if (__first1.__ctz_ == __first2.__ctz_)
|
if (__first1.__ctz_ == __first2.__ctz_)
|
||||||
return __equal_aligned(__first1, __last1, __first2);
|
return __equal_aligned(__first1, __last1, __first2);
|
||||||
return __equal_unaligned(__first1, __last1, __first2);
|
return __equal_unaligned(__first1, __last1, __first2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _C, bool _IsConst>
|
template <class _Cp, bool _IsConst,
|
||||||
|
typename _Cp::__storage_type>
|
||||||
class __bit_iterator
|
class __bit_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename _C::difference_type difference_type;
|
typedef typename _Cp::difference_type difference_type;
|
||||||
typedef bool value_type;
|
typedef bool value_type;
|
||||||
typedef __bit_iterator pointer;
|
typedef __bit_iterator pointer;
|
||||||
typedef typename conditional<_IsConst, __bit_const_reference<_C>, __bit_reference<_C> >::type reference;
|
typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference;
|
||||||
typedef random_access_iterator_tag iterator_category;
|
typedef random_access_iterator_tag iterator_category;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef typename _C::__storage_type __storage_type;
|
typedef typename _Cp::__storage_type __storage_type;
|
||||||
typedef typename conditional<_IsConst, typename _C::__const_storage_pointer,
|
typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer,
|
||||||
typename _C::__storage_pointer>::type __storage_pointer;
|
typename _Cp::__storage_pointer>::type __storage_pointer;
|
||||||
static const unsigned __bits_per_word = _C::__bits_per_word;
|
static const unsigned __bits_per_word = _Cp::__bits_per_word;
|
||||||
|
|
||||||
__storage_pointer __seg_;
|
__storage_pointer __seg_;
|
||||||
unsigned __ctz_;
|
unsigned __ctz_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT {}
|
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
: __seg_(nullptr), __ctz_(0)
|
||||||
|
#endif
|
||||||
|
{}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_iterator(const __bit_iterator<_C, false>& __it) _NOEXCEPT
|
__bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT
|
||||||
: __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
|
: __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
|
||||||
@ -1184,35 +1221,35 @@ private:
|
|||||||
__bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
|
__bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
|
||||||
: __seg_(__s), __ctz_(__ctz) {}
|
: __seg_(__s), __ctz_(__ctz) {}
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
|
||||||
friend typename _C::__self;
|
friend typename _Cp::__self;
|
||||||
#else
|
#else
|
||||||
friend class _C::__self;
|
friend class _Cp::__self;
|
||||||
#endif
|
#endif
|
||||||
friend class __bit_reference<_C>;
|
friend class __bit_reference<_Cp>;
|
||||||
friend class __bit_const_reference<_C>;
|
friend class __bit_const_reference<_Cp>;
|
||||||
friend class __bit_iterator<_C, true>;
|
friend class __bit_iterator<_Cp, true>;
|
||||||
template <class _D> friend struct __bit_array;
|
template <class _Dp> friend struct __bit_array;
|
||||||
template <class _D> friend void __fill_n_false(__bit_iterator<_D, false> __first, typename _D::size_type __n);
|
template <class _Dp> friend void __fill_n_false(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
|
||||||
template <class _D> friend void __fill_n_true(__bit_iterator<_D, false> __first, typename _D::size_type __n);
|
template <class _Dp> friend void __fill_n_true(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
|
||||||
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_aligned(__bit_iterator<_D, _IC> __first,
|
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_aligned(__bit_iterator<_Dp, _IC> __first,
|
||||||
__bit_iterator<_D, _IC> __last,
|
__bit_iterator<_Dp, _IC> __last,
|
||||||
__bit_iterator<_D, false> __result);
|
__bit_iterator<_Dp, false> __result);
|
||||||
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_unaligned(__bit_iterator<_D, _IC> __first,
|
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_unaligned(__bit_iterator<_Dp, _IC> __first,
|
||||||
__bit_iterator<_D, _IC> __last,
|
__bit_iterator<_Dp, _IC> __last,
|
||||||
__bit_iterator<_D, false> __result);
|
__bit_iterator<_Dp, false> __result);
|
||||||
template <class _D, bool _IC> friend __bit_iterator<_D, false> copy(__bit_iterator<_D, _IC> __first,
|
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy(__bit_iterator<_Dp, _IC> __first,
|
||||||
__bit_iterator<_D, _IC> __last,
|
__bit_iterator<_Dp, _IC> __last,
|
||||||
__bit_iterator<_D, false> __result);
|
__bit_iterator<_Dp, false> __result);
|
||||||
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_aligned(__bit_iterator<_D, _IC> __first,
|
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_aligned(__bit_iterator<_Dp, _IC> __first,
|
||||||
__bit_iterator<_D, _IC> __last,
|
__bit_iterator<_Dp, _IC> __last,
|
||||||
__bit_iterator<_D, false> __result);
|
__bit_iterator<_Dp, false> __result);
|
||||||
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_unaligned(__bit_iterator<_D, _IC> __first,
|
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_unaligned(__bit_iterator<_Dp, _IC> __first,
|
||||||
__bit_iterator<_D, _IC> __last,
|
__bit_iterator<_Dp, _IC> __last,
|
||||||
__bit_iterator<_D, false> __result);
|
__bit_iterator<_Dp, false> __result);
|
||||||
template <class _D, bool _IC> friend __bit_iterator<_D, false> copy_backward(__bit_iterator<_D, _IC> __first,
|
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy_backward(__bit_iterator<_Dp, _IC> __first,
|
||||||
__bit_iterator<_D, _IC> __last,
|
__bit_iterator<_Dp, _IC> __last,
|
||||||
__bit_iterator<_D, false> __result);
|
__bit_iterator<_Dp, false> __result);
|
||||||
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>,
|
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>,
|
||||||
__bit_iterator<__C1, false>,
|
__bit_iterator<__C1, false>,
|
||||||
__bit_iterator<__C2, false>);
|
__bit_iterator<__C2, false>);
|
||||||
@ -1222,22 +1259,26 @@ private:
|
|||||||
template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>,
|
template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>,
|
||||||
__bit_iterator<__C1, false>,
|
__bit_iterator<__C1, false>,
|
||||||
__bit_iterator<__C2, false>);
|
__bit_iterator<__C2, false>);
|
||||||
template <class _D> friend __bit_iterator<_D, false> rotate(__bit_iterator<_D, false>,
|
template <class _Dp> friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>,
|
||||||
__bit_iterator<_D, false>,
|
__bit_iterator<_Dp, false>,
|
||||||
__bit_iterator<_D, false>);
|
__bit_iterator<_Dp, false>);
|
||||||
template <class _D> friend bool __equal_aligned(__bit_iterator<_D, true>,
|
template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_aligned(__bit_iterator<_Dp, _IC1>,
|
||||||
__bit_iterator<_D, true>,
|
__bit_iterator<_Dp, _IC1>,
|
||||||
__bit_iterator<_D, true>);
|
__bit_iterator<_Dp, _IC2>);
|
||||||
template <class _D> friend bool __equal_unaligned(__bit_iterator<_D, true>,
|
template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_unaligned(__bit_iterator<_Dp, _IC1>,
|
||||||
__bit_iterator<_D, true>,
|
__bit_iterator<_Dp, _IC1>,
|
||||||
__bit_iterator<_D, true>);
|
__bit_iterator<_Dp, _IC2>);
|
||||||
template <class _D, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_D, _IC1>,
|
template <class _Dp, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_Dp, _IC1>,
|
||||||
__bit_iterator<_D, _IC1>,
|
__bit_iterator<_Dp, _IC1>,
|
||||||
__bit_iterator<_D, _IC2>);
|
__bit_iterator<_Dp, _IC2>);
|
||||||
template <class _D> friend __bit_iterator<_D, false> __find_bool_true(__bit_iterator<_D, false>,
|
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>,
|
||||||
typename _D::size_type);
|
typename _Dp::size_type);
|
||||||
template <class _D> friend __bit_iterator<_D, false> __find_bool_false(__bit_iterator<_D, false>,
|
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>,
|
||||||
typename _D::size_type);
|
typename _Dp::size_type);
|
||||||
|
template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
|
||||||
|
__count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
|
||||||
|
template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
|
||||||
|
__count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
|
||||||
};
|
};
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
634
include/__config
634
include/__config
@ -11,17 +11,61 @@
|
|||||||
#ifndef _LIBCPP_CONFIG
|
#ifndef _LIBCPP_CONFIG
|
||||||
#define _LIBCPP_CONFIG
|
#define _LIBCPP_CONFIG
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
|
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _LIBCPP_VERSION 1001
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||||
|
#else
|
||||||
|
#define _GNUC_VER 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _LIBCPP_VERSION 3800
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_ABI_VERSION
|
||||||
#define _LIBCPP_ABI_VERSION 1
|
#define _LIBCPP_ABI_VERSION 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
|
||||||
|
// Change short string represention so that string data starts at offset 0,
|
||||||
|
// improving its alignment in some cases.
|
||||||
|
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
||||||
|
// Fix deque iterator type in order to support incomplete types.
|
||||||
|
#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
|
#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
|
||||||
#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
|
#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
|
||||||
|
|
||||||
#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
|
#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __has_attribute
|
||||||
|
#define __has_attribute(__x) 0
|
||||||
|
#endif
|
||||||
|
#ifndef __has_builtin
|
||||||
|
#define __has_builtin(__x) 0
|
||||||
|
#endif
|
||||||
|
#ifndef __has_extension
|
||||||
|
#define __has_extension(__x) 0
|
||||||
|
#endif
|
||||||
|
#ifndef __has_feature
|
||||||
|
#define __has_feature(__x) 0
|
||||||
|
#endif
|
||||||
|
// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
|
||||||
|
// the compiler and '1' otherwise.
|
||||||
|
#ifndef __is_identifier
|
||||||
|
#define __is_identifier(__x) 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __LITTLE_ENDIAN__
|
#ifdef __LITTLE_ENDIAN__
|
||||||
#if __LITTLE_ENDIAN__
|
#if __LITTLE_ENDIAN__
|
||||||
#define _LIBCPP_LITTLE_ENDIAN 1
|
#define _LIBCPP_LITTLE_ENDIAN 1
|
||||||
@ -36,6 +80,16 @@
|
|||||||
#endif // __BIG_ENDIAN__
|
#endif // __BIG_ENDIAN__
|
||||||
#endif // __BIG_ENDIAN__
|
#endif // __BIG_ENDIAN__
|
||||||
|
|
||||||
|
#ifdef __BYTE_ORDER__
|
||||||
|
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||||
|
#define _LIBCPP_LITTLE_ENDIAN 1
|
||||||
|
#define _LIBCPP_BIG_ENDIAN 0
|
||||||
|
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||||
|
#define _LIBCPP_LITTLE_ENDIAN 0
|
||||||
|
#define _LIBCPP_BIG_ENDIAN 1
|
||||||
|
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||||
|
#endif // __BYTE_ORDER__
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
# include <sys/endian.h>
|
# include <sys/endian.h>
|
||||||
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
@ -45,17 +99,70 @@
|
|||||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||||
# define _LIBCPP_BIG_ENDIAN 1
|
# define _LIBCPP_BIG_ENDIAN 1
|
||||||
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
|
# ifndef __LONG_LONG_SUPPORTED
|
||||||
|
# define _LIBCPP_HAS_NO_LONG_LONG
|
||||||
|
# endif // __LONG_LONG_SUPPORTED
|
||||||
#endif // __FreeBSD__
|
#endif // __FreeBSD__
|
||||||
|
|
||||||
|
#ifdef __NetBSD__
|
||||||
|
# include <sys/endian.h>
|
||||||
|
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
|
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||||
|
# define _LIBCPP_BIG_ENDIAN 0
|
||||||
|
# else // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
|
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||||
|
# define _LIBCPP_BIG_ENDIAN 1
|
||||||
|
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
|
# define _LIBCPP_HAS_QUICK_EXIT
|
||||||
|
#endif // __NetBSD__
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||||
# define _LIBCPP_BIG_ENDIAN 0
|
# define _LIBCPP_BIG_ENDIAN 0
|
||||||
// Compiler intrinsics (GCC or MSVC)
|
// Compiler intrinsics (MSVC)
|
||||||
# if (defined(_MSC_VER) && _MSC_VER >= 1400) || (__GNUC__ >= 4 && __GNUC_MINOR__ > 3)
|
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||||
# define _LIBCP_HAS_IS_BASE_OF
|
# define _LIBCPP_HAS_IS_BASE_OF
|
||||||
|
# endif
|
||||||
|
# if defined(_MSC_VER) && !defined(__clang__)
|
||||||
|
# define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
|
||||||
|
# define _LIBCPP_TOSTRING2(x) #x
|
||||||
|
# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
|
||||||
|
# define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
|
||||||
|
# endif
|
||||||
|
# // If mingw not explicitly detected, assume using MS C runtime only.
|
||||||
|
# ifndef __MINGW32__
|
||||||
|
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
|
||||||
# endif
|
# endif
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
|
#ifdef __sun__
|
||||||
|
# include <sys/isa_defs.h>
|
||||||
|
# ifdef _LITTLE_ENDIAN
|
||||||
|
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||||
|
# define _LIBCPP_BIG_ENDIAN 0
|
||||||
|
# else
|
||||||
|
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||||
|
# define _LIBCPP_BIG_ENDIAN 1
|
||||||
|
# endif
|
||||||
|
#endif // __sun__
|
||||||
|
|
||||||
|
#if defined(__CloudABI__)
|
||||||
|
// Certain architectures provide arc4random(). Prefer using
|
||||||
|
// arc4random() over /dev/{u,}random to make it possible to obtain
|
||||||
|
// random data even when using sandboxing mechanisms such as chroots,
|
||||||
|
// Capsicum, etc.
|
||||||
|
# define _LIBCPP_USING_ARC4_RANDOM
|
||||||
|
#elif defined(__native_client__)
|
||||||
|
// NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
|
||||||
|
// including accesses to the special files under /dev. C++11's
|
||||||
|
// std::random_device is instead exposed through a NaCl syscall.
|
||||||
|
# define _LIBCPP_USING_NACL_RANDOM
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
# define _LIBCPP_USING_WIN32_RANDOM
|
||||||
|
#else
|
||||||
|
# define _LIBCPP_USING_DEV_RANDOM
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||||
# include <endian.h>
|
# include <endian.h>
|
||||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
@ -69,17 +176,71 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||||
|
|
||||||
#ifndef _LIBCPP_VISIBILITY_TAG
|
#ifdef _WIN32
|
||||||
#define _LIBCPP_VISIBILITY_TAG 1
|
|
||||||
|
// only really useful for a DLL
|
||||||
|
#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
|
||||||
|
# ifdef cxx_EXPORTS
|
||||||
|
# define _LIBCPP_HIDDEN
|
||||||
|
# define _LIBCPP_FUNC_VIS __declspec(dllexport)
|
||||||
|
# define _LIBCPP_TYPE_VIS __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define _LIBCPP_HIDDEN
|
||||||
|
# define _LIBCPP_FUNC_VIS __declspec(dllimport)
|
||||||
|
# define _LIBCPP_TYPE_VIS __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define _LIBCPP_HIDDEN
|
||||||
|
# define _LIBCPP_FUNC_VIS
|
||||||
|
# define _LIBCPP_TYPE_VIS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _LIBCPP_VISIBILITY_TAG
|
#define _LIBCPP_TYPE_VIS_ONLY
|
||||||
|
#define _LIBCPP_FUNC_VIS_ONLY
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_INLINE_VISIBILITY
|
||||||
|
# ifdef _LIBCPP_MSVC
|
||||||
|
# define _LIBCPP_INLINE_VISIBILITY __forceinline
|
||||||
|
# else // MinGW GCC and Clang
|
||||||
|
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXCEPTION_ABI
|
||||||
|
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_ALWAYS_INLINE
|
||||||
|
# ifdef _LIBCPP_MSVC
|
||||||
|
# define _LIBCPP_ALWAYS_INLINE __forceinline
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HIDDEN
|
||||||
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
|
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
|
||||||
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
|
#endif
|
||||||
#else // _LIBCPP_VISIBILITY_TAG
|
|
||||||
#define _LIBCPP_HIDDEN
|
#ifndef _LIBCPP_FUNC_VIS
|
||||||
#define _LIBCPP_VISIBLE
|
#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
|
||||||
#endif // _LIBCPP_VISIBILITY_TAG
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_TYPE_VIS
|
||||||
|
# if __has_attribute(__type_visibility__)
|
||||||
|
# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
|
||||||
|
# else
|
||||||
|
# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_TYPE_VIS_ONLY
|
||||||
|
# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_FUNC_VIS_ONLY
|
||||||
|
# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _LIBCPP_INLINE_VISIBILITY
|
#ifndef _LIBCPP_INLINE_VISIBILITY
|
||||||
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
|
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||||
@ -89,24 +250,36 @@
|
|||||||
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
|
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
|
#ifndef _LIBCPP_ALWAYS_INLINE
|
||||||
|
|
||||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
|
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
|
|
||||||
|
// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
|
||||||
|
// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
|
||||||
|
#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
|
||||||
|
!defined(__arm__)) || \
|
||||||
|
defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
|
||||||
|
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __has_feature(cxx_alignas)
|
||||||
|
# define _ALIGNAS_TYPE(x) alignas(x)
|
||||||
|
# define _ALIGNAS(x) alignas(x)
|
||||||
|
#else
|
||||||
|
# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
||||||
|
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !__has_feature(cxx_alias_templates)
|
#if !__has_feature(cxx_alias_templates)
|
||||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
#if __cplusplus < 201103L
|
||||||
#ifdef __linux__
|
|
||||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
|
||||||
#else
|
|
||||||
typedef __char16_t char16_t;
|
typedef __char16_t char16_t;
|
||||||
typedef __char32_t char32_t;
|
typedef __char32_t char32_t;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !(__has_feature(cxx_exceptions))
|
#if !(__has_feature(cxx_exceptions))
|
||||||
#define _LIBCPP_NO_EXCEPTIONS
|
#define _LIBCPP_NO_EXCEPTIONS
|
||||||
@ -116,17 +289,25 @@ typedef __char32_t char32_t;
|
|||||||
#define _LIBCPP_NO_RTTI
|
#define _LIBCPP_NO_RTTI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !(__has_feature(cxx_strong_enums))
|
||||||
|
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !(__has_feature(cxx_decltype))
|
#if !(__has_feature(cxx_decltype))
|
||||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __has_feature(cxx_attributes)
|
#if __has_feature(cxx_attributes)
|
||||||
# define _ATTRIBUTE(x) [[x]]
|
# define _LIBCPP_NORETURN [[noreturn]]
|
||||||
#else
|
#else
|
||||||
# define _ATTRIBUTE(x) __attribute__ ((x))
|
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define _LIBCPP_UNUSED __attribute__((__unused__))
|
||||||
|
|
||||||
|
#if !(__has_feature(cxx_defaulted_functions))
|
||||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||||
|
#endif // !(__has_feature(cxx_defaulted_functions))
|
||||||
|
|
||||||
#if !(__has_feature(cxx_deleted_functions))
|
#if !(__has_feature(cxx_deleted_functions))
|
||||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
@ -169,7 +350,11 @@ typedef __char32_t char32_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __has_feature(is_base_of)
|
#if __has_feature(is_base_of)
|
||||||
# define _LIBCP_HAS_IS_BASE_OF
|
# define _LIBCPP_HAS_IS_BASE_OF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __has_feature(is_final)
|
||||||
|
# define _LIBCPP_HAS_IS_FINAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Objective-C++ features (opt-in)
|
// Objective-C++ features (opt-in)
|
||||||
@ -179,6 +364,53 @@ typedef __char32_t char32_t;
|
|||||||
|
|
||||||
#if __has_feature(objc_arc_weak)
|
#if __has_feature(objc_arc_weak)
|
||||||
#define _LIBCPP_HAS_OBJC_ARC_WEAK
|
#define _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||||
|
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !(__has_feature(cxx_constexpr))
|
||||||
|
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !(__has_feature(cxx_relaxed_constexpr))
|
||||||
|
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !(__has_feature(cxx_variable_templates))
|
||||||
|
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#define _LIBCPP_HAS_QUICK_EXIT
|
||||||
|
#define _LIBCPP_HAS_C11_FEATURES
|
||||||
|
#elif defined(__ANDROID__)
|
||||||
|
#define _LIBCPP_HAS_QUICK_EXIT
|
||||||
|
#elif defined(__linux__)
|
||||||
|
#if !defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||||
|
# include <features.h>
|
||||||
|
#if __GLIBC_PREREQ(2, 15)
|
||||||
|
#define _LIBCPP_HAS_QUICK_EXIT
|
||||||
|
#endif
|
||||||
|
#if __GLIBC_PREREQ(2, 17)
|
||||||
|
#define _LIBCPP_HAS_C11_FEATURES
|
||||||
|
#endif
|
||||||
|
#else // defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||||
|
#define _LIBCPP_HAS_QUICK_EXIT
|
||||||
|
#define _LIBCPP_HAS_C11_FEATURES
|
||||||
|
#endif
|
||||||
|
#endif // __linux__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !(__has_feature(cxx_noexcept))
|
||||||
|
#define _LIBCPP_HAS_NO_NOEXCEPT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __has_feature(underlying_type)
|
||||||
|
# define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __has_feature(is_literal)
|
||||||
|
# define _LIBCPP_IS_LITERAL(T) __is_literal(T)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Inline namespaces are available in Clang regardless of C++ dialect.
|
// Inline namespaces are available in Clang regardless of C++ dialect.
|
||||||
@ -191,37 +423,52 @@ namespace std {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(__has_feature(cxx_constexpr))
|
#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
|
||||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
#define _LIBCPP_HAS_NO_ASAN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (__has_feature(cxx_noexcept))
|
|
||||||
# define _NOEXCEPT noexcept
|
|
||||||
# define _NOEXCEPT_(x) noexcept(x)
|
|
||||||
#else
|
|
||||||
# define _NOEXCEPT throw()
|
|
||||||
# define _NOEXCEPT_(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __has_feature(underlying_type)
|
|
||||||
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// end defined(__clang__)
|
|
||||||
|
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
|
|
||||||
#define _ATTRIBUTE(x) __attribute__((x))
|
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||||
|
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
||||||
|
|
||||||
|
#define _LIBCPP_NORETURN __attribute__((noreturn))
|
||||||
|
|
||||||
|
#define _LIBCPP_UNUSED __attribute__((__unused__))
|
||||||
|
|
||||||
|
#if _GNUC_VER >= 407
|
||||||
|
#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
|
||||||
|
#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
|
||||||
|
#define _LIBCPP_HAS_IS_FINAL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && _GNUC_VER >= 403
|
||||||
|
# define _LIBCPP_HAS_IS_BASE_OF
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !__EXCEPTIONS
|
#if !__EXCEPTIONS
|
||||||
#define _LIBCPP_NO_EXCEPTIONS
|
#define _LIBCPP_NO_EXCEPTIONS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
|
|
||||||
#define _NOEXCEPT throw()
|
// constexpr was added to GCC in 4.6.
|
||||||
#define _NOEXCEPT_(x)
|
#if _GNUC_VER < 406
|
||||||
|
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
|
// Can only use constexpr in c++11 mode.
|
||||||
|
#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
|
||||||
|
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Determine if GCC supports relaxed constexpr
|
||||||
|
#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
|
||||||
|
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// GCC 5 will support variable templates
|
||||||
|
#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
|
||||||
|
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
|
||||||
@ -234,35 +481,38 @@ namespace std {
|
|||||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
#define _LIBCPP_HAS_NO_VARIADICS
|
#define _LIBCPP_HAS_NO_VARIADICS
|
||||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||||
|
#define _LIBCPP_HAS_NO_NOEXCEPT
|
||||||
|
|
||||||
#else // __GXX_EXPERIMENTAL_CXX0X__
|
#else // __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
|
||||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
#if _GNUC_VER < 403
|
||||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
|
||||||
|
|
||||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
|
||||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
#if _GNUC_VER < 403
|
||||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
#if _GNUC_VER < 404
|
||||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
|
||||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
|
||||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
|
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
#define _LIBCPP_HAS_NO_VARIADICS
|
#define _LIBCPP_HAS_NO_VARIADICS
|
||||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||||
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
#endif // _GNUC_VER < 404
|
||||||
|
|
||||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
|
#if _GNUC_VER < 406
|
||||||
|
#define _LIBCPP_HAS_NO_NOEXCEPT
|
||||||
#define _LIBCPP_HAS_NO_NULLPTR
|
#define _LIBCPP_HAS_NO_NULLPTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if _GNUC_VER < 407
|
||||||
|
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||||
|
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
|
||||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
|
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
|
||||||
@ -275,18 +525,97 @@ namespace _LIBCPP_NAMESPACE {
|
|||||||
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(__GNUC__)
|
#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
|
||||||
|
#define _LIBCPP_HAS_NO_ASAN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined(_LIBCPP_MSVC)
|
||||||
|
|
||||||
|
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
|
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
|
||||||
|
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||||
|
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
|
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
|
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||||
|
#define _LIBCPP_HAS_NO_NOEXCEPT
|
||||||
|
#define __alignof__ __alignof
|
||||||
|
#define _LIBCPP_NORETURN __declspec(noreturn)
|
||||||
|
#define _LIBCPP_UNUSED
|
||||||
|
#define _ALIGNAS(x) __declspec(align(x))
|
||||||
|
#define _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
|
||||||
|
#define _LIBCPP_END_NAMESPACE_STD }
|
||||||
|
#define _VSTD std
|
||||||
|
|
||||||
|
# define _LIBCPP_WEAK
|
||||||
|
namespace std {
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _LIBCPP_HAS_NO_ASAN
|
||||||
|
|
||||||
|
#elif defined(__IBMCPP__)
|
||||||
|
|
||||||
|
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||||
|
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
||||||
|
#define _ATTRIBUTE(x) __attribute__((x))
|
||||||
|
#define _LIBCPP_NORETURN __attribute__((noreturn))
|
||||||
|
#define _LIBCPP_UNUSED
|
||||||
|
|
||||||
|
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||||
|
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||||
|
#define _LIBCPP_HAS_NO_NOEXCEPT
|
||||||
|
#define _LIBCPP_HAS_NO_NULLPTR
|
||||||
|
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
|
#define _LIBCPP_HAS_IS_BASE_OF
|
||||||
|
#define _LIBCPP_HAS_IS_FINAL
|
||||||
|
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||||
|
|
||||||
|
#if defined(_AIX)
|
||||||
|
#define __MULTILOCALE_API
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
|
||||||
|
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||||
|
#define _VSTD std::_LIBCPP_NAMESPACE
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
inline namespace _LIBCPP_NAMESPACE {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _LIBCPP_HAS_NO_ASAN
|
||||||
|
|
||||||
|
#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_NOEXCEPT
|
||||||
|
# define _NOEXCEPT noexcept
|
||||||
|
# define _NOEXCEPT_(x) noexcept(x)
|
||||||
|
#else
|
||||||
|
# define _NOEXCEPT throw()
|
||||||
|
# define _NOEXCEPT_(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
|
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
typedef unsigned short char16_t;
|
typedef unsigned short char16_t;
|
||||||
typedef unsigned int char32_t;
|
typedef unsigned int char32_t;
|
||||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
|
|
||||||
|
#ifndef __SIZEOF_INT128__
|
||||||
|
#define _LIBCPP_HAS_NO_INT128
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
|
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||||
|
|
||||||
|
extern "C++" {
|
||||||
template <bool> struct __static_assert_test;
|
template <bool> struct __static_assert_test;
|
||||||
template <> struct __static_assert_test<true> {};
|
template <> struct __static_assert_test<true> {};
|
||||||
template <unsigned> struct __static_assert_check {};
|
template <unsigned> struct __static_assert_check {};
|
||||||
|
}
|
||||||
#define static_assert(__b, __m) \
|
#define static_assert(__b, __m) \
|
||||||
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
|
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
|
||||||
_LIBCPP_CONCAT(__t, __LINE__)
|
_LIBCPP_CONCAT(__t, __LINE__)
|
||||||
@ -294,43 +623,202 @@ template <unsigned> struct __static_assert_check {};
|
|||||||
#endif // _LIBCPP_HAS_NO_STATIC_ASSERT
|
#endif // _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_DECLTYPE
|
#ifdef _LIBCPP_HAS_NO_DECLTYPE
|
||||||
#define decltype(x) __typeof__(x)
|
// GCC 4.6 provides __decltype in all standard modes.
|
||||||
|
#if !__is_identifier(__decltype) || _GNUC_VER >= 406
|
||||||
|
# define decltype(__x) __decltype(__x)
|
||||||
|
#else
|
||||||
|
# define decltype(__x) __typeof__(__x)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
#define constexpr const
|
#define _LIBCPP_CONSTEXPR
|
||||||
|
#else
|
||||||
|
#define _LIBCPP_CONSTEXPR constexpr
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __has_feature
|
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||||
#define __has_feature(__x) 0
|
#define _LIBCPP_DEFAULT {}
|
||||||
|
#else
|
||||||
|
#define _LIBCPP_DEFAULT = default;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __APPLE__ || __FreeBSD__ || _WIN32
|
#ifdef __GNUC__
|
||||||
|
#define _NOALIAS __attribute__((__malloc__))
|
||||||
|
#else
|
||||||
|
#define _NOALIAS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
|
||||||
|
# define _LIBCPP_EXPLICIT explicit
|
||||||
|
#else
|
||||||
|
# define _LIBCPP_EXPLICIT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
|
||||||
|
# define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||||
|
#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
|
||||||
|
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
|
||||||
|
__lx __v_; \
|
||||||
|
_LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
|
||||||
|
_LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
|
||||||
|
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
|
||||||
|
};
|
||||||
|
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||||
|
#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
|
||||||
|
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
|
||||||
|
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_DEBUG
|
||||||
|
# if _LIBCPP_DEBUG == 0
|
||||||
|
# define _LIBCPP_DEBUG_LEVEL 1
|
||||||
|
# elif _LIBCPP_DEBUG == 1
|
||||||
|
# define _LIBCPP_DEBUG_LEVEL 2
|
||||||
|
# else
|
||||||
|
# error Supported values for _LIBCPP_DEBUG are 0 and 1
|
||||||
|
# endif
|
||||||
|
# define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXTERN_TEMPLATE
|
||||||
|
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXTERN_TEMPLATE2
|
||||||
|
#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
|
||||||
|
#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || \
|
||||||
|
defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
|
||||||
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __APPLE__ || __FreeBSD__
|
#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION) && \
|
||||||
|
!defined(__CloudABI__)
|
||||||
|
#define _LIBCPP_HAS_CATOPEN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#define _DECLARE_C99_LDBL_MATH 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
|
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __APPLE__ || __FreeBSD__
|
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
|
||||||
#define _LIBCPP_WCTYPE_IS_MASK
|
#define _LIBCPP_WCTYPE_IS_MASK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _LIBCPP_DEBUG2
|
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
||||||
# if _LIBCPP_DEBUG2 == 0
|
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
|
||||||
# define _LIBCPP_DEBUG_LEVEL 1
|
|
||||||
# elif _LIBCPP_DEBUG2 == 1
|
|
||||||
# define _LIBCPP_DEBUG_LEVEL 2
|
|
||||||
# else
|
|
||||||
# error Supported values for _LIBCPP_DEBUG2 are 0 and 1
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _LIBCPP_DEBUG2
|
#ifndef _LIBCPP_STD_VER
|
||||||
# include <__debug>
|
# if __cplusplus <= 201103L
|
||||||
|
# define _LIBCPP_STD_VER 11
|
||||||
|
# elif __cplusplus <= 201402L
|
||||||
|
# define _LIBCPP_STD_VER 14
|
||||||
|
# else
|
||||||
|
# define _LIBCPP_STD_VER 15 // current year, or date of c++17 ratification
|
||||||
|
# endif
|
||||||
|
#endif // _LIBCPP_STD_VER
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
#define _LIBCPP_DEPRECATED [[deprecated]]
|
||||||
#else
|
#else
|
||||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
#define _LIBCPP_DEPRECATED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _LIBCPP_CONFIG
|
#if _LIBCPP_STD_VER <= 11
|
||||||
|
#define _LIBCPP_EXPLICIT_AFTER_CXX11
|
||||||
|
#define _LIBCPP_DEPRECATED_AFTER_CXX11
|
||||||
|
#else
|
||||||
|
#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
|
||||||
|
#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
|
||||||
|
#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
|
||||||
|
#else
|
||||||
|
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
# define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
|
||||||
|
#else
|
||||||
|
# define _LIBCPP_EXPLICIT_MOVE(x) (x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_ASAN
|
||||||
|
extern "C" void __sanitizer_annotate_contiguous_container(
|
||||||
|
const void *, const void *, const void *, const void *);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Try to find out if RTTI is disabled.
|
||||||
|
// g++ and cl.exe have RTTI on by default and define a macro when it is.
|
||||||
|
// g++ only defines the macro in 4.3.2 and onwards.
|
||||||
|
#if !defined(_LIBCPP_NO_RTTI)
|
||||||
|
# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
|
||||||
|
(__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
|
||||||
|
# define _LIBCPP_NO_RTTI
|
||||||
|
# elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
|
||||||
|
# define _LIBCPP_NO_RTTI
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_WEAK
|
||||||
|
# define _LIBCPP_WEAK __attribute__((__weak__))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
|
||||||
|
# error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
|
||||||
|
_LIBCPP_HAS_NO_THREADS is defined.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Systems that use capability-based security (FreeBSD with Capsicum,
|
||||||
|
// Nuxi CloudABI) may only provide local filesystem access (using *at()).
|
||||||
|
// Functions like open(), rename(), unlink() and stat() should not be
|
||||||
|
// used, as they attempt to access the global filesystem namespace.
|
||||||
|
#ifdef __CloudABI__
|
||||||
|
#define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// CloudABI is intended for running networked services. Processes do not
|
||||||
|
// have standard input and output channels.
|
||||||
|
#ifdef __CloudABI__
|
||||||
|
#define _LIBCPP_HAS_NO_STDIN
|
||||||
|
#define _LIBCPP_HAS_NO_STDOUT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__ANDROID__) || defined(__CloudABI__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||||
|
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Thread-unsafe functions such as strtok(), mbtowc() and localtime()
|
||||||
|
// are not available.
|
||||||
|
#ifdef __CloudABI__
|
||||||
|
#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __has_feature(cxx_atomic) || __has_extension(c_atomic)
|
||||||
|
#define _LIBCPP_HAS_C_ATOMIC_IMP
|
||||||
|
#elif _GNUC_VER > 407
|
||||||
|
#define _LIBCPP_HAS_GCC_ATOMIC_IMP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
|
||||||
|
|| defined(_LIBCPP_HAS_NO_THREADS)
|
||||||
|
#define _LIBCPP_HAS_NO_ATOMIC_HEADER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif // _LIBCPP_CONFIG
|
||||||
|
23
include/__config_site.in
Normal file
23
include/__config_site.in
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_CONFIG_SITE
|
||||||
|
#define _LIBCPP_CONFIG_SITE
|
||||||
|
|
||||||
|
#cmakedefine _LIBCPP_ABI_VERSION @_LIBCPP_ABI_VERSION@
|
||||||
|
#cmakedefine _LIBCPP_ABI_UNSTABLE
|
||||||
|
#cmakedefine _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
|
#cmakedefine _LIBCPP_HAS_NO_STDIN
|
||||||
|
#cmakedefine _LIBCPP_HAS_NO_STDOUT
|
||||||
|
#cmakedefine _LIBCPP_HAS_NO_THREADS
|
||||||
|
#cmakedefine _LIBCPP_HAS_NO_MONOTONIC_CLOCK
|
||||||
|
#cmakedefine _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
||||||
|
#cmakedefine _LIBCPP_HAS_MUSL_LIBC
|
||||||
|
|
||||||
|
#endif // _LIBCPP_CONFIG_SITE
|
@ -11,36 +11,53 @@
|
|||||||
#ifndef _LIBCPP_DEBUG_H
|
#ifndef _LIBCPP_DEBUG_H
|
||||||
#define _LIBCPP_DEBUG_H
|
#define _LIBCPP_DEBUG_H
|
||||||
|
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 1
|
#include <__config>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _LIBCPP_DEBUG_LEVEL >= 1
|
||||||
# include <cstdlib>
|
# include <cstdlib>
|
||||||
# include <cstdio>
|
# include <cstdio>
|
||||||
# include <cstddef>
|
# include <cstddef>
|
||||||
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
|
# ifndef _LIBCPP_ASSERT
|
||||||
|
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::fprintf(stderr, "%s\n", m), _VSTD::abort()))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_ASSERT
|
||||||
|
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
struct _LIBCPP_VISIBLE __c_node;
|
struct _LIBCPP_TYPE_VIS __c_node;
|
||||||
|
|
||||||
struct _LIBCPP_VISIBLE __i_node
|
struct _LIBCPP_TYPE_VIS __i_node
|
||||||
{
|
{
|
||||||
void* __i_;
|
void* __i_;
|
||||||
__i_node* __next_;
|
__i_node* __next_;
|
||||||
__c_node* __c_;
|
__c_node* __c_;
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
__i_node(const __i_node&) = delete;
|
__i_node(const __i_node&) = delete;
|
||||||
__i_node& operator=(const __i_node&) = delete;
|
__i_node& operator=(const __i_node&) = delete;
|
||||||
|
#else
|
||||||
|
private:
|
||||||
|
__i_node(const __i_node&);
|
||||||
|
__i_node& operator=(const __i_node&);
|
||||||
|
public:
|
||||||
|
#endif
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__i_node(void* __i, __i_node* __next, __c_node* __c)
|
__i_node(void* __i, __i_node* __next, __c_node* __c)
|
||||||
: __i_(__i), __next_(__next), __c_(__c) {}
|
: __i_(__i), __next_(__next), __c_(__c) {}
|
||||||
~__i_node();
|
~__i_node();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _LIBCPP_VISIBLE __c_node
|
struct _LIBCPP_TYPE_VIS __c_node
|
||||||
{
|
{
|
||||||
void* __c_;
|
void* __c_;
|
||||||
__c_node* __next_;
|
__c_node* __next_;
|
||||||
@ -48,8 +65,15 @@ struct _LIBCPP_VISIBLE __c_node
|
|||||||
__i_node** end_;
|
__i_node** end_;
|
||||||
__i_node** cap_;
|
__i_node** cap_;
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
__c_node(const __c_node&) = delete;
|
__c_node(const __c_node&) = delete;
|
||||||
__c_node& operator=(const __c_node&) = delete;
|
__c_node& operator=(const __c_node&) = delete;
|
||||||
|
#else
|
||||||
|
private:
|
||||||
|
__c_node(const __c_node&);
|
||||||
|
__c_node& operator=(const __c_node&);
|
||||||
|
public:
|
||||||
|
#endif
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__c_node(void* __c, __c_node* __next)
|
__c_node(void* __c, __c_node* __next)
|
||||||
: __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
|
: __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
|
||||||
@ -83,8 +107,8 @@ _C_node<_Cont>::__dereferenceable(const void* __i) const
|
|||||||
{
|
{
|
||||||
typedef typename _Cont::const_iterator iterator;
|
typedef typename _Cont::const_iterator iterator;
|
||||||
const iterator* __j = static_cast<const iterator*>(__i);
|
const iterator* __j = static_cast<const iterator*>(__i);
|
||||||
_Cont* _C = static_cast<_Cont*>(__c_);
|
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||||
return _C->__dereferenceable(__j);
|
return _Cp->__dereferenceable(__j);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cont>
|
template <class _Cont>
|
||||||
@ -93,8 +117,8 @@ _C_node<_Cont>::__decrementable(const void* __i) const
|
|||||||
{
|
{
|
||||||
typedef typename _Cont::const_iterator iterator;
|
typedef typename _Cont::const_iterator iterator;
|
||||||
const iterator* __j = static_cast<const iterator*>(__i);
|
const iterator* __j = static_cast<const iterator*>(__i);
|
||||||
_Cont* _C = static_cast<_Cont*>(__c_);
|
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||||
return _C->__decrementable(__j);
|
return _Cp->__decrementable(__j);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cont>
|
template <class _Cont>
|
||||||
@ -103,8 +127,8 @@ _C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
|
|||||||
{
|
{
|
||||||
typedef typename _Cont::const_iterator iterator;
|
typedef typename _Cont::const_iterator iterator;
|
||||||
const iterator* __j = static_cast<const iterator*>(__i);
|
const iterator* __j = static_cast<const iterator*>(__i);
|
||||||
_Cont* _C = static_cast<_Cont*>(__c_);
|
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||||
return _C->__addable(__j, __n);
|
return _Cp->__addable(__j, __n);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cont>
|
template <class _Cont>
|
||||||
@ -113,11 +137,11 @@ _C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
|
|||||||
{
|
{
|
||||||
typedef typename _Cont::const_iterator iterator;
|
typedef typename _Cont::const_iterator iterator;
|
||||||
const iterator* __j = static_cast<const iterator*>(__i);
|
const iterator* __j = static_cast<const iterator*>(__i);
|
||||||
_Cont* _C = static_cast<_Cont*>(__c_);
|
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||||
return _C->__subscriptable(__j, __n);
|
return _Cp->__subscriptable(__j, __n);
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE __libcpp_db
|
class _LIBCPP_TYPE_VIS __libcpp_db
|
||||||
{
|
{
|
||||||
__c_node** __cbeg_;
|
__c_node** __cbeg_;
|
||||||
__c_node** __cend_;
|
__c_node** __cend_;
|
||||||
@ -128,8 +152,15 @@ class _LIBCPP_VISIBLE __libcpp_db
|
|||||||
|
|
||||||
__libcpp_db();
|
__libcpp_db();
|
||||||
public:
|
public:
|
||||||
|
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
__libcpp_db(const __libcpp_db&) = delete;
|
__libcpp_db(const __libcpp_db&) = delete;
|
||||||
__libcpp_db& operator=(const __libcpp_db&) = delete;
|
__libcpp_db& operator=(const __libcpp_db&) = delete;
|
||||||
|
#else
|
||||||
|
private:
|
||||||
|
__libcpp_db(const __libcpp_db&);
|
||||||
|
__libcpp_db& operator=(const __libcpp_db&);
|
||||||
|
public:
|
||||||
|
#endif
|
||||||
~__libcpp_db();
|
~__libcpp_db();
|
||||||
|
|
||||||
class __db_c_iterator;
|
class __db_c_iterator;
|
||||||
@ -169,18 +200,18 @@ public:
|
|||||||
bool __decrementable(const void* __i) const;
|
bool __decrementable(const void* __i) const;
|
||||||
bool __addable(const void* __i, ptrdiff_t __n) const;
|
bool __addable(const void* __i, ptrdiff_t __n) const;
|
||||||
bool __subscriptable(const void* __i, ptrdiff_t __n) const;
|
bool __subscriptable(const void* __i, ptrdiff_t __n) const;
|
||||||
bool __comparable(const void* __i, const void* __j) const;
|
bool __less_than_comparable(const void* __i, const void* __j) const;
|
||||||
private:
|
private:
|
||||||
_LIBCPP_HIDDEN
|
_LIBCPP_HIDDEN
|
||||||
__i_node* __insert_iterator(void* __i);
|
__i_node* __insert_iterator(void* __i);
|
||||||
_LIBCPP_HIDDEN
|
_LIBCPP_HIDDEN
|
||||||
__i_node* __find_iterator(const void* __i) const;
|
__i_node* __find_iterator(const void* __i) const;
|
||||||
|
|
||||||
friend _LIBCPP_VISIBLE __libcpp_db* __get_db();
|
friend _LIBCPP_FUNC_VIS __libcpp_db* __get_db();
|
||||||
};
|
};
|
||||||
|
|
||||||
_LIBCPP_VISIBLE __libcpp_db* __get_db();
|
_LIBCPP_FUNC_VIS __libcpp_db* __get_db();
|
||||||
_LIBCPP_VISIBLE const __libcpp_db* __get_const_db();
|
_LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();
|
||||||
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -15,44 +15,67 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _Arg, class _Result>
|
template <class _Arg, class _Result>
|
||||||
struct _LIBCPP_VISIBLE unary_function
|
struct _LIBCPP_TYPE_VIS_ONLY unary_function
|
||||||
{
|
{
|
||||||
typedef _Arg argument_type;
|
typedef _Arg argument_type;
|
||||||
typedef _Result result_type;
|
typedef _Result result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Arg1, class _Arg2, class _Result>
|
template <class _Arg1, class _Arg2, class _Result>
|
||||||
struct _LIBCPP_VISIBLE binary_function
|
struct _LIBCPP_TYPE_VIS_ONLY binary_function
|
||||||
{
|
{
|
||||||
typedef _Arg1 first_argument_type;
|
typedef _Arg1 first_argument_type;
|
||||||
typedef _Arg2 second_argument_type;
|
typedef _Arg2 second_argument_type;
|
||||||
typedef _Result result_type;
|
typedef _Result result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp> struct _LIBCPP_VISIBLE hash;
|
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash;
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
struct __has_result_type
|
struct __has_result_type
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
struct __two {char _; char __;};
|
struct __two {char __lx; char __lxx;};
|
||||||
template <class _Up> static __two __test(...);
|
template <class _Up> static __two __test(...);
|
||||||
template <class _Up> static char __test(typename _Up::result_type* = 0);
|
template <class _Up> static char __test(typename _Up::result_type* = 0);
|
||||||
public:
|
public:
|
||||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <class _Tp = void>
|
||||||
|
#else
|
||||||
|
template <class _Tp>
|
||||||
|
#endif
|
||||||
|
struct _LIBCPP_TYPE_VIS_ONLY less : binary_function<_Tp, _Tp, bool>
|
||||||
|
{
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator()(const _Tp& __x, const _Tp& __y) const
|
||||||
|
{return __x < __y;}
|
||||||
|
};
|
||||||
|
|
||||||
#include <__functional_base_03>
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <>
|
||||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
struct _LIBCPP_TYPE_VIS_ONLY less<void>
|
||||||
|
{
|
||||||
|
template <class _T1, class _T2>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
auto operator()(_T1&& __t, _T2&& __u) const
|
||||||
|
_NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u)))
|
||||||
|
-> decltype (_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u))
|
||||||
|
{ return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
|
||||||
|
typedef void is_transparent;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
// __weak_result_type
|
// __weak_result_type
|
||||||
|
|
||||||
@ -60,11 +83,11 @@ template <class _Tp>
|
|||||||
struct __derives_from_unary_function
|
struct __derives_from_unary_function
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
struct __two {char _; char __;};
|
struct __two {char __lx; char __lxx;};
|
||||||
static __two __test(...);
|
static __two __test(...);
|
||||||
template <class _A, class _R>
|
template <class _Ap, class _Rp>
|
||||||
static unary_function<_A, _R>
|
static unary_function<_Ap, _Rp>
|
||||||
__test(const volatile unary_function<_A, _R>*);
|
__test(const volatile unary_function<_Ap, _Rp>*);
|
||||||
public:
|
public:
|
||||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||||
typedef decltype(__test((_Tp*)0)) type;
|
typedef decltype(__test((_Tp*)0)) type;
|
||||||
@ -74,11 +97,11 @@ template <class _Tp>
|
|||||||
struct __derives_from_binary_function
|
struct __derives_from_binary_function
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
struct __two {char _; char __;};
|
struct __two {char __lx; char __lxx;};
|
||||||
static __two __test(...);
|
static __two __test(...);
|
||||||
template <class _A1, class _A2, class _R>
|
template <class _A1, class _A2, class _Rp>
|
||||||
static binary_function<_A1, _A2, _R>
|
static binary_function<_A1, _A2, _Rp>
|
||||||
__test(const volatile binary_function<_A1, _A2, _R>*);
|
__test(const volatile binary_function<_A1, _A2, _Rp>*);
|
||||||
public:
|
public:
|
||||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||||
typedef decltype(__test((_Tp*)0)) type;
|
typedef decltype(__test((_Tp*)0)) type;
|
||||||
@ -129,173 +152,181 @@ struct __weak_result_type
|
|||||||
|
|
||||||
// 0 argument case
|
// 0 argument case
|
||||||
|
|
||||||
template <class _R>
|
template <class _Rp>
|
||||||
struct __weak_result_type<_R ()>
|
struct __weak_result_type<_Rp ()>
|
||||||
{
|
{
|
||||||
typedef _R result_type;
|
typedef _Rp result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R>
|
template <class _Rp>
|
||||||
struct __weak_result_type<_R (&)()>
|
struct __weak_result_type<_Rp (&)()>
|
||||||
{
|
{
|
||||||
typedef _R result_type;
|
typedef _Rp result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R>
|
template <class _Rp>
|
||||||
struct __weak_result_type<_R (*)()>
|
struct __weak_result_type<_Rp (*)()>
|
||||||
{
|
{
|
||||||
typedef _R result_type;
|
typedef _Rp result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 1 argument case
|
// 1 argument case
|
||||||
|
|
||||||
template <class _R, class _A1>
|
template <class _Rp, class _A1>
|
||||||
struct __weak_result_type<_R (_A1)>
|
struct __weak_result_type<_Rp (_A1)>
|
||||||
: public unary_function<_A1, _R>
|
: public unary_function<_A1, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _A1>
|
template <class _Rp, class _A1>
|
||||||
struct __weak_result_type<_R (&)(_A1)>
|
struct __weak_result_type<_Rp (&)(_A1)>
|
||||||
: public unary_function<_A1, _R>
|
: public unary_function<_A1, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _A1>
|
template <class _Rp, class _A1>
|
||||||
struct __weak_result_type<_R (*)(_A1)>
|
struct __weak_result_type<_Rp (*)(_A1)>
|
||||||
: public unary_function<_A1, _R>
|
: public unary_function<_A1, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _C>
|
template <class _Rp, class _Cp>
|
||||||
struct __weak_result_type<_R (_C::*)()>
|
struct __weak_result_type<_Rp (_Cp::*)()>
|
||||||
: public unary_function<_C*, _R>
|
: public unary_function<_Cp*, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _C>
|
template <class _Rp, class _Cp>
|
||||||
struct __weak_result_type<_R (_C::*)() const>
|
struct __weak_result_type<_Rp (_Cp::*)() const>
|
||||||
: public unary_function<const _C*, _R>
|
: public unary_function<const _Cp*, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _C>
|
template <class _Rp, class _Cp>
|
||||||
struct __weak_result_type<_R (_C::*)() volatile>
|
struct __weak_result_type<_Rp (_Cp::*)() volatile>
|
||||||
: public unary_function<volatile _C*, _R>
|
: public unary_function<volatile _Cp*, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _C>
|
template <class _Rp, class _Cp>
|
||||||
struct __weak_result_type<_R (_C::*)() const volatile>
|
struct __weak_result_type<_Rp (_Cp::*)() const volatile>
|
||||||
: public unary_function<const volatile _C*, _R>
|
: public unary_function<const volatile _Cp*, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
// 2 argument case
|
// 2 argument case
|
||||||
|
|
||||||
template <class _R, class _A1, class _A2>
|
template <class _Rp, class _A1, class _A2>
|
||||||
struct __weak_result_type<_R (_A1, _A2)>
|
struct __weak_result_type<_Rp (_A1, _A2)>
|
||||||
: public binary_function<_A1, _A2, _R>
|
: public binary_function<_A1, _A2, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _A1, class _A2>
|
template <class _Rp, class _A1, class _A2>
|
||||||
struct __weak_result_type<_R (*)(_A1, _A2)>
|
struct __weak_result_type<_Rp (*)(_A1, _A2)>
|
||||||
: public binary_function<_A1, _A2, _R>
|
: public binary_function<_A1, _A2, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _A1, class _A2>
|
template <class _Rp, class _A1, class _A2>
|
||||||
struct __weak_result_type<_R (&)(_A1, _A2)>
|
struct __weak_result_type<_Rp (&)(_A1, _A2)>
|
||||||
: public binary_function<_A1, _A2, _R>
|
: public binary_function<_A1, _A2, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _C, class _A1>
|
template <class _Rp, class _Cp, class _A1>
|
||||||
struct __weak_result_type<_R (_C::*)(_A1)>
|
struct __weak_result_type<_Rp (_Cp::*)(_A1)>
|
||||||
: public binary_function<_C*, _A1, _R>
|
: public binary_function<_Cp*, _A1, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _C, class _A1>
|
template <class _Rp, class _Cp, class _A1>
|
||||||
struct __weak_result_type<_R (_C::*)(_A1) const>
|
struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
|
||||||
: public binary_function<const _C*, _A1, _R>
|
: public binary_function<const _Cp*, _A1, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _C, class _A1>
|
template <class _Rp, class _Cp, class _A1>
|
||||||
struct __weak_result_type<_R (_C::*)(_A1) volatile>
|
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
|
||||||
: public binary_function<volatile _C*, _A1, _R>
|
: public binary_function<volatile _Cp*, _A1, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _C, class _A1>
|
template <class _Rp, class _Cp, class _A1>
|
||||||
struct __weak_result_type<_R (_C::*)(_A1) const volatile>
|
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
|
||||||
: public binary_function<const volatile _C*, _A1, _R>
|
: public binary_function<const volatile _Cp*, _A1, _Rp>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||||
// 3 or more arguments
|
// 3 or more arguments
|
||||||
|
|
||||||
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
|
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||||
struct __weak_result_type<_R (_A1, _A2, _A3, _A4...)>
|
struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
|
||||||
{
|
{
|
||||||
typedef _R result_type;
|
typedef _Rp result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
|
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||||
struct __weak_result_type<_R (&)(_A1, _A2, _A3, _A4...)>
|
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
|
||||||
{
|
{
|
||||||
typedef _R result_type;
|
typedef _Rp result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
|
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||||
struct __weak_result_type<_R (*)(_A1, _A2, _A3, _A4...)>
|
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
|
||||||
{
|
{
|
||||||
typedef _R result_type;
|
typedef _Rp result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...)>
|
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
|
||||||
{
|
{
|
||||||
typedef _R result_type;
|
typedef _Rp result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const>
|
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
|
||||||
{
|
{
|
||||||
typedef _R result_type;
|
typedef _Rp result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) volatile>
|
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
|
||||||
{
|
{
|
||||||
typedef _R result_type;
|
typedef _Rp result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
|
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
|
||||||
{
|
{
|
||||||
typedef _R result_type;
|
typedef _Rp result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
// __invoke
|
// __invoke
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
// bullets 1 and 2
|
// bullets 1 and 2
|
||||||
|
|
||||||
template <class _F, class _A0, class ..._Args>
|
template <class _Fp, class _A0, class ..._Args,
|
||||||
|
class>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
auto
|
auto
|
||||||
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
|
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
|
||||||
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
|
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||||
{
|
{
|
||||||
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
|
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _F, class _A0, class ..._Args>
|
template <class _Fp, class _A0, class ..._Args,
|
||||||
|
class>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
auto
|
auto
|
||||||
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
|
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
|
||||||
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
|
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||||
{
|
{
|
||||||
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
|
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||||
@ -303,19 +334,21 @@ __invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
|
|||||||
|
|
||||||
// bullets 3 and 4
|
// bullets 3 and 4
|
||||||
|
|
||||||
template <class _F, class _A0>
|
template <class _Fp, class _A0,
|
||||||
|
class>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
auto
|
auto
|
||||||
__invoke(_F&& __f, _A0&& __a0)
|
__invoke(_Fp&& __f, _A0&& __a0)
|
||||||
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
|
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
|
||||||
{
|
{
|
||||||
return _VSTD::forward<_A0>(__a0).*__f;
|
return _VSTD::forward<_A0>(__a0).*__f;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _F, class _A0>
|
template <class _Fp, class _A0,
|
||||||
|
class>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
auto
|
auto
|
||||||
__invoke(_F&& __f, _A0&& __a0)
|
__invoke(_Fp&& __f, _A0&& __a0)
|
||||||
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
|
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
|
||||||
{
|
{
|
||||||
return (*_VSTD::forward<_A0>(__a0)).*__f;
|
return (*_VSTD::forward<_A0>(__a0)).*__f;
|
||||||
@ -323,23 +356,91 @@ __invoke(_F&& __f, _A0&& __a0)
|
|||||||
|
|
||||||
// bullet 5
|
// bullet 5
|
||||||
|
|
||||||
template <class _F, class ..._Args>
|
template <class _Fp, class ..._Args>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
auto
|
auto
|
||||||
__invoke(_F&& __f, _Args&& ...__args)
|
__invoke(_Fp&& __f, _Args&& ...__args)
|
||||||
-> decltype(_VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...))
|
-> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
|
||||||
{
|
{
|
||||||
return _VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...);
|
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class ..._Args>
|
template <class _Tp, class ..._Args>
|
||||||
struct __invoke_return
|
struct __invoke_return
|
||||||
{
|
{
|
||||||
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
|
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
|
#include <__functional_base_03>
|
||||||
|
|
||||||
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
|
|
||||||
|
template <class _Ret>
|
||||||
|
struct __invoke_void_return_wrapper
|
||||||
|
{
|
||||||
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
template <class ..._Args>
|
||||||
|
static _Ret __call(_Args&&... __args) {
|
||||||
|
return __invoke(_VSTD::forward<_Args>(__args)...);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
template <class _Fn>
|
||||||
|
static _Ret __call(_Fn __f) {
|
||||||
|
return __invoke(__f);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Fn, class _A0>
|
||||||
|
static _Ret __call(_Fn __f, _A0& __a0) {
|
||||||
|
return __invoke(__f, __a0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Fn, class _A0, class _A1>
|
||||||
|
static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) {
|
||||||
|
return __invoke(__f, __a0, __a1);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Fn, class _A0, class _A1, class _A2>
|
||||||
|
static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2){
|
||||||
|
return __invoke(__f, __a0, __a1, __a2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct __invoke_void_return_wrapper<void>
|
||||||
|
{
|
||||||
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
template <class ..._Args>
|
||||||
|
static void __call(_Args&&... __args) {
|
||||||
|
__invoke(_VSTD::forward<_Args>(__args)...);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
template <class _Fn>
|
||||||
|
static void __call(_Fn __f) {
|
||||||
|
__invoke(__f);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Fn, class _A0>
|
||||||
|
static void __call(_Fn __f, _A0& __a0) {
|
||||||
|
__invoke(__f, __a0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Fn, class _A0, class _A1>
|
||||||
|
static void __call(_Fn __f, _A0& __a0, _A1& __a1) {
|
||||||
|
__invoke(__f, __a0, __a1);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Fn, class _A0, class _A1, class _A2>
|
||||||
|
static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) {
|
||||||
|
__invoke(__f, __a0, __a1, __a2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
class _LIBCPP_VISIBLE reference_wrapper
|
class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
|
||||||
: public __weak_result_type<_Tp>
|
: public __weak_result_type<_Tp>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -350,7 +451,8 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// construct/copy/destroy
|
// construct/copy/destroy
|
||||||
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(&__f) {}
|
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT
|
||||||
|
: __f_(_VSTD::addressof(__f)) {}
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
|
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
|
||||||
#endif
|
#endif
|
||||||
@ -359,20 +461,126 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
|
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
|
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||||
// invoke
|
// invoke
|
||||||
template <class... _ArgTypes>
|
template <class... _ArgTypes>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
typename __invoke_of<type&, _ArgTypes...>::type
|
typename __invoke_of<type&, _ArgTypes...>::type
|
||||||
operator() (_ArgTypes&&... __args) const
|
operator() (_ArgTypes&&... __args) const {
|
||||||
{
|
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
|
||||||
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
|
}
|
||||||
}
|
#else
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return<type>::type
|
||||||
|
operator() () const {
|
||||||
|
return __invoke(get());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return0<type, _A0>::type
|
||||||
|
operator() (_A0& __a0) const {
|
||||||
|
return __invoke(get(), __a0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return0<type, _A0 const>::type
|
||||||
|
operator() (_A0 const& __a0) const {
|
||||||
|
return __invoke(get(), __a0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0, class _A1>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return1<type, _A0, _A1>::type
|
||||||
|
operator() (_A0& __a0, _A1& __a1) const {
|
||||||
|
return __invoke(get(), __a0, __a1);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0, class _A1>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return1<type, _A0 const, _A1>::type
|
||||||
|
operator() (_A0 const& __a0, _A1& __a1) const {
|
||||||
|
return __invoke(get(), __a0, __a1);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0, class _A1>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return1<type, _A0, _A1 const>::type
|
||||||
|
operator() (_A0& __a0, _A1 const& __a1) const {
|
||||||
|
return __invoke(get(), __a0, __a1);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0, class _A1>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return1<type, _A0 const, _A1 const>::type
|
||||||
|
operator() (_A0 const& __a0, _A1 const& __a1) const {
|
||||||
|
return __invoke(get(), __a0, __a1);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0, class _A1, class _A2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return2<type, _A0, _A1, _A2>::type
|
||||||
|
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
|
||||||
|
return __invoke(get(), __a0, __a1, __a2);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0, class _A1, class _A2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return2<type, _A0 const, _A1, _A2>::type
|
||||||
|
operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
|
||||||
|
return __invoke(get(), __a0, __a1, __a2);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0, class _A1, class _A2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return2<type, _A0, _A1 const, _A2>::type
|
||||||
|
operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
|
||||||
|
return __invoke(get(), __a0, __a1, __a2);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0, class _A1, class _A2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return2<type, _A0, _A1, _A2 const>::type
|
||||||
|
operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
|
||||||
|
return __invoke(get(), __a0, __a1, __a2);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0, class _A1, class _A2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
|
||||||
|
operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const {
|
||||||
|
return __invoke(get(), __a0, __a1, __a2);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0, class _A1, class _A2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
|
||||||
|
operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const {
|
||||||
|
return __invoke(get(), __a0, __a1, __a2);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0, class _A1, class _A2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
|
||||||
|
operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const {
|
||||||
|
return __invoke(get(), __a0, __a1, __a2);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _A0, class _A1, class _A2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
|
||||||
|
operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
|
||||||
|
return __invoke(get(), __a0, __a1, __a2);
|
||||||
|
}
|
||||||
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp> struct ____is_reference_wrapper : public false_type {};
|
template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
|
||||||
template <class _Tp> struct ____is_reference_wrapper<reference_wrapper<_Tp> > : public true_type {};
|
template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {};
|
||||||
template <class _Tp> struct __is_reference_wrapper
|
template <class _Tp> struct __is_reference_wrapper
|
||||||
: public ____is_reference_wrapper<typename remove_cv<_Tp>::type> {};
|
: public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {};
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
@ -406,16 +614,17 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
|||||||
return cref(__t.get());
|
return cref(__t.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
|
|
||||||
template <class _Tp> void ref(const _Tp&& __t) = delete;
|
template <class _Tp> void ref(const _Tp&&) = delete;
|
||||||
template <class _Tp> void cref(const _Tp&& __t) = delete;
|
template <class _Tp> void cref(const _Tp&&) = delete;
|
||||||
|
|
||||||
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
|
|
||||||
template <class _Tp> void ref(const _Tp&& __t);// = delete;
|
template <class _Tp> void ref(const _Tp&&);// = delete;
|
||||||
template <class _Tp> void cref(const _Tp&& __t);// = delete;
|
template <class _Tp> void cref(const _Tp&&);// = delete;
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
|
|
||||||
@ -423,6 +632,111 @@ template <class _Tp> void cref(const _Tp&& __t);// = delete;
|
|||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <class _Tp1, class _Tp2 = void>
|
||||||
|
struct __is_transparent
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
struct __two {char __lx; char __lxx;};
|
||||||
|
template <class _Up> static __two __test(...);
|
||||||
|
template <class _Up> static char __test(typename _Up::is_transparent* = 0);
|
||||||
|
public:
|
||||||
|
static const bool value = sizeof(__test<_Tp1>(0)) == 1;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// allocator_arg_t
|
||||||
|
|
||||||
|
struct _LIBCPP_TYPE_VIS_ONLY allocator_arg_t { };
|
||||||
|
|
||||||
|
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
|
||||||
|
extern const allocator_arg_t allocator_arg;
|
||||||
|
#else
|
||||||
|
constexpr allocator_arg_t allocator_arg = allocator_arg_t();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// uses_allocator
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
struct __has_allocator_type
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
struct __two {char __lx; char __lxx;};
|
||||||
|
template <class _Up> static __two __test(...);
|
||||||
|
template <class _Up> static char __test(typename _Up::allocator_type* = 0);
|
||||||
|
public:
|
||||||
|
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
|
||||||
|
struct __uses_allocator
|
||||||
|
: public integral_constant<bool,
|
||||||
|
is_convertible<_Alloc, typename _Tp::allocator_type>::value>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _Tp, class _Alloc>
|
||||||
|
struct __uses_allocator<_Tp, _Alloc, false>
|
||||||
|
: public false_type
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _Tp, class _Alloc>
|
||||||
|
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator
|
||||||
|
: public __uses_allocator<_Tp, _Alloc>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
|
// allocator construction
|
||||||
|
|
||||||
|
template <class _Tp, class _Alloc, class ..._Args>
|
||||||
|
struct __uses_alloc_ctor_imp
|
||||||
|
{
|
||||||
|
static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
|
||||||
|
static const bool __ic =
|
||||||
|
is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
|
||||||
|
static const int value = __ua ? 2 - __ic : 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _Tp, class _Alloc, class ..._Args>
|
||||||
|
struct __uses_alloc_ctor
|
||||||
|
: integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template <class _Tp, class _Allocator, class... _Args>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
|
||||||
|
{
|
||||||
|
new (__storage) _Tp (_VSTD::forward<_Args>(__args)...);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp, class _Allocator, class... _Args>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
|
||||||
|
{
|
||||||
|
new (__storage) _Tp (allocator_arg, __a, _VSTD::forward<_Args>(__args)...);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp, class _Allocator, class... _Args>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
|
||||||
|
{
|
||||||
|
new (__storage) _Tp (_VSTD::forward<_Args>(__args)..., __a);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp, class _Allocator, class... _Args>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&... __args)
|
||||||
|
{
|
||||||
|
__user_alloc_construct_impl(
|
||||||
|
__uses_alloc_ctor<_Tp, _Allocator>(),
|
||||||
|
__storage, __a, _VSTD::forward<_Args>(__args)...
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP_FUNCTIONAL_BASE
|
#endif // _LIBCPP_FUNCTIONAL_BASE
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
183
include/__locale
183
include/__locale
@ -19,27 +19,52 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#if _WIN32
|
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||||
# include <support/win32/locale_win32.h>
|
# include <support/win32/locale_win32.h>
|
||||||
#elif (__GLIBC__ || __APPLE__ || __FreeBSD__)
|
#elif defined(_AIX)
|
||||||
|
# include <support/ibm/xlocale.h>
|
||||||
|
#elif defined(__ANDROID__)
|
||||||
|
// Android gained the locale aware functions in L (API level 21)
|
||||||
|
# include <android/api-level.h>
|
||||||
|
# if __ANDROID_API__ <= 20
|
||||||
|
# include <support/android/locale_bionic.h>
|
||||||
|
# endif
|
||||||
|
#elif defined(__sun__)
|
||||||
# include <xlocale.h>
|
# include <xlocale.h>
|
||||||
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
|
# include <support/solaris/xlocale.h>
|
||||||
|
#elif defined(_NEWLIB_VERSION)
|
||||||
|
# include <support/newlib/xlocale.h>
|
||||||
|
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \
|
||||||
|
|| defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
|
||||||
|
# include <xlocale.h>
|
||||||
|
#elif defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||||
|
# include <support/musl/xlocale.h>
|
||||||
|
#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
class locale;
|
class _LIBCPP_TYPE_VIS locale;
|
||||||
|
|
||||||
template <class _Facet> bool has_facet(const locale&) _NOEXCEPT;
|
template <class _Facet>
|
||||||
template <class _Facet> const _Facet& use_facet(const locale&);
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool
|
||||||
|
has_facet(const locale&) _NOEXCEPT;
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE locale
|
template <class _Facet>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
const _Facet&
|
||||||
|
use_facet(const locale&);
|
||||||
|
|
||||||
|
class _LIBCPP_TYPE_VIS locale
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types:
|
// types:
|
||||||
class facet;
|
class _LIBCPP_TYPE_VIS facet;
|
||||||
class id;
|
class _LIBCPP_TYPE_VIS id;
|
||||||
|
|
||||||
typedef int category;
|
typedef int category;
|
||||||
static const category // values assigned here are for exposition only
|
static const category // values assigned here are for exposition only
|
||||||
@ -94,7 +119,7 @@ private:
|
|||||||
template <class _Facet> friend const _Facet& use_facet(const locale&);
|
template <class _Facet> friend const _Facet& use_facet(const locale&);
|
||||||
};
|
};
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE locale::facet
|
class _LIBCPP_TYPE_VIS locale::facet
|
||||||
: public __shared_count
|
: public __shared_count
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -110,14 +135,14 @@ private:
|
|||||||
virtual void __on_zero_shared() _NOEXCEPT;
|
virtual void __on_zero_shared() _NOEXCEPT;
|
||||||
};
|
};
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE locale::id
|
class _LIBCPP_TYPE_VIS locale::id
|
||||||
{
|
{
|
||||||
once_flag __flag_;
|
once_flag __flag_;
|
||||||
int32_t __id_;
|
int32_t __id_;
|
||||||
|
|
||||||
static int32_t __next_id;
|
static int32_t __next_id;
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY id() {}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {}
|
||||||
private:
|
private:
|
||||||
void __init();
|
void __init();
|
||||||
void operator=(const id&); // = delete;
|
void operator=(const id&); // = delete;
|
||||||
@ -166,7 +191,7 @@ use_facet(const locale& __l)
|
|||||||
// template <class _CharT> class collate;
|
// template <class _CharT> class collate;
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
class _LIBCPP_VISIBLE collate
|
class _LIBCPP_TYPE_VIS_ONLY collate
|
||||||
: public locale::facet
|
: public locale::facet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -238,22 +263,22 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
|
|||||||
const size_t __mask = size_t(0xF) << (__sr + 4);
|
const size_t __mask = size_t(0xF) << (__sr + 4);
|
||||||
for(const char_type* __p = __lo; __p != __hi; ++__p)
|
for(const char_type* __p = __lo; __p != __hi; ++__p)
|
||||||
{
|
{
|
||||||
__h = (__h << 4) + *__p;
|
__h = (__h << 4) + static_cast<size_t>(*__p);
|
||||||
size_t __g = __h & __mask;
|
size_t __g = __h & __mask;
|
||||||
__h ^= __g | (__g >> __sr);
|
__h ^= __g | (__g >> __sr);
|
||||||
}
|
}
|
||||||
return static_cast<long>(__h);
|
return static_cast<long>(__h);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern template class _LIBCPP_VISIBLE collate<char>;
|
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<char>)
|
||||||
extern template class _LIBCPP_VISIBLE collate<wchar_t>;
|
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<wchar_t>)
|
||||||
|
|
||||||
// template <class CharT> class collate_byname;
|
// template <class CharT> class collate_byname;
|
||||||
|
|
||||||
template <class _CharT> class _LIBCPP_VISIBLE collate_byname;
|
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY collate_byname;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE collate_byname<char>
|
class _LIBCPP_TYPE_VIS collate_byname<char>
|
||||||
: public collate<char>
|
: public collate<char>
|
||||||
{
|
{
|
||||||
locale_t __l;
|
locale_t __l;
|
||||||
@ -272,7 +297,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE collate_byname<wchar_t>
|
class _LIBCPP_TYPE_VIS collate_byname<wchar_t>
|
||||||
: public collate<wchar_t>
|
: public collate<wchar_t>
|
||||||
{
|
{
|
||||||
locale_t __l;
|
locale_t __l;
|
||||||
@ -303,10 +328,10 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
|
|||||||
|
|
||||||
// template <class charT> class ctype
|
// template <class charT> class ctype
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE ctype_base
|
class _LIBCPP_TYPE_VIS ctype_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if __GLIBC__
|
#if defined(__GLIBC__)
|
||||||
typedef unsigned short mask;
|
typedef unsigned short mask;
|
||||||
static const mask space = _ISspace;
|
static const mask space = _ISspace;
|
||||||
static const mask print = _ISprint;
|
static const mask print = _ISprint;
|
||||||
@ -318,7 +343,7 @@ public:
|
|||||||
static const mask punct = _ISpunct;
|
static const mask punct = _ISpunct;
|
||||||
static const mask xdigit = _ISxdigit;
|
static const mask xdigit = _ISxdigit;
|
||||||
static const mask blank = _ISblank;
|
static const mask blank = _ISblank;
|
||||||
#elif _WIN32
|
#elif defined(_WIN32)
|
||||||
typedef unsigned short mask;
|
typedef unsigned short mask;
|
||||||
static const mask space = _SPACE;
|
static const mask space = _SPACE;
|
||||||
static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
|
static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
|
||||||
@ -330,12 +355,15 @@ public:
|
|||||||
static const mask punct = _PUNCT;
|
static const mask punct = _PUNCT;
|
||||||
static const mask xdigit = _HEX;
|
static const mask xdigit = _HEX;
|
||||||
static const mask blank = _BLANK;
|
static const mask blank = _BLANK;
|
||||||
#elif (__APPLE__ || __FreeBSD__)
|
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
|
||||||
#if __APPLE__
|
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
|
||||||
|
# ifdef __APPLE__
|
||||||
typedef __uint32_t mask;
|
typedef __uint32_t mask;
|
||||||
#elif __FreeBSD__
|
# elif defined(__FreeBSD__)
|
||||||
typedef unsigned long mask;
|
typedef unsigned long mask;
|
||||||
#endif
|
# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
|
||||||
|
typedef unsigned short mask;
|
||||||
|
# endif
|
||||||
static const mask space = _CTYPE_S;
|
static const mask space = _CTYPE_S;
|
||||||
static const mask print = _CTYPE_R;
|
static const mask print = _CTYPE_R;
|
||||||
static const mask cntrl = _CTYPE_C;
|
static const mask cntrl = _CTYPE_C;
|
||||||
@ -345,8 +373,41 @@ public:
|
|||||||
static const mask digit = _CTYPE_D;
|
static const mask digit = _CTYPE_D;
|
||||||
static const mask punct = _CTYPE_P;
|
static const mask punct = _CTYPE_P;
|
||||||
static const mask xdigit = _CTYPE_X;
|
static const mask xdigit = _CTYPE_X;
|
||||||
|
|
||||||
|
# if defined(__NetBSD__)
|
||||||
|
static const mask blank = _CTYPE_BL;
|
||||||
|
# else
|
||||||
static const mask blank = _CTYPE_B;
|
static const mask blank = _CTYPE_B;
|
||||||
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
|
# endif
|
||||||
|
#elif defined(__sun__) || defined(_AIX)
|
||||||
|
typedef unsigned int mask;
|
||||||
|
static const mask space = _ISSPACE;
|
||||||
|
static const mask print = _ISPRINT;
|
||||||
|
static const mask cntrl = _ISCNTRL;
|
||||||
|
static const mask upper = _ISUPPER;
|
||||||
|
static const mask lower = _ISLOWER;
|
||||||
|
static const mask alpha = _ISALPHA;
|
||||||
|
static const mask digit = _ISDIGIT;
|
||||||
|
static const mask punct = _ISPUNCT;
|
||||||
|
static const mask xdigit = _ISXDIGIT;
|
||||||
|
static const mask blank = _ISBLANK;
|
||||||
|
#elif defined(_NEWLIB_VERSION)
|
||||||
|
// Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
|
||||||
|
typedef char mask;
|
||||||
|
static const mask space = _S;
|
||||||
|
static const mask print = _P | _U | _L | _N | _B;
|
||||||
|
static const mask cntrl = _C;
|
||||||
|
static const mask upper = _U;
|
||||||
|
static const mask lower = _L;
|
||||||
|
static const mask alpha = _U | _L;
|
||||||
|
static const mask digit = _N;
|
||||||
|
static const mask punct = _P;
|
||||||
|
static const mask xdigit = _X | _N;
|
||||||
|
static const mask blank = _B;
|
||||||
|
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
|
||||||
|
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
|
||||||
|
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
|
||||||
|
#else
|
||||||
typedef unsigned long mask;
|
typedef unsigned long mask;
|
||||||
static const mask space = 1<<0;
|
static const mask space = 1<<0;
|
||||||
static const mask print = 1<<1;
|
static const mask print = 1<<1;
|
||||||
@ -358,17 +419,17 @@ public:
|
|||||||
static const mask punct = 1<<7;
|
static const mask punct = 1<<7;
|
||||||
static const mask xdigit = 1<<8;
|
static const mask xdigit = 1<<8;
|
||||||
static const mask blank = 1<<9;
|
static const mask blank = 1<<9;
|
||||||
#endif // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
|
#endif
|
||||||
static const mask alnum = alpha | digit;
|
static const mask alnum = alpha | digit;
|
||||||
static const mask graph = alnum | punct;
|
static const mask graph = alnum | punct;
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE ctype_base() {}
|
_LIBCPP_ALWAYS_INLINE ctype_base() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT> class _LIBCPP_VISIBLE ctype;
|
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE ctype<wchar_t>
|
class _LIBCPP_TYPE_VIS ctype<wchar_t>
|
||||||
: public locale::facet,
|
: public locale::facet,
|
||||||
public ctype_base
|
public ctype_base
|
||||||
{
|
{
|
||||||
@ -470,7 +531,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE ctype<char>
|
class _LIBCPP_TYPE_VIS ctype<char>
|
||||||
: public locale::facet, public ctype_base
|
: public locale::facet, public ctype_base
|
||||||
{
|
{
|
||||||
const mask* __tab_;
|
const mask* __tab_;
|
||||||
@ -483,14 +544,14 @@ public:
|
|||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
bool is(mask __m, char_type __c) const
|
bool is(mask __m, char_type __c) const
|
||||||
{
|
{
|
||||||
return isascii(__c) ? __tab_[__c] & __m : false;
|
return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
|
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
|
||||||
{
|
{
|
||||||
for (; __low != __high; ++__low, ++__vec)
|
for (; __low != __high; ++__low, ++__vec)
|
||||||
*__vec = isascii(*__low) ? __tab_[*__low] : 0;
|
*__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
|
||||||
return __low;
|
return __low;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,7 +559,7 @@ public:
|
|||||||
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
|
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
|
||||||
{
|
{
|
||||||
for (; __low != __high; ++__low)
|
for (; __low != __high; ++__low)
|
||||||
if (isascii(*__low) && (__tab_[*__low] & __m))
|
if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
|
||||||
break;
|
break;
|
||||||
return __low;
|
return __low;
|
||||||
}
|
}
|
||||||
@ -507,7 +568,7 @@ public:
|
|||||||
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
|
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
|
||||||
{
|
{
|
||||||
for (; __low != __high; ++__low)
|
for (; __low != __high; ++__low)
|
||||||
if (!(isascii(*__low) && (__tab_[*__low] & __m)))
|
if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
|
||||||
break;
|
break;
|
||||||
return __low;
|
return __low;
|
||||||
}
|
}
|
||||||
@ -569,10 +630,14 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
|
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
|
||||||
static const mask* classic_table() _NOEXCEPT;
|
static const mask* classic_table() _NOEXCEPT;
|
||||||
#if defined(__GLIBC__)
|
#if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
|
||||||
static const int* __classic_upper_table() _NOEXCEPT;
|
static const int* __classic_upper_table() _NOEXCEPT;
|
||||||
static const int* __classic_lower_table() _NOEXCEPT;
|
static const int* __classic_lower_table() _NOEXCEPT;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__NetBSD__)
|
||||||
|
static const short* __classic_upper_table() _NOEXCEPT;
|
||||||
|
static const short* __classic_lower_table() _NOEXCEPT;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~ctype();
|
~ctype();
|
||||||
@ -588,10 +653,10 @@ protected:
|
|||||||
|
|
||||||
// template <class CharT> class ctype_byname;
|
// template <class CharT> class ctype_byname;
|
||||||
|
|
||||||
template <class _CharT> class _LIBCPP_VISIBLE ctype_byname;
|
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype_byname;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE ctype_byname<char>
|
class _LIBCPP_TYPE_VIS ctype_byname<char>
|
||||||
: public ctype<char>
|
: public ctype<char>
|
||||||
{
|
{
|
||||||
locale_t __l;
|
locale_t __l;
|
||||||
@ -609,7 +674,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE ctype_byname<wchar_t>
|
class _LIBCPP_TYPE_VIS ctype_byname<wchar_t>
|
||||||
: public ctype<wchar_t>
|
: public ctype<wchar_t>
|
||||||
{
|
{
|
||||||
locale_t __l;
|
locale_t __l;
|
||||||
@ -740,7 +805,7 @@ tolower(_CharT __c, const locale& __loc)
|
|||||||
|
|
||||||
// codecvt_base
|
// codecvt_base
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE codecvt_base
|
class _LIBCPP_TYPE_VIS codecvt_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
_LIBCPP_ALWAYS_INLINE codecvt_base() {}
|
_LIBCPP_ALWAYS_INLINE codecvt_base() {}
|
||||||
@ -749,12 +814,12 @@ public:
|
|||||||
|
|
||||||
// template <class internT, class externT, class stateT> class codecvt;
|
// template <class internT, class externT, class stateT> class codecvt;
|
||||||
|
|
||||||
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_VISIBLE codecvt;
|
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TYPE_VIS_ONLY codecvt;
|
||||||
|
|
||||||
// template <> class codecvt<char, char, mbstate_t>
|
// template <> class codecvt<char, char, mbstate_t>
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE codecvt<char, char, mbstate_t>
|
class _LIBCPP_TYPE_VIS codecvt<char, char, mbstate_t>
|
||||||
: public locale::facet,
|
: public locale::facet,
|
||||||
public codecvt_base
|
public codecvt_base
|
||||||
{
|
{
|
||||||
@ -840,7 +905,7 @@ protected:
|
|||||||
// template <> class codecvt<wchar_t, char, mbstate_t>
|
// template <> class codecvt<wchar_t, char, mbstate_t>
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE codecvt<wchar_t, char, mbstate_t>
|
class _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t>
|
||||||
: public locale::facet,
|
: public locale::facet,
|
||||||
public codecvt_base
|
public codecvt_base
|
||||||
{
|
{
|
||||||
@ -923,7 +988,7 @@ protected:
|
|||||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
// template <> class codecvt<char16_t, char, mbstate_t>
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE codecvt<char16_t, char, mbstate_t>
|
class _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t>
|
||||||
: public locale::facet,
|
: public locale::facet,
|
||||||
public codecvt_base
|
public codecvt_base
|
||||||
{
|
{
|
||||||
@ -1009,7 +1074,7 @@ protected:
|
|||||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
// template <> class codecvt<char32_t, char, mbstate_t>
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE codecvt<char32_t, char, mbstate_t>
|
class _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t>
|
||||||
: public locale::facet,
|
: public locale::facet,
|
||||||
public codecvt_base
|
public codecvt_base
|
||||||
{
|
{
|
||||||
@ -1095,7 +1160,7 @@ protected:
|
|||||||
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
|
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
|
||||||
|
|
||||||
template <class _InternT, class _ExternT, class _StateT>
|
template <class _InternT, class _ExternT, class _StateT>
|
||||||
class _LIBCPP_VISIBLE codecvt_byname
|
class _LIBCPP_TYPE_VIS_ONLY codecvt_byname
|
||||||
: public codecvt<_InternT, _ExternT, _StateT>
|
: public codecvt<_InternT, _ExternT, _StateT>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -1114,14 +1179,14 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
extern template class codecvt_byname<char, char, mbstate_t>;
|
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char, char, mbstate_t>)
|
||||||
extern template class codecvt_byname<wchar_t, char, mbstate_t>;
|
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
|
||||||
extern template class codecvt_byname<char16_t, char, mbstate_t>;
|
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
|
||||||
extern template class codecvt_byname<char32_t, char, mbstate_t>;
|
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
|
||||||
|
|
||||||
_LIBCPP_VISIBLE void __throw_runtime_error(const char*);
|
_LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
|
||||||
|
|
||||||
template <size_t _N>
|
template <size_t _Np>
|
||||||
struct __narrow_to_utf8
|
struct __narrow_to_utf8
|
||||||
{
|
{
|
||||||
template <class _OutputIterator, class _CharT>
|
template <class _OutputIterator, class _CharT>
|
||||||
@ -1211,7 +1276,7 @@ struct __narrow_to_utf8<32>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _N>
|
template <size_t _Np>
|
||||||
struct __widen_from_utf8
|
struct __widen_from_utf8
|
||||||
{
|
{
|
||||||
template <class _OutputIterator>
|
template <class _OutputIterator>
|
||||||
@ -1303,10 +1368,10 @@ struct __widen_from_utf8<32>
|
|||||||
|
|
||||||
// template <class charT> class numpunct
|
// template <class charT> class numpunct
|
||||||
|
|
||||||
template <class _CharT> class _LIBCPP_VISIBLE numpunct;
|
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE numpunct<char>
|
class _LIBCPP_TYPE_VIS numpunct<char>
|
||||||
: public locale::facet
|
: public locale::facet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -1337,7 +1402,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE numpunct<wchar_t>
|
class _LIBCPP_TYPE_VIS numpunct<wchar_t>
|
||||||
: public locale::facet
|
: public locale::facet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -1369,10 +1434,10 @@ protected:
|
|||||||
|
|
||||||
// template <class charT> class numpunct_byname
|
// template <class charT> class numpunct_byname
|
||||||
|
|
||||||
template <class charT> class _LIBCPP_VISIBLE numpunct_byname;
|
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct_byname;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE numpunct_byname<char>
|
class _LIBCPP_TYPE_VIS numpunct_byname<char>
|
||||||
: public numpunct<char>
|
: public numpunct<char>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -1390,7 +1455,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_VISIBLE numpunct_byname<wchar_t>
|
class _LIBCPP_TYPE_VIS numpunct_byname<wchar_t>
|
||||||
: public numpunct<wchar_t>
|
: public numpunct<wchar_t>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -14,29 +14,29 @@
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
#ifdef _LIBCPP_SHARED_LOCK
|
|
||||||
|
|
||||||
namespace ting {
|
|
||||||
template <class _Mutex> class shared_lock;
|
|
||||||
template <class _Mutex> class upgrade_lock;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // _LIBCPP_SHARED_LOCK
|
|
||||||
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE mutex
|
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||||
|
|
||||||
|
class _LIBCPP_TYPE_VIS mutex
|
||||||
{
|
{
|
||||||
pthread_mutex_t __m_;
|
pthread_mutex_t __m_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
|
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
|
constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}
|
||||||
|
#else
|
||||||
|
mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
|
||||||
|
#endif
|
||||||
~mutex();
|
~mutex();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -45,31 +45,33 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void lock();
|
void lock();
|
||||||
bool try_lock();
|
bool try_lock() _NOEXCEPT;
|
||||||
void unlock();
|
void unlock() _NOEXCEPT;
|
||||||
|
|
||||||
typedef pthread_mutex_t* native_handle_type;
|
typedef pthread_mutex_t* native_handle_type;
|
||||||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
|
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _LIBCPP_VISIBLE defer_lock_t {};
|
struct _LIBCPP_TYPE_VIS defer_lock_t {};
|
||||||
struct _LIBCPP_VISIBLE try_to_lock_t {};
|
struct _LIBCPP_TYPE_VIS try_to_lock_t {};
|
||||||
struct _LIBCPP_VISIBLE adopt_lock_t {};
|
struct _LIBCPP_TYPE_VIS adopt_lock_t {};
|
||||||
|
|
||||||
//constexpr
|
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX)
|
||||||
extern const
|
|
||||||
defer_lock_t defer_lock;
|
|
||||||
|
|
||||||
//constexpr
|
extern const defer_lock_t defer_lock;
|
||||||
extern const
|
extern const try_to_lock_t try_to_lock;
|
||||||
try_to_lock_t try_to_lock;
|
extern const adopt_lock_t adopt_lock;
|
||||||
|
|
||||||
//constexpr
|
#else
|
||||||
extern const
|
|
||||||
adopt_lock_t adopt_lock;
|
constexpr defer_lock_t defer_lock = defer_lock_t();
|
||||||
|
constexpr try_to_lock_t try_to_lock = try_to_lock_t();
|
||||||
|
constexpr adopt_lock_t adopt_lock = adopt_lock_t();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class _Mutex>
|
template <class _Mutex>
|
||||||
class _LIBCPP_VISIBLE lock_guard
|
class _LIBCPP_TYPE_VIS_ONLY lock_guard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Mutex mutex_type;
|
typedef _Mutex mutex_type;
|
||||||
@ -93,7 +95,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _Mutex>
|
template <class _Mutex>
|
||||||
class _LIBCPP_VISIBLE unique_lock
|
class _LIBCPP_TYPE_VIS_ONLY unique_lock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Mutex mutex_type;
|
typedef _Mutex mutex_type;
|
||||||
@ -104,12 +106,12 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unique_lock() : __m_(nullptr), __owns_(false) {}
|
unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit unique_lock(mutex_type& __m)
|
explicit unique_lock(mutex_type& __m)
|
||||||
: __m_(&__m), __owns_(true) {__m_->lock();}
|
: __m_(&__m), __owns_(true) {__m_->lock();}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unique_lock(mutex_type& __m, defer_lock_t)
|
unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT
|
||||||
: __m_(&__m), __owns_(false) {}
|
: __m_(&__m), __owns_(false) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unique_lock(mutex_type& __m, try_to_lock_t)
|
unique_lock(mutex_type& __m, try_to_lock_t)
|
||||||
@ -139,11 +141,11 @@ private:
|
|||||||
public:
|
public:
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unique_lock(unique_lock&& __u)
|
unique_lock(unique_lock&& __u) _NOEXCEPT
|
||||||
: __m_(__u.__m_), __owns_(__u.__owns_)
|
: __m_(__u.__m_), __owns_(__u.__owns_)
|
||||||
{__u.__m_ = nullptr; __u.__owns_ = false;}
|
{__u.__m_ = nullptr; __u.__owns_ = false;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unique_lock& operator=(unique_lock&& __u)
|
unique_lock& operator=(unique_lock&& __u) _NOEXCEPT
|
||||||
{
|
{
|
||||||
if (__owns_)
|
if (__owns_)
|
||||||
__m_->unlock();
|
__m_->unlock();
|
||||||
@ -154,27 +156,6 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _LIBCPP_SHARED_LOCK
|
|
||||||
|
|
||||||
unique_lock(ting::shared_lock<mutex_type>&&, try_to_lock_t);
|
|
||||||
template <class _Clock, class _Duration>
|
|
||||||
unique_lock(ting::shared_lock<mutex_type>&&,
|
|
||||||
const chrono::time_point<_Clock, _Duration>&);
|
|
||||||
template <class _Rep, class _Period>
|
|
||||||
unique_lock(ting::shared_lock<mutex_type>&&,
|
|
||||||
const chrono::duration<_Rep, _Period>&);
|
|
||||||
|
|
||||||
explicit unique_lock(ting::upgrade_lock<mutex_type>&&);
|
|
||||||
unique_lock(ting::upgrade_lock<mutex_type>&&, try_to_lock_t);
|
|
||||||
template <class _Clock, class _Duration>
|
|
||||||
unique_lock(ting::upgrade_lock<mutex_type>&&,
|
|
||||||
const chrono::time_point<_Clock, _Duration>&);
|
|
||||||
template <class _Rep, class _Period>
|
|
||||||
unique_lock(ting::upgrade_lock<mutex_type>&&,
|
|
||||||
const chrono::duration<_Rep, _Period>&);
|
|
||||||
|
|
||||||
#endif // _LIBCPP_SHARED_LOCK
|
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
void lock();
|
void lock();
|
||||||
@ -188,13 +169,13 @@ public:
|
|||||||
void unlock();
|
void unlock();
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void swap(unique_lock& __u)
|
void swap(unique_lock& __u) _NOEXCEPT
|
||||||
{
|
{
|
||||||
_VSTD::swap(__m_, __u.__m_);
|
_VSTD::swap(__m_, __u.__m_);
|
||||||
_VSTD::swap(__owns_, __u.__owns_);
|
_VSTD::swap(__owns_, __u.__owns_);
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
mutex_type* release()
|
mutex_type* release() _NOEXCEPT
|
||||||
{
|
{
|
||||||
mutex_type* __m = __m_;
|
mutex_type* __m = __m_;
|
||||||
__m_ = nullptr;
|
__m_ = nullptr;
|
||||||
@ -203,12 +184,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool owns_lock() const {return __owns_;}
|
bool owns_lock() const _NOEXCEPT {return __owns_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
// explicit
|
_LIBCPP_EXPLICIT
|
||||||
operator bool () const {return __owns_;}
|
operator bool () const _NOEXCEPT {return __owns_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
mutex_type* mutex() const {return __m_;}
|
mutex_type* mutex() const _NOEXCEPT {return __m_;}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Mutex>
|
template <class _Mutex>
|
||||||
@ -274,28 +255,27 @@ unique_lock<_Mutex>::unlock()
|
|||||||
template <class _Mutex>
|
template <class _Mutex>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) {__x.swap(__y);}
|
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) _NOEXCEPT
|
||||||
|
{__x.swap(__y);}
|
||||||
|
|
||||||
struct _LIBCPP_VISIBLE cv_status
|
//enum class cv_status
|
||||||
|
_LIBCPP_DECLARE_STRONG_ENUM(cv_status)
|
||||||
{
|
{
|
||||||
enum _ {
|
no_timeout,
|
||||||
no_timeout,
|
timeout
|
||||||
timeout
|
|
||||||
};
|
|
||||||
|
|
||||||
_ __v_;
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status)
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE condition_variable
|
class _LIBCPP_TYPE_VIS condition_variable
|
||||||
{
|
{
|
||||||
pthread_cond_t __cv_;
|
pthread_cond_t __cv_;
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
|
constexpr condition_variable() : __cv_(PTHREAD_COND_INITIALIZER) {}
|
||||||
|
#else
|
||||||
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
|
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
|
||||||
|
#endif
|
||||||
~condition_variable();
|
~condition_variable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -303,18 +283,13 @@ private:
|
|||||||
condition_variable& operator=(const condition_variable&); // = delete;
|
condition_variable& operator=(const condition_variable&); // = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void notify_one();
|
void notify_one() _NOEXCEPT;
|
||||||
void notify_all();
|
void notify_all() _NOEXCEPT;
|
||||||
|
|
||||||
void wait(unique_lock<mutex>& __lk);
|
void wait(unique_lock<mutex>& __lk) _NOEXCEPT;
|
||||||
template <class _Predicate>
|
template <class _Predicate>
|
||||||
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
|
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
|
||||||
|
|
||||||
template <class _Duration>
|
|
||||||
cv_status
|
|
||||||
wait_until(unique_lock<mutex>& __lk,
|
|
||||||
const chrono::time_point<chrono::system_clock, _Duration>& __t);
|
|
||||||
|
|
||||||
template <class _Clock, class _Duration>
|
template <class _Clock, class _Duration>
|
||||||
cv_status
|
cv_status
|
||||||
wait_until(unique_lock<mutex>& __lk,
|
wait_until(unique_lock<mutex>& __lk,
|
||||||
@ -333,6 +308,7 @@ public:
|
|||||||
|
|
||||||
template <class _Rep, class _Period, class _Predicate>
|
template <class _Rep, class _Period, class _Predicate>
|
||||||
bool
|
bool
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
wait_for(unique_lock<mutex>& __lk,
|
wait_for(unique_lock<mutex>& __lk,
|
||||||
const chrono::duration<_Rep, _Period>& __d,
|
const chrono::duration<_Rep, _Period>& __d,
|
||||||
_Predicate __pred);
|
_Predicate __pred);
|
||||||
@ -342,8 +318,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void __do_timed_wait(unique_lock<mutex>& __lk,
|
void __do_timed_wait(unique_lock<mutex>& __lk,
|
||||||
chrono::time_point<chrono::system_clock, chrono::nanoseconds>);
|
chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT;
|
||||||
};
|
};
|
||||||
|
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||||
|
|
||||||
template <class _To, class _Rep, class _Period>
|
template <class _To, class _Rep, class _Period>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
@ -361,6 +338,7 @@ __ceil(chrono::duration<_Rep, _Period> __d)
|
|||||||
return __r;
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||||
template <class _Predicate>
|
template <class _Predicate>
|
||||||
void
|
void
|
||||||
condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
|
condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
|
||||||
@ -369,28 +347,13 @@ condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
|
|||||||
wait(__lk);
|
wait(__lk);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Duration>
|
|
||||||
cv_status
|
|
||||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
|
||||||
const chrono::time_point<chrono::system_clock, _Duration>& __t)
|
|
||||||
{
|
|
||||||
using namespace chrono;
|
|
||||||
typedef time_point<system_clock, nanoseconds> __nano_sys_tmpt;
|
|
||||||
__do_timed_wait(__lk,
|
|
||||||
__nano_sys_tmpt(__ceil<nanoseconds>(__t.time_since_epoch())));
|
|
||||||
return system_clock::now() < __t ? cv_status::no_timeout :
|
|
||||||
cv_status::timeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Clock, class _Duration>
|
template <class _Clock, class _Duration>
|
||||||
cv_status
|
cv_status
|
||||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||||
const chrono::time_point<_Clock, _Duration>& __t)
|
const chrono::time_point<_Clock, _Duration>& __t)
|
||||||
{
|
{
|
||||||
using namespace chrono;
|
using namespace chrono;
|
||||||
system_clock::time_point __s_now = system_clock::now();
|
wait_for(__lk, __t - _Clock::now());
|
||||||
typename _Clock::time_point __c_now = _Clock::now();
|
|
||||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__t - __c_now));
|
|
||||||
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
|
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,15 +377,23 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
|
|||||||
const chrono::duration<_Rep, _Period>& __d)
|
const chrono::duration<_Rep, _Period>& __d)
|
||||||
{
|
{
|
||||||
using namespace chrono;
|
using namespace chrono;
|
||||||
|
if (__d <= __d.zero())
|
||||||
|
return cv_status::timeout;
|
||||||
|
typedef time_point<system_clock, duration<long double, nano> > __sys_tpf;
|
||||||
|
typedef time_point<system_clock, nanoseconds> __sys_tpi;
|
||||||
|
__sys_tpf _Max = __sys_tpi::max();
|
||||||
system_clock::time_point __s_now = system_clock::now();
|
system_clock::time_point __s_now = system_clock::now();
|
||||||
steady_clock::time_point __c_now = steady_clock::now();
|
steady_clock::time_point __c_now = steady_clock::now();
|
||||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
|
if (_Max - __d > __s_now)
|
||||||
|
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
|
||||||
|
else
|
||||||
|
__do_timed_wait(__lk, __sys_tpi::max());
|
||||||
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
||||||
cv_status::timeout;
|
cv_status::timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Rep, class _Period, class _Predicate>
|
template <class _Rep, class _Period, class _Predicate>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bool
|
bool
|
||||||
condition_variable::wait_for(unique_lock<mutex>& __lk,
|
condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||||
const chrono::duration<_Rep, _Period>& __d,
|
const chrono::duration<_Rep, _Period>& __d,
|
||||||
@ -432,6 +403,8 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
|
|||||||
_VSTD::move(__pred));
|
_VSTD::move(__pred));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP___MUTEX_BASE
|
#endif // _LIBCPP___MUTEX_BASE
|
||||||
|
66
include/__nullptr
Normal file
66
include/__nullptr
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===--------------------------- __nullptr --------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_NULLPTR
|
||||||
|
#define _LIBCPP_NULLPTR
|
||||||
|
|
||||||
|
#include <__config>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_HAS_NO_NULLPTR
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
|
||||||
|
{
|
||||||
|
void* __lx;
|
||||||
|
|
||||||
|
struct __nat {int __for_bool_;};
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
|
||||||
|
operator _Tp* () const {return 0;}
|
||||||
|
|
||||||
|
template <class _Tp, class _Up>
|
||||||
|
_LIBCPP_ALWAYS_INLINE
|
||||||
|
operator _Tp _Up::* () const {return 0;}
|
||||||
|
|
||||||
|
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
|
||||||
|
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
|
||||||
|
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
|
||||||
|
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
|
||||||
|
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
|
||||||
|
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
||||||
|
|
||||||
|
#define nullptr _VSTD::__get_nullptr_t()
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
#else // _LIBCPP_HAS_NO_NULLPTR
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
typedef decltype(nullptr) nullptr_t;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _LIBCPP_HAS_NO_NULLPTR
|
||||||
|
|
||||||
|
#endif // _LIBCPP_NULLPTR
|
139
include/__refstring
Normal file
139
include/__refstring
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
//===------------------------ __refstring ---------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP___REFSTRING
|
||||||
|
#define _LIBCPP___REFSTRING
|
||||||
|
|
||||||
|
#include <__config>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstring>
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <mach-o/dyld.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
class _LIBCPP_HIDDEN __libcpp_refstring
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
const char* str_;
|
||||||
|
|
||||||
|
typedef int count_t;
|
||||||
|
|
||||||
|
struct _Rep_base
|
||||||
|
{
|
||||||
|
std::size_t len;
|
||||||
|
std::size_t cap;
|
||||||
|
count_t count;
|
||||||
|
};
|
||||||
|
|
||||||
|
static
|
||||||
|
_Rep_base*
|
||||||
|
rep_from_data(const char *data_) _NOEXCEPT
|
||||||
|
{
|
||||||
|
char *data = const_cast<char *>(data_);
|
||||||
|
return reinterpret_cast<_Rep_base *>(data - sizeof(_Rep_base));
|
||||||
|
}
|
||||||
|
static
|
||||||
|
char *
|
||||||
|
data_from_rep(_Rep_base *rep) _NOEXCEPT
|
||||||
|
{
|
||||||
|
char *data = reinterpret_cast<char *>(rep);
|
||||||
|
return data + sizeof(*rep);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
static
|
||||||
|
const char*
|
||||||
|
compute_gcc_empty_string_storage() _NOEXCEPT
|
||||||
|
{
|
||||||
|
void* handle = dlopen("/usr/lib/libstdc++.6.dylib", RTLD_NOLOAD);
|
||||||
|
if (handle == nullptr)
|
||||||
|
return nullptr;
|
||||||
|
void* sym = dlsym(handle, "_ZNSs4_Rep20_S_empty_rep_storageE");
|
||||||
|
if (sym == nullptr)
|
||||||
|
return nullptr;
|
||||||
|
return data_from_rep(reinterpret_cast<_Rep_base *>(sym));
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
const char*
|
||||||
|
get_gcc_empty_string_storage() _NOEXCEPT
|
||||||
|
{
|
||||||
|
static const char* p = compute_gcc_empty_string_storage();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
uses_refcount() const
|
||||||
|
{
|
||||||
|
return str_ != get_gcc_empty_string_storage();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
bool
|
||||||
|
uses_refcount() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit __libcpp_refstring(const char* msg) {
|
||||||
|
std::size_t len = strlen(msg);
|
||||||
|
_Rep_base* rep = static_cast<_Rep_base *>(::operator new(sizeof(*rep) + len + 1));
|
||||||
|
rep->len = len;
|
||||||
|
rep->cap = len;
|
||||||
|
rep->count = 0;
|
||||||
|
char *data = data_from_rep(rep);
|
||||||
|
std::memcpy(data, msg, len + 1);
|
||||||
|
str_ = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
__libcpp_refstring(const __libcpp_refstring& s) _NOEXCEPT : str_(s.str_)
|
||||||
|
{
|
||||||
|
if (uses_refcount())
|
||||||
|
__sync_add_and_fetch(&rep_from_data(str_)->count, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
__libcpp_refstring& operator=(const __libcpp_refstring& s) _NOEXCEPT
|
||||||
|
{
|
||||||
|
bool adjust_old_count = uses_refcount();
|
||||||
|
struct _Rep_base *old_rep = rep_from_data(str_);
|
||||||
|
str_ = s.str_;
|
||||||
|
if (uses_refcount())
|
||||||
|
__sync_add_and_fetch(&rep_from_data(str_)->count, 1);
|
||||||
|
if (adjust_old_count)
|
||||||
|
{
|
||||||
|
if (__sync_add_and_fetch(&old_rep->count, count_t(-1)) < 0)
|
||||||
|
{
|
||||||
|
::operator delete(old_rep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
~__libcpp_refstring()
|
||||||
|
{
|
||||||
|
if (uses_refcount())
|
||||||
|
{
|
||||||
|
_Rep_base* rep = rep_from_data(str_);
|
||||||
|
if (__sync_add_and_fetch(&rep->count, count_t(-1)) < 0)
|
||||||
|
{
|
||||||
|
::operator delete(rep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* c_str() const _NOEXCEPT {return str_;}
|
||||||
|
};
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
#endif //_LIBCPP___REFSTRING
|
@ -6,7 +6,11 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <__undef_min_max>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@ -52,9 +56,12 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
|
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
|
||||||
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
|
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__split_buffer()
|
__split_buffer()
|
||||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __split_buffer(__alloc_rr& __a);
|
explicit __split_buffer(__alloc_rr& __a);
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __split_buffer(const __alloc_rr& __a);
|
explicit __split_buffer(const __alloc_rr& __a);
|
||||||
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
|
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
|
||||||
~__split_buffer();
|
~__split_buffer();
|
||||||
@ -91,7 +98,7 @@ public:
|
|||||||
void reserve(size_type __n);
|
void reserve(size_type __n);
|
||||||
void shrink_to_fit() _NOEXCEPT;
|
void shrink_to_fit() _NOEXCEPT;
|
||||||
void push_front(const_reference __x);
|
void push_front(const_reference __x);
|
||||||
void push_back(const_reference __x);
|
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
|
||||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||||
void push_front(value_type&& __x);
|
void push_front(value_type&& __x);
|
||||||
void push_back(value_type&& __x);
|
void push_back(value_type&& __x);
|
||||||
@ -124,13 +131,17 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
|
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
|
||||||
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
|
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __destruct_at_begin(pointer __new_begin, false_type);
|
void __destruct_at_begin(pointer __new_begin, false_type);
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __destruct_at_begin(pointer __new_begin, true_type);
|
void __destruct_at_begin(pointer __new_begin, true_type);
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __destruct_at_end(pointer __new_last) _NOEXCEPT
|
void __destruct_at_end(pointer __new_last) _NOEXCEPT
|
||||||
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
|
{__destruct_at_end(__new_last, false_type());}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
|
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
|
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
|
||||||
|
|
||||||
void swap(__split_buffer& __x)
|
void swap(__split_buffer& __x)
|
||||||
@ -148,26 +159,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __move_assign_alloc(__split_buffer& __c, false_type) _NOEXCEPT
|
void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
|
||||||
{}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y)
|
|
||||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
|
||||||
__is_nothrow_swappable<__alloc_rr>::value)
|
|
||||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
|
||||||
__alloc_traits::propagate_on_container_swap::value>());}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
|
|
||||||
_NOEXCEPT_(__is_nothrow_swappable<__alloc_rr>::value)
|
|
||||||
{
|
|
||||||
using _VSTD::swap;
|
|
||||||
swap(__x, __y);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT
|
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -279,16 +271,16 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _F
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline
|
||||||
void
|
void
|
||||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
|
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
|
||||||
{
|
{
|
||||||
while (__begin_ < __new_begin)
|
while (__begin_ != __new_begin)
|
||||||
__alloc_traits::destroy(__alloc(), __begin_++);
|
__alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline
|
||||||
void
|
void
|
||||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
|
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
|
||||||
{
|
{
|
||||||
@ -296,16 +288,16 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
|
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
|
||||||
{
|
{
|
||||||
while (__new_last < __end_)
|
while (__new_last != __end_)
|
||||||
__alloc_traits::destroy(__alloc(), --__end_);
|
__alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
|
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -314,7 +306,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type
|
|||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
|
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
|
||||||
: __end_cap_(0, __a)
|
: __end_cap_(nullptr, __a)
|
||||||
{
|
{
|
||||||
__first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;
|
__first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;
|
||||||
__begin_ = __end_ = __first_ + __start;
|
__begin_ = __end_ = __first_ + __start;
|
||||||
@ -322,24 +314,24 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline
|
||||||
__split_buffer<_Tp, _Allocator>::__split_buffer()
|
__split_buffer<_Tp, _Allocator>::__split_buffer()
|
||||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||||
: __first_(0), __begin_(0), __end_(0), __end_cap_(0)
|
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline
|
||||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
|
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
|
||||||
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
|
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline
|
||||||
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
|
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
|
||||||
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
|
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,8 +380,8 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al
|
|||||||
__first_ = __alloc_traits::allocate(__alloc(), __cap);
|
__first_ = __alloc_traits::allocate(__alloc(), __cap);
|
||||||
__begin_ = __end_ = __first_;
|
__begin_ = __end_ = __first_;
|
||||||
__end_cap() = __first_ + __cap;
|
__end_cap() = __first_ + __cap;
|
||||||
typedef move_iterator<iterator> _I;
|
typedef move_iterator<iterator> _Ip;
|
||||||
__construct_at_end(_I(__c.begin()), _I(__c.end()));
|
__construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,7 +417,7 @@ __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
|
|||||||
_VSTD::swap(__begin_, __x.__begin_);
|
_VSTD::swap(__begin_, __x.__begin_);
|
||||||
_VSTD::swap(__end_, __x.__end_);
|
_VSTD::swap(__end_, __x.__end_);
|
||||||
_VSTD::swap(__end_cap(), __x.__end_cap());
|
_VSTD::swap(__end_cap(), __x.__end_cap());
|
||||||
__swap_alloc(__alloc(), __x.__alloc());
|
__swap_allocator(__alloc(), __x.__alloc());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
@ -486,7 +478,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||||
move_iterator<pointer>(__end_));
|
move_iterator<pointer>(__end_));
|
||||||
@ -517,7 +509,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||||
move_iterator<pointer>(__end_));
|
move_iterator<pointer>(__end_));
|
||||||
@ -535,7 +527,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
|||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
||||||
{
|
{
|
||||||
@ -550,7 +542,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||||
move_iterator<pointer>(__end_));
|
move_iterator<pointer>(__end_));
|
||||||
@ -581,7 +573,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||||
move_iterator<pointer>(__end_));
|
move_iterator<pointer>(__end_));
|
||||||
@ -614,7 +606,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||||
move_iterator<pointer>(__end_));
|
move_iterator<pointer>(__end_));
|
||||||
@ -634,7 +626,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
|||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
|
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
|
||||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||||
|
@ -15,24 +15,28 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
|
#include <__undef___deallocate>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _Tp, size_t _N> class _LIBCPP_HIDDEN __sso_allocator;
|
template <class _Tp, size_t _Np> class _LIBCPP_HIDDEN __sso_allocator;
|
||||||
|
|
||||||
template <size_t _N>
|
template <size_t _Np>
|
||||||
class _LIBCPP_HIDDEN __sso_allocator<void, _N>
|
class _LIBCPP_HIDDEN __sso_allocator<void, _Np>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef const void* const_pointer;
|
typedef const void* const_pointer;
|
||||||
typedef void value_type;
|
typedef void value_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, size_t _N>
|
template <class _Tp, size_t _Np>
|
||||||
class _LIBCPP_HIDDEN __sso_allocator
|
class _LIBCPP_HIDDEN __sso_allocator
|
||||||
{
|
{
|
||||||
typename aligned_storage<sizeof(_Tp) * _N>::type buf_;
|
typename aligned_storage<sizeof(_Tp) * _Np>::type buf_;
|
||||||
bool __allocated_;
|
bool __allocated_;
|
||||||
public:
|
public:
|
||||||
typedef size_t size_type;
|
typedef size_t size_type;
|
||||||
@ -41,26 +45,26 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {}
|
_LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
|
_LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
|
||||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _N>&) throw()
|
template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _Np>&) throw()
|
||||||
: __allocated_(false) {}
|
: __allocated_(false) {}
|
||||||
private:
|
private:
|
||||||
__sso_allocator& operator=(const __sso_allocator&);
|
__sso_allocator& operator=(const __sso_allocator&);
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _N>::const_pointer = 0)
|
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = 0)
|
||||||
{
|
{
|
||||||
if (!__allocated_ && __n <= _N)
|
if (!__allocated_ && __n <= _Np)
|
||||||
{
|
{
|
||||||
__allocated_ = true;
|
__allocated_ = true;
|
||||||
return (pointer)&buf_;
|
return (pointer)&buf_;
|
||||||
}
|
}
|
||||||
return static_cast<pointer>(::operator new(__n * sizeof(_Tp)));
|
return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type)
|
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type)
|
||||||
{
|
{
|
||||||
if (__p == (pointer)&buf_)
|
if (__p == (pointer)&buf_)
|
||||||
__allocated_ = false;
|
__allocated_ = false;
|
||||||
else
|
else
|
||||||
::operator delete(__p);
|
_VSTD::__deallocate(__p);
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
||||||
|
|
||||||
|
@ -17,11 +17,15 @@
|
|||||||
#include <__locale>
|
#include <__locale>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
#include <__undef_min_max>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
static const unsigned __limit = 8;
|
static const int __limit = 8;
|
||||||
|
|
||||||
// __stdinbuf
|
// __stdinbuf
|
||||||
|
|
||||||
@ -37,7 +41,7 @@ public:
|
|||||||
typedef typename traits_type::off_type off_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
typedef typename traits_type::state_type state_type;
|
typedef typename traits_type::state_type state_type;
|
||||||
|
|
||||||
explicit __stdinbuf(FILE* __fp);
|
__stdinbuf(FILE* __fp, state_type* __st);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int_type underflow();
|
virtual int_type underflow();
|
||||||
@ -49,8 +53,10 @@ private:
|
|||||||
|
|
||||||
FILE* __file_;
|
FILE* __file_;
|
||||||
const codecvt<char_type, char, state_type>* __cv_;
|
const codecvt<char_type, char, state_type>* __cv_;
|
||||||
state_type __st_;
|
state_type* __st_;
|
||||||
int __encoding_;
|
int __encoding_;
|
||||||
|
int_type __last_consumed_;
|
||||||
|
bool __last_consumed_is_next_;
|
||||||
bool __always_noconv_;
|
bool __always_noconv_;
|
||||||
|
|
||||||
__stdinbuf(const __stdinbuf&);
|
__stdinbuf(const __stdinbuf&);
|
||||||
@ -60,9 +66,11 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp)
|
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp, state_type* __st)
|
||||||
: __file_(__fp),
|
: __file_(__fp),
|
||||||
__st_()
|
__st_(__st),
|
||||||
|
__last_consumed_(traits_type::eof()),
|
||||||
|
__last_consumed_is_next_(false)
|
||||||
{
|
{
|
||||||
imbue(this->getloc());
|
imbue(this->getloc());
|
||||||
}
|
}
|
||||||
@ -96,11 +104,21 @@ template <class _CharT>
|
|||||||
typename __stdinbuf<_CharT>::int_type
|
typename __stdinbuf<_CharT>::int_type
|
||||||
__stdinbuf<_CharT>::__getchar(bool __consume)
|
__stdinbuf<_CharT>::__getchar(bool __consume)
|
||||||
{
|
{
|
||||||
|
if (__last_consumed_is_next_)
|
||||||
|
{
|
||||||
|
int_type __result = __last_consumed_;
|
||||||
|
if (__consume)
|
||||||
|
{
|
||||||
|
__last_consumed_ = traits_type::eof();
|
||||||
|
__last_consumed_is_next_ = false;
|
||||||
|
}
|
||||||
|
return __result;
|
||||||
|
}
|
||||||
char __extbuf[__limit];
|
char __extbuf[__limit];
|
||||||
int __nread = _VSTD::max(1, __encoding_);
|
int __nread = _VSTD::max(1, __encoding_);
|
||||||
for (int __i = 0; __i < __nread; ++__i)
|
for (int __i = 0; __i < __nread; ++__i)
|
||||||
{
|
{
|
||||||
char __c = getc(__file_);
|
int __c = getc(__file_);
|
||||||
if (__c == EOF)
|
if (__c == EOF)
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
__extbuf[__i] = static_cast<char>(__c);
|
__extbuf[__i] = static_cast<char>(__c);
|
||||||
@ -115,19 +133,19 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
|
|||||||
codecvt_base::result __r;
|
codecvt_base::result __r;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
state_type __sv_st = __st_;
|
state_type __sv_st = *__st_;
|
||||||
__r = __cv_->in(__st_, __extbuf, __extbuf + __nread, __enxt,
|
__r = __cv_->in(*__st_, __extbuf, __extbuf + __nread, __enxt,
|
||||||
&__1buf, &__1buf + 1, __inxt);
|
&__1buf, &__1buf + 1, __inxt);
|
||||||
switch (__r)
|
switch (__r)
|
||||||
{
|
{
|
||||||
case _VSTD::codecvt_base::ok:
|
case _VSTD::codecvt_base::ok:
|
||||||
break;
|
break;
|
||||||
case codecvt_base::partial:
|
case codecvt_base::partial:
|
||||||
__st_ = __sv_st;
|
*__st_ = __sv_st;
|
||||||
if (__nread == sizeof(__extbuf))
|
if (__nread == sizeof(__extbuf))
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
{
|
{
|
||||||
char __c = getc(__file_);
|
int __c = getc(__file_);
|
||||||
if (__c == EOF)
|
if (__c == EOF)
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
__extbuf[__nread] = static_cast<char>(__c);
|
__extbuf[__nread] = static_cast<char>(__c);
|
||||||
@ -146,10 +164,12 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
|
|||||||
{
|
{
|
||||||
for (int __i = __nread; __i > 0;)
|
for (int __i = __nread; __i > 0;)
|
||||||
{
|
{
|
||||||
if (ungetc(__extbuf[--__i], __file_) == EOF)
|
if (ungetc(traits_type::to_int_type(__extbuf[--__i]), __file_) == EOF)
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
__last_consumed_ = traits_type::to_int_type(__1buf);
|
||||||
return traits_type::to_int_type(__1buf);
|
return traits_type::to_int_type(__1buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,28 +178,41 @@ typename __stdinbuf<_CharT>::int_type
|
|||||||
__stdinbuf<_CharT>::pbackfail(int_type __c)
|
__stdinbuf<_CharT>::pbackfail(int_type __c)
|
||||||
{
|
{
|
||||||
if (traits_type::eq_int_type(__c, traits_type::eof()))
|
if (traits_type::eq_int_type(__c, traits_type::eof()))
|
||||||
return __c;
|
|
||||||
char __extbuf[__limit];
|
|
||||||
char* __enxt;
|
|
||||||
const char_type __ci = traits_type::to_char_type(__c);
|
|
||||||
const char_type* __inxt;
|
|
||||||
switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt,
|
|
||||||
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
|
|
||||||
{
|
{
|
||||||
case _VSTD::codecvt_base::ok:
|
if (!__last_consumed_is_next_)
|
||||||
break;
|
{
|
||||||
case _VSTD::codecvt_base::noconv:
|
__c = __last_consumed_;
|
||||||
__extbuf[0] = static_cast<char>(__c);
|
__last_consumed_is_next_ = !traits_type::eq_int_type(__last_consumed_,
|
||||||
__enxt = __extbuf + 1;
|
traits_type::eof());
|
||||||
break;
|
}
|
||||||
case codecvt_base::partial:
|
return __c;
|
||||||
case codecvt_base::error:
|
|
||||||
return traits_type::eof();
|
|
||||||
}
|
}
|
||||||
while (__enxt > __extbuf)
|
if (__last_consumed_is_next_)
|
||||||
if (ungetc(*--__enxt, __file_) == EOF)
|
{
|
||||||
|
char __extbuf[__limit];
|
||||||
|
char* __enxt;
|
||||||
|
const char_type __ci = traits_type::to_char_type(__last_consumed_);
|
||||||
|
const char_type* __inxt;
|
||||||
|
switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt,
|
||||||
|
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
|
||||||
|
{
|
||||||
|
case _VSTD::codecvt_base::ok:
|
||||||
|
break;
|
||||||
|
case _VSTD::codecvt_base::noconv:
|
||||||
|
__extbuf[0] = static_cast<char>(__last_consumed_);
|
||||||
|
__enxt = __extbuf + 1;
|
||||||
|
break;
|
||||||
|
case codecvt_base::partial:
|
||||||
|
case codecvt_base::error:
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
return traits_type::not_eof(__c);
|
}
|
||||||
|
while (__enxt > __extbuf)
|
||||||
|
if (ungetc(*--__enxt, __file_) == EOF)
|
||||||
|
return traits_type::eof();
|
||||||
|
}
|
||||||
|
__last_consumed_ = __c;
|
||||||
|
__last_consumed_is_next_ = true;
|
||||||
|
return __c;
|
||||||
}
|
}
|
||||||
|
|
||||||
// __stdoutbuf
|
// __stdoutbuf
|
||||||
@ -196,17 +229,18 @@ public:
|
|||||||
typedef typename traits_type::off_type off_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
typedef typename traits_type::state_type state_type;
|
typedef typename traits_type::state_type state_type;
|
||||||
|
|
||||||
explicit __stdoutbuf(FILE* __fp);
|
__stdoutbuf(FILE* __fp, state_type* __st);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int_type overflow (int_type __c = traits_type::eof());
|
virtual int_type overflow (int_type __c = traits_type::eof());
|
||||||
|
virtual streamsize xsputn(const char_type* __s, streamsize __n);
|
||||||
virtual int sync();
|
virtual int sync();
|
||||||
virtual void imbue(const locale& __loc);
|
virtual void imbue(const locale& __loc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FILE* __file_;
|
FILE* __file_;
|
||||||
const codecvt<char_type, char, state_type>* __cv_;
|
const codecvt<char_type, char, state_type>* __cv_;
|
||||||
state_type __st_;
|
state_type* __st_;
|
||||||
bool __always_noconv_;
|
bool __always_noconv_;
|
||||||
|
|
||||||
__stdoutbuf(const __stdoutbuf&);
|
__stdoutbuf(const __stdoutbuf&);
|
||||||
@ -214,10 +248,10 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp)
|
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp, state_type* __st)
|
||||||
: __file_(__fp),
|
: __file_(__fp),
|
||||||
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
|
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
|
||||||
__st_(),
|
__st_(__st),
|
||||||
__always_noconv_(__cv_->always_noconv())
|
__always_noconv_(__cv_->always_noconv())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -230,30 +264,30 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
|
|||||||
char_type __1buf;
|
char_type __1buf;
|
||||||
if (!traits_type::eq_int_type(__c, traits_type::eof()))
|
if (!traits_type::eq_int_type(__c, traits_type::eof()))
|
||||||
{
|
{
|
||||||
this->setp(&__1buf, &__1buf+1);
|
__1buf = traits_type::to_char_type(__c);
|
||||||
*this->pptr() = traits_type::to_char_type(__c);
|
|
||||||
this->pbump(1);
|
|
||||||
if (__always_noconv_)
|
if (__always_noconv_)
|
||||||
{
|
{
|
||||||
if (fwrite(this->pbase(), sizeof(char_type), 1, __file_) != 1)
|
if (fwrite(&__1buf, sizeof(char_type), 1, __file_) != 1)
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char* __extbe = __extbuf;
|
char* __extbe = __extbuf;
|
||||||
codecvt_base::result __r;
|
codecvt_base::result __r;
|
||||||
|
char_type* pbase = &__1buf;
|
||||||
|
char_type* pptr = pbase + 1;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
const char_type* __e;
|
const char_type* __e;
|
||||||
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
|
__r = __cv_->out(*__st_, pbase, pptr, __e,
|
||||||
__extbuf,
|
__extbuf,
|
||||||
__extbuf + sizeof(__extbuf),
|
__extbuf + sizeof(__extbuf),
|
||||||
__extbe);
|
__extbe);
|
||||||
if (__e == this->pbase())
|
if (__e == pbase)
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
if (__r == codecvt_base::noconv)
|
if (__r == codecvt_base::noconv)
|
||||||
{
|
{
|
||||||
if (fwrite(this->pbase(), 1, 1, __file_) != 1)
|
if (fwrite(pbase, 1, 1, __file_) != 1)
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
}
|
}
|
||||||
else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
|
else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
|
||||||
@ -263,19 +297,30 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
|
|||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
if (__r == codecvt_base::partial)
|
if (__r == codecvt_base::partial)
|
||||||
{
|
{
|
||||||
this->setp((char_type*)__e, this->pptr());
|
pbase = (char_type*)__e;
|
||||||
this->pbump(this->epptr() - this->pbase());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
} while (__r == codecvt_base::partial);
|
} while (__r == codecvt_base::partial);
|
||||||
}
|
}
|
||||||
this->setp(0, 0);
|
|
||||||
}
|
}
|
||||||
return traits_type::not_eof(__c);
|
return traits_type::not_eof(__c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class _CharT>
|
||||||
|
streamsize
|
||||||
|
__stdoutbuf<_CharT>::xsputn(const char_type* __s, streamsize __n)
|
||||||
|
{
|
||||||
|
if (__always_noconv_)
|
||||||
|
return fwrite(__s, sizeof(char_type), __n, __file_);
|
||||||
|
streamsize __i = 0;
|
||||||
|
for (; __i < __n; ++__i, ++__s)
|
||||||
|
if (overflow(traits_type::to_int_type(*__s)) == traits_type::eof())
|
||||||
|
break;
|
||||||
|
return __i;
|
||||||
|
}
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
int
|
int
|
||||||
__stdoutbuf<_CharT>::sync()
|
__stdoutbuf<_CharT>::sync()
|
||||||
@ -285,7 +330,7 @@ __stdoutbuf<_CharT>::sync()
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
char* __extbe;
|
char* __extbe;
|
||||||
__r = __cv_->unshift(__st_, __extbuf,
|
__r = __cv_->unshift(*__st_, __extbuf,
|
||||||
__extbuf + sizeof(__extbuf),
|
__extbuf + sizeof(__extbuf),
|
||||||
__extbe);
|
__extbe);
|
||||||
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
|
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
|
||||||
|
364
include/__tree
364
include/__tree
@ -17,23 +17,17 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator> class __tree;
|
template <class _Tp, class _Compare, class _Allocator> class __tree;
|
||||||
template <class _Tp, class _NodePtr, class _DiffType>
|
template <class _Tp, class _NodePtr, class _DiffType>
|
||||||
class _LIBCPP_VISIBLE __tree_iterator;
|
class _LIBCPP_TYPE_VIS_ONLY __tree_iterator;
|
||||||
template <class _Tp, class _ConstNodePtr, class _DiffType>
|
template <class _Tp, class _ConstNodePtr, class _DiffType>
|
||||||
class _LIBCPP_VISIBLE __tree_const_iterator;
|
class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator;
|
||||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
|
||||||
class _LIBCPP_VISIBLE map;
|
|
||||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
|
||||||
class _LIBCPP_VISIBLE multimap;
|
|
||||||
template <class _Key, class _Compare, class _Allocator>
|
|
||||||
class _LIBCPP_VISIBLE set;
|
|
||||||
template <class _Key, class _Compare, class _Allocator>
|
|
||||||
class _LIBCPP_VISIBLE multiset;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@ -520,9 +514,9 @@ public:
|
|||||||
bool __value_constructed;
|
bool __value_constructed;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __tree_node_destructor(allocator_type& __na) _NOEXCEPT
|
explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
|
||||||
: __na_(__na),
|
: __na_(__na),
|
||||||
__value_constructed(false)
|
__value_constructed(__val)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@ -612,16 +606,14 @@ public:
|
|||||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _TreeIterator> class __map_iterator;
|
template <class _TreeIterator> class _LIBCPP_TYPE_VIS_ONLY __map_iterator;
|
||||||
template <class _TreeIterator> class __map_const_iterator;
|
template <class _TreeIterator> class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator;
|
||||||
|
|
||||||
template <class _Tp, class _NodePtr, class _DiffType>
|
template <class _Tp, class _NodePtr, class _DiffType>
|
||||||
class _LIBCPP_VISIBLE __tree_iterator
|
class _LIBCPP_TYPE_VIS_ONLY __tree_iterator
|
||||||
{
|
{
|
||||||
typedef _NodePtr __node_pointer;
|
typedef _NodePtr __node_pointer;
|
||||||
typedef typename pointer_traits<__node_pointer>::element_type __node;
|
typedef typename pointer_traits<__node_pointer>::element_type __node;
|
||||||
typedef typename __node::base __node_base;
|
|
||||||
typedef typename __node_base::pointer __node_base_pointer;
|
|
||||||
|
|
||||||
__node_pointer __ptr_;
|
__node_pointer __ptr_;
|
||||||
|
|
||||||
@ -639,23 +631,32 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
pointer;
|
pointer;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT {}
|
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
: __ptr_(nullptr)
|
||||||
|
#endif
|
||||||
|
{}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
|
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
|
_LIBCPP_INLINE_VISIBILITY pointer operator->() const
|
||||||
|
{return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_iterator& operator++()
|
__tree_iterator& operator++() {
|
||||||
{__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
|
__ptr_ = static_cast<__node_pointer>(
|
||||||
return *this;}
|
__tree_next(static_cast<typename __node::base::pointer>(__ptr_)));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_iterator operator++(int)
|
__tree_iterator operator++(int)
|
||||||
{__tree_iterator __t(*this); ++(*this); return __t;}
|
{__tree_iterator __t(*this); ++(*this); return __t;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_iterator& operator--()
|
__tree_iterator& operator--() {
|
||||||
{__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
|
__ptr_ = static_cast<__node_pointer>(
|
||||||
return *this;}
|
__tree_prev(static_cast<typename __node::base::pointer>(__ptr_)));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_iterator operator--(int)
|
__tree_iterator operator--(int)
|
||||||
{__tree_iterator __t(*this); --(*this); return __t;}
|
{__tree_iterator __t(*this); --(*this); return __t;}
|
||||||
@ -671,27 +672,19 @@ private:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
||||||
template <class, class, class> friend class __tree;
|
template <class, class, class> friend class __tree;
|
||||||
template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
|
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator;
|
||||||
template <class> friend class _LIBCPP_VISIBLE __map_iterator;
|
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __map_iterator;
|
||||||
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
|
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
|
||||||
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
|
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
|
||||||
template <class, class, class> friend class _LIBCPP_VISIBLE set;
|
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY set;
|
||||||
template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
|
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multiset;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _ConstNodePtr, class _DiffType>
|
template <class _Tp, class _ConstNodePtr, class _DiffType>
|
||||||
class _LIBCPP_VISIBLE __tree_const_iterator
|
class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator
|
||||||
{
|
{
|
||||||
typedef _ConstNodePtr __node_pointer;
|
typedef _ConstNodePtr __node_pointer;
|
||||||
typedef typename pointer_traits<__node_pointer>::element_type __node;
|
typedef typename pointer_traits<__node_pointer>::element_type __node;
|
||||||
typedef const typename __node::base __node_base;
|
|
||||||
typedef typename pointer_traits<__node_pointer>::template
|
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
|
||||||
rebind<__node_base>
|
|
||||||
#else
|
|
||||||
rebind<__node_base>::other
|
|
||||||
#endif
|
|
||||||
__node_base_pointer;
|
|
||||||
|
|
||||||
__node_pointer __ptr_;
|
__node_pointer __ptr_;
|
||||||
|
|
||||||
@ -709,7 +702,12 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
pointer;
|
pointer;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY __tree_const_iterator() {}
|
_LIBCPP_INLINE_VISIBILITY __tree_const_iterator() _NOEXCEPT
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
: __ptr_(nullptr)
|
||||||
|
#endif
|
||||||
|
{}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef typename remove_const<__node>::type __non_const_node;
|
typedef typename remove_const<__node>::type __non_const_node;
|
||||||
typedef typename pointer_traits<__node_pointer>::template
|
typedef typename pointer_traits<__node_pointer>::template
|
||||||
@ -727,20 +725,43 @@ public:
|
|||||||
: __ptr_(__p.__ptr_) {}
|
: __ptr_(__p.__ptr_) {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
|
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
|
_LIBCPP_INLINE_VISIBILITY pointer operator->() const
|
||||||
|
{return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_const_iterator& operator++()
|
__tree_const_iterator& operator++() {
|
||||||
{__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
|
typedef typename pointer_traits<__node_pointer>::template
|
||||||
return *this;}
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
rebind<typename __node::base>
|
||||||
|
#else
|
||||||
|
rebind<typename __node::base>::other
|
||||||
|
#endif
|
||||||
|
__node_base_pointer;
|
||||||
|
|
||||||
|
__ptr_ = static_cast<__node_pointer>(
|
||||||
|
__tree_next(static_cast<__node_base_pointer>(__ptr_)));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_const_iterator operator++(int)
|
__tree_const_iterator operator++(int)
|
||||||
{__tree_const_iterator __t(*this); ++(*this); return __t;}
|
{__tree_const_iterator __t(*this); ++(*this); return __t;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_const_iterator& operator--()
|
__tree_const_iterator& operator--() {
|
||||||
{__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
|
typedef typename pointer_traits<__node_pointer>::template
|
||||||
return *this;}
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
rebind<typename __node::base>
|
||||||
|
#else
|
||||||
|
rebind<typename __node::base>::other
|
||||||
|
#endif
|
||||||
|
__node_base_pointer;
|
||||||
|
|
||||||
|
__ptr_ = static_cast<__node_pointer>(
|
||||||
|
__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_const_iterator operator--(int)
|
__tree_const_iterator operator--(int)
|
||||||
{__tree_const_iterator __t(*this); --(*this); return __t;}
|
{__tree_const_iterator __t(*this); --(*this); return __t;}
|
||||||
@ -757,11 +778,11 @@ private:
|
|||||||
explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
|
explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
|
||||||
: __ptr_(__p) {}
|
: __ptr_(__p) {}
|
||||||
template <class, class, class> friend class __tree;
|
template <class, class, class> friend class __tree;
|
||||||
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
|
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
|
||||||
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
|
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
|
||||||
template <class, class, class> friend class _LIBCPP_VISIBLE set;
|
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY set;
|
||||||
template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
|
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multiset;
|
||||||
template <class> friend class _LIBCPP_VISIBLE __map_const_iterator;
|
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@ -777,20 +798,16 @@ public:
|
|||||||
typedef typename __alloc_traits::size_type size_type;
|
typedef typename __alloc_traits::size_type size_type;
|
||||||
typedef typename __alloc_traits::difference_type difference_type;
|
typedef typename __alloc_traits::difference_type difference_type;
|
||||||
|
|
||||||
typedef __tree_node<value_type, typename __alloc_traits::void_pointer> __node;
|
typedef typename __alloc_traits::void_pointer __void_pointer;
|
||||||
typedef __tree_node_base<typename __alloc_traits::void_pointer> __node_base;
|
|
||||||
typedef typename __alloc_traits::template
|
typedef __tree_node<value_type, __void_pointer> __node;
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
typedef __tree_node_base<__void_pointer> __node_base;
|
||||||
rebind_alloc<__node>
|
typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator;
|
||||||
#else
|
|
||||||
rebind_alloc<__node>::other
|
|
||||||
#endif
|
|
||||||
__node_allocator;
|
|
||||||
typedef allocator_traits<__node_allocator> __node_traits;
|
typedef allocator_traits<__node_allocator> __node_traits;
|
||||||
typedef typename __node_traits::pointer __node_pointer;
|
typedef typename __node_traits::pointer __node_pointer;
|
||||||
typedef typename __node_traits::const_pointer __node_const_pointer;
|
typedef typename __node_traits::pointer __node_const_pointer;
|
||||||
typedef typename __node_base::pointer __node_base_pointer;
|
typedef typename __node_base::pointer __node_base_pointer;
|
||||||
typedef typename __node_base::const_pointer __node_base_const_pointer;
|
typedef typename __node_base::pointer __node_base_const_pointer;
|
||||||
private:
|
private:
|
||||||
typedef typename __node_base::base __end_node_t;
|
typedef typename __node_base::base __end_node_t;
|
||||||
typedef typename pointer_traits<__node_pointer>::template
|
typedef typename pointer_traits<__node_pointer>::template
|
||||||
@ -802,9 +819,9 @@ private:
|
|||||||
__end_node_ptr;
|
__end_node_ptr;
|
||||||
typedef typename pointer_traits<__node_pointer>::template
|
typedef typename pointer_traits<__node_pointer>::template
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
rebind<const __end_node_t>
|
rebind<__end_node_t>
|
||||||
#else
|
#else
|
||||||
rebind<const __end_node_t>::other
|
rebind<__end_node_t>::other
|
||||||
#endif
|
#endif
|
||||||
__end_node_const_ptr;
|
__end_node_const_ptr;
|
||||||
|
|
||||||
@ -826,7 +843,7 @@ public:
|
|||||||
{
|
{
|
||||||
return static_cast<__node_const_pointer>
|
return static_cast<__node_const_pointer>
|
||||||
(
|
(
|
||||||
pointer_traits<__end_node_const_ptr>::pointer_to(__pair1_.first())
|
pointer_traits<__end_node_const_ptr>::pointer_to(const_cast<__end_node_t&>(__pair1_.first()))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@ -863,7 +880,7 @@ public:
|
|||||||
{return static_cast<__node_const_pointer>(__end_node()->__left_);}
|
{return static_cast<__node_const_pointer>(__end_node()->__left_);}
|
||||||
|
|
||||||
typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
|
typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
|
||||||
typedef __tree_const_iterator<value_type, __node_const_pointer, difference_type> const_iterator;
|
typedef __tree_const_iterator<value_type, __node_pointer, difference_type> const_iterator;
|
||||||
|
|
||||||
explicit __tree(const value_compare& __comp)
|
explicit __tree(const value_compare& __comp)
|
||||||
_NOEXCEPT_(
|
_NOEXCEPT_(
|
||||||
@ -909,9 +926,12 @@ public:
|
|||||||
|
|
||||||
void swap(__tree& __t)
|
void swap(__tree& __t)
|
||||||
_NOEXCEPT_(
|
_NOEXCEPT_(
|
||||||
__is_nothrow_swappable<value_compare>::value &&
|
__is_nothrow_swappable<value_compare>::value
|
||||||
(!__node_traits::propagate_on_container_swap::value ||
|
#if _LIBCPP_STD_VER <= 11
|
||||||
__is_nothrow_swappable<__node_allocator>::value));
|
&& (!__node_traits::propagate_on_container_swap::value ||
|
||||||
|
__is_nothrow_swappable<__node_allocator>::value)
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||||
@ -930,14 +950,14 @@ public:
|
|||||||
__emplace_hint_multi(const_iterator __p, _Args&&... __args);
|
__emplace_hint_multi(const_iterator __p, _Args&&... __args);
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
template <class _V>
|
template <class _Vp>
|
||||||
pair<iterator, bool> __insert_unique(_V&& __v);
|
pair<iterator, bool> __insert_unique(_Vp&& __v);
|
||||||
template <class _V>
|
template <class _Vp>
|
||||||
iterator __insert_unique(const_iterator __p, _V&& __v);
|
iterator __insert_unique(const_iterator __p, _Vp&& __v);
|
||||||
template <class _V>
|
template <class _Vp>
|
||||||
iterator __insert_multi(_V&& __v);
|
iterator __insert_multi(_Vp&& __v);
|
||||||
template <class _V>
|
template <class _Vp>
|
||||||
iterator __insert_multi(const_iterator __p, _V&& __v);
|
iterator __insert_multi(const_iterator __p, _Vp&& __v);
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
pair<iterator, bool> __insert_unique(const value_type& __v);
|
pair<iterator, bool> __insert_unique(const value_type& __v);
|
||||||
@ -1019,8 +1039,8 @@ public:
|
|||||||
pair<const_iterator, const_iterator>
|
pair<const_iterator, const_iterator>
|
||||||
__equal_range_multi(const _Key& __k) const;
|
__equal_range_multi(const _Key& __k) const;
|
||||||
|
|
||||||
typedef __tree_node_destructor<__node_allocator> _D;
|
typedef __tree_node_destructor<__node_allocator> _Dp;
|
||||||
typedef unique_ptr<__node, _D> __node_holder;
|
typedef unique_ptr<__node, _Dp> __node_holder;
|
||||||
|
|
||||||
__node_holder remove(const_iterator __p) _NOEXCEPT;
|
__node_holder remove(const_iterator __p) _NOEXCEPT;
|
||||||
private:
|
private:
|
||||||
@ -1079,27 +1099,11 @@ private:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __move_assign_alloc(__tree& __t, false_type) _NOEXCEPT {}
|
void __move_assign_alloc(__tree& __t, false_type) _NOEXCEPT {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
|
|
||||||
_NOEXCEPT_(
|
|
||||||
!__node_traits::propagate_on_container_swap::value ||
|
|
||||||
__is_nothrow_swappable<__node_allocator>::value)
|
|
||||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
|
||||||
__node_traits::propagate_on_container_swap::value>());}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type)
|
|
||||||
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
|
|
||||||
{
|
|
||||||
using _VSTD::swap;
|
|
||||||
swap(__x, __y);
|
|
||||||
}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type)
|
|
||||||
_NOEXCEPT
|
|
||||||
{}
|
|
||||||
|
|
||||||
__node_pointer __detach();
|
__node_pointer __detach();
|
||||||
static __node_pointer __detach(__node_pointer);
|
static __node_pointer __detach(__node_pointer);
|
||||||
|
|
||||||
|
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
|
||||||
|
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@ -1114,8 +1118,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
|
|||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
|
__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
|
||||||
: __pair1_(__node_allocator(__a)),
|
: __begin_node_(__node_pointer()),
|
||||||
__begin_node_(__node_pointer()),
|
__pair1_(__node_allocator(__a)),
|
||||||
__pair3_(0)
|
__pair3_(0)
|
||||||
{
|
{
|
||||||
__begin_node() = __end_node();
|
__begin_node() = __end_node();
|
||||||
@ -1124,8 +1128,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
|
|||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
|
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
|
||||||
const allocator_type& __a)
|
const allocator_type& __a)
|
||||||
: __pair1_(__node_allocator(__a)),
|
: __begin_node_(__node_pointer()),
|
||||||
__begin_node_(__node_pointer()),
|
__pair1_(__node_allocator(__a)),
|
||||||
__pair3_(0, __comp)
|
__pair3_(0, __comp)
|
||||||
{
|
{
|
||||||
__begin_node() = __end_node();
|
__begin_node() = __end_node();
|
||||||
@ -1159,7 +1163,7 @@ __tree<_Tp, _Compare, _Allocator>::__detach(__node_pointer __cache)
|
|||||||
{
|
{
|
||||||
if (__cache->__parent_ == nullptr)
|
if (__cache->__parent_ == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (__tree_is_left_child(__cache))
|
if (__tree_is_left_child(static_cast<__node_base_pointer>(__cache)))
|
||||||
{
|
{
|
||||||
__cache->__parent_->__left_ = nullptr;
|
__cache->__parent_->__left_ = nullptr;
|
||||||
__cache = static_cast<__node_pointer>(__cache->__parent_);
|
__cache = static_cast<__node_pointer>(__cache->__parent_);
|
||||||
@ -1292,7 +1296,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
|
|||||||
__begin_node() = __end_node();
|
__begin_node() = __end_node();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__end_node()->__left_->__parent_ = __end_node();
|
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
|
||||||
__t.__begin_node() = __t.__end_node();
|
__t.__begin_node() = __t.__end_node();
|
||||||
__t.__end_node()->__left_ = nullptr;
|
__t.__end_node()->__left_ = nullptr;
|
||||||
__t.size() = 0;
|
__t.size() = 0;
|
||||||
@ -1312,7 +1316,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __
|
|||||||
{
|
{
|
||||||
__begin_node() = __t.__begin_node();
|
__begin_node() = __t.__begin_node();
|
||||||
__end_node()->__left_ = __t.__end_node()->__left_;
|
__end_node()->__left_ = __t.__end_node()->__left_;
|
||||||
__end_node()->__left_->__parent_ = __end_node();
|
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
|
||||||
size() = __t.size();
|
size() = __t.size();
|
||||||
__t.__begin_node() = __t.__end_node();
|
__t.__begin_node() = __t.__end_node();
|
||||||
__t.__end_node()->__left_ = nullptr;
|
__t.__end_node()->__left_ = nullptr;
|
||||||
@ -1340,7 +1344,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
|
|||||||
__begin_node() = __end_node();
|
__begin_node() = __end_node();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__end_node()->__left_->__parent_ = __end_node();
|
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
|
||||||
__t.__begin_node() = __t.__end_node();
|
__t.__begin_node() = __t.__end_node();
|
||||||
__t.__end_node()->__left_ = nullptr;
|
__t.__end_node()->__left_ = nullptr;
|
||||||
__t.size() = 0;
|
__t.size() = 0;
|
||||||
@ -1432,24 +1436,27 @@ __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT
|
|||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
void
|
void
|
||||||
__tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
|
__tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
|
||||||
_NOEXCEPT_(
|
_NOEXCEPT_(
|
||||||
__is_nothrow_swappable<value_compare>::value &&
|
__is_nothrow_swappable<value_compare>::value
|
||||||
(!__node_traits::propagate_on_container_swap::value ||
|
#if _LIBCPP_STD_VER <= 11
|
||||||
__is_nothrow_swappable<__node_allocator>::value))
|
&& (!__node_traits::propagate_on_container_swap::value ||
|
||||||
|
__is_nothrow_swappable<__node_allocator>::value)
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
using _VSTD::swap;
|
using _VSTD::swap;
|
||||||
swap(__begin_node_, __t.__begin_node_);
|
swap(__begin_node_, __t.__begin_node_);
|
||||||
swap(__pair1_.first(), __t.__pair1_.first());
|
swap(__pair1_.first(), __t.__pair1_.first());
|
||||||
__swap_alloc(__node_alloc(), __t.__node_alloc());
|
__swap_allocator(__node_alloc(), __t.__node_alloc());
|
||||||
__pair3_.swap(__t.__pair3_);
|
__pair3_.swap(__t.__pair3_);
|
||||||
if (size() == 0)
|
if (size() == 0)
|
||||||
__begin_node() = __end_node();
|
__begin_node() = __end_node();
|
||||||
else
|
else
|
||||||
__end_node()->__left_->__parent_ = __end_node();
|
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
|
||||||
if (__t.size() == 0)
|
if (__t.size() == 0)
|
||||||
__t.__begin_node() = __t.__end_node();
|
__t.__begin_node() = __t.__end_node();
|
||||||
else
|
else
|
||||||
__t.__end_node()->__left_->__parent_ = __t.__end_node();
|
__t.__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__t.__end_node());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@ -1481,7 +1488,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer
|
|||||||
__nd = static_cast<__node_pointer>(__nd->__right_);
|
__nd = static_cast<__node_pointer>(__nd->__right_);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = __nd;
|
__parent = static_cast<__node_base_pointer>(__nd);
|
||||||
return __parent->__right_;
|
return __parent->__right_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1491,13 +1498,13 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer
|
|||||||
__nd = static_cast<__node_pointer>(__nd->__left_);
|
__nd = static_cast<__node_pointer>(__nd->__left_);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = __nd;
|
__parent = static_cast<__node_base_pointer>(__nd);
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__parent = __end_node();
|
__parent = static_cast<__node_base_pointer>(__end_node());
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1520,7 +1527,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointe
|
|||||||
__nd = static_cast<__node_pointer>(__nd->__left_);
|
__nd = static_cast<__node_pointer>(__nd->__left_);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = __nd;
|
__parent = static_cast<__node_base_pointer>(__nd);
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1530,13 +1537,13 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointe
|
|||||||
__nd = static_cast<__node_pointer>(__nd->__right_);
|
__nd = static_cast<__node_pointer>(__nd->__right_);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = __nd;
|
__parent = static_cast<__node_base_pointer>(__nd);
|
||||||
return __parent->__right_;
|
return __parent->__right_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__parent = __end_node();
|
__parent = static_cast<__node_base_pointer>(__end_node());
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1561,12 +1568,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
|
|||||||
// *prev(__hint) <= __v <= *__hint
|
// *prev(__hint) <= __v <= *__hint
|
||||||
if (__hint.__ptr_->__left_ == nullptr)
|
if (__hint.__ptr_->__left_ == nullptr)
|
||||||
{
|
{
|
||||||
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
|
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = const_cast<__node_pointer&>(__prior.__ptr_);
|
__parent = static_cast<__node_base_pointer>(__prior.__ptr_);
|
||||||
return __parent->__right_;
|
return __parent->__right_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1598,7 +1605,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& _
|
|||||||
__nd = static_cast<__node_pointer>(__nd->__left_);
|
__nd = static_cast<__node_pointer>(__nd->__left_);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = __nd;
|
__parent = static_cast<__node_base_pointer>(__nd);
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1608,18 +1615,18 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& _
|
|||||||
__nd = static_cast<__node_pointer>(__nd->__right_);
|
__nd = static_cast<__node_pointer>(__nd->__right_);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = __nd;
|
__parent = static_cast<__node_base_pointer>(__nd);
|
||||||
return __parent->__right_;
|
return __parent->__right_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = __nd;
|
__parent = static_cast<__node_base_pointer>(__nd);
|
||||||
return __parent;
|
return __parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__parent = __end_node();
|
__parent = static_cast<__node_base_pointer>(__end_node());
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1646,12 +1653,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
|
|||||||
// *prev(__hint) < __v < *__hint
|
// *prev(__hint) < __v < *__hint
|
||||||
if (__hint.__ptr_->__left_ == nullptr)
|
if (__hint.__ptr_->__left_ == nullptr)
|
||||||
{
|
{
|
||||||
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
|
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = const_cast<__node_pointer&>(__prior.__ptr_);
|
__parent = static_cast<__node_base_pointer>(__prior.__ptr_);
|
||||||
return __parent->__right_;
|
return __parent->__right_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1667,12 +1674,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
|
|||||||
// *__hint < __v < *_VSTD::next(__hint)
|
// *__hint < __v < *_VSTD::next(__hint)
|
||||||
if (__hint.__ptr_->__right_ == nullptr)
|
if (__hint.__ptr_->__right_ == nullptr)
|
||||||
{
|
{
|
||||||
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
|
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
|
||||||
return __parent->__right_;
|
return __parent->__right_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = const_cast<__node_pointer&>(__next.__ptr_);
|
__parent = static_cast<__node_base_pointer>(__next.__ptr_);
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1680,7 +1687,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
|
|||||||
return __find_equal(__parent, __v);
|
return __find_equal(__parent, __v);
|
||||||
}
|
}
|
||||||
// else __v == *__hint
|
// else __v == *__hint
|
||||||
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
|
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
|
||||||
return __parent;
|
return __parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1709,7 +1716,7 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
|||||||
__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
|
__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
|
||||||
{
|
{
|
||||||
__node_allocator& __na = __node_alloc();
|
__node_allocator& __na = __node_alloc();
|
||||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
|
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
|
||||||
__h.get_deleter().__value_constructed = true;
|
__h.get_deleter().__value_constructed = true;
|
||||||
return __h;
|
return __h;
|
||||||
@ -1727,7 +1734,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_unique(_Args&&... __args)
|
|||||||
bool __inserted = false;
|
bool __inserted = false;
|
||||||
if (__child == nullptr)
|
if (__child == nullptr)
|
||||||
{
|
{
|
||||||
__insert_node_at(__parent, __child, __h.get());
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||||
__r = __h.release();
|
__r = __h.release();
|
||||||
__inserted = true;
|
__inserted = true;
|
||||||
}
|
}
|
||||||
@ -1745,7 +1752,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique(const_iterator __p, _Ar
|
|||||||
__node_pointer __r = static_cast<__node_pointer>(__child);
|
__node_pointer __r = static_cast<__node_pointer>(__child);
|
||||||
if (__child == nullptr)
|
if (__child == nullptr)
|
||||||
{
|
{
|
||||||
__insert_node_at(__parent, __child, __h.get());
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||||
__r = __h.release();
|
__r = __h.release();
|
||||||
}
|
}
|
||||||
return iterator(__r);
|
return iterator(__r);
|
||||||
@ -1759,7 +1766,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args)
|
|||||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
|
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
|
||||||
__insert_node_at(__parent, __child, __h.get());
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||||
return iterator(static_cast<__node_pointer>(__h.release()));
|
return iterator(static_cast<__node_pointer>(__h.release()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1772,18 +1779,18 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
|
|||||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
|
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
|
||||||
__insert_node_at(__parent, __child, __h.get());
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||||
return iterator(static_cast<__node_pointer>(__h.release()));
|
return iterator(static_cast<__node_pointer>(__h.release()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
template <class _V>
|
template <class _Vp>
|
||||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
|
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v)
|
||||||
{
|
{
|
||||||
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
|
||||||
pair<iterator, bool> __r = __node_insert_unique(__h.get());
|
pair<iterator, bool> __r = __node_insert_unique(__h.get());
|
||||||
if (__r.second)
|
if (__r.second)
|
||||||
__h.release();
|
__h.release();
|
||||||
@ -1791,11 +1798,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
template <class _V>
|
template <class _Vp>
|
||||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
|
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v)
|
||||||
{
|
{
|
||||||
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
|
||||||
iterator __r = __node_insert_unique(__p, __h.get());
|
iterator __r = __node_insert_unique(__p, __h.get());
|
||||||
if (__r.__ptr_ == __h.get())
|
if (__r.__ptr_ == __h.get())
|
||||||
__h.release();
|
__h.release();
|
||||||
@ -1803,26 +1810,26 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
template <class _V>
|
template <class _Vp>
|
||||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v)
|
__tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v)
|
||||||
{
|
{
|
||||||
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
|
||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
|
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
|
||||||
__insert_node_at(__parent, __child, __h.get());
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||||
return iterator(__h.release());
|
return iterator(__h.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
template <class _V>
|
template <class _Vp>
|
||||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _V&& __v)
|
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _Vp&& __v)
|
||||||
{
|
{
|
||||||
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
|
||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
|
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
|
||||||
__insert_node_at(__parent, __child, __h.get());
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||||
return iterator(__h.release());
|
return iterator(__h.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1833,10 +1840,10 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
|||||||
__tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
|
__tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
|
||||||
{
|
{
|
||||||
__node_allocator& __na = __node_alloc();
|
__node_allocator& __na = __node_alloc();
|
||||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
|
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
|
||||||
__h.get_deleter().__value_constructed = true;
|
__h.get_deleter().__value_constructed = true;
|
||||||
return _VSTD::move(__h);
|
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
@ -1852,7 +1859,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const value_type& __v)
|
|||||||
if (__child == nullptr)
|
if (__child == nullptr)
|
||||||
{
|
{
|
||||||
__node_holder __h = __construct_node(__v);
|
__node_holder __h = __construct_node(__v);
|
||||||
__insert_node_at(__parent, __child, __h.get());
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||||
__r = __h.release();
|
__r = __h.release();
|
||||||
__inserted = true;
|
__inserted = true;
|
||||||
}
|
}
|
||||||
@ -1869,7 +1876,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, const val
|
|||||||
if (__child == nullptr)
|
if (__child == nullptr)
|
||||||
{
|
{
|
||||||
__node_holder __h = __construct_node(__v);
|
__node_holder __h = __construct_node(__v);
|
||||||
__insert_node_at(__parent, __child, __h.get());
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||||
__r = __h.release();
|
__r = __h.release();
|
||||||
}
|
}
|
||||||
return iterator(__r);
|
return iterator(__r);
|
||||||
@ -1882,7 +1889,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const value_type& __v)
|
|||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf_high(__parent, __v);
|
__node_base_pointer& __child = __find_leaf_high(__parent, __v);
|
||||||
__node_holder __h = __construct_node(__v);
|
__node_holder __h = __construct_node(__v);
|
||||||
__insert_node_at(__parent, __child, __h.get());
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||||
return iterator(__h.release());
|
return iterator(__h.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1893,7 +1900,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const valu
|
|||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf(__p, __parent, __v);
|
__node_base_pointer& __child = __find_leaf(__p, __parent, __v);
|
||||||
__node_holder __h = __construct_node(__v);
|
__node_holder __h = __construct_node(__v);
|
||||||
__insert_node_at(__parent, __child, __h.get());
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||||
return iterator(__h.release());
|
return iterator(__h.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1907,7 +1914,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)
|
|||||||
bool __inserted = false;
|
bool __inserted = false;
|
||||||
if (__child == nullptr)
|
if (__child == nullptr)
|
||||||
{
|
{
|
||||||
__insert_node_at(__parent, __child, __nd);
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
|
||||||
__r = __nd;
|
__r = __nd;
|
||||||
__inserted = true;
|
__inserted = true;
|
||||||
}
|
}
|
||||||
@ -1924,7 +1931,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_unique(const_iterator __p,
|
|||||||
__node_pointer __r = static_cast<__node_pointer>(__child);
|
__node_pointer __r = static_cast<__node_pointer>(__child);
|
||||||
if (__child == nullptr)
|
if (__child == nullptr)
|
||||||
{
|
{
|
||||||
__insert_node_at(__parent, __child, __nd);
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
|
||||||
__r = __nd;
|
__r = __nd;
|
||||||
}
|
}
|
||||||
return iterator(__r);
|
return iterator(__r);
|
||||||
@ -1936,7 +1943,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_multi(__node_pointer __nd)
|
|||||||
{
|
{
|
||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf_high(__parent, __nd->__value_);
|
__node_base_pointer& __child = __find_leaf_high(__parent, __nd->__value_);
|
||||||
__insert_node_at(__parent, __child, __nd);
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
|
||||||
return iterator(__nd);
|
return iterator(__nd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1947,7 +1954,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p,
|
|||||||
{
|
{
|
||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf(__p, __parent, __nd->__value_);
|
__node_base_pointer& __child = __find_leaf(__p, __parent, __nd->__value_);
|
||||||
__insert_node_at(__parent, __child, __nd);
|
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
|
||||||
return iterator(__nd);
|
return iterator(__nd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1955,16 +1962,16 @@ template <class _Tp, class _Compare, class _Allocator>
|
|||||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||||
__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
|
__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
|
||||||
{
|
{
|
||||||
__node_pointer __np = const_cast<__node_pointer>(__p.__ptr_);
|
__node_pointer __np = __p.__ptr_;
|
||||||
iterator __r(__np);
|
iterator __r(__np);
|
||||||
++__r;
|
++__r;
|
||||||
if (__begin_node() == __np)
|
if (__begin_node() == __np)
|
||||||
__begin_node() = __r.__ptr_;
|
__begin_node() = __r.__ptr_;
|
||||||
--size();
|
--size();
|
||||||
__node_allocator& __na = __node_alloc();
|
__node_allocator& __na = __node_alloc();
|
||||||
__node_traits::destroy(__na, const_cast<value_type*>(_VSTD::addressof(*__p)));
|
|
||||||
__tree_remove(__end_node()->__left_,
|
__tree_remove(__end_node()->__left_,
|
||||||
static_cast<__node_base_pointer>(__np));
|
static_cast<__node_base_pointer>(__np));
|
||||||
|
__node_traits::destroy(__na, const_cast<value_type*>(_VSTD::addressof(*__p)));
|
||||||
__node_traits::deallocate(__na, __np, 1);
|
__node_traits::deallocate(__na, __np, 1);
|
||||||
return __r;
|
return __r;
|
||||||
}
|
}
|
||||||
@ -1975,7 +1982,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l)
|
|||||||
{
|
{
|
||||||
while (__f != __l)
|
while (__f != __l)
|
||||||
__f = erase(__f);
|
__f = erase(__f);
|
||||||
return iterator(const_cast<__node_pointer>(__l.__ptr_));
|
return iterator(__l.__ptr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@ -2051,7 +2058,6 @@ template <class _Key>
|
|||||||
typename __tree<_Tp, _Compare, _Allocator>::size_type
|
typename __tree<_Tp, _Compare, _Allocator>::size_type
|
||||||
__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
|
__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
|
||||||
{
|
{
|
||||||
typedef pair<const_iterator, const_iterator> _P;
|
|
||||||
__node_const_pointer __result = __end_node();
|
__node_const_pointer __result = __end_node();
|
||||||
__node_const_pointer __rt = __root();
|
__node_const_pointer __rt = __root();
|
||||||
while (__rt != nullptr)
|
while (__rt != nullptr)
|
||||||
@ -2158,7 +2164,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
|
|||||||
typename __tree<_Tp, _Compare, _Allocator>::iterator>
|
typename __tree<_Tp, _Compare, _Allocator>::iterator>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
|
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
|
||||||
{
|
{
|
||||||
typedef pair<iterator, iterator> _P;
|
typedef pair<iterator, iterator> _Pp;
|
||||||
__node_pointer __result = __end_node();
|
__node_pointer __result = __end_node();
|
||||||
__node_pointer __rt = __root();
|
__node_pointer __rt = __root();
|
||||||
while (__rt != nullptr)
|
while (__rt != nullptr)
|
||||||
@ -2171,13 +2177,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
|
|||||||
else if (value_comp()(__rt->__value_, __k))
|
else if (value_comp()(__rt->__value_, __k))
|
||||||
__rt = static_cast<__node_pointer>(__rt->__right_);
|
__rt = static_cast<__node_pointer>(__rt->__right_);
|
||||||
else
|
else
|
||||||
return _P(iterator(__rt),
|
return _Pp(iterator(__rt),
|
||||||
iterator(
|
iterator(
|
||||||
__rt->__right_ != nullptr ?
|
__rt->__right_ != nullptr ?
|
||||||
static_cast<__node_pointer>(__tree_min(__rt->__right_))
|
static_cast<__node_pointer>(__tree_min(__rt->__right_))
|
||||||
: __result));
|
: __result));
|
||||||
}
|
}
|
||||||
return _P(iterator(__result), iterator(__result));
|
return _Pp(iterator(__result), iterator(__result));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@ -2186,7 +2192,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
|
|||||||
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
|
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
|
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
|
||||||
{
|
{
|
||||||
typedef pair<const_iterator, const_iterator> _P;
|
typedef pair<const_iterator, const_iterator> _Pp;
|
||||||
__node_const_pointer __result = __end_node();
|
__node_const_pointer __result = __end_node();
|
||||||
__node_const_pointer __rt = __root();
|
__node_const_pointer __rt = __root();
|
||||||
while (__rt != nullptr)
|
while (__rt != nullptr)
|
||||||
@ -2199,13 +2205,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
|
|||||||
else if (value_comp()(__rt->__value_, __k))
|
else if (value_comp()(__rt->__value_, __k))
|
||||||
__rt = static_cast<__node_const_pointer>(__rt->__right_);
|
__rt = static_cast<__node_const_pointer>(__rt->__right_);
|
||||||
else
|
else
|
||||||
return _P(const_iterator(__rt),
|
return _Pp(const_iterator(__rt),
|
||||||
const_iterator(
|
const_iterator(
|
||||||
__rt->__right_ != nullptr ?
|
__rt->__right_ != nullptr ?
|
||||||
static_cast<__node_const_pointer>(__tree_min(__rt->__right_))
|
static_cast<__node_const_pointer>(__tree_min(__rt->__right_))
|
||||||
: __result));
|
: __result));
|
||||||
}
|
}
|
||||||
return _P(const_iterator(__result), const_iterator(__result));
|
return _Pp(const_iterator(__result), const_iterator(__result));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@ -2214,7 +2220,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
|
|||||||
typename __tree<_Tp, _Compare, _Allocator>::iterator>
|
typename __tree<_Tp, _Compare, _Allocator>::iterator>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
|
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
|
||||||
{
|
{
|
||||||
typedef pair<iterator, iterator> _P;
|
typedef pair<iterator, iterator> _Pp;
|
||||||
__node_pointer __result = __end_node();
|
__node_pointer __result = __end_node();
|
||||||
__node_pointer __rt = __root();
|
__node_pointer __rt = __root();
|
||||||
while (__rt != nullptr)
|
while (__rt != nullptr)
|
||||||
@ -2227,10 +2233,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
|
|||||||
else if (value_comp()(__rt->__value_, __k))
|
else if (value_comp()(__rt->__value_, __k))
|
||||||
__rt = static_cast<__node_pointer>(__rt->__right_);
|
__rt = static_cast<__node_pointer>(__rt->__right_);
|
||||||
else
|
else
|
||||||
return _P(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
|
return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
|
||||||
__upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
|
__upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
|
||||||
}
|
}
|
||||||
return _P(iterator(__result), iterator(__result));
|
return _Pp(iterator(__result), iterator(__result));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@ -2239,7 +2245,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
|
|||||||
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
|
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
|
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
|
||||||
{
|
{
|
||||||
typedef pair<const_iterator, const_iterator> _P;
|
typedef pair<const_iterator, const_iterator> _Pp;
|
||||||
__node_const_pointer __result = __end_node();
|
__node_const_pointer __result = __end_node();
|
||||||
__node_const_pointer __rt = __root();
|
__node_const_pointer __rt = __root();
|
||||||
while (__rt != nullptr)
|
while (__rt != nullptr)
|
||||||
@ -2252,17 +2258,17 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
|
|||||||
else if (value_comp()(__rt->__value_, __k))
|
else if (value_comp()(__rt->__value_, __k))
|
||||||
__rt = static_cast<__node_const_pointer>(__rt->__right_);
|
__rt = static_cast<__node_const_pointer>(__rt->__right_);
|
||||||
else
|
else
|
||||||
return _P(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
|
return _Pp(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
|
||||||
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result));
|
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result));
|
||||||
}
|
}
|
||||||
return _P(const_iterator(__result), const_iterator(__result));
|
return _Pp(const_iterator(__result), const_iterator(__result));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
||||||
__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
|
__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
|
||||||
{
|
{
|
||||||
__node_pointer __np = const_cast<__node_pointer>(__p.__ptr_);
|
__node_pointer __np = __p.__ptr_;
|
||||||
if (__begin_node() == __np)
|
if (__begin_node() == __np)
|
||||||
{
|
{
|
||||||
if (__np->__right_ != nullptr)
|
if (__np->__right_ != nullptr)
|
||||||
@ -2273,7 +2279,7 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
|
|||||||
--size();
|
--size();
|
||||||
__tree_remove(__end_node()->__left_,
|
__tree_remove(__end_node()->__left_,
|
||||||
static_cast<__node_base_pointer>(__np));
|
static_cast<__node_base_pointer>(__np));
|
||||||
return __node_holder(__np, _D(__node_alloc()));
|
return __node_holder(__np, _Dp(__node_alloc(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
|
176
include/__tuple
176
include/__tuple
@ -15,103 +15,142 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
|
|
||||||
#include <__tuple_03>
|
|
||||||
|
|
||||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
|
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_size;
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
class _LIBCPP_VISIBLE tuple_size<const _Tp>
|
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const _Tp>
|
||||||
: public tuple_size<_Tp> {};
|
: public tuple_size<_Tp> {};
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
class _LIBCPP_VISIBLE tuple_size<volatile _Tp>
|
class _LIBCPP_TYPE_VIS_ONLY tuple_size<volatile _Tp>
|
||||||
: public tuple_size<_Tp> {};
|
: public tuple_size<_Tp> {};
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
class _LIBCPP_VISIBLE tuple_size<const volatile _Tp>
|
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const volatile _Tp>
|
||||||
: public tuple_size<_Tp> {};
|
: public tuple_size<_Tp> {};
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
|
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_element;
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp>
|
template <size_t _Ip, class _Tp>
|
||||||
class _LIBCPP_VISIBLE tuple_element<_Ip, const _Tp>
|
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const _Tp>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
|
typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp>
|
template <size_t _Ip, class _Tp>
|
||||||
class _LIBCPP_VISIBLE tuple_element<_Ip, volatile _Tp>
|
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, volatile _Tp>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
|
typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp>
|
template <size_t _Ip, class _Tp>
|
||||||
class _LIBCPP_VISIBLE tuple_element<_Ip, const volatile _Tp>
|
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const volatile _Tp>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
|
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class ..._Tp> class _LIBCPP_VISIBLE tuple;
|
|
||||||
template <class _T1, class _T2> class _LIBCPP_VISIBLE pair;
|
|
||||||
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
|
|
||||||
|
|
||||||
template <class _Tp> struct __tuple_like : false_type {};
|
template <class _Tp> struct __tuple_like : false_type {};
|
||||||
|
|
||||||
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
|
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
|
||||||
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
|
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
|
||||||
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
|
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
|
||||||
|
|
||||||
|
// tuple specializations
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||||
|
template <class ..._Tp> class _LIBCPP_TYPE_VIS_ONLY tuple;
|
||||||
|
|
||||||
template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
|
template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
|
||||||
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
|
|
||||||
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
|
|
||||||
|
|
||||||
template <size_t _Ip, class ..._Tp>
|
template <size_t _Ip, class ..._Tp>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||||
get(tuple<_Tp...>&) _NOEXCEPT;
|
get(tuple<_Tp...>&) _NOEXCEPT;
|
||||||
|
|
||||||
template <size_t _Ip, class ..._Tp>
|
template <size_t _Ip, class ..._Tp>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||||
get(const tuple<_Tp...>&) _NOEXCEPT;
|
get(const tuple<_Tp...>&) _NOEXCEPT;
|
||||||
|
|
||||||
template <size_t _Ip, class ..._Tp>
|
template <size_t _Ip, class ..._Tp>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
||||||
get(tuple<_Tp...>&&) _NOEXCEPT;
|
get(tuple<_Tp...>&&) _NOEXCEPT;
|
||||||
|
|
||||||
|
template <size_t _Ip, class ..._Tp>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
|
const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
||||||
|
get(const tuple<_Tp...>&&) _NOEXCEPT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// pair specializations
|
||||||
|
|
||||||
|
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY pair;
|
||||||
|
|
||||||
|
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
|
||||||
|
|
||||||
template <size_t _Ip, class _T1, class _T2>
|
template <size_t _Ip, class _T1, class _T2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||||
get(pair<_T1, _T2>&) _NOEXCEPT;
|
get(pair<_T1, _T2>&) _NOEXCEPT;
|
||||||
|
|
||||||
template <size_t _Ip, class _T1, class _T2>
|
template <size_t _Ip, class _T1, class _T2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||||
get(const pair<_T1, _T2>&) _NOEXCEPT;
|
get(const pair<_T1, _T2>&) _NOEXCEPT;
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||||
template <size_t _Ip, class _T1, class _T2>
|
template <size_t _Ip, class _T1, class _T2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||||
get(pair<_T1, _T2>&&) _NOEXCEPT;
|
get(pair<_T1, _T2>&&) _NOEXCEPT;
|
||||||
|
|
||||||
|
template <size_t _Ip, class _T1, class _T2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
|
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||||
|
get(const pair<_T1, _T2>&&) _NOEXCEPT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// array specializations
|
||||||
|
|
||||||
|
template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY array;
|
||||||
|
|
||||||
|
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
_Tp&
|
_Tp&
|
||||||
get(array<_Tp, _Size>&) _NOEXCEPT;
|
get(array<_Tp, _Size>&) _NOEXCEPT;
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
const _Tp&
|
const _Tp&
|
||||||
get(const array<_Tp, _Size>&) _NOEXCEPT;
|
get(const array<_Tp, _Size>&) _NOEXCEPT;
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
_Tp&&
|
_Tp&&
|
||||||
get(array<_Tp, _Size>&&) _NOEXCEPT;
|
get(array<_Tp, _Size>&&) _NOEXCEPT;
|
||||||
|
|
||||||
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
|
const _Tp&&
|
||||||
|
get(const array<_Tp, _Size>&&) _NOEXCEPT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||||
|
|
||||||
// __make_tuple_indices
|
// __make_tuple_indices
|
||||||
|
|
||||||
template <size_t...> struct __tuple_indices {};
|
template <size_t...> struct __tuple_indices {};
|
||||||
@ -143,7 +182,7 @@ struct __make_tuple_indices
|
|||||||
template <class ..._Tp> struct __tuple_types {};
|
template <class ..._Tp> struct __tuple_types {};
|
||||||
|
|
||||||
template <size_t _Ip>
|
template <size_t _Ip>
|
||||||
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<> >
|
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static_assert(_Ip == 0, "tuple_element index out of range");
|
static_assert(_Ip == 0, "tuple_element index out of range");
|
||||||
@ -151,21 +190,21 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _Hp, class ..._Tp>
|
template <class _Hp, class ..._Tp>
|
||||||
class _LIBCPP_VISIBLE tuple_element<0, __tuple_types<_Hp, _Tp...> >
|
class _LIBCPP_TYPE_VIS_ONLY tuple_element<0, __tuple_types<_Hp, _Tp...> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Hp type;
|
typedef _Hp type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _Ip, class _Hp, class ..._Tp>
|
template <size_t _Ip, class _Hp, class ..._Tp>
|
||||||
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
|
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
|
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class ..._Tp>
|
template <class ..._Tp>
|
||||||
class _LIBCPP_VISIBLE tuple_size<__tuple_types<_Tp...> >
|
class _LIBCPP_TYPE_VIS_ONLY tuple_size<__tuple_types<_Tp...> >
|
||||||
: public integral_constant<size_t, sizeof...(_Tp)>
|
: public integral_constant<size_t, sizeof...(_Tp)>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
@ -208,19 +247,30 @@ struct __make_tuple_types
|
|||||||
|
|
||||||
// __tuple_convertible
|
// __tuple_convertible
|
||||||
|
|
||||||
template <bool, class _Tp, class _Up>
|
template <class, class>
|
||||||
struct __tuple_convertible_imp : public false_type {};
|
struct __tuple_convertible_imp : public false_type {};
|
||||||
|
|
||||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||||
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
struct __tuple_convertible_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||||
: public integral_constant<bool,
|
: public integral_constant<bool,
|
||||||
is_constructible<_Up0, _Tp0>::value &&
|
is_convertible<_Tp0, _Up0>::value &&
|
||||||
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
__tuple_convertible_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<> >
|
struct __tuple_convertible_imp<__tuple_types<>, __tuple_types<> >
|
||||||
: public true_type {};
|
: public true_type {};
|
||||||
|
|
||||||
|
template <bool, class, class>
|
||||||
|
struct __tuple_convertible_apply : public false_type {};
|
||||||
|
|
||||||
|
template <class _Tp, class _Up>
|
||||||
|
struct __tuple_convertible_apply<true, _Tp, _Up>
|
||||||
|
: public __tuple_convertible_imp<
|
||||||
|
typename __make_tuple_types<_Tp>::type
|
||||||
|
, typename __make_tuple_types<_Up>::type
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||||
bool = __tuple_like<_Up>::value>
|
bool = __tuple_like<_Up>::value>
|
||||||
struct __tuple_convertible
|
struct __tuple_convertible
|
||||||
@ -228,26 +278,73 @@ struct __tuple_convertible
|
|||||||
|
|
||||||
template <class _Tp, class _Up>
|
template <class _Tp, class _Up>
|
||||||
struct __tuple_convertible<_Tp, _Up, true, true>
|
struct __tuple_convertible<_Tp, _Up, true, true>
|
||||||
: public __tuple_convertible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
: public __tuple_convertible_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||||
tuple_size<_Up>::value,
|
tuple_size<_Up>::value, _Tp, _Up>
|
||||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
{};
|
||||||
|
|
||||||
|
// __tuple_constructible
|
||||||
|
|
||||||
|
template <class, class>
|
||||||
|
struct __tuple_constructible_imp : public false_type {};
|
||||||
|
|
||||||
|
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||||
|
struct __tuple_constructible_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||||
|
: public integral_constant<bool,
|
||||||
|
is_constructible<_Up0, _Tp0>::value &&
|
||||||
|
__tuple_constructible_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct __tuple_constructible_imp<__tuple_types<>, __tuple_types<> >
|
||||||
|
: public true_type {};
|
||||||
|
|
||||||
|
template <bool _SameSize, class, class>
|
||||||
|
struct __tuple_constructible_apply : public false_type {};
|
||||||
|
|
||||||
|
template <class _Tp, class _Up>
|
||||||
|
struct __tuple_constructible_apply<true, _Tp, _Up>
|
||||||
|
: public __tuple_constructible_imp<
|
||||||
|
typename __make_tuple_types<_Tp>::type
|
||||||
|
, typename __make_tuple_types<_Up>::type
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||||
|
bool = __tuple_like<_Up>::value>
|
||||||
|
struct __tuple_constructible
|
||||||
|
: public false_type {};
|
||||||
|
|
||||||
|
template <class _Tp, class _Up>
|
||||||
|
struct __tuple_constructible<_Tp, _Up, true, true>
|
||||||
|
: public __tuple_constructible_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||||
|
tuple_size<_Up>::value, _Tp, _Up>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
// __tuple_assignable
|
// __tuple_assignable
|
||||||
|
|
||||||
template <bool, class _Tp, class _Up>
|
template <class, class>
|
||||||
struct __tuple_assignable_imp : public false_type {};
|
struct __tuple_assignable_imp : public false_type {};
|
||||||
|
|
||||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||||
struct __tuple_assignable_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
struct __tuple_assignable_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||||
: public integral_constant<bool,
|
: public integral_constant<bool,
|
||||||
is_assignable<_Up0&, _Tp0>::value &&
|
is_assignable<_Up0&, _Tp0>::value &&
|
||||||
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
__tuple_assignable_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct __tuple_assignable_imp<true, __tuple_types<>, __tuple_types<> >
|
struct __tuple_assignable_imp<__tuple_types<>, __tuple_types<> >
|
||||||
: public true_type {};
|
: public true_type {};
|
||||||
|
|
||||||
|
template <bool, class, class>
|
||||||
|
struct __tuple_assignable_apply : public false_type {};
|
||||||
|
|
||||||
|
template <class _Tp, class _Up>
|
||||||
|
struct __tuple_assignable_apply<true, _Tp, _Up>
|
||||||
|
: __tuple_assignable_imp<
|
||||||
|
typename __make_tuple_types<_Tp>::type
|
||||||
|
, typename __make_tuple_types<_Up>::type
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||||
bool = __tuple_like<_Up>::value>
|
bool = __tuple_like<_Up>::value>
|
||||||
struct __tuple_assignable
|
struct __tuple_assignable
|
||||||
@ -255,13 +352,12 @@ struct __tuple_assignable
|
|||||||
|
|
||||||
template <class _Tp, class _Up>
|
template <class _Tp, class _Up>
|
||||||
struct __tuple_assignable<_Tp, _Up, true, true>
|
struct __tuple_assignable<_Tp, _Up, true, true>
|
||||||
: public __tuple_assignable_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
: public __tuple_assignable_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||||
tuple_size<_Up>::value,
|
tuple_size<_Up>::value, _Tp, _Up>
|
||||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
|
||||||
{};
|
{};
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP___TUPLE
|
#endif // _LIBCPP___TUPLE
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#ifndef _LIBCPP___TUPLE_03
|
|
||||||
#define _LIBCPP___TUPLE_03
|
|
||||||
|
|
||||||
#include <__config>
|
|
||||||
|
|
||||||
#pragma GCC system_header
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
||||||
|
|
||||||
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
|
|
||||||
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
|
||||||
|
|
||||||
#endif // _LIBCPP___TUPLE_03
|
|
18
include/__undef___deallocate
Normal file
18
include/__undef___deallocate
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifdef __deallocate
|
||||||
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
|
_LIBCPP_WARNING("macro __deallocate is incompatible with C++. #undefining __deallocate")
|
||||||
|
#else
|
||||||
|
#warning: macro __deallocate is incompatible with C++. #undefining __deallocate
|
||||||
|
#endif
|
||||||
|
#undef __deallocate
|
||||||
|
#endif
|
29
include/__undef_min_max
Normal file
29
include/__undef_min_max
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifdef min
|
||||||
|
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||||
|
_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
|
||||||
|
"before any Windows header. #undefing min")
|
||||||
|
#else
|
||||||
|
#warning: macro min is incompatible with C++. #undefing min
|
||||||
|
#endif
|
||||||
|
#undef min
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef max
|
||||||
|
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||||
|
_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
|
||||||
|
"before any Windows header. #undefing max")
|
||||||
|
#else
|
||||||
|
#warning: macro max is incompatible with C++. #undefing max
|
||||||
|
#endif
|
||||||
|
#undef max
|
||||||
|
#endif
|
1319
include/algorithm
1319
include/algorithm
File diff suppressed because it is too large
Load Diff
@ -55,18 +55,18 @@ struct array
|
|||||||
// capacity:
|
// capacity:
|
||||||
constexpr size_type size() const noexcept;
|
constexpr size_type size() const noexcept;
|
||||||
constexpr size_type max_size() const noexcept;
|
constexpr size_type max_size() const noexcept;
|
||||||
bool empty() const noexcept;
|
constexpr bool empty() const noexcept;
|
||||||
|
|
||||||
// element access:
|
// element access:
|
||||||
reference operator[](size_type n);
|
reference operator[](size_type n);
|
||||||
const_reference operator[](size_type n) const;
|
const_reference operator[](size_type n) const; // constexpr in C++14
|
||||||
const_reference at(size_type n) const;
|
const_reference at(size_type n) const; // constexpr in C++14
|
||||||
reference at(size_type n);
|
reference at(size_type n);
|
||||||
|
|
||||||
reference front();
|
reference front();
|
||||||
const_reference front() const;
|
const_reference front() const; // constexpr in C++14
|
||||||
reference back();
|
reference back();
|
||||||
const_reference back() const;
|
const_reference back() const; // constexpr in C++14
|
||||||
|
|
||||||
T* data() noexcept;
|
T* data() noexcept;
|
||||||
const T* data() const noexcept;
|
const T* data() const noexcept;
|
||||||
@ -89,12 +89,13 @@ template <class T, size_t N >
|
|||||||
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
|
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
|
||||||
|
|
||||||
template <class T> class tuple_size;
|
template <class T> class tuple_size;
|
||||||
template <int I, class T> class tuple_element;
|
template <size_t I, class T> class tuple_element;
|
||||||
template <class T, size_t N> struct tuple_size<array<T, N>>;
|
template <class T, size_t N> struct tuple_size<array<T, N>>;
|
||||||
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
|
template <size_t I, class T, size_t N> struct tuple_element<I, array<T, N>>;
|
||||||
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept;
|
template <size_t I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
|
||||||
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept;
|
template <size_t I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14
|
||||||
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
|
template <size_t I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
|
||||||
|
template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexcept; // constexpr in C++14
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
|
||||||
@ -111,12 +112,14 @@ template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
struct _LIBCPP_VISIBLE array
|
struct _LIBCPP_TYPE_VIS_ONLY array
|
||||||
{
|
{
|
||||||
// types:
|
// types:
|
||||||
typedef array __self;
|
typedef array __self;
|
||||||
@ -171,22 +174,22 @@ struct _LIBCPP_VISIBLE array
|
|||||||
|
|
||||||
// capacity:
|
// capacity:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/ size_type size() const _NOEXCEPT {return _Size;}
|
_LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;}
|
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool empty() const _NOEXCEPT {return _Size == 0;}
|
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
|
||||||
|
|
||||||
// element access:
|
// element access:
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
|
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
|
||||||
_LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const {return __elems_[__n];}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type __n) const {return __elems_[__n];}
|
||||||
reference at(size_type __n);
|
reference at(size_type __n);
|
||||||
const_reference at(size_type __n) const;
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];}
|
_LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];}
|
||||||
_LIBCPP_INLINE_VISIBILITY const_reference front() const {return __elems_[0];}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}
|
||||||
_LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
_LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||||
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
value_type* data() _NOEXCEPT {return __elems_;}
|
value_type* data() _NOEXCEPT {return __elems_;}
|
||||||
@ -208,6 +211,7 @@ array<_Tp, _Size>::at(size_type __n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
typename array<_Tp, _Size>::const_reference
|
typename array<_Tp, _Size>::const_reference
|
||||||
array<_Tp, _Size>::at(size_type __n) const
|
array<_Tp, _Size>::at(size_type __n) const
|
||||||
{
|
{
|
||||||
@ -221,7 +225,7 @@ array<_Tp, _Size>::at(size_type __n) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||||
{
|
{
|
||||||
@ -229,7 +233,7 @@ operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||||
{
|
{
|
||||||
@ -237,7 +241,7 @@ operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||||
{
|
{
|
||||||
@ -245,7 +249,7 @@ operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||||
{
|
{
|
||||||
@ -253,7 +257,7 @@ operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||||
{
|
{
|
||||||
@ -261,7 +265,7 @@ operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||||
{
|
{
|
||||||
@ -269,7 +273,7 @@ operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
__is_swappable<_Tp>::value,
|
__is_swappable<_Tp>::value,
|
||||||
@ -282,51 +286,52 @@ swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
class _LIBCPP_VISIBLE tuple_size<array<_Tp, _Size> >
|
class _LIBCPP_TYPE_VIS_ONLY tuple_size<array<_Tp, _Size> >
|
||||||
: public integral_constant<size_t, _Size> {};
|
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
|
||||||
class _LIBCPP_VISIBLE tuple_size<const array<_Tp, _Size> >
|
|
||||||
: public integral_constant<size_t, _Size> {};
|
: public integral_constant<size_t, _Size> {};
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
class _LIBCPP_VISIBLE tuple_element<_Ip, array<_Tp, _Size> >
|
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, array<_Tp, _Size> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Tp type;
|
typedef _Tp type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
class _LIBCPP_VISIBLE tuple_element<_Ip, const array<_Tp, _Size> >
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef const _Tp type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
|
||||||
_Tp&
|
_Tp&
|
||||||
get(array<_Tp, _Size>& __a) _NOEXCEPT
|
get(array<_Tp, _Size>& __a) _NOEXCEPT
|
||||||
{
|
{
|
||||||
return __a[_Ip];
|
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
|
||||||
|
return __a.__elems_[_Ip];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
const _Tp&
|
const _Tp&
|
||||||
get(const array<_Tp, _Size>& __a) _NOEXCEPT
|
get(const array<_Tp, _Size>& __a) _NOEXCEPT
|
||||||
{
|
{
|
||||||
return __a[_Ip];
|
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
|
||||||
|
return __a.__elems_[_Ip];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
_Tp&&
|
_Tp&&
|
||||||
get(array<_Tp, _Size>&& __a) _NOEXCEPT
|
get(array<_Tp, _Size>&& __a) _NOEXCEPT
|
||||||
{
|
{
|
||||||
return _VSTD::move(__a[_Ip]);
|
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
|
||||||
|
return _VSTD::move(__a.__elems_[_Ip]);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
|
const _Tp&&
|
||||||
|
get(const array<_Tp, _Size>&& __a) _NOEXCEPT
|
||||||
|
{
|
||||||
|
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array &&)");
|
||||||
|
return _VSTD::move(__a.__elems_[_Ip]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
1046
include/atomic
1046
include/atomic
File diff suppressed because it is too large
Load Diff
225
include/bitset
225
include/bitset
@ -113,7 +113,9 @@ template <size_t N> struct hash<std::bitset<N>>;
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
#include <__bit_reference>
|
#include <__bit_reference>
|
||||||
@ -127,6 +129,8 @@ template <size_t N> struct hash<std::bitset<N>>;
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <__undef_min_max>
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
@ -144,9 +148,9 @@ class __bitset
|
|||||||
public:
|
public:
|
||||||
typedef ptrdiff_t difference_type;
|
typedef ptrdiff_t difference_type;
|
||||||
typedef size_t size_type;
|
typedef size_t size_type;
|
||||||
|
typedef size_type __storage_type;
|
||||||
protected:
|
protected:
|
||||||
typedef __bitset __self;
|
typedef __bitset __self;
|
||||||
typedef size_type __storage_type;
|
|
||||||
typedef __storage_type* __storage_pointer;
|
typedef __storage_type* __storage_pointer;
|
||||||
typedef const __storage_type* __const_storage_pointer;
|
typedef const __storage_type* __const_storage_pointer;
|
||||||
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
||||||
@ -155,7 +159,7 @@ protected:
|
|||||||
friend class __bit_const_reference<__bitset>;
|
friend class __bit_const_reference<__bitset>;
|
||||||
friend class __bit_iterator<__bitset, false>;
|
friend class __bit_iterator<__bitset, false>;
|
||||||
friend class __bit_iterator<__bitset, true>;
|
friend class __bit_iterator<__bitset, true>;
|
||||||
friend class __bit_array<__bitset>;
|
friend struct __bit_array<__bitset>;
|
||||||
|
|
||||||
__storage_type __first_[_N_words];
|
__storage_type __first_[_N_words];
|
||||||
|
|
||||||
@ -164,20 +168,25 @@ protected:
|
|||||||
typedef __bit_iterator<__bitset, false> iterator;
|
typedef __bit_iterator<__bitset, false> iterator;
|
||||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||||
|
|
||||||
__bitset() _NOEXCEPT;
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __bitset(unsigned long long __v) _NOEXCEPT;
|
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
|
||||||
{return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
|
{return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
|
||||||
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
|
||||||
{return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
|
{return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
|
||||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
||||||
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
||||||
{return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
{return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void operator&=(const __bitset& __v) _NOEXCEPT;
|
void operator&=(const __bitset& __v) _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void operator|=(const __bitset& __v) _NOEXCEPT;
|
void operator|=(const __bitset& __v) _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void operator^=(const __bitset& __v) _NOEXCEPT;
|
void operator^=(const __bitset& __v) _NOEXCEPT;
|
||||||
|
|
||||||
void flip() _NOEXCEPT;
|
void flip() _NOEXCEPT;
|
||||||
@ -188,28 +197,43 @@ protected:
|
|||||||
|
|
||||||
bool all() const _NOEXCEPT;
|
bool all() const _NOEXCEPT;
|
||||||
bool any() const _NOEXCEPT;
|
bool any() const _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_t __hash_code() const _NOEXCEPT;
|
size_t __hash_code() const _NOEXCEPT;
|
||||||
private:
|
private:
|
||||||
|
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
void __init(unsigned long long __v, false_type) _NOEXCEPT;
|
void __init(unsigned long long __v, false_type) _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __init(unsigned long long __v, true_type) _NOEXCEPT;
|
void __init(unsigned long long __v, true_type) _NOEXCEPT;
|
||||||
|
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
unsigned long to_ulong(false_type) const;
|
unsigned long to_ulong(false_type) const;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long to_ulong(true_type) const;
|
unsigned long to_ulong(true_type) const;
|
||||||
unsigned long long to_ullong(false_type) const;
|
unsigned long long to_ullong(false_type) const;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long long to_ullong(true_type) const;
|
unsigned long long to_ullong(true_type) const;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long long to_ullong(true_type, false_type) const;
|
unsigned long long to_ullong(true_type, false_type) const;
|
||||||
unsigned long long to_ullong(true_type, true_type) const;
|
unsigned long long to_ullong(true_type, true_type) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
|
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
|
||||||
|
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
|
: __first_{0}
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
_VSTD::fill_n(__first_, _N_words, __storage_type(0));
|
_VSTD::fill_n(__first_, _N_words, __storage_type(0));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
void
|
void
|
||||||
__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type)
|
__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
|
||||||
{
|
{
|
||||||
__storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
|
__storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
|
||||||
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
|
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
|
||||||
@ -222,21 +246,35 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type)
|
|||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type)
|
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
|
||||||
{
|
{
|
||||||
__first_[0] = __v;
|
__first_[0] = __v;
|
||||||
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
|
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
||||||
|
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
|
#if __SIZEOF_SIZE_T__ == 8
|
||||||
|
: __first_{__v}
|
||||||
|
#elif __SIZEOF_SIZE_T__ == 4
|
||||||
|
: __first_{__v, __v >> __bits_per_word}
|
||||||
|
#else
|
||||||
|
#error This constructor has not been ported to this platform
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
|
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
void
|
void
|
||||||
__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -245,7 +283,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
void
|
void
|
||||||
__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -254,7 +292,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
void
|
void
|
||||||
__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -297,7 +335,7 @@ __bitset<_N_words, _Size>::to_ulong(false_type) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
unsigned long
|
unsigned long
|
||||||
__bitset<_N_words, _Size>::to_ulong(true_type) const
|
__bitset<_N_words, _Size>::to_ulong(true_type) const
|
||||||
{
|
{
|
||||||
@ -320,7 +358,7 @@ __bitset<_N_words, _Size>::to_ullong(false_type) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
unsigned long long
|
unsigned long long
|
||||||
__bitset<_N_words, _Size>::to_ullong(true_type) const
|
__bitset<_N_words, _Size>::to_ullong(true_type) const
|
||||||
{
|
{
|
||||||
@ -328,7 +366,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
unsigned long long
|
unsigned long long
|
||||||
__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const
|
__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const
|
||||||
{
|
{
|
||||||
@ -386,7 +424,7 @@ __bitset<_N_words, _Size>::any() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
size_t
|
size_t
|
||||||
__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
|
__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -402,9 +440,9 @@ class __bitset<1, _Size>
|
|||||||
public:
|
public:
|
||||||
typedef ptrdiff_t difference_type;
|
typedef ptrdiff_t difference_type;
|
||||||
typedef size_t size_type;
|
typedef size_t size_type;
|
||||||
|
typedef size_type __storage_type;
|
||||||
protected:
|
protected:
|
||||||
typedef __bitset __self;
|
typedef __bitset __self;
|
||||||
typedef size_type __storage_type;
|
|
||||||
typedef __storage_type* __storage_pointer;
|
typedef __storage_type* __storage_pointer;
|
||||||
typedef const __storage_type* __const_storage_pointer;
|
typedef const __storage_type* __const_storage_pointer;
|
||||||
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
||||||
@ -413,7 +451,7 @@ protected:
|
|||||||
friend class __bit_const_reference<__bitset>;
|
friend class __bit_const_reference<__bitset>;
|
||||||
friend class __bit_iterator<__bitset, false>;
|
friend class __bit_iterator<__bitset, false>;
|
||||||
friend class __bit_iterator<__bitset, true>;
|
friend class __bit_iterator<__bitset, true>;
|
||||||
friend class __bit_array<__bitset>;
|
friend struct __bit_array<__bitset>;
|
||||||
|
|
||||||
__storage_type __first_;
|
__storage_type __first_;
|
||||||
|
|
||||||
@ -422,49 +460,62 @@ protected:
|
|||||||
typedef __bit_iterator<__bitset, false> iterator;
|
typedef __bit_iterator<__bitset, false> iterator;
|
||||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||||
|
|
||||||
__bitset() _NOEXCEPT;
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __bitset(unsigned long long __v) _NOEXCEPT;
|
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
|
||||||
{return reference(&__first_, __storage_type(1) << __pos);}
|
{return reference(&__first_, __storage_type(1) << __pos);}
|
||||||
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
|
||||||
{return const_reference(&__first_, __storage_type(1) << __pos);}
|
{return const_reference(&__first_, __storage_type(1) << __pos);}
|
||||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
||||||
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
||||||
{return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
{return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void operator&=(const __bitset& __v) _NOEXCEPT;
|
void operator&=(const __bitset& __v) _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void operator|=(const __bitset& __v) _NOEXCEPT;
|
void operator|=(const __bitset& __v) _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void operator^=(const __bitset& __v) _NOEXCEPT;
|
void operator^=(const __bitset& __v) _NOEXCEPT;
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void flip() _NOEXCEPT;
|
void flip() _NOEXCEPT;
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long to_ulong() const;
|
unsigned long to_ulong() const;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long long to_ullong() const;
|
unsigned long long to_ullong() const;
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool all() const _NOEXCEPT;
|
bool all() const _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool any() const _NOEXCEPT;
|
bool any() const _NOEXCEPT;
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_t __hash_code() const _NOEXCEPT;
|
size_t __hash_code() const _NOEXCEPT;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
__bitset<1, _Size>::__bitset() _NOEXCEPT
|
__bitset<1, _Size>::__bitset() _NOEXCEPT
|
||||||
: __first_(0)
|
: __first_(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
||||||
: __first_(static_cast<__storage_type>(__v))
|
: __first_(static_cast<__storage_type>(__v))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
void
|
void
|
||||||
__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -472,7 +523,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
void
|
void
|
||||||
__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -480,7 +531,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
void
|
void
|
||||||
__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -488,7 +539,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
void
|
void
|
||||||
__bitset<1, _Size>::flip() _NOEXCEPT
|
__bitset<1, _Size>::flip() _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -498,7 +549,7 @@ __bitset<1, _Size>::flip() _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
unsigned long
|
unsigned long
|
||||||
__bitset<1, _Size>::to_ulong() const
|
__bitset<1, _Size>::to_ulong() const
|
||||||
{
|
{
|
||||||
@ -506,7 +557,7 @@ __bitset<1, _Size>::to_ulong() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
unsigned long long
|
unsigned long long
|
||||||
__bitset<1, _Size>::to_ullong() const
|
__bitset<1, _Size>::to_ullong() const
|
||||||
{
|
{
|
||||||
@ -514,7 +565,7 @@ __bitset<1, _Size>::to_ullong() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bool
|
bool
|
||||||
__bitset<1, _Size>::all() const _NOEXCEPT
|
__bitset<1, _Size>::all() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -523,7 +574,7 @@ __bitset<1, _Size>::all() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bool
|
bool
|
||||||
__bitset<1, _Size>::any() const _NOEXCEPT
|
__bitset<1, _Size>::any() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -532,7 +583,7 @@ __bitset<1, _Size>::any() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
size_t
|
size_t
|
||||||
__bitset<1, _Size>::__hash_code() const _NOEXCEPT
|
__bitset<1, _Size>::__hash_code() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -545,9 +596,9 @@ class __bitset<0, 0>
|
|||||||
public:
|
public:
|
||||||
typedef ptrdiff_t difference_type;
|
typedef ptrdiff_t difference_type;
|
||||||
typedef size_t size_type;
|
typedef size_t size_type;
|
||||||
|
typedef size_type __storage_type;
|
||||||
protected:
|
protected:
|
||||||
typedef __bitset __self;
|
typedef __bitset __self;
|
||||||
typedef size_type __storage_type;
|
|
||||||
typedef __storage_type* __storage_pointer;
|
typedef __storage_type* __storage_pointer;
|
||||||
typedef const __storage_type* __const_storage_pointer;
|
typedef const __storage_type* __const_storage_pointer;
|
||||||
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
||||||
@ -556,23 +607,25 @@ protected:
|
|||||||
friend class __bit_const_reference<__bitset>;
|
friend class __bit_const_reference<__bitset>;
|
||||||
friend class __bit_iterator<__bitset, false>;
|
friend class __bit_iterator<__bitset, false>;
|
||||||
friend class __bit_iterator<__bitset, true>;
|
friend class __bit_iterator<__bitset, true>;
|
||||||
friend class __bit_array<__bitset>;
|
friend struct __bit_array<__bitset>;
|
||||||
|
|
||||||
typedef __bit_reference<__bitset> reference;
|
typedef __bit_reference<__bitset> reference;
|
||||||
typedef __bit_const_reference<__bitset> const_reference;
|
typedef __bit_const_reference<__bitset> const_reference;
|
||||||
typedef __bit_iterator<__bitset, false> iterator;
|
typedef __bit_iterator<__bitset, false> iterator;
|
||||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||||
|
|
||||||
__bitset() _NOEXCEPT;
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __bitset(unsigned long long) _NOEXCEPT;
|
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
|
||||||
{return reference(0, 1);}
|
{return reference(0, 1);}
|
||||||
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
|
||||||
{return const_reference(0, 1);}
|
{return const_reference(0, 1);}
|
||||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
|
||||||
{return iterator(0, 0);}
|
{return iterator(0, 0);}
|
||||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT
|
||||||
{return const_iterator(0, 0);}
|
{return const_iterator(0, 0);}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
|
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
|
||||||
@ -590,23 +643,26 @@ protected:
|
|||||||
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
|
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
__bitset<0, 0>::__bitset() _NOEXCEPT
|
__bitset<0, 0>::__bitset() _NOEXCEPT
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
|
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size> class bitset;
|
template <size_t _Size> class _LIBCPP_TYPE_VIS_ONLY bitset;
|
||||||
template <size_t _Size> struct hash<bitset<_Size> >;
|
template <size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY hash<bitset<_Size> >;
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
class _LIBCPP_VISIBLE bitset
|
class _LIBCPP_TYPE_VIS_ONLY bitset
|
||||||
: private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
|
: private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
|
static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
|
||||||
typedef __bitset<__n_words, _Size> base;
|
typedef __bitset<__n_words, _Size> base;
|
||||||
|
|
||||||
@ -615,8 +671,9 @@ public:
|
|||||||
typedef typename base::const_reference const_reference;
|
typedef typename base::const_reference const_reference;
|
||||||
|
|
||||||
// 23.3.5.1 constructors:
|
// 23.3.5.1 constructors:
|
||||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() _NOEXCEPT {}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
|
||||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
|
bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
|
||||||
template<class _CharT>
|
template<class _CharT>
|
||||||
explicit bitset(const _CharT* __str,
|
explicit bitset(const _CharT* __str,
|
||||||
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
|
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
|
||||||
@ -629,44 +686,64 @@ public:
|
|||||||
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
|
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
|
||||||
|
|
||||||
// 23.3.5.2 bitset operations:
|
// 23.3.5.2 bitset operations:
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
|
bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
|
bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
|
bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
|
||||||
bitset& operator<<=(size_t __pos) _NOEXCEPT;
|
bitset& operator<<=(size_t __pos) _NOEXCEPT;
|
||||||
bitset& operator>>=(size_t __pos) _NOEXCEPT;
|
bitset& operator>>=(size_t __pos) _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bitset& set() _NOEXCEPT;
|
bitset& set() _NOEXCEPT;
|
||||||
bitset& set(size_t __pos, bool __val = true);
|
bitset& set(size_t __pos, bool __val = true);
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bitset& reset() _NOEXCEPT;
|
bitset& reset() _NOEXCEPT;
|
||||||
bitset& reset(size_t __pos);
|
bitset& reset(size_t __pos);
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bitset operator~() const _NOEXCEPT;
|
bitset operator~() const _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bitset& flip() _NOEXCEPT;
|
bitset& flip() _NOEXCEPT;
|
||||||
bitset& flip(size_t __pos);
|
bitset& flip(size_t __pos);
|
||||||
|
|
||||||
// element access:
|
// element access:
|
||||||
_LIBCPP_INLINE_VISIBILITY const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
|
const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
|
_LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long to_ulong() const;
|
unsigned long to_ulong() const;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long long to_ullong() const;
|
unsigned long long to_ullong() const;
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
|
basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
|
||||||
_CharT __one = _CharT('1')) const;
|
_CharT __one = _CharT('1')) const;
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
|
basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
|
||||||
_CharT __one = _CharT('1')) const;
|
_CharT __one = _CharT('1')) const;
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
|
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
|
||||||
_CharT __one = _CharT('1')) const;
|
_CharT __one = _CharT('1')) const;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
|
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
|
||||||
char __one = '1') const;
|
char __one = '1') const;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_t count() const _NOEXCEPT;
|
size_t count() const _NOEXCEPT;
|
||||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const _NOEXCEPT {return _Size;}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator==(const bitset& __rhs) const _NOEXCEPT;
|
bool operator==(const bitset& __rhs) const _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator!=(const bitset& __rhs) const _NOEXCEPT;
|
bool operator!=(const bitset& __rhs) const _NOEXCEPT;
|
||||||
bool test(size_t __pos) const;
|
bool test(size_t __pos) const;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool all() const _NOEXCEPT;
|
bool all() const _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool any() const _NOEXCEPT;
|
bool any() const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();}
|
_LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bitset operator<<(size_t __pos) const _NOEXCEPT;
|
bitset operator<<(size_t __pos) const _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bitset operator>>(size_t __pos) const _NOEXCEPT;
|
bitset operator>>(size_t __pos) const _NOEXCEPT;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -691,11 +768,11 @@ bitset<_Size>::bitset(const _CharT* __str,
|
|||||||
#else
|
#else
|
||||||
assert(!"bitset string ctor has invalid argument");
|
assert(!"bitset string ctor has invalid argument");
|
||||||
#endif
|
#endif
|
||||||
size_t _M = _VSTD::min(__rlen, _Size);
|
size_t _Mp = _VSTD::min(__rlen, _Size);
|
||||||
size_t __i = 0;
|
size_t __i = 0;
|
||||||
for (; __i < _M; ++__i)
|
for (; __i < _Mp; ++__i)
|
||||||
{
|
{
|
||||||
_CharT __c = __str[_M - 1 - __i];
|
_CharT __c = __str[_Mp - 1 - __i];
|
||||||
if (__c == __zero)
|
if (__c == __zero)
|
||||||
(*this)[__i] = false;
|
(*this)[__i] = false;
|
||||||
else
|
else
|
||||||
@ -725,11 +802,11 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
|||||||
#else
|
#else
|
||||||
assert(!"bitset string ctor has invalid argument");
|
assert(!"bitset string ctor has invalid argument");
|
||||||
#endif
|
#endif
|
||||||
size_t _M = _VSTD::min(__rlen, _Size);
|
size_t _Mp = _VSTD::min(__rlen, _Size);
|
||||||
size_t __i = 0;
|
size_t __i = 0;
|
||||||
for (; __i < _M; ++__i)
|
for (; __i < _Mp; ++__i)
|
||||||
{
|
{
|
||||||
_CharT __c = __str[__pos + _M - 1 - __i];
|
_CharT __c = __str[__pos + _Mp - 1 - __i];
|
||||||
if (_Traits::eq(__c, __zero))
|
if (_Traits::eq(__c, __zero))
|
||||||
(*this)[__i] = false;
|
(*this)[__i] = false;
|
||||||
else
|
else
|
||||||
@ -739,7 +816,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bitset<_Size>&
|
bitset<_Size>&
|
||||||
bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
|
bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -748,7 +825,7 @@ bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bitset<_Size>&
|
bitset<_Size>&
|
||||||
bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
|
bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -757,7 +834,7 @@ bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bitset<_Size>&
|
bitset<_Size>&
|
||||||
bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
|
bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -786,7 +863,7 @@ bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bitset<_Size>&
|
bitset<_Size>&
|
||||||
bitset<_Size>::set() _NOEXCEPT
|
bitset<_Size>::set() _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -809,7 +886,7 @@ bitset<_Size>::set(size_t __pos, bool __val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bitset<_Size>&
|
bitset<_Size>&
|
||||||
bitset<_Size>::reset() _NOEXCEPT
|
bitset<_Size>::reset() _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -832,7 +909,7 @@ bitset<_Size>::reset(size_t __pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bitset<_Size>
|
bitset<_Size>
|
||||||
bitset<_Size>::operator~() const _NOEXCEPT
|
bitset<_Size>::operator~() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -842,7 +919,7 @@ bitset<_Size>::operator~() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bitset<_Size>&
|
bitset<_Size>&
|
||||||
bitset<_Size>::flip() _NOEXCEPT
|
bitset<_Size>::flip() _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -866,7 +943,7 @@ bitset<_Size>::flip(size_t __pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
unsigned long
|
unsigned long
|
||||||
bitset<_Size>::to_ulong() const
|
bitset<_Size>::to_ulong() const
|
||||||
{
|
{
|
||||||
@ -874,7 +951,7 @@ bitset<_Size>::to_ulong() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
unsigned long long
|
unsigned long long
|
||||||
bitset<_Size>::to_ullong() const
|
bitset<_Size>::to_ullong() const
|
||||||
{
|
{
|
||||||
@ -897,7 +974,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
|||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
basic_string<_CharT, _Traits, allocator<_CharT> >
|
basic_string<_CharT, _Traits, allocator<_CharT> >
|
||||||
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
||||||
{
|
{
|
||||||
@ -906,7 +983,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
|||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
|
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
|
||||||
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
||||||
{
|
{
|
||||||
@ -914,7 +991,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
basic_string<char, char_traits<char>, allocator<char> >
|
basic_string<char, char_traits<char>, allocator<char> >
|
||||||
bitset<_Size>::to_string(char __zero, char __one) const
|
bitset<_Size>::to_string(char __zero, char __one) const
|
||||||
{
|
{
|
||||||
@ -922,7 +999,7 @@ bitset<_Size>::to_string(char __zero, char __one) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
size_t
|
size_t
|
||||||
bitset<_Size>::count() const _NOEXCEPT
|
bitset<_Size>::count() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -930,7 +1007,7 @@ bitset<_Size>::count() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bool
|
bool
|
||||||
bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
|
bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -938,7 +1015,7 @@ bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bool
|
bool
|
||||||
bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
|
bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -959,7 +1036,7 @@ bitset<_Size>::test(size_t __pos) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bool
|
bool
|
||||||
bitset<_Size>::all() const _NOEXCEPT
|
bitset<_Size>::all() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -967,7 +1044,7 @@ bitset<_Size>::all() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bool
|
bool
|
||||||
bitset<_Size>::any() const _NOEXCEPT
|
bitset<_Size>::any() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -975,7 +1052,7 @@ bitset<_Size>::any() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bitset<_Size>
|
bitset<_Size>
|
||||||
bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
|
bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -985,7 +1062,7 @@ bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bitset<_Size>
|
bitset<_Size>
|
||||||
bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
|
bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -1025,7 +1102,7 @@ operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
struct _LIBCPP_VISIBLE hash<bitset<_Size> >
|
struct _LIBCPP_TYPE_VIS_ONLY hash<bitset<_Size> >
|
||||||
: public unary_function<bitset<_Size>, size_t>
|
: public unary_function<bitset<_Size>, size_t>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
@ -20,4 +20,6 @@ Macros:
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
// hh 080623 Created
|
// hh 080623 Created
|
||||||
|
|
||||||
|
@ -38,121 +38,26 @@ int toupper(int c);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
#ifdef isalnum
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalnum(int __c) {return isalnum(__c);}
|
|
||||||
#undef isalnum
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int isalnum(int __c) {return __libcpp_isalnum(__c);}
|
|
||||||
#else // isalnum
|
|
||||||
using ::isalnum;
|
using ::isalnum;
|
||||||
#endif // isalnum
|
|
||||||
|
|
||||||
#ifdef isalpha
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalpha(int __c) {return isalpha(__c);}
|
|
||||||
#undef isalpha
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int isalpha(int __c) {return __libcpp_isalpha(__c);}
|
|
||||||
#else // isalpha
|
|
||||||
using ::isalpha;
|
using ::isalpha;
|
||||||
#endif // isalpha
|
|
||||||
|
|
||||||
#ifdef isblank
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isblank(int __c) {return isblank(__c);}
|
|
||||||
#undef isblank
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int isblank(int __c) {return __libcpp_isblank(__c);}
|
|
||||||
#else // isblank
|
|
||||||
using ::isblank;
|
using ::isblank;
|
||||||
#endif // isblank
|
|
||||||
|
|
||||||
#ifdef iscntrl
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iscntrl(int __c) {return iscntrl(__c);}
|
|
||||||
#undef iscntrl
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iscntrl(int __c) {return __libcpp_iscntrl(__c);}
|
|
||||||
#else // iscntrl
|
|
||||||
using ::iscntrl;
|
using ::iscntrl;
|
||||||
#endif // iscntrl
|
|
||||||
|
|
||||||
#ifdef isdigit
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isdigit(int __c) {return isdigit(__c);}
|
|
||||||
#undef isdigit
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int isdigit(int __c) {return __libcpp_isdigit(__c);}
|
|
||||||
#else // isdigit
|
|
||||||
using ::isdigit;
|
using ::isdigit;
|
||||||
#endif // isdigit
|
|
||||||
|
|
||||||
#ifdef isgraph
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isgraph(int __c) {return isgraph(__c);}
|
|
||||||
#undef isgraph
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int isgraph(int __c) {return __libcpp_isgraph(__c);}
|
|
||||||
#else // isgraph
|
|
||||||
using ::isgraph;
|
using ::isgraph;
|
||||||
#endif // isgraph
|
|
||||||
|
|
||||||
#ifdef islower
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_islower(int __c) {return islower(__c);}
|
|
||||||
#undef islower
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int islower(int __c) {return __libcpp_islower(__c);}
|
|
||||||
#else // islower
|
|
||||||
using ::islower;
|
using ::islower;
|
||||||
#endif // islower
|
|
||||||
|
|
||||||
#ifdef isprint
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isprint(int __c) {return isprint(__c);}
|
|
||||||
#undef isprint
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int isprint(int __c) {return __libcpp_isprint(__c);}
|
|
||||||
#else // isprint
|
|
||||||
using ::isprint;
|
using ::isprint;
|
||||||
#endif // isprint
|
|
||||||
|
|
||||||
#ifdef ispunct
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ispunct(int __c) {return ispunct(__c);}
|
|
||||||
#undef ispunct
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int ispunct(int __c) {return __libcpp_ispunct(__c);}
|
|
||||||
#else // ispunct
|
|
||||||
using ::ispunct;
|
using ::ispunct;
|
||||||
#endif // ispunct
|
|
||||||
|
|
||||||
#ifdef isspace
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isspace(int __c) {return isspace(__c);}
|
|
||||||
#undef isspace
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int isspace(int __c) {return __libcpp_isspace(__c);}
|
|
||||||
#else // isspace
|
|
||||||
using ::isspace;
|
using ::isspace;
|
||||||
#endif // isspace
|
|
||||||
|
|
||||||
#ifdef isupper
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isupper(int __c) {return isupper(__c);}
|
|
||||||
#undef isupper
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int isupper(int __c) {return __libcpp_isupper(__c);}
|
|
||||||
#else // isupper
|
|
||||||
using ::isupper;
|
using ::isupper;
|
||||||
#endif // isupper
|
|
||||||
|
|
||||||
#ifdef isxdigit
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isxdigit(int __c) {return isxdigit(__c);}
|
|
||||||
#undef isxdigit
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int isxdigit(int __c) {return __libcpp_isxdigit(__c);}
|
|
||||||
#else // isxdigit
|
|
||||||
using ::isxdigit;
|
using ::isxdigit;
|
||||||
#endif // isxdigit
|
|
||||||
|
|
||||||
#ifdef tolower
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_tolower(int __c) {return tolower(__c);}
|
|
||||||
#undef tolower
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int tolower(int __c) {return __libcpp_tolower(__c);}
|
|
||||||
#else // tolower
|
|
||||||
using ::tolower;
|
using ::tolower;
|
||||||
#endif // tolower
|
|
||||||
|
|
||||||
#ifdef toupper
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_toupper(int __c) {return toupper(__c);}
|
|
||||||
#undef toupper
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int toupper(int __c) {return __libcpp_toupper(__c);}
|
|
||||||
#else // toupper
|
|
||||||
using ::toupper;
|
using ::toupper;
|
||||||
#endif // toupper
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
360
include/cerrno
360
include/cerrno
@ -26,366 +26,8 @@ Macros:
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
|
||||||
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
|
||||||
|
|
||||||
#ifdef ELAST
|
|
||||||
|
|
||||||
const int __elast1 = ELAST+1;
|
|
||||||
const int __elast2 = ELAST+2;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
const int __elast1 = 104;
|
|
||||||
const int __elast2 = 105;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENOTRECOVERABLE
|
|
||||||
|
|
||||||
#define EOWNERDEAD __elast1
|
|
||||||
|
|
||||||
#ifdef ELAST
|
|
||||||
#undef ELAST
|
|
||||||
#define ELAST EOWNERDEAD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(EOWNERDEAD)
|
|
||||||
|
|
||||||
#define ENOTRECOVERABLE __elast1
|
|
||||||
#ifdef ELAST
|
|
||||||
#undef ELAST
|
|
||||||
#define ELAST ENOTRECOVERABLE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else // defined(EOWNERDEAD)
|
|
||||||
|
|
||||||
#define EOWNERDEAD __elast1
|
|
||||||
#define ENOTRECOVERABLE __elast2
|
|
||||||
#ifdef ELAST
|
|
||||||
#undef ELAST
|
|
||||||
#define ELAST ENOTRECOVERABLE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // defined(EOWNERDEAD)
|
|
||||||
|
|
||||||
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
|
||||||
|
|
||||||
// supply errno values likely to be missing, particularly on Windows
|
|
||||||
|
|
||||||
#ifndef EAFNOSUPPORT
|
|
||||||
#define EAFNOSUPPORT 9901
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EADDRINUSE
|
|
||||||
#define EADDRINUSE 9902
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EADDRNOTAVAIL
|
|
||||||
#define EADDRNOTAVAIL 9903
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EISCONN
|
|
||||||
#define EISCONN 9904
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EBADMSG
|
|
||||||
#define EBADMSG 9905
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECONNABORTED
|
|
||||||
#define ECONNABORTED 9906
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EALREADY
|
|
||||||
#define EALREADY 9907
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECONNREFUSED
|
|
||||||
#define ECONNREFUSED 9908
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECONNRESET
|
|
||||||
#define ECONNRESET 9909
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EDESTADDRREQ
|
|
||||||
#define EDESTADDRREQ 9910
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EHOSTUNREACH
|
|
||||||
#define EHOSTUNREACH 9911
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EIDRM
|
|
||||||
#define EIDRM 9912
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EMSGSIZE
|
|
||||||
#define EMSGSIZE 9913
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENETDOWN
|
|
||||||
#define ENETDOWN 9914
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENETRESET
|
|
||||||
#define ENETRESET 9915
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENETUNREACH
|
|
||||||
#define ENETUNREACH 9916
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOBUFS
|
|
||||||
#define ENOBUFS 9917
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOLINK
|
|
||||||
#define ENOLINK 9918
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENODATA
|
|
||||||
#define ENODATA 9919
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOMSG
|
|
||||||
#define ENOMSG 9920
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOPROTOOPT
|
|
||||||
#define ENOPROTOOPT 9921
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOSR
|
|
||||||
#define ENOSR 9922
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTSOCK
|
|
||||||
#define ENOTSOCK 9923
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOSTR
|
|
||||||
#define ENOSTR 9924
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTCONN
|
|
||||||
#define ENOTCONN 9925
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTSUP
|
|
||||||
#define ENOTSUP 9926
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECANCELED
|
|
||||||
#define ECANCELED 9927
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EINPROGRESS
|
|
||||||
#define EINPROGRESS 9928
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EOPNOTSUPP
|
|
||||||
#define EOPNOTSUPP 9929
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EWOULDBLOCK
|
|
||||||
#define EWOULDBLOCK 9930
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EOWNERDEAD
|
|
||||||
#define EOWNERDEAD 9931
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPROTO
|
|
||||||
#define EPROTO 9932
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPROTONOSUPPORT
|
|
||||||
#define EPROTONOSUPPORT 9933
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTRECOVERABLE
|
|
||||||
#define ENOTRECOVERABLE 9934
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ETIME
|
|
||||||
#define ETIME 9935
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ETXTBSY
|
|
||||||
#define ETXTBSY 9936
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ETIMEDOUT
|
|
||||||
#define ETIMEDOUT 9938
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ELOOP
|
|
||||||
#define ELOOP 9939
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EOVERFLOW
|
|
||||||
#define EOVERFLOW 9940
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPROTOTYPE
|
|
||||||
#define EPROTOTYPE 9941
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOSYS
|
|
||||||
#define ENOSYS 9942
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EINVAL
|
|
||||||
#define EINVAL 9943
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ERANGE
|
|
||||||
#define ERANGE 9944
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EILSEQ
|
|
||||||
#define EILSEQ 9945
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Windows Mobile doesn't appear to define these:
|
|
||||||
|
|
||||||
#ifndef E2BIG
|
|
||||||
#define E2BIG 9946
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EDOM
|
|
||||||
#define EDOM 9947
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EFAULT
|
|
||||||
#define EFAULT 9948
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EBADF
|
|
||||||
#define EBADF 9949
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPIPE
|
|
||||||
#define EPIPE 9950
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EXDEV
|
|
||||||
#define EXDEV 9951
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EBUSY
|
|
||||||
#define EBUSY 9952
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTEMPTY
|
|
||||||
#define ENOTEMPTY 9953
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOEXEC
|
|
||||||
#define ENOEXEC 9954
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EEXIST
|
|
||||||
#define EEXIST 9955
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EFBIG
|
|
||||||
#define EFBIG 9956
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENAMETOOLONG
|
|
||||||
#define ENAMETOOLONG 9957
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTTY
|
|
||||||
#define ENOTTY 9958
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EINTR
|
|
||||||
#define EINTR 9959
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ESPIPE
|
|
||||||
#define ESPIPE 9960
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EIO
|
|
||||||
#define EIO 9961
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EISDIR
|
|
||||||
#define EISDIR 9962
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECHILD
|
|
||||||
#define ECHILD 9963
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOLCK
|
|
||||||
#define ENOLCK 9964
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOSPC
|
|
||||||
#define ENOSPC 9965
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENXIO
|
|
||||||
#define ENXIO 9966
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENODEV
|
|
||||||
#define ENODEV 9967
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOENT
|
|
||||||
#define ENOENT 9968
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ESRCH
|
|
||||||
#define ESRCH 9969
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTDIR
|
|
||||||
#define ENOTDIR 9970
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOMEM
|
|
||||||
#define ENOMEM 9971
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPERM
|
|
||||||
#define EPERM 9972
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EACCES
|
|
||||||
#define EACCES 9973
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EROFS
|
|
||||||
#define EROFS 9974
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EDEADLK
|
|
||||||
#define EDEADLK 9975
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EAGAIN
|
|
||||||
#define EAGAIN 9976
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENFILE
|
|
||||||
#define ENFILE 9977
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EMFILE
|
|
||||||
#define EMFILE 9978
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EMLINK
|
|
||||||
#define EMLINK 9979
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _LIBCPP_CERRNO
|
#endif // _LIBCPP_CERRNO
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//===---------------------------- cctype ----------------------------------===//
|
//===---------------------------- cfenv -----------------------------------===//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
@ -56,7 +56,9 @@ int feupdateenv(const fenv_t* envp);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <fenv.h>
|
#include <fenv.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
@ -63,14 +63,8 @@ Macros:
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
|
||||||
#ifndef FLT_EVAL_METHOD
|
|
||||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DECIMAL_DIG
|
|
||||||
#define DECIMAL_DIG __DECIMAL_DIG__
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _LIBCPP_CFLOAT
|
#endif // _LIBCPP_CFLOAT
|
||||||
|
491
include/chrono
491
include/chrono
@ -20,18 +20,22 @@ namespace chrono
|
|||||||
{
|
{
|
||||||
|
|
||||||
template <class ToDuration, class Rep, class Period>
|
template <class ToDuration, class Rep, class Period>
|
||||||
|
constexpr
|
||||||
ToDuration
|
ToDuration
|
||||||
duration_cast(const duration<Rep, Period>& fd);
|
duration_cast(const duration<Rep, Period>& fd);
|
||||||
|
|
||||||
template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {};
|
template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {};
|
||||||
|
|
||||||
|
template <class Rep> constexpr bool treat_as_floating_point_v
|
||||||
|
= treat_as_floating_point<Rep>::value; // C++17
|
||||||
|
|
||||||
template <class Rep>
|
template <class Rep>
|
||||||
struct duration_values
|
struct duration_values
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Rep zero();
|
static constexpr Rep zero();
|
||||||
static Rep max();
|
static constexpr Rep max();
|
||||||
static Rep min();
|
static constexpr Rep min();
|
||||||
};
|
};
|
||||||
|
|
||||||
// duration
|
// duration
|
||||||
@ -46,9 +50,9 @@ public:
|
|||||||
typedef Rep rep;
|
typedef Rep rep;
|
||||||
typedef Period period;
|
typedef Period period;
|
||||||
|
|
||||||
duration() = default;
|
constexpr duration() = default;
|
||||||
template <class Rep2>
|
template <class Rep2>
|
||||||
explicit duration(const Rep2& r,
|
constexpr explicit duration(const Rep2& r,
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
is_convertible<Rep2, rep>::value &&
|
is_convertible<Rep2, rep>::value &&
|
||||||
@ -58,7 +62,7 @@ public:
|
|||||||
|
|
||||||
// conversions
|
// conversions
|
||||||
template <class Rep2, class Period2>
|
template <class Rep2, class Period2>
|
||||||
duration(const duration<Rep2, Period2>& d,
|
constexpr duration(const duration<Rep2, Period2>& d,
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
treat_as_floating_point<rep>::value ||
|
treat_as_floating_point<rep>::value ||
|
||||||
@ -67,12 +71,12 @@ public:
|
|||||||
|
|
||||||
// observer
|
// observer
|
||||||
|
|
||||||
rep count() const;
|
constexpr rep count() const;
|
||||||
|
|
||||||
// arithmetic
|
// arithmetic
|
||||||
|
|
||||||
duration operator+() const;
|
constexpr duration operator+() const;
|
||||||
duration operator-() const;
|
constexpr duration operator-() const;
|
||||||
duration& operator++();
|
duration& operator++();
|
||||||
duration operator++(int);
|
duration operator++(int);
|
||||||
duration& operator--();
|
duration& operator--();
|
||||||
@ -86,9 +90,9 @@ public:
|
|||||||
|
|
||||||
// special values
|
// special values
|
||||||
|
|
||||||
static duration zero();
|
static constexpr duration zero();
|
||||||
static duration min();
|
static constexpr duration min();
|
||||||
static duration max();
|
static constexpr duration max();
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef duration<long long, nano> nanoseconds;
|
typedef duration<long long, nano> nanoseconds;
|
||||||
@ -110,16 +114,16 @@ private:
|
|||||||
duration d_; // exposition only
|
duration d_; // exposition only
|
||||||
|
|
||||||
public:
|
public:
|
||||||
time_point(); // has value "epoch"
|
time_point(); // has value "epoch" // constexpr in C++14
|
||||||
explicit time_point(const duration& d); // same as time_point() + d
|
explicit time_point(const duration& d); // same as time_point() + d // constexpr in C++14
|
||||||
|
|
||||||
// conversions
|
// conversions
|
||||||
template <class Duration2>
|
template <class Duration2>
|
||||||
time_point(const time_point<clock, Duration2>& t);
|
time_point(const time_point<clock, Duration2>& t); // constexpr in C++14
|
||||||
|
|
||||||
// observer
|
// observer
|
||||||
|
|
||||||
duration time_since_epoch() const;
|
duration time_since_epoch() const; // constexpr in C++14
|
||||||
|
|
||||||
// arithmetic
|
// arithmetic
|
||||||
|
|
||||||
@ -145,43 +149,62 @@ namespace chrono {
|
|||||||
|
|
||||||
// duration arithmetic
|
// duration arithmetic
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
|
constexpr
|
||||||
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
||||||
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
|
constexpr
|
||||||
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
||||||
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period, class Rep2>
|
template <class Rep1, class Period, class Rep2>
|
||||||
|
constexpr
|
||||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||||
operator*(const duration<Rep1, Period>& d, const Rep2& s);
|
operator*(const duration<Rep1, Period>& d, const Rep2& s);
|
||||||
template <class Rep1, class Period, class Rep2>
|
template <class Rep1, class Period, class Rep2>
|
||||||
|
constexpr
|
||||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||||
operator*(const Rep1& s, const duration<Rep2, Period>& d);
|
operator*(const Rep1& s, const duration<Rep2, Period>& d);
|
||||||
template <class Rep1, class Period, class Rep2>
|
template <class Rep1, class Period, class Rep2>
|
||||||
|
constexpr
|
||||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||||
operator/(const duration<Rep1, Period>& d, const Rep2& s);
|
operator/(const duration<Rep1, Period>& d, const Rep2& s);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
|
constexpr
|
||||||
typename common_type<Rep1, Rep2>::type
|
typename common_type<Rep1, Rep2>::type
|
||||||
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
|
|
||||||
// duration comparisons
|
// duration comparisons
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
|
constexpr
|
||||||
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
|
constexpr
|
||||||
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
|
constexpr
|
||||||
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
|
constexpr
|
||||||
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
|
constexpr
|
||||||
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
|
constexpr
|
||||||
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
|
|
||||||
// duration_cast
|
// duration_cast
|
||||||
template <class ToDuration, class Rep, class Period>
|
template <class ToDuration, class Rep, class Period>
|
||||||
ToDuration duration_cast(const duration<Rep, Period>& d);
|
ToDuration duration_cast(const duration<Rep, Period>& d);
|
||||||
|
|
||||||
// time_point arithmetic
|
template <class ToDuration, class Rep, class Period>
|
||||||
|
constexpr ToDuration floor(const duration<Rep, Period>& d); // C++17
|
||||||
|
template <class ToDuration, class Rep, class Period>
|
||||||
|
constexpr ToDuration ceil(const duration<Rep, Period>& d); // C++17
|
||||||
|
template <class ToDuration, class Rep, class Period>
|
||||||
|
constexpr ToDuration round(const duration<Rep, Period>& d); // C++17
|
||||||
|
|
||||||
|
// time_point arithmetic (all constexpr in C++14)
|
||||||
template <class Clock, class Duration1, class Rep2, class Period2>
|
template <class Clock, class Duration1, class Rep2, class Period2>
|
||||||
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
|
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
|
||||||
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
|
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
@ -195,7 +218,7 @@ template <class Clock, class Duration1, class Duration2>
|
|||||||
typename common_type<Duration1, Duration2>::type
|
typename common_type<Duration1, Duration2>::type
|
||||||
operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||||
|
|
||||||
// time_point comparisons
|
// time_point comparisons (all constexpr in C++14)
|
||||||
template <class Clock, class Duration1, class Duration2>
|
template <class Clock, class Duration1, class Duration2>
|
||||||
bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||||
template <class Clock, class Duration1, class Duration2>
|
template <class Clock, class Duration1, class Duration2>
|
||||||
@ -209,11 +232,25 @@ template <class Clock, class Duration1, class Duration2>
|
|||||||
template <class Clock, class Duration1, class Duration2>
|
template <class Clock, class Duration1, class Duration2>
|
||||||
bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||||
|
|
||||||
// time_point_cast
|
// time_point_cast (constexpr in C++14)
|
||||||
|
|
||||||
template <class ToDuration, class Clock, class Duration>
|
template <class ToDuration, class Clock, class Duration>
|
||||||
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
|
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
|
||||||
|
|
||||||
|
template <class ToDuration, class Clock, class Duration>
|
||||||
|
constexpr time_point<Clock, ToDuration>
|
||||||
|
floor(const time_point<Clock, Duration>& tp); // C++17
|
||||||
|
|
||||||
|
template <class ToDuration, class Clock, class Duration>
|
||||||
|
constexpr time_point<Clock, ToDuration>
|
||||||
|
ceil(const time_point<Clock, Duration>& tp); // C++17
|
||||||
|
|
||||||
|
template <class ToDuration, class Clock, class Duration>
|
||||||
|
constexpr time_point<Clock, ToDuration>
|
||||||
|
round(const time_point<Clock, Duration>& tp); // C++17
|
||||||
|
|
||||||
|
template <class Rep, class Period>
|
||||||
|
constexpr duration<Rep, Period> abs(duration<Rep, Period> d); // C++17
|
||||||
// Clocks
|
// Clocks
|
||||||
|
|
||||||
class system_clock
|
class system_clock
|
||||||
@ -223,7 +260,7 @@ public:
|
|||||||
typedef duration::rep rep;
|
typedef duration::rep rep;
|
||||||
typedef duration::period period;
|
typedef duration::period period;
|
||||||
typedef chrono::time_point<system_clock> time_point;
|
typedef chrono::time_point<system_clock> time_point;
|
||||||
static const bool is_steady = false;
|
static const bool is_steady = false; // constexpr in C++14
|
||||||
|
|
||||||
static time_point now() noexcept;
|
static time_point now() noexcept;
|
||||||
static time_t to_time_t (const time_point& __t) noexcept;
|
static time_t to_time_t (const time_point& __t) noexcept;
|
||||||
@ -237,7 +274,7 @@ public:
|
|||||||
typedef duration::rep rep;
|
typedef duration::rep rep;
|
||||||
typedef duration::period period;
|
typedef duration::period period;
|
||||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||||
static const bool is_steady = true;
|
static const bool is_steady = true; // constexpr in C++14
|
||||||
|
|
||||||
static time_point now() noexcept;
|
static time_point now() noexcept;
|
||||||
};
|
};
|
||||||
@ -246,6 +283,19 @@ typedef steady_clock high_resolution_clock;
|
|||||||
|
|
||||||
} // chrono
|
} // chrono
|
||||||
|
|
||||||
|
constexpr chrono::hours operator "" h(unsigned long long); // C++14
|
||||||
|
constexpr chrono::duration<unspecified , ratio<3600,1>> operator "" h(long double); // C++14
|
||||||
|
constexpr chrono::minutes operator "" min(unsigned long long); // C++14
|
||||||
|
constexpr chrono::duration<unspecified , ratio<60,1>> operator "" min(long double); // C++14
|
||||||
|
constexpr chrono::seconds operator "" s(unsigned long long); // C++14
|
||||||
|
constexpr chrono::duration<unspecified > operator "" s(long double); // C++14
|
||||||
|
constexpr chrono::milliseconds operator "" ms(unsigned long long); // C++14
|
||||||
|
constexpr chrono::duration<unspecified , milli> operator "" ms(long double); // C++14
|
||||||
|
constexpr chrono::microseconds operator "" us(unsigned long long); // C++14
|
||||||
|
constexpr chrono::duration<unspecified , micro> operator "" us(long double); // C++14
|
||||||
|
constexpr chrono::nanoseconds operator "" ns(unsigned long long); // C++14
|
||||||
|
constexpr chrono::duration<unspecified , nano> operator "" ns(long double); // C++14
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -255,14 +305,18 @@ typedef steady_clock high_resolution_clock;
|
|||||||
#include <ratio>
|
#include <ratio>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
#include <__undef_min_max>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
namespace chrono
|
namespace chrono
|
||||||
{
|
{
|
||||||
|
|
||||||
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_VISIBLE duration;
|
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_TYPE_VIS_ONLY duration;
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
struct __is_duration : false_type {};
|
struct __is_duration : false_type {};
|
||||||
@ -282,8 +336,8 @@ struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
|
|||||||
} // chrono
|
} // chrono
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
struct _LIBCPP_VISIBLE common_type<chrono::duration<_Rep1, _Period1>,
|
struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::duration<_Rep1, _Period1>,
|
||||||
chrono::duration<_Rep2, _Period2> >
|
chrono::duration<_Rep2, _Period2> >
|
||||||
{
|
{
|
||||||
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
|
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
|
||||||
typename __ratio_gcd<_Period1, _Period2>::type> type;
|
typename __ratio_gcd<_Period1, _Period2>::type> type;
|
||||||
@ -302,7 +356,7 @@ struct __duration_cast;
|
|||||||
template <class _FromDuration, class _ToDuration, class _Period>
|
template <class _FromDuration, class _ToDuration, class _Period>
|
||||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
|
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
_ToDuration operator()(const _FromDuration& __fd) const
|
_ToDuration operator()(const _FromDuration& __fd) const
|
||||||
{
|
{
|
||||||
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
|
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
|
||||||
@ -312,7 +366,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
|
|||||||
template <class _FromDuration, class _ToDuration, class _Period>
|
template <class _FromDuration, class _ToDuration, class _Period>
|
||||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
|
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
_ToDuration operator()(const _FromDuration& __fd) const
|
_ToDuration operator()(const _FromDuration& __fd) const
|
||||||
{
|
{
|
||||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||||
@ -324,7 +378,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
|
|||||||
template <class _FromDuration, class _ToDuration, class _Period>
|
template <class _FromDuration, class _ToDuration, class _Period>
|
||||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
|
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
_ToDuration operator()(const _FromDuration& __fd) const
|
_ToDuration operator()(const _FromDuration& __fd) const
|
||||||
{
|
{
|
||||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||||
@ -336,7 +390,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
|
|||||||
template <class _FromDuration, class _ToDuration, class _Period>
|
template <class _FromDuration, class _ToDuration, class _Period>
|
||||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
|
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
_ToDuration operator()(const _FromDuration& __fd) const
|
_ToDuration operator()(const _FromDuration& __fd) const
|
||||||
{
|
{
|
||||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||||
@ -348,6 +402,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
|
|||||||
|
|
||||||
template <class _ToDuration, class _Rep, class _Period>
|
template <class _ToDuration, class _Rep, class _Period>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
__is_duration<_ToDuration>::value,
|
__is_duration<_ToDuration>::value,
|
||||||
@ -359,25 +414,113 @@ duration_cast(const duration<_Rep, _Period>& __fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Rep>
|
template <class _Rep>
|
||||||
struct _LIBCPP_VISIBLE treat_as_floating_point : is_floating_point<_Rep> {};
|
struct _LIBCPP_TYPE_VIS_ONLY treat_as_floating_point : is_floating_point<_Rep> {};
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
|
||||||
|
template <class _Rep> _LIBCPP_CONSTEXPR bool treat_as_floating_point_v
|
||||||
|
= treat_as_floating_point<_Rep>::value;
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class _Rep>
|
template <class _Rep>
|
||||||
struct _LIBCPP_VISIBLE duration_values
|
struct _LIBCPP_TYPE_VIS_ONLY duration_values
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
|
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() {return _Rep(0);}
|
||||||
_LIBCPP_INLINE_VISIBILITY static _Rep max() {return numeric_limits<_Rep>::max();}
|
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep max() {return numeric_limits<_Rep>::max();}
|
||||||
_LIBCPP_INLINE_VISIBILITY static _Rep min() {return numeric_limits<_Rep>::lowest();}
|
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 14
|
||||||
|
template <class _ToDuration, class _Rep, class _Period>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__is_duration<_ToDuration>::value,
|
||||||
|
_ToDuration
|
||||||
|
>::type
|
||||||
|
floor(const duration<_Rep, _Period>& __d)
|
||||||
|
{
|
||||||
|
_ToDuration __t = duration_cast<_ToDuration>(__d);
|
||||||
|
if (__t > __d)
|
||||||
|
__t = __t - _ToDuration{1};
|
||||||
|
return __t;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _ToDuration, class _Rep, class _Period>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__is_duration<_ToDuration>::value,
|
||||||
|
_ToDuration
|
||||||
|
>::type
|
||||||
|
ceil(const duration<_Rep, _Period>& __d)
|
||||||
|
{
|
||||||
|
_ToDuration __t = duration_cast<_ToDuration>(__d);
|
||||||
|
if (__t < __d)
|
||||||
|
__t = __t + _ToDuration{1};
|
||||||
|
return __t;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _ToDuration, class _Rep, class _Period>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__is_duration<_ToDuration>::value,
|
||||||
|
_ToDuration
|
||||||
|
>::type
|
||||||
|
round(const duration<_Rep, _Period>& __d)
|
||||||
|
{
|
||||||
|
_ToDuration __lower = floor<_ToDuration>(__d);
|
||||||
|
_ToDuration __upper = __lower + _ToDuration{1};
|
||||||
|
auto __lowerDiff = __d - __lower;
|
||||||
|
auto __upperDiff = __upper - __d;
|
||||||
|
if (__lowerDiff < __upperDiff)
|
||||||
|
return __lower;
|
||||||
|
if (__lowerDiff > __upperDiff)
|
||||||
|
return __upper;
|
||||||
|
return __lower.count() & 1 ? __upper : __lower;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// duration
|
// duration
|
||||||
|
|
||||||
template <class _Rep, class _Period>
|
template <class _Rep, class _Period>
|
||||||
class _LIBCPP_VISIBLE duration
|
class _LIBCPP_TYPE_VIS_ONLY duration
|
||||||
{
|
{
|
||||||
static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
|
static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
|
||||||
static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
|
static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
|
||||||
static_assert(_Period::num > 0, "duration period must be positive");
|
static_assert(_Period::num > 0, "duration period must be positive");
|
||||||
|
|
||||||
|
template <class _R1, class _R2>
|
||||||
|
struct __no_overflow
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
||||||
|
static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
|
||||||
|
static const intmax_t __n1 = _R1::num / __gcd_n1_n2;
|
||||||
|
static const intmax_t __d1 = _R1::den / __gcd_d1_d2;
|
||||||
|
static const intmax_t __n2 = _R2::num / __gcd_n1_n2;
|
||||||
|
static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
|
||||||
|
static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1);
|
||||||
|
|
||||||
|
template <intmax_t _Xp, intmax_t _Yp, bool __overflow>
|
||||||
|
struct __mul // __overflow == false
|
||||||
|
{
|
||||||
|
static const intmax_t value = _Xp * _Yp;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <intmax_t _Xp, intmax_t _Yp>
|
||||||
|
struct __mul<_Xp, _Yp, true>
|
||||||
|
{
|
||||||
|
static const intmax_t value = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
static const bool value = (__n1 <= max / __d2) && (__n2 <= max / __d1);
|
||||||
|
typedef ratio<__mul<__n1, __d2, !value>::value,
|
||||||
|
__mul<__n2, __d1, !value>::value> type;
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef _Rep rep;
|
typedef _Rep rep;
|
||||||
typedef _Period period;
|
typedef _Period period;
|
||||||
@ -385,9 +528,15 @@ private:
|
|||||||
rep __rep_;
|
rep __rep_;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY duration() {} // = default;
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
|
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||||
|
duration() = default;
|
||||||
|
#else
|
||||||
|
duration() {}
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class _Rep2>
|
template <class _Rep2>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
explicit duration(const _Rep2& __r,
|
explicit duration(const _Rep2& __r,
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
@ -399,24 +548,25 @@ public:
|
|||||||
|
|
||||||
// conversions
|
// conversions
|
||||||
template <class _Rep2, class _Period2>
|
template <class _Rep2, class _Period2>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
duration(const duration<_Rep2, _Period2>& __d,
|
duration(const duration<_Rep2, _Period2>& __d,
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
|
__no_overflow<_Period2, period>::value && (
|
||||||
treat_as_floating_point<rep>::value ||
|
treat_as_floating_point<rep>::value ||
|
||||||
(ratio_divide<_Period2, period>::type::den == 1 &&
|
(__no_overflow<_Period2, period>::type::den == 1 &&
|
||||||
!treat_as_floating_point<_Rep2>::value)
|
!treat_as_floating_point<_Rep2>::value))
|
||||||
>::type* = 0)
|
>::type* = 0)
|
||||||
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
|
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
|
||||||
|
|
||||||
// observer
|
// observer
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR rep count() const {return __rep_;}
|
||||||
|
|
||||||
// arithmetic
|
// arithmetic
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY duration operator+() const {return *this;}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY duration operator-() const {return duration(-__rep_);}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);}
|
||||||
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
|
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
|
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
|
||||||
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
|
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
|
||||||
@ -432,9 +582,9 @@ public:
|
|||||||
|
|
||||||
// special values
|
// special values
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY static duration zero() {return duration(duration_values<rep>::zero());}
|
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration zero() {return duration(duration_values<rep>::zero());}
|
||||||
_LIBCPP_INLINE_VISIBILITY static duration min() {return duration(duration_values<rep>::min());}
|
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration min() {return duration(duration_values<rep>::min());}
|
||||||
_LIBCPP_INLINE_VISIBILITY static duration max() {return duration(duration_values<rep>::max());}
|
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration max() {return duration(duration_values<rep>::max());}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef duration<long long, nano> nanoseconds;
|
typedef duration<long long, nano> nanoseconds;
|
||||||
@ -449,8 +599,8 @@ typedef duration< long, ratio<3600> > hours;
|
|||||||
template <class _LhsDuration, class _RhsDuration>
|
template <class _LhsDuration, class _RhsDuration>
|
||||||
struct __duration_eq
|
struct __duration_eq
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
|
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
|
||||||
{
|
{
|
||||||
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
||||||
return _Ct(__lhs).count() == _Ct(__rhs).count();
|
return _Ct(__lhs).count() == _Ct(__rhs).count();
|
||||||
@ -460,13 +610,14 @@ struct __duration_eq
|
|||||||
template <class _LhsDuration>
|
template <class _LhsDuration>
|
||||||
struct __duration_eq<_LhsDuration, _LhsDuration>
|
struct __duration_eq<_LhsDuration, _LhsDuration>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
|
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
|
||||||
{return __lhs.count() == __rhs.count();}
|
{return __lhs.count() == __rhs.count();}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
bool
|
bool
|
||||||
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -477,6 +628,7 @@ operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
|||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
bool
|
bool
|
||||||
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -488,8 +640,8 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
|||||||
template <class _LhsDuration, class _RhsDuration>
|
template <class _LhsDuration, class _RhsDuration>
|
||||||
struct __duration_lt
|
struct __duration_lt
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
|
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
|
||||||
{
|
{
|
||||||
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
||||||
return _Ct(__lhs).count() < _Ct(__rhs).count();
|
return _Ct(__lhs).count() < _Ct(__rhs).count();
|
||||||
@ -499,13 +651,14 @@ struct __duration_lt
|
|||||||
template <class _LhsDuration>
|
template <class _LhsDuration>
|
||||||
struct __duration_lt<_LhsDuration, _LhsDuration>
|
struct __duration_lt<_LhsDuration, _LhsDuration>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
|
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
|
||||||
{return __lhs.count() < __rhs.count();}
|
{return __lhs.count() < __rhs.count();}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
bool
|
bool
|
||||||
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -516,6 +669,7 @@ operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
|||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
bool
|
bool
|
||||||
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -526,6 +680,7 @@ operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
|||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
bool
|
bool
|
||||||
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -536,6 +691,7 @@ operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
|||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
bool
|
bool
|
||||||
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -546,30 +702,31 @@ operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
|||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||||
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
|
||||||
__r += __rhs;
|
return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
|
||||||
return __r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duration -
|
// Duration -
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||||
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
|
||||||
__r -= __rhs;
|
return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
|
||||||
return __r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duration *
|
// Duration *
|
||||||
|
|
||||||
template <class _Rep1, class _Period, class _Rep2>
|
template <class _Rep1, class _Period, class _Rep2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
|
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
|
||||||
@ -578,13 +735,13 @@ typename enable_if
|
|||||||
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||||
{
|
{
|
||||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||||
duration<_Cr, _Period> __r = __d;
|
typedef duration<_Cr, _Period> _Cd;
|
||||||
__r *= static_cast<_Cr>(__s);
|
return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
|
||||||
return __r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Rep1, class _Period, class _Rep2>
|
template <class _Rep1, class _Period, class _Rep2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
|
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
|
||||||
@ -623,17 +780,18 @@ struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
|
|||||||
|
|
||||||
template <class _Rep1, class _Period, class _Rep2>
|
template <class _Rep1, class _Period, class _Rep2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
||||||
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||||
{
|
{
|
||||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||||
duration<_Cr, _Period> __r = __d;
|
typedef duration<_Cr, _Period> _Cd;
|
||||||
__r /= static_cast<_Cr>(__s);
|
return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
|
||||||
return __r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
typename common_type<_Rep1, _Rep2>::type
|
typename common_type<_Rep1, _Rep2>::type
|
||||||
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -645,23 +803,24 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
|
|||||||
|
|
||||||
template <class _Rep1, class _Period, class _Rep2>
|
template <class _Rep1, class _Period, class _Rep2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
||||||
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||||
{
|
{
|
||||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||||
duration<_Cr, _Period> __r = __d;
|
typedef duration<_Cr, _Period> _Cd;
|
||||||
__r %= static_cast<_Cr>(__s);
|
return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
|
||||||
return __r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||||
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||||
__r %= __rhs;
|
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
|
||||||
return __r;
|
return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
@ -669,7 +828,7 @@ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
|
|||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template <class _Clock, class _Duration = typename _Clock::duration>
|
template <class _Clock, class _Duration = typename _Clock::duration>
|
||||||
class _LIBCPP_VISIBLE time_point
|
class _LIBCPP_TYPE_VIS_ONLY time_point
|
||||||
{
|
{
|
||||||
static_assert(__is_duration<_Duration>::value,
|
static_assert(__is_duration<_Duration>::value,
|
||||||
"Second template parameter of time_point must be a std::chrono::duration");
|
"Second template parameter of time_point must be a std::chrono::duration");
|
||||||
@ -682,12 +841,12 @@ private:
|
|||||||
duration __d_;
|
duration __d_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY time_point() : __d_(duration::zero()) {}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 time_point() : __d_(duration::zero()) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY explicit time_point(const duration& __d) : __d_(__d) {}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit time_point(const duration& __d) : __d_(__d) {}
|
||||||
|
|
||||||
// conversions
|
// conversions
|
||||||
template <class _Duration2>
|
template <class _Duration2>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
time_point(const time_point<clock, _Duration2>& t,
|
time_point(const time_point<clock, _Duration2>& t,
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
@ -697,24 +856,24 @@ public:
|
|||||||
|
|
||||||
// observer
|
// observer
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY duration time_since_epoch() const {return __d_;}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 duration time_since_epoch() const {return __d_;}
|
||||||
|
|
||||||
// arithmetic
|
// arithmetic
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d;}
|
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d;}
|
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
|
||||||
|
|
||||||
// special values
|
// special values
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY static time_point min() {return time_point(duration::min());}
|
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point min() {return time_point(duration::min());}
|
||||||
_LIBCPP_INLINE_VISIBILITY static time_point max() {return time_point(duration::max());}
|
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() {return time_point(duration::max());}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // chrono
|
} // chrono
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
struct _LIBCPP_VISIBLE common_type<chrono::time_point<_Clock, _Duration1>,
|
struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::time_point<_Clock, _Duration1>,
|
||||||
chrono::time_point<_Clock, _Duration2> >
|
chrono::time_point<_Clock, _Duration2> >
|
||||||
{
|
{
|
||||||
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
|
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
|
||||||
};
|
};
|
||||||
@ -722,17 +881,67 @@ struct _LIBCPP_VISIBLE common_type<chrono::time_point<_Clock, _Duration1>,
|
|||||||
namespace chrono {
|
namespace chrono {
|
||||||
|
|
||||||
template <class _ToDuration, class _Clock, class _Duration>
|
template <class _ToDuration, class _Clock, class _Duration>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
time_point<_Clock, _ToDuration>
|
time_point<_Clock, _ToDuration>
|
||||||
time_point_cast(const time_point<_Clock, _Duration>& __t)
|
time_point_cast(const time_point<_Clock, _Duration>& __t)
|
||||||
{
|
{
|
||||||
return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
|
return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 14
|
||||||
|
template <class _ToDuration, class _Clock, class _Duration>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__is_duration<_ToDuration>::value,
|
||||||
|
time_point<_Clock, _ToDuration>
|
||||||
|
>::type
|
||||||
|
floor(const time_point<_Clock, _Duration>& __t)
|
||||||
|
{
|
||||||
|
return time_point<_Clock, _ToDuration>{floor<_ToDuration>(__t.time_since_epoch())};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _ToDuration, class _Clock, class _Duration>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__is_duration<_ToDuration>::value,
|
||||||
|
time_point<_Clock, _ToDuration>
|
||||||
|
>::type
|
||||||
|
ceil(const time_point<_Clock, _Duration>& __t)
|
||||||
|
{
|
||||||
|
return time_point<_Clock, _ToDuration>{ceil<_ToDuration>(__t.time_since_epoch())};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _ToDuration, class _Clock, class _Duration>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
__is_duration<_ToDuration>::value,
|
||||||
|
time_point<_Clock, _ToDuration>
|
||||||
|
>::type
|
||||||
|
round(const time_point<_Clock, _Duration>& __t)
|
||||||
|
{
|
||||||
|
return time_point<_Clock, _ToDuration>{round<_ToDuration>(__t.time_since_epoch())};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Rep, class _Period>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||||
|
typename enable_if
|
||||||
|
<
|
||||||
|
numeric_limits<_Rep>::is_signed,
|
||||||
|
duration<_Rep, _Period>
|
||||||
|
>::type
|
||||||
|
abs(duration<_Rep, _Period> __d)
|
||||||
|
{
|
||||||
|
return __d >= __d.zero() ? __d : -__d;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// time_point ==
|
// time_point ==
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
bool
|
bool
|
||||||
operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -742,7 +951,7 @@ operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
// time_point !=
|
// time_point !=
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
bool
|
bool
|
||||||
operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -752,7 +961,7 @@ operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
// time_point <
|
// time_point <
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
bool
|
bool
|
||||||
operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -762,7 +971,7 @@ operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
// time_point >
|
// time_point >
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
bool
|
bool
|
||||||
operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -772,7 +981,7 @@ operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
// time_point <=
|
// time_point <=
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
bool
|
bool
|
||||||
operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -782,7 +991,7 @@ operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
// time_point >=
|
// time_point >=
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
bool
|
bool
|
||||||
operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -792,20 +1001,18 @@ operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
// time_point operator+(time_point x, duration y);
|
// time_point operator+(time_point x, duration y);
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
|
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
|
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
|
||||||
operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
|
typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
|
||||||
_Tr __r(__lhs.time_since_epoch());
|
return _Tr (__lhs.time_since_epoch() + __rhs);
|
||||||
__r += __rhs;
|
|
||||||
return __r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// time_point operator+(duration x, time_point y);
|
// time_point operator+(duration x, time_point y);
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Clock, class _Duration2>
|
template <class _Rep1, class _Period1, class _Clock, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
|
time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
|
||||||
operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -815,7 +1022,7 @@ operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Dura
|
|||||||
// time_point operator-(time_point x, duration y);
|
// time_point operator-(time_point x, duration y);
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
|
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
|
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
|
||||||
operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -825,7 +1032,7 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Pe
|
|||||||
// duration operator-(time_point x, time_point y);
|
// duration operator-(time_point x, time_point y);
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
typename common_type<_Duration1, _Duration2>::type
|
typename common_type<_Duration1, _Duration2>::type
|
||||||
operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@ -836,36 +1043,120 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
/////////////////////// clocks ///////////////////////////
|
/////////////////////// clocks ///////////////////////////
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE system_clock
|
class _LIBCPP_TYPE_VIS system_clock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef microseconds duration;
|
typedef microseconds duration;
|
||||||
typedef duration::rep rep;
|
typedef duration::rep rep;
|
||||||
typedef duration::period period;
|
typedef duration::period period;
|
||||||
typedef chrono::time_point<system_clock> time_point;
|
typedef chrono::time_point<system_clock> time_point;
|
||||||
static const bool is_steady = false;
|
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
|
||||||
|
|
||||||
static time_point now() _NOEXCEPT;
|
static time_point now() _NOEXCEPT;
|
||||||
static time_t to_time_t (const time_point& __t) _NOEXCEPT;
|
static time_t to_time_t (const time_point& __t) _NOEXCEPT;
|
||||||
static time_point from_time_t(time_t __t) _NOEXCEPT;
|
static time_point from_time_t(time_t __t) _NOEXCEPT;
|
||||||
};
|
};
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE steady_clock
|
#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
|
||||||
|
class _LIBCPP_TYPE_VIS steady_clock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef nanoseconds duration;
|
typedef nanoseconds duration;
|
||||||
typedef duration::rep rep;
|
typedef duration::rep rep;
|
||||||
typedef duration::period period;
|
typedef duration::period period;
|
||||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||||
static const bool is_steady = true;
|
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = true;
|
||||||
|
|
||||||
static time_point now() _NOEXCEPT;
|
static time_point now() _NOEXCEPT;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef steady_clock high_resolution_clock;
|
typedef steady_clock high_resolution_clock;
|
||||||
|
#else
|
||||||
|
typedef system_clock high_resolution_clock;
|
||||||
|
#endif
|
||||||
|
|
||||||
} // chrono
|
} // chrono
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
// Suffixes for duration literals [time.duration.literals]
|
||||||
|
inline namespace literals
|
||||||
|
{
|
||||||
|
inline namespace chrono_literals
|
||||||
|
{
|
||||||
|
|
||||||
|
constexpr chrono::hours operator"" h(unsigned long long __h)
|
||||||
|
{
|
||||||
|
return chrono::hours(static_cast<chrono::hours::rep>(__h));
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr chrono::duration<long double, ratio<3600,1>> operator"" h(long double __h)
|
||||||
|
{
|
||||||
|
return chrono::duration<long double, ratio<3600,1>>(__h);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
constexpr chrono::minutes operator"" min(unsigned long long __m)
|
||||||
|
{
|
||||||
|
return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr chrono::duration<long double, ratio<60,1>> operator"" min(long double __m)
|
||||||
|
{
|
||||||
|
return chrono::duration<long double, ratio<60,1>> (__m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
constexpr chrono::seconds operator"" s(unsigned long long __s)
|
||||||
|
{
|
||||||
|
return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr chrono::duration<long double> operator"" s(long double __s)
|
||||||
|
{
|
||||||
|
return chrono::duration<long double> (__s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
constexpr chrono::milliseconds operator"" ms(unsigned long long __ms)
|
||||||
|
{
|
||||||
|
return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr chrono::duration<long double, milli> operator"" ms(long double __ms)
|
||||||
|
{
|
||||||
|
return chrono::duration<long double, milli>(__ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
constexpr chrono::microseconds operator"" us(unsigned long long __us)
|
||||||
|
{
|
||||||
|
return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr chrono::duration<long double, micro> operator"" us(long double __us)
|
||||||
|
{
|
||||||
|
return chrono::duration<long double, micro> (__us);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
constexpr chrono::nanoseconds operator"" ns(unsigned long long __ns)
|
||||||
|
{
|
||||||
|
return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr chrono::duration<long double, nano> operator"" ns(long double __ns)
|
||||||
|
{
|
||||||
|
return chrono::duration<long double, nano> (__ns);
|
||||||
|
}
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
namespace chrono { // hoist the literals into namespace std::chrono
|
||||||
|
using namespace literals::chrono_literals;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP_CHRONO
|
#endif // _LIBCPP_CHRONO
|
||||||
|
@ -239,12 +239,13 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
using::imaxdiv_t;
|
using::imaxdiv_t;
|
||||||
|
|
||||||
using::imaxabs;
|
using::imaxabs;
|
||||||
using::imaxdiv;
|
using::imaxdiv;
|
||||||
using::strtoimax;
|
using::strtoimax;
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // _LIBCPP_CISO646
|
#endif // _LIBCPP_CISO646
|
||||||
|
@ -41,6 +41,8 @@ Macros:
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // _LIBCPP_CLIMITS
|
#endif // _LIBCPP_CLIMITS
|
||||||
|
@ -38,12 +38,16 @@ lconv* localeconv();
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
using ::lconv;
|
using ::lconv;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
||||||
using ::setlocale;
|
using ::setlocale;
|
||||||
|
#endif
|
||||||
using ::localeconv;
|
using ::localeconv;
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
1123
include/cmath
1123
include/cmath
File diff suppressed because it is too large
Load Diff
@ -29,7 +29,8 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
|
|||||||
class codecvt_utf8
|
class codecvt_utf8
|
||||||
: public codecvt<Elem, char, mbstate_t>
|
: public codecvt<Elem, char, mbstate_t>
|
||||||
{
|
{
|
||||||
// unspecified
|
explicit codecvt_utf8(size_t refs = 0);
|
||||||
|
~codecvt_utf8();
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||||
@ -37,7 +38,8 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
|
|||||||
class codecvt_utf16
|
class codecvt_utf16
|
||||||
: public codecvt<Elem, char, mbstate_t>
|
: public codecvt<Elem, char, mbstate_t>
|
||||||
{
|
{
|
||||||
// unspecified
|
explicit codecvt_utf16(size_t refs = 0);
|
||||||
|
~codecvt_utf16();
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||||
@ -45,7 +47,8 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
|
|||||||
class codecvt_utf8_utf16
|
class codecvt_utf8_utf16
|
||||||
: public codecvt<Elem, char, mbstate_t>
|
: public codecvt<Elem, char, mbstate_t>
|
||||||
{
|
{
|
||||||
// unspecified
|
explicit codecvt_utf8_utf16(size_t refs = 0);
|
||||||
|
~codecvt_utf8_utf16();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
@ -55,7 +58,9 @@ class codecvt_utf8_utf16
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <__locale>
|
#include <__locale>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@ -71,7 +76,7 @@ enum codecvt_mode
|
|||||||
template <class _Elem> class __codecvt_utf8;
|
template <class _Elem> class __codecvt_utf8;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class __codecvt_utf8<wchar_t>
|
class _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t>
|
||||||
: public codecvt<wchar_t, char, mbstate_t>
|
: public codecvt<wchar_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@ -106,7 +111,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class __codecvt_utf8<char16_t>
|
class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t>
|
||||||
: public codecvt<char16_t, char, mbstate_t>
|
: public codecvt<char16_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@ -141,7 +146,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class __codecvt_utf8<char32_t>
|
class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t>
|
||||||
: public codecvt<char32_t, char, mbstate_t>
|
: public codecvt<char32_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@ -177,7 +182,7 @@ protected:
|
|||||||
|
|
||||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||||
codecvt_mode _Mode = (codecvt_mode)0>
|
codecvt_mode _Mode = (codecvt_mode)0>
|
||||||
class _LIBCPP_VISIBLE codecvt_utf8
|
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8
|
||||||
: public __codecvt_utf8<_Elem>
|
: public __codecvt_utf8<_Elem>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -194,7 +199,7 @@ public:
|
|||||||
template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
|
template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class __codecvt_utf16<wchar_t, false>
|
class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false>
|
||||||
: public codecvt<wchar_t, char, mbstate_t>
|
: public codecvt<wchar_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@ -229,7 +234,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class __codecvt_utf16<wchar_t, true>
|
class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, true>
|
||||||
: public codecvt<wchar_t, char, mbstate_t>
|
: public codecvt<wchar_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@ -264,7 +269,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class __codecvt_utf16<char16_t, false>
|
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false>
|
||||||
: public codecvt<char16_t, char, mbstate_t>
|
: public codecvt<char16_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@ -299,7 +304,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class __codecvt_utf16<char16_t, true>
|
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true>
|
||||||
: public codecvt<char16_t, char, mbstate_t>
|
: public codecvt<char16_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@ -334,7 +339,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class __codecvt_utf16<char32_t, false>
|
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false>
|
||||||
: public codecvt<char32_t, char, mbstate_t>
|
: public codecvt<char32_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@ -369,7 +374,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class __codecvt_utf16<char32_t, true>
|
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true>
|
||||||
: public codecvt<char32_t, char, mbstate_t>
|
: public codecvt<char32_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@ -405,7 +410,7 @@ protected:
|
|||||||
|
|
||||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||||
codecvt_mode _Mode = (codecvt_mode)0>
|
codecvt_mode _Mode = (codecvt_mode)0>
|
||||||
class _LIBCPP_VISIBLE codecvt_utf16
|
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf16
|
||||||
: public __codecvt_utf16<_Elem, _Mode & little_endian>
|
: public __codecvt_utf16<_Elem, _Mode & little_endian>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -422,7 +427,7 @@ public:
|
|||||||
template <class _Elem> class __codecvt_utf8_utf16;
|
template <class _Elem> class __codecvt_utf8_utf16;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class __codecvt_utf8_utf16<wchar_t>
|
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t>
|
||||||
: public codecvt<wchar_t, char, mbstate_t>
|
: public codecvt<wchar_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@ -457,7 +462,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class __codecvt_utf8_utf16<char32_t>
|
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t>
|
||||||
: public codecvt<char32_t, char, mbstate_t>
|
: public codecvt<char32_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@ -492,7 +497,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class __codecvt_utf8_utf16<char16_t>
|
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t>
|
||||||
: public codecvt<char16_t, char, mbstate_t>
|
: public codecvt<char16_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@ -528,7 +533,7 @@ protected:
|
|||||||
|
|
||||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||||
codecvt_mode _Mode = (codecvt_mode)0>
|
codecvt_mode _Mode = (codecvt_mode)0>
|
||||||
class _LIBCPP_VISIBLE codecvt_utf8_utf16
|
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8_utf16
|
||||||
: public __codecvt_utf8_utf16<_Elem>
|
: public __codecvt_utf8_utf16<_Elem>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
217
include/complex
217
include/complex
@ -23,12 +23,12 @@ class complex
|
|||||||
public:
|
public:
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
|
|
||||||
complex(const T& re = T(), const T& im = T());
|
complex(const T& re = T(), const T& im = T()); // constexpr in C++14
|
||||||
complex(const complex&);
|
complex(const complex&); // constexpr in C++14
|
||||||
template<class X> complex(const complex<X>&);
|
template<class X> complex(const complex<X>&); // constexpr in C++14
|
||||||
|
|
||||||
T real() const;
|
T real() const; // constexpr in C++14
|
||||||
T imag() const;
|
T imag() const; // constexpr in C++14
|
||||||
|
|
||||||
void real(T);
|
void real(T);
|
||||||
void imag(T);
|
void imag(T);
|
||||||
@ -149,12 +149,12 @@ template<class T> complex<T> operator/(const complex<T>&, const T&);
|
|||||||
template<class T> complex<T> operator/(const T&, const complex<T>&);
|
template<class T> complex<T> operator/(const T&, const complex<T>&);
|
||||||
template<class T> complex<T> operator+(const complex<T>&);
|
template<class T> complex<T> operator+(const complex<T>&);
|
||||||
template<class T> complex<T> operator-(const complex<T>&);
|
template<class T> complex<T> operator-(const complex<T>&);
|
||||||
template<class T> bool operator==(const complex<T>&, const complex<T>&);
|
template<class T> bool operator==(const complex<T>&, const complex<T>&); // constexpr in C++14
|
||||||
template<class T> bool operator==(const complex<T>&, const T&);
|
template<class T> bool operator==(const complex<T>&, const T&); // constexpr in C++14
|
||||||
template<class T> bool operator==(const T&, const complex<T>&);
|
template<class T> bool operator==(const T&, const complex<T>&); // constexpr in C++14
|
||||||
template<class T> bool operator!=(const complex<T>&, const complex<T>&);
|
template<class T> bool operator!=(const complex<T>&, const complex<T>&); // constexpr in C++14
|
||||||
template<class T> bool operator!=(const complex<T>&, const T&);
|
template<class T> bool operator!=(const complex<T>&, const T&); // constexpr in C++14
|
||||||
template<class T> bool operator!=(const T&, const complex<T>&);
|
template<class T> bool operator!=(const T&, const complex<T>&); // constexpr in C++14
|
||||||
|
|
||||||
template<class T, class charT, class traits>
|
template<class T, class charT, class traits>
|
||||||
basic_istream<charT, traits>&
|
basic_istream<charT, traits>&
|
||||||
@ -165,17 +165,17 @@ template<class T, class charT, class traits>
|
|||||||
|
|
||||||
// 26.3.7 values:
|
// 26.3.7 values:
|
||||||
|
|
||||||
template<class T> T real(const complex<T>&);
|
template<class T> T real(const complex<T>&); // constexpr in C++14
|
||||||
long double real(long double);
|
long double real(long double); // constexpr in C++14
|
||||||
double real(double);
|
double real(double); // constexpr in C++14
|
||||||
template<Integral T> double real(T);
|
template<Integral T> double real(T); // constexpr in C++14
|
||||||
float real(float);
|
float real(float); // constexpr in C++14
|
||||||
|
|
||||||
template<class T> T imag(const complex<T>&);
|
template<class T> T imag(const complex<T>&); // constexpr in C++14
|
||||||
long double imag(long double);
|
long double imag(long double); // constexpr in C++14
|
||||||
double imag(double);
|
double imag(double); // constexpr in C++14
|
||||||
template<Integral T> double imag(T);
|
template<Integral T> double imag(T); // constexpr in C++14
|
||||||
float imag(float);
|
float imag(float); // constexpr in C++14
|
||||||
|
|
||||||
template<class T> T abs(const complex<T>&);
|
template<class T> T abs(const complex<T>&);
|
||||||
|
|
||||||
@ -249,17 +249,19 @@ template<class T, class charT, class traits>
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template<class _Tp> class _LIBCPP_VISIBLE complex;
|
template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY complex;
|
||||||
|
|
||||||
template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
|
template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
|
||||||
template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
|
template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
class _LIBCPP_VISIBLE complex
|
class _LIBCPP_TYPE_VIS_ONLY complex
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
@ -267,20 +269,21 @@ private:
|
|||||||
value_type __re_;
|
value_type __re_;
|
||||||
value_type __im_;
|
value_type __im_;
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
complex(const value_type& __re = value_type(), const value_type& __im = value_type())
|
complex(const value_type& __re = value_type(), const value_type& __im = value_type())
|
||||||
: __re_(__re), __im_(__im) {}
|
: __re_(__re), __im_(__im) {}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
complex(const complex<_Xp>& __c)
|
complex(const complex<_Xp>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY value_type real() const {return __re_;}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type real() const {return __re_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY value_type imag() const {return __im_;}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type imag() const {return __im_;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||||
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) {__re_ = __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re)
|
||||||
|
{__re_ = __re; __im_ = value_type(); return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
||||||
@ -306,39 +309,40 @@ public:
|
|||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this * __c;
|
*this = *this * complex(__c.real(), __c.imag());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this / __c;
|
*this = *this / complex(__c.real(), __c.imag());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> class _LIBCPP_VISIBLE complex<double>;
|
template<> class _LIBCPP_TYPE_VIS_ONLY complex<double>;
|
||||||
template<> class _LIBCPP_VISIBLE complex<long double>;
|
template<> class _LIBCPP_TYPE_VIS_ONLY complex<long double>;
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class _LIBCPP_VISIBLE complex<float>
|
class _LIBCPP_TYPE_VIS_ONLY complex<float>
|
||||||
{
|
{
|
||||||
float __re_;
|
float __re_;
|
||||||
float __im_;
|
float __im_;
|
||||||
public:
|
public:
|
||||||
typedef float value_type;
|
typedef float value_type;
|
||||||
|
|
||||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(float __re = 0.0f, float __im = 0.0f)
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f)
|
||||||
: __re_(__re), __im_(__im) {}
|
: __re_(__re), __im_(__im) {}
|
||||||
explicit /*constexpr*/ complex(const complex<double>& __c);
|
explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
|
||||||
explicit /*constexpr*/ complex(const complex<long double>& __c);
|
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
|
||||||
|
|
||||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float real() const {return __re_;}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;}
|
||||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float imag() const {return __im_;}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||||
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) {__re_ = __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator= (float __re)
|
||||||
|
{__re_ = __re; __im_ = value_type(); return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
||||||
@ -364,36 +368,37 @@ public:
|
|||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this * __c;
|
*this = *this * complex(__c.real(), __c.imag());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this / __c;
|
*this = *this / complex(__c.real(), __c.imag());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class _LIBCPP_VISIBLE complex<double>
|
class _LIBCPP_TYPE_VIS_ONLY complex<double>
|
||||||
{
|
{
|
||||||
double __re_;
|
double __re_;
|
||||||
double __im_;
|
double __im_;
|
||||||
public:
|
public:
|
||||||
typedef double value_type;
|
typedef double value_type;
|
||||||
|
|
||||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(double __re = 0.0, double __im = 0.0)
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0)
|
||||||
: __re_(__re), __im_(__im) {}
|
: __re_(__re), __im_(__im) {}
|
||||||
/*constexpr*/ complex(const complex<float>& __c);
|
_LIBCPP_CONSTEXPR complex(const complex<float>& __c);
|
||||||
explicit /*constexpr*/ complex(const complex<long double>& __c);
|
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
|
||||||
|
|
||||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double real() const {return __re_;}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;}
|
||||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double imag() const {return __im_;}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||||
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) {__re_ = __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator= (double __re)
|
||||||
|
{__re_ = __re; __im_ = value_type(); return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
||||||
@ -419,36 +424,37 @@ public:
|
|||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this * __c;
|
*this = *this * complex(__c.real(), __c.imag());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this / __c;
|
*this = *this / complex(__c.real(), __c.imag());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class _LIBCPP_VISIBLE complex<long double>
|
class _LIBCPP_TYPE_VIS_ONLY complex<long double>
|
||||||
{
|
{
|
||||||
long double __re_;
|
long double __re_;
|
||||||
long double __im_;
|
long double __im_;
|
||||||
public:
|
public:
|
||||||
typedef long double value_type;
|
typedef long double value_type;
|
||||||
|
|
||||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(long double __re = 0.0L, long double __im = 0.0L)
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
|
||||||
: __re_(__re), __im_(__im) {}
|
: __re_(__re), __im_(__im) {}
|
||||||
/*constexpr*/ complex(const complex<float>& __c);
|
_LIBCPP_CONSTEXPR complex(const complex<float>& __c);
|
||||||
/*constexpr*/ complex(const complex<double>& __c);
|
_LIBCPP_CONSTEXPR complex(const complex<double>& __c);
|
||||||
|
|
||||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double real() const {return __re_;}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;}
|
||||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double imag() const {return __im_;}
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||||
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) {__re_ = __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re)
|
||||||
|
{__re_ = __re; __im_ = value_type(); return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
||||||
@ -474,43 +480,43 @@ public:
|
|||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this * __c;
|
*this = *this * complex(__c.real(), __c.imag());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this / __c;
|
*this = *this / complex(__c.real(), __c.imag());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//constexpr
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
complex<float>::complex(const complex<double>& __c)
|
complex<float>::complex(const complex<double>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
//constexpr
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
complex<float>::complex(const complex<long double>& __c)
|
complex<float>::complex(const complex<long double>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
//constexpr
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
complex<double>::complex(const complex<float>& __c)
|
complex<double>::complex(const complex<float>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
//constexpr
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
complex<double>::complex(const complex<long double>& __c)
|
complex<double>::complex(const complex<long double>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
//constexpr
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
complex<long double>::complex(const complex<float>& __c)
|
complex<long double>::complex(const complex<float>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
//constexpr
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
complex<long double>::complex(const complex<double>& __c)
|
complex<long double>::complex(const complex<double>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
@ -734,7 +740,7 @@ operator-(const complex<_Tp>& __x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
bool
|
bool
|
||||||
operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
|
operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
|
||||||
{
|
{
|
||||||
@ -742,7 +748,7 @@ operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
bool
|
bool
|
||||||
operator==(const complex<_Tp>& __x, const _Tp& __y)
|
operator==(const complex<_Tp>& __x, const _Tp& __y)
|
||||||
{
|
{
|
||||||
@ -750,7 +756,7 @@ operator==(const complex<_Tp>& __x, const _Tp& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
bool
|
bool
|
||||||
operator==(const _Tp& __x, const complex<_Tp>& __y)
|
operator==(const _Tp& __x, const complex<_Tp>& __y)
|
||||||
{
|
{
|
||||||
@ -758,7 +764,7 @@ operator==(const _Tp& __x, const complex<_Tp>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
bool
|
bool
|
||||||
operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
|
operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
|
||||||
{
|
{
|
||||||
@ -766,7 +772,7 @@ operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
bool
|
bool
|
||||||
operator!=(const complex<_Tp>& __x, const _Tp& __y)
|
operator!=(const complex<_Tp>& __x, const _Tp& __y)
|
||||||
{
|
{
|
||||||
@ -774,7 +780,7 @@ operator!=(const complex<_Tp>& __x, const _Tp& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
bool
|
bool
|
||||||
operator!=(const _Tp& __x, const complex<_Tp>& __y)
|
operator!=(const _Tp& __x, const complex<_Tp>& __y)
|
||||||
{
|
{
|
||||||
@ -786,21 +792,21 @@ operator!=(const _Tp& __x, const complex<_Tp>& __y)
|
|||||||
// real
|
// real
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
_Tp
|
_Tp
|
||||||
real(const complex<_Tp>& __c)
|
real(const complex<_Tp>& __c)
|
||||||
{
|
{
|
||||||
return __c.real();
|
return __c.real();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
long double
|
long double
|
||||||
real(long double __re)
|
real(long double __re)
|
||||||
{
|
{
|
||||||
return __re;
|
return __re;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
double
|
double
|
||||||
real(double __re)
|
real(double __re)
|
||||||
{
|
{
|
||||||
@ -808,7 +814,7 @@ real(double __re)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
is_integral<_Tp>::value,
|
is_integral<_Tp>::value,
|
||||||
@ -819,7 +825,7 @@ real(_Tp __re)
|
|||||||
return __re;
|
return __re;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
float
|
float
|
||||||
real(float __re)
|
real(float __re)
|
||||||
{
|
{
|
||||||
@ -829,21 +835,21 @@ real(float __re)
|
|||||||
// imag
|
// imag
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
_Tp
|
_Tp
|
||||||
imag(const complex<_Tp>& __c)
|
imag(const complex<_Tp>& __c)
|
||||||
{
|
{
|
||||||
return __c.imag();
|
return __c.imag();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
long double
|
long double
|
||||||
imag(long double __re)
|
imag(long double __re)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
double
|
double
|
||||||
imag(double __re)
|
imag(double __re)
|
||||||
{
|
{
|
||||||
@ -851,7 +857,7 @@ imag(double __re)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
is_integral<_Tp>::value,
|
is_integral<_Tp>::value,
|
||||||
@ -862,7 +868,7 @@ imag(_Tp __re)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
float
|
float
|
||||||
imag(float __re)
|
imag(float __re)
|
||||||
{
|
{
|
||||||
@ -1243,10 +1249,12 @@ acosh(const complex<_Tp>& __x)
|
|||||||
if (isnan(__x.imag()))
|
if (isnan(__x.imag()))
|
||||||
return complex<_Tp>(abs(__x.real()), __x.imag());
|
return complex<_Tp>(abs(__x.real()), __x.imag());
|
||||||
if (isinf(__x.imag()))
|
if (isinf(__x.imag()))
|
||||||
|
{
|
||||||
if (__x.real() > 0)
|
if (__x.real() > 0)
|
||||||
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
|
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
|
||||||
else
|
else
|
||||||
return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
|
return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
|
||||||
|
}
|
||||||
if (__x.real() < 0)
|
if (__x.real() < 0)
|
||||||
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
|
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
|
||||||
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
||||||
@ -1345,7 +1353,11 @@ tanh(const complex<_Tp>& __x)
|
|||||||
_Tp __2r(_Tp(2) * __x.real());
|
_Tp __2r(_Tp(2) * __x.real());
|
||||||
_Tp __2i(_Tp(2) * __x.imag());
|
_Tp __2i(_Tp(2) * __x.imag());
|
||||||
_Tp __d(cosh(__2r) + cos(__2i));
|
_Tp __d(cosh(__2r) + cos(__2i));
|
||||||
return complex<_Tp>(sinh(__2r)/__d, sin(__2i)/__d);
|
_Tp __2rsh(sinh(__2r));
|
||||||
|
if (isinf(__2rsh) && isinf(__d))
|
||||||
|
return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
|
||||||
|
__2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
|
||||||
|
return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
|
||||||
}
|
}
|
||||||
|
|
||||||
// asin
|
// asin
|
||||||
@ -1509,6 +1521,47 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
|
|||||||
return __os << __s.str();
|
return __os << __s.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
// Literal suffix for complex number literals [complex.literals]
|
||||||
|
inline namespace literals
|
||||||
|
{
|
||||||
|
inline namespace complex_literals
|
||||||
|
{
|
||||||
|
constexpr complex<long double> operator""il(long double __im)
|
||||||
|
{
|
||||||
|
return { 0.0l, __im };
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr complex<long double> operator""il(unsigned long long __im)
|
||||||
|
{
|
||||||
|
return { 0.0l, static_cast<long double>(__im) };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
constexpr complex<double> operator""i(long double __im)
|
||||||
|
{
|
||||||
|
return { 0.0, static_cast<double>(__im) };
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr complex<double> operator""i(unsigned long long __im)
|
||||||
|
{
|
||||||
|
return { 0.0, static_cast<double>(__im) };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
constexpr complex<float> operator""if(long double __im)
|
||||||
|
{
|
||||||
|
return { 0.0f, static_cast<float>(__im) };
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr complex<float> operator""if(unsigned long long __im)
|
||||||
|
{
|
||||||
|
return { 0.0f, static_cast<float>(__im) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP_COMPLEX
|
#endif // _LIBCPP_COMPLEX
|
||||||
|
@ -18,6 +18,12 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <__config>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <ccomplex>
|
#include <ccomplex>
|
||||||
@ -28,6 +34,4 @@
|
|||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#pragma GCC system_header
|
|
||||||
|
|
||||||
#endif // _LIBCPP_COMPLEX_H
|
#endif // _LIBCPP_COMPLEX_H
|
||||||
|
@ -28,8 +28,8 @@ public:
|
|||||||
condition_variable(const condition_variable&) = delete;
|
condition_variable(const condition_variable&) = delete;
|
||||||
condition_variable& operator=(const condition_variable&) = delete;
|
condition_variable& operator=(const condition_variable&) = delete;
|
||||||
|
|
||||||
void notify_one();
|
void notify_one() noexcept;
|
||||||
void notify_all();
|
void notify_all() noexcept;
|
||||||
|
|
||||||
void wait(unique_lock<mutex>& lock);
|
void wait(unique_lock<mutex>& lock);
|
||||||
template <class Predicate>
|
template <class Predicate>
|
||||||
@ -72,8 +72,8 @@ public:
|
|||||||
condition_variable_any(const condition_variable_any&) = delete;
|
condition_variable_any(const condition_variable_any&) = delete;
|
||||||
condition_variable_any& operator=(const condition_variable_any&) = delete;
|
condition_variable_any& operator=(const condition_variable_any&) = delete;
|
||||||
|
|
||||||
void notify_one();
|
void notify_one() noexcept;
|
||||||
void notify_all();
|
void notify_all() noexcept;
|
||||||
|
|
||||||
template <class Lock>
|
template <class Lock>
|
||||||
void wait(Lock& lock);
|
void wait(Lock& lock);
|
||||||
@ -111,23 +111,31 @@ public:
|
|||||||
#include <__mutex_base>
|
#include <__mutex_base>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE condition_variable_any
|
class _LIBCPP_TYPE_VIS condition_variable_any
|
||||||
{
|
{
|
||||||
condition_variable __cv_;
|
condition_variable __cv_;
|
||||||
shared_ptr<mutex> __mut_;
|
shared_ptr<mutex> __mut_;
|
||||||
public:
|
public:
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
condition_variable_any();
|
condition_variable_any();
|
||||||
|
|
||||||
void notify_one();
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void notify_all();
|
void notify_one() _NOEXCEPT;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
void notify_all() _NOEXCEPT;
|
||||||
|
|
||||||
template <class _Lock>
|
template <class _Lock>
|
||||||
void wait(_Lock& __lock);
|
void wait(_Lock& __lock);
|
||||||
template <class _Lock, class _Predicate>
|
template <class _Lock, class _Predicate>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void wait(_Lock& __lock, _Predicate __pred);
|
void wait(_Lock& __lock, _Predicate __pred);
|
||||||
|
|
||||||
template <class _Lock, class _Clock, class _Duration>
|
template <class _Lock, class _Clock, class _Duration>
|
||||||
@ -137,39 +145,42 @@ public:
|
|||||||
|
|
||||||
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
||||||
bool
|
bool
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
wait_until(_Lock& __lock,
|
wait_until(_Lock& __lock,
|
||||||
const chrono::time_point<_Clock, _Duration>& __t,
|
const chrono::time_point<_Clock, _Duration>& __t,
|
||||||
_Predicate __pred);
|
_Predicate __pred);
|
||||||
|
|
||||||
template <class _Lock, class _Rep, class _Period>
|
template <class _Lock, class _Rep, class _Period>
|
||||||
cv_status
|
cv_status
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
wait_for(_Lock& __lock,
|
wait_for(_Lock& __lock,
|
||||||
const chrono::duration<_Rep, _Period>& __d);
|
const chrono::duration<_Rep, _Period>& __d);
|
||||||
|
|
||||||
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
||||||
bool
|
bool
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
wait_for(_Lock& __lock,
|
wait_for(_Lock& __lock,
|
||||||
const chrono::duration<_Rep, _Period>& __d,
|
const chrono::duration<_Rep, _Period>& __d,
|
||||||
_Predicate __pred);
|
_Predicate __pred);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
condition_variable_any::condition_variable_any()
|
condition_variable_any::condition_variable_any()
|
||||||
: __mut_(make_shared<mutex>()) {}
|
: __mut_(make_shared<mutex>()) {}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
void
|
void
|
||||||
condition_variable_any::notify_one()
|
condition_variable_any::notify_one() _NOEXCEPT
|
||||||
{
|
{
|
||||||
{lock_guard<mutex> _(*__mut_);}
|
{lock_guard<mutex> __lx(*__mut_);}
|
||||||
__cv_.notify_one();
|
__cv_.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
void
|
void
|
||||||
condition_variable_any::notify_all()
|
condition_variable_any::notify_all() _NOEXCEPT
|
||||||
{
|
{
|
||||||
{lock_guard<mutex> _(*__mut_);}
|
{lock_guard<mutex> __lx(*__mut_);}
|
||||||
__cv_.notify_all();
|
__cv_.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,13 +197,13 @@ condition_variable_any::wait(_Lock& __lock)
|
|||||||
shared_ptr<mutex> __mut = __mut_;
|
shared_ptr<mutex> __mut = __mut_;
|
||||||
unique_lock<mutex> __lk(*__mut);
|
unique_lock<mutex> __lk(*__mut);
|
||||||
__lock.unlock();
|
__lock.unlock();
|
||||||
unique_ptr<_Lock, __lock_external> __(&__lock);
|
unique_ptr<_Lock, __lock_external> __lxx(&__lock);
|
||||||
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
|
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
|
||||||
__cv_.wait(__lk);
|
__cv_.wait(__lk);
|
||||||
} // __mut_.unlock(), __lock.lock()
|
} // __mut_.unlock(), __lock.lock()
|
||||||
|
|
||||||
template <class _Lock, class _Predicate>
|
template <class _Lock, class _Predicate>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
void
|
void
|
||||||
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
|
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
|
||||||
{
|
{
|
||||||
@ -208,13 +219,13 @@ condition_variable_any::wait_until(_Lock& __lock,
|
|||||||
shared_ptr<mutex> __mut = __mut_;
|
shared_ptr<mutex> __mut = __mut_;
|
||||||
unique_lock<mutex> __lk(*__mut);
|
unique_lock<mutex> __lk(*__mut);
|
||||||
__lock.unlock();
|
__lock.unlock();
|
||||||
unique_ptr<_Lock, __lock_external> __(&__lock);
|
unique_ptr<_Lock, __lock_external> __lxx(&__lock);
|
||||||
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
|
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
|
||||||
return __cv_.wait_until(__lk, __t);
|
return __cv_.wait_until(__lk, __t);
|
||||||
} // __mut_.unlock(), __lock.lock()
|
} // __mut_.unlock(), __lock.lock()
|
||||||
|
|
||||||
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bool
|
bool
|
||||||
condition_variable_any::wait_until(_Lock& __lock,
|
condition_variable_any::wait_until(_Lock& __lock,
|
||||||
const chrono::time_point<_Clock, _Duration>& __t,
|
const chrono::time_point<_Clock, _Duration>& __t,
|
||||||
@ -227,7 +238,7 @@ condition_variable_any::wait_until(_Lock& __lock,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Lock, class _Rep, class _Period>
|
template <class _Lock, class _Rep, class _Period>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
cv_status
|
cv_status
|
||||||
condition_variable_any::wait_for(_Lock& __lock,
|
condition_variable_any::wait_for(_Lock& __lock,
|
||||||
const chrono::duration<_Rep, _Period>& __d)
|
const chrono::duration<_Rep, _Period>& __d)
|
||||||
@ -236,7 +247,7 @@ condition_variable_any::wait_for(_Lock& __lock,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
bool
|
bool
|
||||||
condition_variable_any::wait_for(_Lock& __lock,
|
condition_variable_any::wait_for(_Lock& __lock,
|
||||||
const chrono::duration<_Rep, _Period>& __d,
|
const chrono::duration<_Rep, _Period>& __d,
|
||||||
@ -246,9 +257,11 @@ condition_variable_any::wait_for(_Lock& __lock,
|
|||||||
_VSTD::move(__pred));
|
_VSTD::move(__pred));
|
||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_VISIBLE
|
_LIBCPP_FUNC_VIS
|
||||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||||
|
|
||||||
#endif // _LIBCPP_CONDITION_VARIABLE
|
#endif // _LIBCPP_CONDITION_VARIABLE
|
||||||
|
@ -34,10 +34,8 @@ void longjmp(jmp_buf env, int val);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
|
||||||
#ifndef setjmp
|
|
||||||
#define setjmp(env) setjmp(env)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
@ -43,7 +43,9 @@ int raise(int sig);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
@ -35,7 +35,9 @@ Types:
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
@ -22,7 +22,9 @@ Macros:
|
|||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef __bool_true_false_are_defined
|
#undef __bool_true_false_are_defined
|
||||||
#define __bool_true_false_are_defined 1
|
#define __bool_true_false_are_defined 1
|
||||||
|
@ -35,66 +35,26 @@ Types:
|
|||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
|
|
||||||
#ifdef __GLIBC__
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#define __need_NULL
|
|
||||||
#define __need_ptrdiff_t
|
|
||||||
#define __need_size_t
|
|
||||||
#endif // __GLIBC__
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Don't include our own <stddef.h>; we don't want to declare ::nullptr_t.
|
||||||
|
#include_next <stddef.h>
|
||||||
|
#include <__nullptr>
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
using ::ptrdiff_t;
|
using ::ptrdiff_t;
|
||||||
using ::size_t;
|
using ::size_t;
|
||||||
|
|
||||||
|
#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
|
||||||
|
// Re-use the compiler's <stddef.h> max_align_t where possible.
|
||||||
|
using ::max_align_t;
|
||||||
|
#else
|
||||||
typedef long double max_align_t;
|
typedef long double max_align_t;
|
||||||
|
#endif
|
||||||
#ifdef _LIBCPP_HAS_NO_NULLPTR
|
|
||||||
|
|
||||||
struct _LIBCPP_VISIBLE nullptr_t
|
|
||||||
{
|
|
||||||
void* _;
|
|
||||||
|
|
||||||
struct __nat {int __for_bool_;};
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {}
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
|
||||||
operator _Tp* () const {return 0;}
|
|
||||||
|
|
||||||
template <class _Tp, class _Up>
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
|
||||||
operator _Tp _Up::* () const {return 0;}
|
|
||||||
|
|
||||||
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
|
|
||||||
friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;}
|
|
||||||
friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, nullptr_t) {return false;}
|
|
||||||
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
|
|
||||||
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
|
|
||||||
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
|
|
||||||
};
|
|
||||||
|
|
||||||
inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
|
||||||
|
|
||||||
#define nullptr _VSTD::__get_nullptr_t()
|
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_NULLPTR
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_NULLPTR
|
|
||||||
|
|
||||||
namespace std
|
|
||||||
{
|
|
||||||
typedef decltype(nullptr) nullptr_t;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_NULLPTR
|
|
||||||
|
|
||||||
#endif // _LIBCPP_CSTDDEF
|
#endif // _LIBCPP_CSTDDEF
|
||||||
|
@ -144,7 +144,9 @@ Types:
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ int fputc(int c, FILE* stream);
|
|||||||
int fputs(const char* restrict s, FILE* restrict stream);
|
int fputs(const char* restrict s, FILE* restrict stream);
|
||||||
int getc(FILE* stream);
|
int getc(FILE* stream);
|
||||||
int getchar(void);
|
int getchar(void);
|
||||||
char* gets(char* s);
|
char* gets(char* s); // removed in C++14
|
||||||
int putc(int c, FILE* stream);
|
int putc(int c, FILE* stream);
|
||||||
int putchar(int c);
|
int putchar(int c);
|
||||||
int puts(const char* s);
|
int puts(const char* s);
|
||||||
@ -99,7 +99,9 @@ void perror(const char* s);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@ -107,40 +109,28 @@ using ::FILE;
|
|||||||
using ::fpos_t;
|
using ::fpos_t;
|
||||||
using ::size_t;
|
using ::size_t;
|
||||||
|
|
||||||
using ::remove;
|
|
||||||
using ::rename;
|
|
||||||
using ::tmpfile;
|
|
||||||
using ::tmpnam;
|
|
||||||
using ::fclose;
|
using ::fclose;
|
||||||
using ::fflush;
|
using ::fflush;
|
||||||
using ::fopen;
|
|
||||||
using ::freopen;
|
|
||||||
using ::setbuf;
|
using ::setbuf;
|
||||||
using ::setvbuf;
|
using ::setvbuf;
|
||||||
using ::fprintf;
|
using ::fprintf;
|
||||||
using ::fscanf;
|
using ::fscanf;
|
||||||
using ::printf;
|
|
||||||
using ::scanf;
|
|
||||||
using ::snprintf;
|
using ::snprintf;
|
||||||
using ::sprintf;
|
using ::sprintf;
|
||||||
using ::sscanf;
|
using ::sscanf;
|
||||||
|
#ifndef _LIBCPP_MSVCRT
|
||||||
using ::vfprintf;
|
using ::vfprintf;
|
||||||
using ::vfscanf;
|
using ::vfscanf;
|
||||||
using ::vprintf;
|
using ::vsscanf;
|
||||||
using ::vscanf;
|
#endif // _LIBCPP_MSVCRT
|
||||||
using ::vsnprintf;
|
using ::vsnprintf;
|
||||||
using ::vsprintf;
|
using ::vsprintf;
|
||||||
using ::vsscanf;
|
|
||||||
using ::fgetc;
|
using ::fgetc;
|
||||||
using ::fgets;
|
using ::fgets;
|
||||||
using ::fputc;
|
using ::fputc;
|
||||||
using ::fputs;
|
using ::fputs;
|
||||||
using ::getc;
|
using ::getc;
|
||||||
using ::getchar;
|
|
||||||
using ::gets;
|
|
||||||
using ::putc;
|
using ::putc;
|
||||||
using ::putchar;
|
|
||||||
using ::puts;
|
|
||||||
using ::ungetc;
|
using ::ungetc;
|
||||||
using ::fread;
|
using ::fread;
|
||||||
using ::fwrite;
|
using ::fwrite;
|
||||||
@ -154,6 +144,31 @@ using ::feof;
|
|||||||
using ::ferror;
|
using ::ferror;
|
||||||
using ::perror;
|
using ::perror;
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
|
using ::fopen;
|
||||||
|
using ::freopen;
|
||||||
|
using ::remove;
|
||||||
|
using ::rename;
|
||||||
|
using ::tmpfile;
|
||||||
|
using ::tmpnam;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_STDIN
|
||||||
|
using ::getchar;
|
||||||
|
#if _LIBCPP_STD_VER <= 11
|
||||||
|
using ::gets;
|
||||||
|
#endif
|
||||||
|
using ::scanf;
|
||||||
|
using ::vscanf;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_STDOUT
|
||||||
|
using ::printf;
|
||||||
|
using ::putchar;
|
||||||
|
using ::puts;
|
||||||
|
using ::vprintf;
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP_CSTDIO
|
#endif // _LIBCPP_CSTDIO
|
||||||
|
@ -74,6 +74,9 @@ int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
|
|||||||
int wctomb(char* s, wchar_t wchar);
|
int wctomb(char* s, wchar_t wchar);
|
||||||
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
|
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
|
||||||
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
|
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
|
||||||
|
int at_quick_exit(void (*func)(void)) // C++11
|
||||||
|
void quick_exit(int status); // C++11
|
||||||
|
void *aligned_alloc(size_t alignment, size_t size); // C11
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
|
||||||
@ -82,25 +85,35 @@ size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
using ::size_t;
|
using ::size_t;
|
||||||
using ::div_t;
|
using ::div_t;
|
||||||
using ::ldiv_t;
|
using ::ldiv_t;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::lldiv_t;
|
using ::lldiv_t;
|
||||||
|
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::atof;
|
using ::atof;
|
||||||
using ::atoi;
|
using ::atoi;
|
||||||
using ::atol;
|
using ::atol;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::atoll;
|
using ::atoll;
|
||||||
|
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::strtod;
|
using ::strtod;
|
||||||
using ::strtof;
|
using ::strtof;
|
||||||
using ::strtold;
|
using ::strtold;
|
||||||
using ::strtol;
|
using ::strtol;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::strtoll;
|
using ::strtoll;
|
||||||
|
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::strtoul;
|
using ::strtoul;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::strtoull;
|
using ::strtoull;
|
||||||
|
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::rand;
|
using ::rand;
|
||||||
using ::srand;
|
using ::srand;
|
||||||
using ::calloc;
|
using ::calloc;
|
||||||
@ -117,21 +130,28 @@ using ::bsearch;
|
|||||||
using ::qsort;
|
using ::qsort;
|
||||||
using ::abs;
|
using ::abs;
|
||||||
using ::labs;
|
using ::labs;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::llabs;
|
using ::llabs;
|
||||||
|
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::div;
|
using ::div;
|
||||||
using ::ldiv;
|
using ::ldiv;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::lldiv;
|
using ::lldiv;
|
||||||
|
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||||
|
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
||||||
using ::mblen;
|
using ::mblen;
|
||||||
using ::mbtowc;
|
using ::mbtowc;
|
||||||
using ::wctomb;
|
using ::wctomb;
|
||||||
|
#endif
|
||||||
using ::mbstowcs;
|
using ::mbstowcs;
|
||||||
using ::wcstombs;
|
using ::wcstombs;
|
||||||
|
#ifdef _LIBCPP_HAS_QUICK_EXIT
|
||||||
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) {return labs(__x);}
|
using ::at_quick_exit;
|
||||||
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
|
using ::quick_exit;
|
||||||
|
#endif
|
||||||
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) {return ldiv(__x, __y);}
|
#ifdef _LIBCPP_HAS_C11_FEATURES
|
||||||
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
|
using ::aligned_alloc;
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
@ -60,7 +60,9 @@ size_t strlen(const char* s);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@ -91,7 +93,8 @@ using ::strspn;
|
|||||||
|
|
||||||
using ::strstr;
|
using ::strstr;
|
||||||
|
|
||||||
#ifndef __GLIBC__ // GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
|
// MSVCRT, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
|
||||||
|
#if !defined(__GLIBC__) && !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
|
||||||
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
|
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
|
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
|
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
|
||||||
@ -99,7 +102,9 @@ inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, si
|
|||||||
inline _LIBCPP_INLINE_VISIBILITY char* strstr( char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
|
inline _LIBCPP_INLINE_VISIBILITY char* strstr( char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
||||||
using ::strtok;
|
using ::strtok;
|
||||||
|
#endif
|
||||||
using ::memset;
|
using ::memset;
|
||||||
using ::strerror;
|
using ::strerror;
|
||||||
using ::strlen;
|
using ::strlen;
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#include <ccomplex>
|
#include <ccomplex>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // _LIBCPP_CTGMATH
|
#endif // _LIBCPP_CTGMATH
|
||||||
|
@ -47,7 +47,9 @@ size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@ -59,10 +61,12 @@ using ::clock;
|
|||||||
using ::difftime;
|
using ::difftime;
|
||||||
using ::mktime;
|
using ::mktime;
|
||||||
using ::time;
|
using ::time;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
||||||
using ::asctime;
|
using ::asctime;
|
||||||
using ::ctime;
|
using ::ctime;
|
||||||
using ::gmtime;
|
using ::gmtime;
|
||||||
using ::localtime;
|
using ::localtime;
|
||||||
|
#endif
|
||||||
using ::strftime;
|
using ::strftime;
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
69
include/ctype.h
Normal file
69
include/ctype.h
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===---------------------------- ctype.h ---------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_CTYPE_H
|
||||||
|
#define _LIBCPP_CTYPE_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
ctype.h synopsis
|
||||||
|
|
||||||
|
int isalnum(int c);
|
||||||
|
int isalpha(int c);
|
||||||
|
int isblank(int c); // C99
|
||||||
|
int iscntrl(int c);
|
||||||
|
int isdigit(int c);
|
||||||
|
int isgraph(int c);
|
||||||
|
int islower(int c);
|
||||||
|
int isprint(int c);
|
||||||
|
int ispunct(int c);
|
||||||
|
int isspace(int c);
|
||||||
|
int isupper(int c);
|
||||||
|
int isxdigit(int c);
|
||||||
|
int tolower(int c);
|
||||||
|
int toupper(int c);
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <__config>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include_next <ctype.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#if defined(_LIBCPP_MSVCRT)
|
||||||
|
// We support including .h headers inside 'extern "C"' contexts, so switch
|
||||||
|
// back to C++ linkage before including these C++ headers.
|
||||||
|
extern "C++" {
|
||||||
|
#include "support/win32/support.h"
|
||||||
|
#include "support/win32/locale_win32.h"
|
||||||
|
}
|
||||||
|
#endif // _LIBCPP_MSVCRT
|
||||||
|
|
||||||
|
#undef isalnum
|
||||||
|
#undef isalpha
|
||||||
|
#undef isblank
|
||||||
|
#undef iscntrl
|
||||||
|
#undef isdigit
|
||||||
|
#undef isgraph
|
||||||
|
#undef islower
|
||||||
|
#undef isprint
|
||||||
|
#undef ispunct
|
||||||
|
#undef isspace
|
||||||
|
#undef isupper
|
||||||
|
#undef isxdigit
|
||||||
|
#undef tolower
|
||||||
|
#undef toupper
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _LIBCPP_CTYPE_H
|
@ -106,11 +106,10 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <cwctype>
|
#include <cwctype>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#if _WIN32
|
|
||||||
#include <support/win32/support.h> // pull in *swprintf defines
|
|
||||||
#endif // _WIN32
|
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@ -122,32 +121,34 @@ using ::FILE;
|
|||||||
using ::fwprintf;
|
using ::fwprintf;
|
||||||
using ::fwscanf;
|
using ::fwscanf;
|
||||||
using ::swprintf;
|
using ::swprintf;
|
||||||
using ::swscanf;
|
|
||||||
using ::vfwprintf;
|
using ::vfwprintf;
|
||||||
using ::vfwscanf;
|
|
||||||
using ::vswprintf;
|
using ::vswprintf;
|
||||||
|
#ifndef _LIBCPP_MSVCRT
|
||||||
|
using ::swscanf;
|
||||||
|
using ::vfwscanf;
|
||||||
using ::vswscanf;
|
using ::vswscanf;
|
||||||
using ::vwprintf;
|
#endif // _LIBCPP_MSVCRT
|
||||||
using ::vwscanf;
|
|
||||||
using ::wprintf;
|
|
||||||
using ::wscanf;
|
|
||||||
using ::fgetwc;
|
using ::fgetwc;
|
||||||
using ::fgetws;
|
using ::fgetws;
|
||||||
using ::fputwc;
|
using ::fputwc;
|
||||||
using ::fputws;
|
using ::fputws;
|
||||||
using ::fwide;
|
using ::fwide;
|
||||||
using ::getwc;
|
using ::getwc;
|
||||||
using ::getwchar;
|
|
||||||
using ::putwc;
|
using ::putwc;
|
||||||
using ::putwchar;
|
|
||||||
using ::ungetwc;
|
using ::ungetwc;
|
||||||
using ::wcstod;
|
using ::wcstod;
|
||||||
|
#ifndef _LIBCPP_MSVCRT
|
||||||
using ::wcstof;
|
using ::wcstof;
|
||||||
using ::wcstold;
|
using ::wcstold;
|
||||||
|
#endif // _LIBCPP_MSVCRT
|
||||||
using ::wcstol;
|
using ::wcstol;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::wcstoll;
|
using ::wcstoll;
|
||||||
|
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::wcstoul;
|
using ::wcstoul;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::wcstoull;
|
using ::wcstoull;
|
||||||
|
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||||
using ::wcscpy;
|
using ::wcscpy;
|
||||||
using ::wcsncpy;
|
using ::wcsncpy;
|
||||||
using ::wcscat;
|
using ::wcscat;
|
||||||
@ -157,28 +158,33 @@ using ::wcscoll;
|
|||||||
using ::wcsncmp;
|
using ::wcsncmp;
|
||||||
using ::wcsxfrm;
|
using ::wcsxfrm;
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS
|
||||||
|
using ::wcschr;
|
||||||
|
using ::wcspbrk;
|
||||||
|
using ::wcsrchr;
|
||||||
|
using ::wcsstr;
|
||||||
|
using ::wmemchr;
|
||||||
|
#else
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
|
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
|
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
|
||||||
|
|
||||||
using ::wcscspn;
|
|
||||||
using ::wcslen;
|
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
|
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
|
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
|
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
|
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
|
||||||
|
|
||||||
using ::wcsspn;
|
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
|
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
|
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
|
||||||
|
|
||||||
using ::wcstok;
|
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
|
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
|
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using ::wcscspn;
|
||||||
|
using ::wcslen;
|
||||||
|
using ::wcsspn;
|
||||||
|
using ::wcstok;
|
||||||
using ::wmemcmp;
|
using ::wmemcmp;
|
||||||
using ::wmemcpy;
|
using ::wmemcpy;
|
||||||
using ::wmemmove;
|
using ::wmemmove;
|
||||||
@ -193,6 +199,20 @@ using ::wcrtomb;
|
|||||||
using ::mbsrtowcs;
|
using ::mbsrtowcs;
|
||||||
using ::wcsrtombs;
|
using ::wcsrtombs;
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_STDIN
|
||||||
|
using ::getwchar;
|
||||||
|
#ifndef _LIBCPP_MSVCRT
|
||||||
|
using ::vwscanf;
|
||||||
|
#endif // _LIBCPP_MSVCRT
|
||||||
|
using ::wscanf;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_STDOUT
|
||||||
|
using ::putwchar;
|
||||||
|
using ::vwprintf;
|
||||||
|
using ::wprintf;
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP_CWCHAR
|
#endif // _LIBCPP_CWCHAR
|
||||||
|
128
include/cwctype
128
include/cwctype
@ -54,157 +54,33 @@ wctrans_t wctrans(const char* property);
|
|||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
using ::wint_t;
|
using ::wint_t;
|
||||||
using ::wctrans_t;
|
using ::wctrans_t;
|
||||||
using ::wctype_t;
|
using ::wctype_t;
|
||||||
|
|
||||||
#ifdef iswalnum
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalnum(wint_t __wc) {return iswalnum(__wc);}
|
|
||||||
#undef iswalnum
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iswalnum(wint_t __wc) {return __libcpp_iswalnum(__wc);}
|
|
||||||
#else // iswalnum
|
|
||||||
using ::iswalnum;
|
using ::iswalnum;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef iswalpha
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalpha(wint_t __wc) {return iswalpha(__wc);}
|
|
||||||
#undef iswalpha
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iswalpha(wint_t __wc) {return __libcpp_iswalpha(__wc);}
|
|
||||||
#else // iswalpha
|
|
||||||
using ::iswalpha;
|
using ::iswalpha;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef iswblank
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswblank(wint_t __wc) {return iswblank(__wc);}
|
|
||||||
#undef iswblank
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iswblank(wint_t __wc) {return __libcpp_iswblank(__wc);}
|
|
||||||
#else // iswblank
|
|
||||||
using ::iswblank;
|
using ::iswblank;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef iswcntrl
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswcntrl(wint_t __wc) {return iswcntrl(__wc);}
|
|
||||||
#undef iswcntrl
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iswcntrl(wint_t __wc) {return __libcpp_iswcntrl(__wc);}
|
|
||||||
#else // iswcntrl
|
|
||||||
using ::iswcntrl;
|
using ::iswcntrl;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef iswdigit
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswdigit(wint_t __wc) {return iswdigit(__wc);}
|
|
||||||
#undef iswdigit
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iswdigit(wint_t __wc) {return __libcpp_iswdigit(__wc);}
|
|
||||||
#else // iswdigit
|
|
||||||
using ::iswdigit;
|
using ::iswdigit;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef iswgraph
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswgraph(wint_t __wc) {return iswgraph(__wc);}
|
|
||||||
#undef iswgraph
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iswgraph(wint_t __wc) {return __libcpp_iswgraph(__wc);}
|
|
||||||
#else // iswgraph
|
|
||||||
using ::iswgraph;
|
using ::iswgraph;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef iswlower
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswlower(wint_t __wc) {return iswlower(__wc);}
|
|
||||||
#undef iswlower
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iswlower(wint_t __wc) {return __libcpp_iswlower(__wc);}
|
|
||||||
#else // iswlower
|
|
||||||
using ::iswlower;
|
using ::iswlower;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef iswprint
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswprint(wint_t __wc) {return iswprint(__wc);}
|
|
||||||
#undef iswprint
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iswprint(wint_t __wc) {return __libcpp_iswprint(__wc);}
|
|
||||||
#else // iswprint
|
|
||||||
using ::iswprint;
|
using ::iswprint;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef iswpunct
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswpunct(wint_t __wc) {return iswpunct(__wc);}
|
|
||||||
#undef iswpunct
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iswpunct(wint_t __wc) {return __libcpp_iswpunct(__wc);}
|
|
||||||
#else // iswpunct
|
|
||||||
using ::iswpunct;
|
using ::iswpunct;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef iswspace
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswspace(wint_t __wc) {return iswspace(__wc);}
|
|
||||||
#undef iswspace
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iswspace(wint_t __wc) {return __libcpp_iswspace(__wc);}
|
|
||||||
#else // iswspace
|
|
||||||
using ::iswspace;
|
using ::iswspace;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef iswupper
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswupper(wint_t __wc) {return iswupper(__wc);}
|
|
||||||
#undef iswupper
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iswupper(wint_t __wc) {return __libcpp_iswupper(__wc);}
|
|
||||||
#else // iswupper
|
|
||||||
using ::iswupper;
|
using ::iswupper;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef iswxdigit
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswxdigit(wint_t __wc) {return iswxdigit(__wc);}
|
|
||||||
#undef iswxdigit
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iswxdigit(wint_t __wc) {return __libcpp_iswxdigit(__wc);}
|
|
||||||
#else // iswxdigit
|
|
||||||
using ::iswxdigit;
|
using ::iswxdigit;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef iswctype
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswctype(wint_t __w, wctype_t __d) {return iswctype(__w, __d);}
|
|
||||||
#undef iswctype
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY int iswctype(wint_t __w, wctype_t __d) {return __libcpp_iswctype(__w, __d);}
|
|
||||||
#else // iswctype
|
|
||||||
using ::iswctype;
|
using ::iswctype;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef wctype
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wctype_t __libcpp_wctype(const char* __p) {return wctype(__p);}
|
|
||||||
#undef wctype
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wctype_t wctype(const char* __p) {return __libcpp_wctype(__p);}
|
|
||||||
#else // wctype
|
|
||||||
using ::wctype;
|
using ::wctype;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef towlower
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towlower(wint_t __wc) {return towlower(__wc);}
|
|
||||||
#undef towlower
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wint_t towlower(wint_t __wc) {return __libcpp_towlower(__wc);}
|
|
||||||
#else // towlower
|
|
||||||
using ::towlower;
|
using ::towlower;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef towupper
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towupper(wint_t __wc) {return towupper(__wc);}
|
|
||||||
#undef towupper
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wint_t towupper(wint_t __wc) {return __libcpp_towupper(__wc);}
|
|
||||||
#else // towupper
|
|
||||||
using ::towupper;
|
using ::towupper;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef towctrans
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towctrans(wint_t __wc, wctype_t __d) {return towctrans(__wc, __d);}
|
|
||||||
#undef towctrans
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wint_t towctrans(wint_t __wc, wctype_t __d) {return __libcpp_towctrans(__wc, __d);}
|
|
||||||
#else // towctrans
|
|
||||||
using ::towctrans;
|
using ::towctrans;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef wctrans
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wctrans_t __libcpp_wctrans(const char* __p) {return wctrans(__p);}
|
|
||||||
#undef wctrans
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wctrans_t wctrans(const char* __p) {return __libcpp_wctrans(__p);}
|
|
||||||
#else // wctrans
|
|
||||||
using ::wctrans;
|
using ::wctrans;
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
355
include/deque
355
include/deque
@ -41,6 +41,7 @@ public:
|
|||||||
deque() noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
deque() noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
||||||
explicit deque(const allocator_type& a);
|
explicit deque(const allocator_type& a);
|
||||||
explicit deque(size_type n);
|
explicit deque(size_type n);
|
||||||
|
explicit deque(size_type n, const allocator_type& a); // C++14
|
||||||
deque(size_type n, const value_type& v);
|
deque(size_type n, const value_type& v);
|
||||||
deque(size_type n, const value_type& v, const allocator_type& a);
|
deque(size_type n, const value_type& v, const allocator_type& a);
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
@ -116,15 +117,14 @@ public:
|
|||||||
iterator insert(const_iterator p, value_type&& v);
|
iterator insert(const_iterator p, value_type&& v);
|
||||||
iterator insert(const_iterator p, size_type n, const value_type& v);
|
iterator insert(const_iterator p, size_type n, const value_type& v);
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
iterator insert (const_iterator p, InputIterator f, InputIterator l);
|
iterator insert(const_iterator p, InputIterator f, InputIterator l);
|
||||||
iterator insert(const_iterator p, initializer_list<value_type> il);
|
iterator insert(const_iterator p, initializer_list<value_type> il);
|
||||||
void pop_front();
|
void pop_front();
|
||||||
void pop_back();
|
void pop_back();
|
||||||
iterator erase(const_iterator p);
|
iterator erase(const_iterator p);
|
||||||
iterator erase(const_iterator f, const_iterator l);
|
iterator erase(const_iterator f, const_iterator l);
|
||||||
void swap(deque& c)
|
void swap(deque& c)
|
||||||
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
noexcept(allocator_traits<allocator_type>::is_always_equal::value); // C++17
|
||||||
__is_nothrow_swappable<allocator_type>::value);
|
|
||||||
void clear() noexcept;
|
void clear() noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -150,7 +150,9 @@ template <class T, class Allocator>
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
#include <__split_buffer>
|
#include <__split_buffer>
|
||||||
@ -160,13 +162,16 @@ template <class T, class Allocator>
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include <__undef_min_max>
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _Tp, class _Allocator> class __deque_base;
|
template <class _Tp, class _Allocator> class __deque_base;
|
||||||
|
template <class _Tp, class _Allocator = allocator<_Tp> > class _LIBCPP_TYPE_VIS_ONLY deque;
|
||||||
|
|
||||||
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
|
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
|
||||||
class _DiffType, _DiffType _BlockSize>
|
class _DiffType, _DiffType _BlockSize>
|
||||||
class _LIBCPP_VISIBLE __deque_iterator;
|
class _LIBCPP_TYPE_VIS_ONLY __deque_iterator;
|
||||||
|
|
||||||
template <class _RAIter,
|
template <class _RAIter,
|
||||||
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
|
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
|
||||||
@ -256,9 +261,22 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
|
|||||||
__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
|
__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
|
||||||
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
|
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
|
||||||
|
|
||||||
|
template <class _ValueType, class _DiffType>
|
||||||
|
struct __deque_block_size {
|
||||||
|
static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16;
|
||||||
|
};
|
||||||
|
|
||||||
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
|
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
|
||||||
class _DiffType, _DiffType _BlockSize>
|
class _DiffType, _DiffType _BS =
|
||||||
class _LIBCPP_VISIBLE __deque_iterator
|
#ifdef _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
|
||||||
|
// Keep template parameter to avoid changing all template declarations thoughout
|
||||||
|
// this file.
|
||||||
|
0
|
||||||
|
#else
|
||||||
|
__deque_block_size<_ValueType, _DiffType>::value
|
||||||
|
#endif
|
||||||
|
>
|
||||||
|
class _LIBCPP_TYPE_VIS_ONLY __deque_iterator
|
||||||
{
|
{
|
||||||
typedef _MapPointer __map_iterator;
|
typedef _MapPointer __map_iterator;
|
||||||
public:
|
public:
|
||||||
@ -268,18 +286,22 @@ private:
|
|||||||
__map_iterator __m_iter_;
|
__map_iterator __m_iter_;
|
||||||
pointer __ptr_;
|
pointer __ptr_;
|
||||||
|
|
||||||
static const difference_type __block_size = _BlockSize;
|
static const difference_type __block_size;
|
||||||
public:
|
public:
|
||||||
typedef _ValueType value_type;
|
typedef _ValueType value_type;
|
||||||
typedef random_access_iterator_tag iterator_category;
|
typedef random_access_iterator_tag iterator_category;
|
||||||
typedef _Reference reference;
|
typedef _Reference reference;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT {}
|
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
: __m_iter_(nullptr), __ptr_(nullptr)
|
||||||
|
#endif
|
||||||
|
{}
|
||||||
|
|
||||||
template <class _P, class _R, class _MP>
|
template <class _Pp, class _Rp, class _MP>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__deque_iterator(const __deque_iterator<value_type, _P, _R, _MP, difference_type, __block_size>& __it,
|
__deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, _BS>& __it,
|
||||||
typename enable_if<is_convertible<_P, pointer>::value>::type* = 0) _NOEXCEPT
|
typename enable_if<is_convertible<_Pp, pointer>::value>::type* = 0) _NOEXCEPT
|
||||||
: __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
|
: __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__ptr_;}
|
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__ptr_;}
|
||||||
@ -405,10 +427,10 @@ private:
|
|||||||
_LIBCPP_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
|
||||||
: __m_iter_(__m), __ptr_(__p) {}
|
: __m_iter_(__m), __ptr_(__p) {}
|
||||||
|
|
||||||
template <class _Tp, class _A> friend class __deque_base;
|
template <class _Tp, class _Ap> friend class __deque_base;
|
||||||
template <class _Tp, class _A> friend class _LIBCPP_VISIBLE deque;
|
template <class _Tp, class _Ap> friend class _LIBCPP_TYPE_VIS_ONLY deque;
|
||||||
template <class _V, class _P, class _R, class _MP, class _D, _D>
|
template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp>
|
||||||
friend class _LIBCPP_VISIBLE __deque_iterator;
|
friend class _LIBCPP_TYPE_VIS_ONLY __deque_iterator;
|
||||||
|
|
||||||
template <class _RAIter,
|
template <class _RAIter,
|
||||||
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
|
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
|
||||||
@ -511,6 +533,12 @@ private:
|
|||||||
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
|
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
|
||||||
|
class _DiffType, _DiffType _BlockSize>
|
||||||
|
const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer,
|
||||||
|
_DiffType, _BlockSize>::__block_size =
|
||||||
|
__deque_block_size<_ValueType, _DiffType>::value;
|
||||||
|
|
||||||
// copy
|
// copy
|
||||||
|
|
||||||
template <class _RAIter,
|
template <class _RAIter,
|
||||||
@ -523,10 +551,11 @@ copy(_RAIter __f,
|
|||||||
{
|
{
|
||||||
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
|
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
|
||||||
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
|
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
|
||||||
|
const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size;
|
||||||
while (__f != __l)
|
while (__f != __l)
|
||||||
{
|
{
|
||||||
pointer __rb = __r.__ptr_;
|
pointer __rb = __r.__ptr_;
|
||||||
pointer __re = *__r.__m_iter_ + _B2;
|
pointer __re = *__r.__m_iter_ + __block_size;
|
||||||
difference_type __bs = __re - __rb;
|
difference_type __bs = __re - __rb;
|
||||||
difference_type __n = __l - __f;
|
difference_type __n = __l - __f;
|
||||||
_RAIter __m = __l;
|
_RAIter __m = __l;
|
||||||
@ -551,11 +580,12 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
|
|||||||
{
|
{
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
||||||
|
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
|
||||||
difference_type __n = __l - __f;
|
difference_type __n = __l - __f;
|
||||||
while (__n > 0)
|
while (__n > 0)
|
||||||
{
|
{
|
||||||
pointer __fb = __f.__ptr_;
|
pointer __fb = __f.__ptr_;
|
||||||
pointer __fe = *__f.__m_iter_ + _B1;
|
pointer __fe = *__f.__m_iter_ + __block_size;
|
||||||
difference_type __bs = __fe - __fb;
|
difference_type __bs = __fe - __fb;
|
||||||
if (__bs > __n)
|
if (__bs > __n)
|
||||||
{
|
{
|
||||||
@ -578,11 +608,12 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
|
|||||||
{
|
{
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
||||||
|
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
|
||||||
difference_type __n = __l - __f;
|
difference_type __n = __l - __f;
|
||||||
while (__n > 0)
|
while (__n > 0)
|
||||||
{
|
{
|
||||||
pointer __fb = __f.__ptr_;
|
pointer __fb = __f.__ptr_;
|
||||||
pointer __fe = *__f.__m_iter_ + _B1;
|
pointer __fe = *__f.__m_iter_ + __block_size;
|
||||||
difference_type __bs = __fe - __fb;
|
difference_type __bs = __fe - __fb;
|
||||||
if (__bs > __n)
|
if (__bs > __n)
|
||||||
{
|
{
|
||||||
@ -696,10 +727,11 @@ move(_RAIter __f,
|
|||||||
{
|
{
|
||||||
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
|
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
|
||||||
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
|
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
|
||||||
|
const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size;
|
||||||
while (__f != __l)
|
while (__f != __l)
|
||||||
{
|
{
|
||||||
pointer __rb = __r.__ptr_;
|
pointer __rb = __r.__ptr_;
|
||||||
pointer __re = *__r.__m_iter_ + _B2;
|
pointer __re = *__r.__m_iter_ + __block_size;
|
||||||
difference_type __bs = __re - __rb;
|
difference_type __bs = __re - __rb;
|
||||||
difference_type __n = __l - __f;
|
difference_type __n = __l - __f;
|
||||||
_RAIter __m = __l;
|
_RAIter __m = __l;
|
||||||
@ -724,11 +756,12 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
|
|||||||
{
|
{
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
||||||
|
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
|
||||||
difference_type __n = __l - __f;
|
difference_type __n = __l - __f;
|
||||||
while (__n > 0)
|
while (__n > 0)
|
||||||
{
|
{
|
||||||
pointer __fb = __f.__ptr_;
|
pointer __fb = __f.__ptr_;
|
||||||
pointer __fe = *__f.__m_iter_ + _B1;
|
pointer __fe = *__f.__m_iter_ + __block_size;
|
||||||
difference_type __bs = __fe - __fb;
|
difference_type __bs = __fe - __fb;
|
||||||
if (__bs > __n)
|
if (__bs > __n)
|
||||||
{
|
{
|
||||||
@ -751,11 +784,12 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
|
|||||||
{
|
{
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
||||||
|
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
|
||||||
difference_type __n = __l - __f;
|
difference_type __n = __l - __f;
|
||||||
while (__n > 0)
|
while (__n > 0)
|
||||||
{
|
{
|
||||||
pointer __fb = __f.__ptr_;
|
pointer __fb = __f.__ptr_;
|
||||||
pointer __fe = *__f.__m_iter_ + _B1;
|
pointer __fe = *__f.__m_iter_ + __block_size;
|
||||||
difference_type __bs = __fe - __fb;
|
difference_type __bs = __fe - __fb;
|
||||||
if (__bs > __n)
|
if (__bs > __n)
|
||||||
{
|
{
|
||||||
@ -900,24 +934,19 @@ protected:
|
|||||||
typedef typename __alloc_traits::pointer pointer;
|
typedef typename __alloc_traits::pointer pointer;
|
||||||
typedef typename __alloc_traits::const_pointer const_pointer;
|
typedef typename __alloc_traits::const_pointer const_pointer;
|
||||||
|
|
||||||
static const difference_type __block_size = sizeof(value_type) < 256 ? 4096 / sizeof(value_type) : 16;
|
static const difference_type __block_size;
|
||||||
|
|
||||||
typedef typename __alloc_traits::template
|
typedef typename __rebind_alloc_helper<__alloc_traits, pointer>::type __pointer_allocator;
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
|
||||||
rebind_alloc<pointer>
|
|
||||||
#else
|
|
||||||
rebind_alloc<pointer>::other
|
|
||||||
#endif
|
|
||||||
__pointer_allocator;
|
|
||||||
typedef allocator_traits<__pointer_allocator> __map_traits;
|
typedef allocator_traits<__pointer_allocator> __map_traits;
|
||||||
typedef typename __map_traits::pointer __map_pointer;
|
typedef typename __map_traits::pointer __map_pointer;
|
||||||
typedef typename __map_traits::const_pointer __map_const_pointer;
|
typedef typename __rebind_alloc_helper<__alloc_traits, const_pointer>::type __const_pointer_allocator;
|
||||||
|
typedef typename allocator_traits<__const_pointer_allocator>::const_pointer __map_const_pointer;
|
||||||
typedef __split_buffer<pointer, __pointer_allocator> __map;
|
typedef __split_buffer<pointer, __pointer_allocator> __map;
|
||||||
|
|
||||||
typedef __deque_iterator<value_type, pointer, reference, __map_pointer,
|
typedef __deque_iterator<value_type, pointer, reference, __map_pointer,
|
||||||
difference_type, __block_size> iterator;
|
difference_type> iterator;
|
||||||
typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer,
|
typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer,
|
||||||
difference_type, __block_size> const_iterator;
|
difference_type> const_iterator;
|
||||||
|
|
||||||
__map __map_;
|
__map __map_;
|
||||||
size_type __start_;
|
size_type __start_;
|
||||||
@ -935,8 +964,10 @@ protected:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const allocator_type& __alloc() const _NOEXCEPT {return __size_.second();}
|
const allocator_type& __alloc() const _NOEXCEPT {return __size_.second();}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__deque_base()
|
__deque_base()
|
||||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __deque_base(const allocator_type& __a);
|
explicit __deque_base(const allocator_type& __a);
|
||||||
public:
|
public:
|
||||||
~__deque_base();
|
~__deque_base();
|
||||||
@ -949,8 +980,12 @@ public:
|
|||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
void swap(__deque_base& __c)
|
void swap(__deque_base& __c)
|
||||||
|
#if _LIBCPP_STD_VER >= 14
|
||||||
|
_NOEXCEPT;
|
||||||
|
#else
|
||||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||||
__is_nothrow_swappable<allocator_type>::value);
|
__is_nothrow_swappable<allocator_type>::value);
|
||||||
|
#endif
|
||||||
protected:
|
protected:
|
||||||
void clear() _NOEXCEPT;
|
void clear() _NOEXCEPT;
|
||||||
|
|
||||||
@ -984,30 +1019,15 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __move_assign_alloc(__deque_base& __c, false_type) _NOEXCEPT
|
void __move_assign_alloc(__deque_base&, false_type) _NOEXCEPT
|
||||||
{}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __swap_alloc(allocator_type& __x, allocator_type& __y)
|
|
||||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
|
||||||
__is_nothrow_swappable<allocator_type>::value)
|
|
||||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
|
||||||
__alloc_traits::propagate_on_container_swap::value>());}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __swap_alloc(allocator_type& __x, allocator_type& __y, true_type)
|
|
||||||
_NOEXCEPT_(__is_nothrow_swappable<allocator_type>::value)
|
|
||||||
{
|
|
||||||
using _VSTD::swap;
|
|
||||||
swap(__x, __y);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
|
|
||||||
_NOEXCEPT
|
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class _Tp, class _Allocator>
|
||||||
|
const typename __deque_base<_Tp, _Allocator>::difference_type
|
||||||
|
__deque_base<_Tp, _Allocator>::__block_size =
|
||||||
|
__deque_block_size<value_type, difference_type>::value;
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
bool
|
bool
|
||||||
__deque_base<_Tp, _Allocator>::__invariants() const
|
__deque_base<_Tp, _Allocator>::__invariants() const
|
||||||
@ -1049,7 +1069,7 @@ template <class _Tp, class _Allocator>
|
|||||||
typename __deque_base<_Tp, _Allocator>::const_iterator
|
typename __deque_base<_Tp, _Allocator>::const_iterator
|
||||||
__deque_base<_Tp, _Allocator>::begin() const _NOEXCEPT
|
__deque_base<_Tp, _Allocator>::begin() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
__map_const_pointer __mp = __map_.begin() + __start_ / __block_size;
|
__map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size);
|
||||||
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
|
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1067,18 +1087,18 @@ typename __deque_base<_Tp, _Allocator>::const_iterator
|
|||||||
__deque_base<_Tp, _Allocator>::end() const _NOEXCEPT
|
__deque_base<_Tp, _Allocator>::end() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
size_type __p = size() + __start_;
|
size_type __p = size() + __start_;
|
||||||
__map_const_pointer __mp = __map_.begin() + __p / __block_size;
|
__map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size);
|
||||||
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
|
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
__deque_base<_Tp, _Allocator>::__deque_base()
|
__deque_base<_Tp, _Allocator>::__deque_base()
|
||||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||||
: __start_(0), __size_(0) {}
|
: __start_(0), __size_(0) {}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
__deque_base<_Tp, _Allocator>::__deque_base(const allocator_type& __a)
|
__deque_base<_Tp, _Allocator>::__deque_base(const allocator_type& __a)
|
||||||
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {}
|
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {}
|
||||||
|
|
||||||
@ -1129,13 +1149,17 @@ __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_
|
|||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
void
|
void
|
||||||
__deque_base<_Tp, _Allocator>::swap(__deque_base& __c)
|
__deque_base<_Tp, _Allocator>::swap(__deque_base& __c)
|
||||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
#if _LIBCPP_STD_VER >= 14
|
||||||
__is_nothrow_swappable<allocator_type>::value)
|
_NOEXCEPT
|
||||||
|
#else
|
||||||
|
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||||
|
__is_nothrow_swappable<allocator_type>::value)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
__map_.swap(__c.__map_);
|
__map_.swap(__c.__map_);
|
||||||
_VSTD::swap(__start_, __c.__start_);
|
_VSTD::swap(__start_, __c.__start_);
|
||||||
_VSTD::swap(size(), __c.size());
|
_VSTD::swap(size(), __c.size());
|
||||||
__swap_alloc(__alloc(), __c.__alloc());
|
__swap_allocator(__alloc(), __c.__alloc());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
@ -1162,8 +1186,8 @@ __deque_base<_Tp, _Allocator>::clear() _NOEXCEPT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator = allocator<_Tp> >
|
template <class _Tp, class _Allocator /*= allocator<_Tp>*/>
|
||||||
class _LIBCPP_VISIBLE deque
|
class _LIBCPP_TYPE_VIS_ONLY deque
|
||||||
: private __deque_base<_Tp, _Allocator>
|
: private __deque_base<_Tp, _Allocator>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -1172,6 +1196,9 @@ public:
|
|||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
typedef _Allocator allocator_type;
|
typedef _Allocator allocator_type;
|
||||||
|
|
||||||
|
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
|
||||||
|
"Allocator::value_type must be same type as value_type");
|
||||||
|
|
||||||
typedef __deque_base<value_type, allocator_type> __base;
|
typedef __deque_base<value_type, allocator_type> __base;
|
||||||
|
|
||||||
typedef typename __base::__alloc_traits __alloc_traits;
|
typedef typename __base::__alloc_traits __alloc_traits;
|
||||||
@ -1192,8 +1219,11 @@ public:
|
|||||||
deque()
|
deque()
|
||||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||||
{}
|
{}
|
||||||
_LIBCPP_INLINE_VISIBILITY deque(const allocator_type& __a) : __base(__a) {}
|
_LIBCPP_INLINE_VISIBILITY explicit deque(const allocator_type& __a) : __base(__a) {}
|
||||||
explicit deque(size_type __n);
|
explicit deque(size_type __n);
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
explicit deque(size_type __n, const _Allocator& __a);
|
||||||
|
#endif
|
||||||
deque(size_type __n, const value_type& __v);
|
deque(size_type __n, const value_type& __v);
|
||||||
deque(size_type __n, const value_type& __v, const allocator_type& __a);
|
deque(size_type __n, const value_type& __v, const allocator_type& __a);
|
||||||
template <class _InputIter>
|
template <class _InputIter>
|
||||||
@ -1216,8 +1246,11 @@ public:
|
|||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
|
deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
deque(deque&& __c, const allocator_type& __a);
|
deque(deque&& __c, const allocator_type& __a);
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
deque& operator=(deque&& __c)
|
deque& operator=(deque&& __c)
|
||||||
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
|
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||||
is_nothrow_move_assignable<allocator_type>::value);
|
is_nothrow_move_assignable<allocator_type>::value);
|
||||||
@ -1236,6 +1269,7 @@ public:
|
|||||||
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
|
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
allocator_type get_allocator() const _NOEXCEPT;
|
allocator_type get_allocator() const _NOEXCEPT;
|
||||||
|
|
||||||
// iterators:
|
// iterators:
|
||||||
@ -1288,13 +1322,21 @@ public:
|
|||||||
bool empty() const _NOEXCEPT {return __base::size() == 0;}
|
bool empty() const _NOEXCEPT {return __base::size() == 0;}
|
||||||
|
|
||||||
// element access:
|
// element access:
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
reference operator[](size_type __i);
|
reference operator[](size_type __i);
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_reference operator[](size_type __i) const;
|
const_reference operator[](size_type __i) const;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
reference at(size_type __i);
|
reference at(size_type __i);
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_reference at(size_type __i) const;
|
const_reference at(size_type __i) const;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
reference front();
|
reference front();
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_reference front() const;
|
const_reference front() const;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
reference back();
|
reference back();
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_reference back() const;
|
const_reference back() const;
|
||||||
|
|
||||||
// 23.2.2.3 modifiers:
|
// 23.2.2.3 modifiers:
|
||||||
@ -1313,11 +1355,15 @@ public:
|
|||||||
iterator insert(const_iterator __p, const value_type& __v);
|
iterator insert(const_iterator __p, const value_type& __v);
|
||||||
iterator insert(const_iterator __p, size_type __n, const value_type& __v);
|
iterator insert(const_iterator __p, size_type __n, const value_type& __v);
|
||||||
template <class _InputIter>
|
template <class _InputIter>
|
||||||
iterator insert (const_iterator __p, _InputIter __f, _InputIter __l,
|
iterator insert(const_iterator __p, _InputIter __f, _InputIter __l,
|
||||||
typename enable_if<__is_input_iterator<_InputIter>::value
|
typename enable_if<__is_input_iterator<_InputIter>::value
|
||||||
&&!__is_bidirectional_iterator<_InputIter>::value>::type* = 0);
|
&&!__is_forward_iterator<_InputIter>::value>::type* = 0);
|
||||||
|
template <class _ForwardIterator>
|
||||||
|
iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l,
|
||||||
|
typename enable_if<__is_forward_iterator<_ForwardIterator>::value
|
||||||
|
&&!__is_bidirectional_iterator<_ForwardIterator>::value>::type* = 0);
|
||||||
template <class _BiIter>
|
template <class _BiIter>
|
||||||
iterator insert (const_iterator __p, _BiIter __f, _BiIter __l,
|
iterator insert(const_iterator __p, _BiIter __f, _BiIter __l,
|
||||||
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
|
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@ -1329,14 +1375,22 @@ public:
|
|||||||
iterator erase(const_iterator __p);
|
iterator erase(const_iterator __p);
|
||||||
iterator erase(const_iterator __f, const_iterator __l);
|
iterator erase(const_iterator __f, const_iterator __l);
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void swap(deque& __c)
|
void swap(deque& __c)
|
||||||
|
#if _LIBCPP_STD_VER >= 14
|
||||||
|
_NOEXCEPT;
|
||||||
|
#else
|
||||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||||
__is_nothrow_swappable<allocator_type>::value);
|
__is_nothrow_swappable<allocator_type>::value);
|
||||||
|
#endif
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void clear() _NOEXCEPT;
|
void clear() _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool __invariants() const {return __base::__invariants();}
|
bool __invariants() const {return __base::__invariants();}
|
||||||
private:
|
private:
|
||||||
|
typedef typename __base::__map_const_pointer __map_const_pointer;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
static size_type __recommend_blocks(size_type __n)
|
static size_type __recommend_blocks(size_type __n)
|
||||||
{
|
{
|
||||||
@ -1399,7 +1453,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __copy_assign_alloc(const deque& __c, false_type)
|
void __copy_assign_alloc(const deque&, false_type)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void __move_assign(deque& __c, true_type)
|
void __move_assign(deque& __c, true_type)
|
||||||
@ -1414,6 +1468,16 @@ deque<_Tp, _Allocator>::deque(size_type __n)
|
|||||||
__append(__n);
|
__append(__n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <class _Tp, class _Allocator>
|
||||||
|
deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a)
|
||||||
|
: __base(__a)
|
||||||
|
{
|
||||||
|
if (__n > 0)
|
||||||
|
__append(__n);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v)
|
deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v)
|
||||||
{
|
{
|
||||||
@ -1492,7 +1556,7 @@ deque<_Tp, _Allocator>::operator=(const deque& __c)
|
|||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
deque<_Tp, _Allocator>::deque(deque&& __c)
|
deque<_Tp, _Allocator>::deque(deque&& __c)
|
||||||
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
|
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
|
||||||
: __base(_VSTD::move(__c))
|
: __base(_VSTD::move(__c))
|
||||||
@ -1500,19 +1564,19 @@ deque<_Tp, _Allocator>::deque(deque&& __c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
|
deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
|
||||||
: __base(_VSTD::move(__c), __a)
|
: __base(_VSTD::move(__c), __a)
|
||||||
{
|
{
|
||||||
if (__a != __c.__alloc())
|
if (__a != __c.__alloc())
|
||||||
{
|
{
|
||||||
typedef move_iterator<iterator> _I;
|
typedef move_iterator<iterator> _Ip;
|
||||||
assign(_I(__c.begin()), _I(__c.end()));
|
assign(_Ip(__c.begin()), _Ip(__c.end()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
deque<_Tp, _Allocator>&
|
deque<_Tp, _Allocator>&
|
||||||
deque<_Tp, _Allocator>::operator=(deque&& __c)
|
deque<_Tp, _Allocator>::operator=(deque&& __c)
|
||||||
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
|
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||||
@ -1529,8 +1593,8 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type)
|
|||||||
{
|
{
|
||||||
if (__base::__alloc() != __c.__alloc())
|
if (__base::__alloc() != __c.__alloc())
|
||||||
{
|
{
|
||||||
typedef move_iterator<iterator> _I;
|
typedef move_iterator<iterator> _Ip;
|
||||||
assign(_I(__c.begin()), _I(__c.end()));
|
assign(_Ip(__c.begin()), _Ip(__c.end()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
__move_assign(__c, true_type());
|
__move_assign(__c, true_type());
|
||||||
@ -1557,7 +1621,7 @@ deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l,
|
|||||||
{
|
{
|
||||||
iterator __i = __base::begin();
|
iterator __i = __base::begin();
|
||||||
iterator __e = __base::end();
|
iterator __e = __base::end();
|
||||||
for (; __f != __l && __i != __e; ++__f, ++__i)
|
for (; __f != __l && __i != __e; ++__f, (void) ++__i)
|
||||||
*__i = *__f;
|
*__i = *__f;
|
||||||
if (__f != __l)
|
if (__f != __l)
|
||||||
__append(__f, __l);
|
__append(__f, __l);
|
||||||
@ -1596,7 +1660,7 @@ deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
_Allocator
|
_Allocator
|
||||||
deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT
|
deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -1655,7 +1719,7 @@ deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
typename deque<_Tp, _Allocator>::reference
|
typename deque<_Tp, _Allocator>::reference
|
||||||
deque<_Tp, _Allocator>::operator[](size_type __i)
|
deque<_Tp, _Allocator>::operator[](size_type __i)
|
||||||
{
|
{
|
||||||
@ -1664,7 +1728,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
typename deque<_Tp, _Allocator>::const_reference
|
typename deque<_Tp, _Allocator>::const_reference
|
||||||
deque<_Tp, _Allocator>::operator[](size_type __i) const
|
deque<_Tp, _Allocator>::operator[](size_type __i) const
|
||||||
{
|
{
|
||||||
@ -1673,7 +1737,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
typename deque<_Tp, _Allocator>::reference
|
typename deque<_Tp, _Allocator>::reference
|
||||||
deque<_Tp, _Allocator>::at(size_type __i)
|
deque<_Tp, _Allocator>::at(size_type __i)
|
||||||
{
|
{
|
||||||
@ -1684,7 +1748,7 @@ deque<_Tp, _Allocator>::at(size_type __i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
typename deque<_Tp, _Allocator>::const_reference
|
typename deque<_Tp, _Allocator>::const_reference
|
||||||
deque<_Tp, _Allocator>::at(size_type __i) const
|
deque<_Tp, _Allocator>::at(size_type __i) const
|
||||||
{
|
{
|
||||||
@ -1695,7 +1759,7 @@ deque<_Tp, _Allocator>::at(size_type __i) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
typename deque<_Tp, _Allocator>::reference
|
typename deque<_Tp, _Allocator>::reference
|
||||||
deque<_Tp, _Allocator>::front()
|
deque<_Tp, _Allocator>::front()
|
||||||
{
|
{
|
||||||
@ -1704,7 +1768,7 @@ deque<_Tp, _Allocator>::front()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
typename deque<_Tp, _Allocator>::const_reference
|
typename deque<_Tp, _Allocator>::const_reference
|
||||||
deque<_Tp, _Allocator>::front() const
|
deque<_Tp, _Allocator>::front() const
|
||||||
{
|
{
|
||||||
@ -1713,7 +1777,7 @@ deque<_Tp, _Allocator>::front() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
typename deque<_Tp, _Allocator>::reference
|
typename deque<_Tp, _Allocator>::reference
|
||||||
deque<_Tp, _Allocator>::back()
|
deque<_Tp, _Allocator>::back()
|
||||||
{
|
{
|
||||||
@ -1722,7 +1786,7 @@ deque<_Tp, _Allocator>::back()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
typename deque<_Tp, _Allocator>::const_reference
|
typename deque<_Tp, _Allocator>::const_reference
|
||||||
deque<_Tp, _Allocator>::back() const
|
deque<_Tp, _Allocator>::back() const
|
||||||
{
|
{
|
||||||
@ -1962,6 +2026,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
value_type __tmp(_VSTD::forward<_Args>(__args)...);
|
||||||
iterator __b = __base::begin();
|
iterator __b = __base::begin();
|
||||||
iterator __bm1 = _VSTD::prev(__b);
|
iterator __bm1 = _VSTD::prev(__b);
|
||||||
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
|
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
|
||||||
@ -1969,7 +2034,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
|||||||
++__base::size();
|
++__base::size();
|
||||||
if (__pos > 1)
|
if (__pos > 1)
|
||||||
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
|
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
|
||||||
*__b = value_type(_VSTD::forward<_Args>(__args)...);
|
*__b = _VSTD::move(__tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1985,13 +2050,14 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
value_type __tmp(_VSTD::forward<_Args>(__args)...);
|
||||||
iterator __e = __base::end();
|
iterator __e = __base::end();
|
||||||
iterator __em1 = _VSTD::prev(__e);
|
iterator __em1 = _VSTD::prev(__e);
|
||||||
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
|
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
|
||||||
++__base::size();
|
++__base::size();
|
||||||
if (__de > 1)
|
if (__de > 1)
|
||||||
__e = _VSTD::move_backward(__e - __de, __em1, __e);
|
__e = _VSTD::move_backward(__e - __de, __em1, __e);
|
||||||
*--__e = value_type(_VSTD::forward<_Args>(__args)...);
|
*--__e = _VSTD::move(__tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return __base::begin() + __pos;
|
return __base::begin() + __pos;
|
||||||
@ -2012,7 +2078,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
|
|||||||
if (__n > __front_spare())
|
if (__n > __front_spare())
|
||||||
__add_front_capacity(__n - __front_spare());
|
__add_front_capacity(__n - __front_spare());
|
||||||
// __n <= __front_spare()
|
// __n <= __front_spare()
|
||||||
size_type __old_n = __n;
|
|
||||||
iterator __old_begin = __base::begin();
|
iterator __old_begin = __base::begin();
|
||||||
iterator __i = __old_begin;
|
iterator __i = __old_begin;
|
||||||
if (__n > __pos)
|
if (__n > __pos)
|
||||||
@ -2037,7 +2102,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
|
|||||||
if (__n > __back_capacity)
|
if (__n > __back_capacity)
|
||||||
__add_back_capacity(__n - __back_capacity);
|
__add_back_capacity(__n - __back_capacity);
|
||||||
// __n <= __back_capacity
|
// __n <= __back_capacity
|
||||||
size_type __old_n = __n;
|
|
||||||
iterator __old_end = __base::end();
|
iterator __old_end = __base::end();
|
||||||
iterator __i = __old_end;
|
iterator __i = __old_end;
|
||||||
size_type __de = __base::size() - __pos;
|
size_type __de = __base::size() - __pos;
|
||||||
@ -2065,7 +2129,7 @@ template <class _InputIter>
|
|||||||
typename deque<_Tp, _Allocator>::iterator
|
typename deque<_Tp, _Allocator>::iterator
|
||||||
deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l,
|
deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l,
|
||||||
typename enable_if<__is_input_iterator<_InputIter>::value
|
typename enable_if<__is_input_iterator<_InputIter>::value
|
||||||
&&!__is_bidirectional_iterator<_InputIter>::value>::type*)
|
&&!__is_forward_iterator<_InputIter>::value>::type*)
|
||||||
{
|
{
|
||||||
__split_buffer<value_type, allocator_type&> __buf(__base::__alloc());
|
__split_buffer<value_type, allocator_type&> __buf(__base::__alloc());
|
||||||
__buf.__construct_at_end(__f, __l);
|
__buf.__construct_at_end(__f, __l);
|
||||||
@ -2073,6 +2137,20 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __
|
|||||||
return insert(__p, move_iterator<__bi>(__buf.begin()), move_iterator<__bi>(__buf.end()));
|
return insert(__p, move_iterator<__bi>(__buf.begin()), move_iterator<__bi>(__buf.end()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class _Tp, class _Allocator>
|
||||||
|
template <class _ForwardIterator>
|
||||||
|
typename deque<_Tp, _Allocator>::iterator
|
||||||
|
deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l,
|
||||||
|
typename enable_if<__is_forward_iterator<_ForwardIterator>::value
|
||||||
|
&&!__is_bidirectional_iterator<_ForwardIterator>::value>::type*)
|
||||||
|
{
|
||||||
|
size_type __n = _VSTD::distance(__f, __l);
|
||||||
|
__split_buffer<value_type, allocator_type&> __buf(__n, 0, __base::__alloc());
|
||||||
|
__buf.__construct_at_end(__f, __l);
|
||||||
|
typedef typename __split_buffer<value_type, allocator_type&>::iterator __fwd;
|
||||||
|
return insert(__p, move_iterator<__fwd>(__buf.begin()), move_iterator<__fwd>(__buf.end()));
|
||||||
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
template <class _BiIter>
|
template <class _BiIter>
|
||||||
typename deque<_Tp, _Allocator>::iterator
|
typename deque<_Tp, _Allocator>::iterator
|
||||||
@ -2088,7 +2166,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
|
|||||||
if (__n > __front_spare())
|
if (__n > __front_spare())
|
||||||
__add_front_capacity(__n - __front_spare());
|
__add_front_capacity(__n - __front_spare());
|
||||||
// __n <= __front_spare()
|
// __n <= __front_spare()
|
||||||
size_type __old_n = __n;
|
|
||||||
iterator __old_begin = __base::begin();
|
iterator __old_begin = __base::begin();
|
||||||
iterator __i = __old_begin;
|
iterator __i = __old_begin;
|
||||||
_BiIter __m = __f;
|
_BiIter __m = __f;
|
||||||
@ -2119,7 +2196,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
|
|||||||
if (__n > __back_capacity)
|
if (__n > __back_capacity)
|
||||||
__add_back_capacity(__n - __back_capacity);
|
__add_back_capacity(__n - __back_capacity);
|
||||||
// __n <= __back_capacity
|
// __n <= __back_capacity
|
||||||
size_type __old_n = __n;
|
|
||||||
iterator __old_end = __base::end();
|
iterator __old_end = __base::end();
|
||||||
iterator __i = __old_end;
|
iterator __i = __old_end;
|
||||||
_BiIter __m = __l;
|
_BiIter __m = __l;
|
||||||
@ -2127,7 +2203,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
|
|||||||
if (__n > __de)
|
if (__n > __de)
|
||||||
{
|
{
|
||||||
__m = __de < __n / 2 ? _VSTD::next(__f, __de) : _VSTD::prev(__l, __n - __de);
|
__m = __de < __n / 2 ? _VSTD::next(__f, __de) : _VSTD::prev(__l, __n - __de);
|
||||||
for (_BiIter __j = __m; __j != __l; ++__i, ++__j, ++__base::size())
|
for (_BiIter __j = __m; __j != __l; ++__i, (void) ++__j, ++__base::size())
|
||||||
__alloc_traits::construct(__a, _VSTD::addressof(*__i), *__j);
|
__alloc_traits::construct(__a, _VSTD::addressof(*__i), *__j);
|
||||||
__n = __de;
|
__n = __de;
|
||||||
}
|
}
|
||||||
@ -2167,7 +2243,7 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
|
|||||||
if (__n > __back_capacity)
|
if (__n > __back_capacity)
|
||||||
__add_back_capacity(__n - __back_capacity);
|
__add_back_capacity(__n - __back_capacity);
|
||||||
// __n <= __back_capacity
|
// __n <= __back_capacity
|
||||||
for (iterator __i = __base::end(); __f != __l; ++__i, ++__f, ++__base::size())
|
for (iterator __i = __base::end(); __f != __l; ++__i, (void) ++__f, ++__base::size())
|
||||||
__alloc_traits::construct(__a, _VSTD::addressof(*__i), *__f);
|
__alloc_traits::construct(__a, _VSTD::addressof(*__i), *__f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2236,19 +2312,14 @@ deque<_Tp, _Allocator>::__add_front_capacity()
|
|||||||
__split_buffer<pointer, typename __base::__pointer_allocator&>
|
__split_buffer<pointer, typename __base::__pointer_allocator&>
|
||||||
__buf(max<size_type>(2 * __base::__map_.capacity(), 1),
|
__buf(max<size_type>(2 * __base::__map_.capacity(), 1),
|
||||||
0, __base::__map_.__alloc());
|
0, __base::__map_.__alloc());
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
try
|
typedef __allocator_destructor<_Allocator> _Dp;
|
||||||
{
|
unique_ptr<pointer, _Dp> __hold(
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
__alloc_traits::allocate(__a, __base::__block_size),
|
||||||
__buf.push_back(__alloc_traits::allocate(__a, __base::__block_size));
|
_Dp(__a, __base::__block_size));
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
__buf.push_back(__hold.get());
|
||||||
}
|
__hold.release();
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
__alloc_traits::deallocate(__a, __buf.front(), __base::__block_size);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
|
||||||
for (typename __base::__map_pointer __i = __base::__map_.begin();
|
for (typename __base::__map_pointer __i = __base::__map_.begin();
|
||||||
__i != __base::__map_.end(); ++__i)
|
__i != __base::__map_.end(); ++__i)
|
||||||
__buf.push_back(*__i);
|
__buf.push_back(*__i);
|
||||||
@ -2384,19 +2455,14 @@ deque<_Tp, _Allocator>::__add_back_capacity()
|
|||||||
__buf(max<size_type>(2* __base::__map_.capacity(), 1),
|
__buf(max<size_type>(2* __base::__map_.capacity(), 1),
|
||||||
__base::__map_.size(),
|
__base::__map_.size(),
|
||||||
__base::__map_.__alloc());
|
__base::__map_.__alloc());
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
try
|
typedef __allocator_destructor<_Allocator> _Dp;
|
||||||
{
|
unique_ptr<pointer, _Dp> __hold(
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
__alloc_traits::allocate(__a, __base::__block_size),
|
||||||
__buf.push_back(__alloc_traits::allocate(__a, __base::__block_size));
|
_Dp(__a, __base::__block_size));
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
__buf.push_back(__hold.get());
|
||||||
}
|
__hold.release();
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
__alloc_traits::deallocate(__a, __buf.back(), __base::__block_size);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
|
||||||
for (typename __base::__map_pointer __i = __base::__map_.end();
|
for (typename __base::__map_pointer __i = __base::__map_.end();
|
||||||
__i != __base::__map_.begin();)
|
__i != __base::__map_.begin();)
|
||||||
__buf.push_front(*--__i);
|
__buf.push_front(*--__i);
|
||||||
@ -2499,9 +2565,9 @@ void
|
|||||||
deque<_Tp, _Allocator>::pop_front()
|
deque<_Tp, _Allocator>::pop_front()
|
||||||
{
|
{
|
||||||
allocator_type& __a = __base::__alloc();
|
allocator_type& __a = __base::__alloc();
|
||||||
__alloc_traits::destroy(__a, *(__base::__map_.begin() +
|
__alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +
|
||||||
__base::__start_ / __base::__block_size) +
|
__base::__start_ / __base::__block_size) +
|
||||||
__base::__start_ % __base::__block_size);
|
__base::__start_ % __base::__block_size));
|
||||||
--__base::size();
|
--__base::size();
|
||||||
if (++__base::__start_ >= 2 * __base::__block_size)
|
if (++__base::__start_ >= 2 * __base::__block_size)
|
||||||
{
|
{
|
||||||
@ -2517,9 +2583,9 @@ deque<_Tp, _Allocator>::pop_back()
|
|||||||
{
|
{
|
||||||
allocator_type& __a = __base::__alloc();
|
allocator_type& __a = __base::__alloc();
|
||||||
size_type __p = __base::size() + __base::__start_ - 1;
|
size_type __p = __base::size() + __base::__start_ - 1;
|
||||||
__alloc_traits::destroy(__a, *(__base::__map_.begin() +
|
__alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +
|
||||||
__p / __base::__block_size) +
|
__p / __base::__block_size) +
|
||||||
__p % __base::__block_size);
|
__p % __base::__block_size));
|
||||||
--__base::size();
|
--__base::size();
|
||||||
if (__back_spare() >= 2 * __base::__block_size)
|
if (__back_spare() >= 2 * __base::__block_size)
|
||||||
{
|
{
|
||||||
@ -2550,7 +2616,7 @@ deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __
|
|||||||
__fe = __fb + __bs;
|
__fe = __fb + __bs;
|
||||||
}
|
}
|
||||||
if (__fb <= __vt && __vt < __fe)
|
if (__fb <= __vt && __vt < __fe)
|
||||||
__vt = (const_iterator(__f.__m_iter_, __vt) -= __f - __r).__ptr_;
|
__vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_;
|
||||||
__r = _VSTD::move(__fb, __fe, __r);
|
__r = _VSTD::move(__fb, __fe, __r);
|
||||||
__n -= __bs;
|
__n -= __bs;
|
||||||
__f += __bs;
|
__f += __bs;
|
||||||
@ -2581,7 +2647,7 @@ deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, it
|
|||||||
__lb = __le - __bs;
|
__lb = __le - __bs;
|
||||||
}
|
}
|
||||||
if (__lb <= __vt && __vt < __le)
|
if (__lb <= __vt && __vt < __le)
|
||||||
__vt = (const_iterator(__l.__m_iter_, __vt) += __r - __l - 1).__ptr_;
|
__vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_;
|
||||||
__r = _VSTD::move_backward(__lb, __le, __r);
|
__r = _VSTD::move_backward(__lb, __le, __r);
|
||||||
__n -= __bs;
|
__n -= __bs;
|
||||||
__l -= __bs - 1;
|
__l -= __bs - 1;
|
||||||
@ -2612,7 +2678,7 @@ deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l,
|
|||||||
__fe = __fb + __bs;
|
__fe = __fb + __bs;
|
||||||
}
|
}
|
||||||
if (__fb <= __vt && __vt < __fe)
|
if (__fb <= __vt && __vt < __fe)
|
||||||
__vt = (const_iterator(__f.__m_iter_, __vt) += __r - __f).__ptr_;
|
__vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_;
|
||||||
for (; __fb != __fe; ++__fb, ++__r, ++__base::size())
|
for (; __fb != __fe; ++__fb, ++__r, ++__base::size())
|
||||||
__alloc_traits::construct(__a, _VSTD::addressof(*__r), _VSTD::move(*__fb));
|
__alloc_traits::construct(__a, _VSTD::addressof(*__r), _VSTD::move(*__fb));
|
||||||
__n -= __bs;
|
__n -= __bs;
|
||||||
@ -2648,7 +2714,7 @@ deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterat
|
|||||||
__lb = __le - __bs;
|
__lb = __le - __bs;
|
||||||
}
|
}
|
||||||
if (__lb <= __vt && __vt < __le)
|
if (__lb <= __vt && __vt < __le)
|
||||||
__vt = (const_iterator(__l.__m_iter_, __vt) -= __l - __r + 1).__ptr_;
|
__vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_;
|
||||||
while (__le != __lb)
|
while (__le != __lb)
|
||||||
{
|
{
|
||||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__r), _VSTD::move(*--__le));
|
__alloc_traits::construct(__a, _VSTD::addressof(*--__r), _VSTD::move(*--__le));
|
||||||
@ -2664,12 +2730,11 @@ template <class _Tp, class _Allocator>
|
|||||||
typename deque<_Tp, _Allocator>::iterator
|
typename deque<_Tp, _Allocator>::iterator
|
||||||
deque<_Tp, _Allocator>::erase(const_iterator __f)
|
deque<_Tp, _Allocator>::erase(const_iterator __f)
|
||||||
{
|
{
|
||||||
difference_type __n = 1;
|
|
||||||
iterator __b = __base::begin();
|
iterator __b = __base::begin();
|
||||||
difference_type __pos = __f - __b;
|
difference_type __pos = __f - __b;
|
||||||
iterator __p = __b + __pos;
|
iterator __p = __b + __pos;
|
||||||
allocator_type& __a = __base::__alloc();
|
allocator_type& __a = __base::__alloc();
|
||||||
if (__pos < (__base::size() - 1) / 2)
|
if (__pos <= (__base::size() - 1) / 2)
|
||||||
{ // erase from front
|
{ // erase from front
|
||||||
_VSTD::move_backward(__b, __p, _VSTD::next(__p));
|
_VSTD::move_backward(__b, __p, _VSTD::next(__p));
|
||||||
__alloc_traits::destroy(__a, _VSTD::addressof(*__b));
|
__alloc_traits::destroy(__a, _VSTD::addressof(*__b));
|
||||||
@ -2707,7 +2772,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
|
|||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
allocator_type& __a = __base::__alloc();
|
allocator_type& __a = __base::__alloc();
|
||||||
if (__pos < (__base::size() - __n) / 2)
|
if (__pos <= (__base::size() - __n) / 2)
|
||||||
{ // erase from front
|
{ // erase from front
|
||||||
iterator __i = _VSTD::move_backward(__b, __p, __p + __n);
|
iterator __i = _VSTD::move_backward(__b, __p, __p + __n);
|
||||||
for (; __b != __i; ++__b)
|
for (; __b != __i; ++__b)
|
||||||
@ -2760,17 +2825,21 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
void
|
void
|
||||||
deque<_Tp, _Allocator>::swap(deque& __c)
|
deque<_Tp, _Allocator>::swap(deque& __c)
|
||||||
|
#if _LIBCPP_STD_VER >= 14
|
||||||
|
_NOEXCEPT
|
||||||
|
#else
|
||||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||||
__is_nothrow_swappable<allocator_type>::value)
|
__is_nothrow_swappable<allocator_type>::value)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
__base::swap(__c);
|
__base::swap(__c);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline
|
||||||
void
|
void
|
||||||
deque<_Tp, _Allocator>::clear() _NOEXCEPT
|
deque<_Tp, _Allocator>::clear() _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -2778,7 +2847,7 @@ deque<_Tp, _Allocator>::clear() _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
||||||
{
|
{
|
||||||
@ -2787,7 +2856,7 @@ operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
||||||
{
|
{
|
||||||
@ -2795,7 +2864,7 @@ operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
||||||
{
|
{
|
||||||
@ -2803,7 +2872,7 @@ operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
||||||
{
|
{
|
||||||
@ -2811,7 +2880,7 @@ operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
||||||
{
|
{
|
||||||
@ -2819,7 +2888,7 @@ operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
||||||
{
|
{
|
||||||
@ -2827,7 +2896,7 @@ operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
_LIBCPP_INLINE_VISIBILITY inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
|
swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
|
||||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||||
|
398
include/errno.h
Normal file
398
include/errno.h
Normal file
@ -0,0 +1,398 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===-------------------------- errno.h -----------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_ERRNO_H
|
||||||
|
#define _LIBCPP_ERRNO_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
errno.h synopsis
|
||||||
|
|
||||||
|
Macros:
|
||||||
|
|
||||||
|
EDOM
|
||||||
|
EILSEQ // C99
|
||||||
|
ERANGE
|
||||||
|
errno
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <__config>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include_next <errno.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||||
|
|
||||||
|
#ifdef ELAST
|
||||||
|
|
||||||
|
static const int __elast1 = ELAST+1;
|
||||||
|
static const int __elast2 = ELAST+2;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static const int __elast1 = 104;
|
||||||
|
static const int __elast2 = 105;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENOTRECOVERABLE
|
||||||
|
|
||||||
|
#define EOWNERDEAD __elast1
|
||||||
|
|
||||||
|
#ifdef ELAST
|
||||||
|
#undef ELAST
|
||||||
|
#define ELAST EOWNERDEAD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined(EOWNERDEAD)
|
||||||
|
|
||||||
|
#define ENOTRECOVERABLE __elast1
|
||||||
|
#ifdef ELAST
|
||||||
|
#undef ELAST
|
||||||
|
#define ELAST ENOTRECOVERABLE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else // defined(EOWNERDEAD)
|
||||||
|
|
||||||
|
#define EOWNERDEAD __elast1
|
||||||
|
#define ENOTRECOVERABLE __elast2
|
||||||
|
#ifdef ELAST
|
||||||
|
#undef ELAST
|
||||||
|
#define ELAST ENOTRECOVERABLE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // defined(EOWNERDEAD)
|
||||||
|
|
||||||
|
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||||
|
|
||||||
|
// supply errno values likely to be missing, particularly on Windows
|
||||||
|
|
||||||
|
#ifndef EAFNOSUPPORT
|
||||||
|
#define EAFNOSUPPORT 9901
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EADDRINUSE
|
||||||
|
#define EADDRINUSE 9902
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EADDRNOTAVAIL
|
||||||
|
#define EADDRNOTAVAIL 9903
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EISCONN
|
||||||
|
#define EISCONN 9904
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EBADMSG
|
||||||
|
#define EBADMSG 9905
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ECONNABORTED
|
||||||
|
#define ECONNABORTED 9906
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EALREADY
|
||||||
|
#define EALREADY 9907
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ECONNREFUSED
|
||||||
|
#define ECONNREFUSED 9908
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ECONNRESET
|
||||||
|
#define ECONNRESET 9909
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EDESTADDRREQ
|
||||||
|
#define EDESTADDRREQ 9910
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EHOSTUNREACH
|
||||||
|
#define EHOSTUNREACH 9911
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EIDRM
|
||||||
|
#define EIDRM 9912
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EMSGSIZE
|
||||||
|
#define EMSGSIZE 9913
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENETDOWN
|
||||||
|
#define ENETDOWN 9914
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENETRESET
|
||||||
|
#define ENETRESET 9915
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENETUNREACH
|
||||||
|
#define ENETUNREACH 9916
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOBUFS
|
||||||
|
#define ENOBUFS 9917
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOLINK
|
||||||
|
#define ENOLINK 9918
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENODATA
|
||||||
|
#define ENODATA 9919
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOMSG
|
||||||
|
#define ENOMSG 9920
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOPROTOOPT
|
||||||
|
#define ENOPROTOOPT 9921
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOSR
|
||||||
|
#define ENOSR 9922
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOTSOCK
|
||||||
|
#define ENOTSOCK 9923
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOSTR
|
||||||
|
#define ENOSTR 9924
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOTCONN
|
||||||
|
#define ENOTCONN 9925
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOTSUP
|
||||||
|
#define ENOTSUP 9926
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ECANCELED
|
||||||
|
#define ECANCELED 9927
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EINPROGRESS
|
||||||
|
#define EINPROGRESS 9928
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EOPNOTSUPP
|
||||||
|
#define EOPNOTSUPP 9929
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EWOULDBLOCK
|
||||||
|
#define EWOULDBLOCK 9930
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EOWNERDEAD
|
||||||
|
#define EOWNERDEAD 9931
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EPROTO
|
||||||
|
#define EPROTO 9932
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EPROTONOSUPPORT
|
||||||
|
#define EPROTONOSUPPORT 9933
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOTRECOVERABLE
|
||||||
|
#define ENOTRECOVERABLE 9934
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ETIME
|
||||||
|
#define ETIME 9935
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ETXTBSY
|
||||||
|
#define ETXTBSY 9936
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ETIMEDOUT
|
||||||
|
#define ETIMEDOUT 9938
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ELOOP
|
||||||
|
#define ELOOP 9939
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EOVERFLOW
|
||||||
|
#define EOVERFLOW 9940
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EPROTOTYPE
|
||||||
|
#define EPROTOTYPE 9941
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOSYS
|
||||||
|
#define ENOSYS 9942
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EINVAL
|
||||||
|
#define EINVAL 9943
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ERANGE
|
||||||
|
#define ERANGE 9944
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EILSEQ
|
||||||
|
#define EILSEQ 9945
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Windows Mobile doesn't appear to define these:
|
||||||
|
|
||||||
|
#ifndef E2BIG
|
||||||
|
#define E2BIG 9946
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EDOM
|
||||||
|
#define EDOM 9947
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EFAULT
|
||||||
|
#define EFAULT 9948
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EBADF
|
||||||
|
#define EBADF 9949
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EPIPE
|
||||||
|
#define EPIPE 9950
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EXDEV
|
||||||
|
#define EXDEV 9951
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EBUSY
|
||||||
|
#define EBUSY 9952
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOTEMPTY
|
||||||
|
#define ENOTEMPTY 9953
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOEXEC
|
||||||
|
#define ENOEXEC 9954
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EEXIST
|
||||||
|
#define EEXIST 9955
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EFBIG
|
||||||
|
#define EFBIG 9956
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENAMETOOLONG
|
||||||
|
#define ENAMETOOLONG 9957
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOTTY
|
||||||
|
#define ENOTTY 9958
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EINTR
|
||||||
|
#define EINTR 9959
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ESPIPE
|
||||||
|
#define ESPIPE 9960
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EIO
|
||||||
|
#define EIO 9961
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EISDIR
|
||||||
|
#define EISDIR 9962
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ECHILD
|
||||||
|
#define ECHILD 9963
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOLCK
|
||||||
|
#define ENOLCK 9964
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOSPC
|
||||||
|
#define ENOSPC 9965
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENXIO
|
||||||
|
#define ENXIO 9966
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENODEV
|
||||||
|
#define ENODEV 9967
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOENT
|
||||||
|
#define ENOENT 9968
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ESRCH
|
||||||
|
#define ESRCH 9969
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOTDIR
|
||||||
|
#define ENOTDIR 9970
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENOMEM
|
||||||
|
#define ENOMEM 9971
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EPERM
|
||||||
|
#define EPERM 9972
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EACCES
|
||||||
|
#define EACCES 9973
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EROFS
|
||||||
|
#define EROFS 9974
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EDEADLK
|
||||||
|
#define EDEADLK 9975
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EAGAIN
|
||||||
|
#define EAGAIN 9976
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENFILE
|
||||||
|
#define ENFILE 9977
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EMFILE
|
||||||
|
#define EMFILE 9978
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EMLINK
|
||||||
|
#define EMLINK 9979
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif // _LIBCPP_ERRNO_H
|
@ -48,7 +48,8 @@ terminate_handler set_terminate(terminate_handler f ) noexcept;
|
|||||||
terminate_handler get_terminate() noexcept;
|
terminate_handler get_terminate() noexcept;
|
||||||
[[noreturn]] void terminate() noexcept;
|
[[noreturn]] void terminate() noexcept;
|
||||||
|
|
||||||
bool uncaught_exception() noexcept;
|
bool uncaught_exception() noexcept;
|
||||||
|
int uncaught_exceptions() noexcept; // C++17
|
||||||
|
|
||||||
typedef unspecified exception_ptr;
|
typedef unspecified exception_ptr;
|
||||||
|
|
||||||
@ -80,7 +81,9 @@ template <class E> void rethrow_if_nested(const E& e);
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace std // purposefully not using versioning namespace
|
namespace std // purposefully not using versioning namespace
|
||||||
{
|
{
|
||||||
@ -103,23 +106,24 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef void (*unexpected_handler)();
|
typedef void (*unexpected_handler)();
|
||||||
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
|
_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
|
||||||
_LIBCPP_VISIBLE unexpected_handler get_unexpected() _NOEXCEPT;
|
_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT;
|
||||||
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void unexpected();
|
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected();
|
||||||
|
|
||||||
typedef void (*terminate_handler)();
|
typedef void (*terminate_handler)();
|
||||||
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
|
_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
|
||||||
_LIBCPP_VISIBLE terminate_handler get_terminate() _NOEXCEPT;
|
_LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT;
|
||||||
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void terminate() _NOEXCEPT;
|
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT;
|
_LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT;
|
||||||
|
_LIBCPP_FUNC_VIS int uncaught_exceptions() _NOEXCEPT;
|
||||||
|
|
||||||
class exception_ptr;
|
class _LIBCPP_TYPE_VIS exception_ptr;
|
||||||
|
|
||||||
exception_ptr current_exception() _NOEXCEPT;
|
_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
|
||||||
_ATTRIBUTE(noreturn) void rethrow_exception(exception_ptr);
|
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE exception_ptr
|
class _LIBCPP_TYPE_VIS exception_ptr
|
||||||
{
|
{
|
||||||
void* __ptr_;
|
void* __ptr_;
|
||||||
public:
|
public:
|
||||||
@ -130,7 +134,7 @@ public:
|
|||||||
~exception_ptr() _NOEXCEPT;
|
~exception_ptr() _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
// explicit
|
_LIBCPP_EXPLICIT
|
||||||
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
|
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
|
||||||
|
|
||||||
friend _LIBCPP_INLINE_VISIBILITY
|
friend _LIBCPP_INLINE_VISIBILITY
|
||||||
@ -140,13 +144,13 @@ public:
|
|||||||
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||||
{return !(__x == __y);}
|
{return !(__x == __y);}
|
||||||
|
|
||||||
friend exception_ptr current_exception() _NOEXCEPT;
|
friend _LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
|
||||||
_ATTRIBUTE(noreturn) friend void rethrow_exception(exception_ptr);
|
friend _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class _E>
|
template<class _Ep>
|
||||||
exception_ptr
|
exception_ptr
|
||||||
make_exception_ptr(_E __e) _NOEXCEPT
|
make_exception_ptr(_Ep __e) _NOEXCEPT
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
@ -172,7 +176,7 @@ public:
|
|||||||
virtual ~nested_exception() _NOEXCEPT;
|
virtual ~nested_exception() _NOEXCEPT;
|
||||||
|
|
||||||
// access functions
|
// access functions
|
||||||
_ATTRIBUTE(noreturn) void rethrow_nested() const;
|
_LIBCPP_NORETURN void rethrow_nested() const;
|
||||||
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
|
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -185,12 +189,13 @@ struct __nested
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
_ATTRIBUTE(noreturn)
|
_LIBCPP_NORETURN
|
||||||
void
|
void
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||||
is_class<typename remove_reference<_Tp>::type>::value &&
|
is_class<typename remove_reference<_Tp>::type>::value &&
|
||||||
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||||
|
&& !__libcpp_is_final<typename remove_reference<_Tp>::type>::value
|
||||||
>::type* = 0)
|
>::type* = 0)
|
||||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
throw_with_nested (_Tp& __t, typename enable_if<
|
throw_with_nested (_Tp& __t, typename enable_if<
|
||||||
@ -204,12 +209,13 @@ throw_with_nested (_Tp& __t, typename enable_if<
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
_ATTRIBUTE(noreturn)
|
_LIBCPP_NORETURN
|
||||||
void
|
void
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||||
!is_class<typename remove_reference<_Tp>::type>::value ||
|
!is_class<typename remove_reference<_Tp>::type>::value ||
|
||||||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||||
|
|| __libcpp_is_final<typename remove_reference<_Tp>::type>::value
|
||||||
>::type* = 0)
|
>::type* = 0)
|
||||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
throw_with_nested (_Tp& __t, typename enable_if<
|
throw_with_nested (_Tp& __t, typename enable_if<
|
||||||
@ -222,23 +228,23 @@ throw_with_nested (_Tp& __t, typename enable_if<
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _E>
|
template <class _Ep>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
rethrow_if_nested(const _E& __e, typename enable_if<
|
rethrow_if_nested(const _Ep& __e, typename enable_if<
|
||||||
is_polymorphic<_E>::value
|
is_polymorphic<_Ep>::value
|
||||||
>::type* = 0)
|
>::type* = 0)
|
||||||
{
|
{
|
||||||
const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
|
const nested_exception* __nep = dynamic_cast<const nested_exception*>(_VSTD::addressof(__e));
|
||||||
if (__nep)
|
if (__nep)
|
||||||
__nep->rethrow_nested();
|
__nep->rethrow_nested();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _E>
|
template <class _Ep>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
rethrow_if_nested(const _E& __e, typename enable_if<
|
rethrow_if_nested(const _Ep&, typename enable_if<
|
||||||
!is_polymorphic<_E>::value
|
!is_polymorphic<_Ep>::value
|
||||||
>::type* = 0)
|
>::type* = 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
32
include/experimental/__config
Normal file
32
include/experimental/__config
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===--------------------------- __config ---------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXPERIMENTAL_CONFIG
|
||||||
|
#define _LIBCPP_EXPERIMENTAL_CONFIG
|
||||||
|
|
||||||
|
#include <__config>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace std { namespace experimental {
|
||||||
|
#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL } }
|
||||||
|
#define _VSTD_EXPERIMENTAL std::experimental
|
||||||
|
|
||||||
|
#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 {
|
||||||
|
#define _LIBCPP_END_NAMESPACE_LFTS } } }
|
||||||
|
#define _VSTD_LFTS _VSTD_EXPERIMENTAL::fundamentals_v1
|
||||||
|
|
||||||
|
#define _LIBCPP_BEGIN_NAMESPACE_CHRONO_LFTS _LIBCPP_BEGIN_NAMESPACE_STD \
|
||||||
|
namespace chrono { namespace experimental { inline namespace fundamentals_v1 {
|
||||||
|
#define _LIBCPP_END_NAMESPACE_CHRONO_LFTS _LIBCPP_END_NAMESPACE_STD } } }
|
||||||
|
|
||||||
|
#endif
|
120
include/experimental/algorithm
Normal file
120
include/experimental/algorithm
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===-------------------------- algorithm ---------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXPERIMENTAL_ALGORITHM
|
||||||
|
#define _LIBCPP_EXPERIMENTAL_ALGORITHM
|
||||||
|
|
||||||
|
/*
|
||||||
|
experimental/algorithm synopsis
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
namespace experimental {
|
||||||
|
inline namespace fundamentals_v1 {
|
||||||
|
|
||||||
|
template <class ForwardIterator, class Searcher>
|
||||||
|
ForwardIterator search(ForwardIterator first, ForwardIterator last,
|
||||||
|
const Searcher &searcher);
|
||||||
|
template <class PopulationIterator, class SampleIterator, class Distance,
|
||||||
|
class UniformRandomNumberGenerator>
|
||||||
|
SampleIterator sample(PopulationIterator first, PopulationIterator last,
|
||||||
|
SampleIterator out, Distance n,
|
||||||
|
UniformRandomNumberGenerator &&g);
|
||||||
|
|
||||||
|
} // namespace fundamentals_v1
|
||||||
|
} // namespace experimental
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <experimental/__config>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include <__undef_min_max>
|
||||||
|
|
||||||
|
#include <__debug>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
|
||||||
|
template <class _ForwardIterator, class _Searcher>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
|
||||||
|
{ return __s(__f, __l); }
|
||||||
|
|
||||||
|
|
||||||
|
template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
||||||
|
class _UniformRandomNumberGenerator>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
_SampleIterator __sample(_PopulationIterator __first,
|
||||||
|
_PopulationIterator __last, _SampleIterator __out,
|
||||||
|
_Distance __n,
|
||||||
|
_UniformRandomNumberGenerator &&__g,
|
||||||
|
input_iterator_tag) {
|
||||||
|
|
||||||
|
_Distance __k = 0;
|
||||||
|
for (; __first != __last && __k < __n; ++__first, (void)++__k)
|
||||||
|
__out[__k] = *__first;
|
||||||
|
_Distance __sz = __k;
|
||||||
|
for (; __first != __last; ++__first, (void)++__k) {
|
||||||
|
_Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g);
|
||||||
|
if (__r < __sz)
|
||||||
|
__out[__r] = *__first;
|
||||||
|
}
|
||||||
|
return __out + _VSTD::min(__n, __k);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
||||||
|
class _UniformRandomNumberGenerator>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
_SampleIterator __sample(_PopulationIterator __first,
|
||||||
|
_PopulationIterator __last, _SampleIterator __out,
|
||||||
|
_Distance __n,
|
||||||
|
_UniformRandomNumberGenerator &&__g,
|
||||||
|
forward_iterator_tag) {
|
||||||
|
_Distance __unsampled_sz = _VSTD::distance(__first, __last);
|
||||||
|
for (__n = _VSTD::min(__n, __unsampled_sz); __n != 0; ++__first) {
|
||||||
|
_Distance __r =
|
||||||
|
_VSTD::uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g);
|
||||||
|
if (__r < __n) {
|
||||||
|
*__out++ = *__first;
|
||||||
|
--__n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return __out;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
||||||
|
class _UniformRandomNumberGenerator>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
_SampleIterator sample(_PopulationIterator __first,
|
||||||
|
_PopulationIterator __last, _SampleIterator __out,
|
||||||
|
_Distance __n, _UniformRandomNumberGenerator &&__g) {
|
||||||
|
typedef typename iterator_traits<_PopulationIterator>::iterator_category
|
||||||
|
_PopCategory;
|
||||||
|
typedef typename iterator_traits<_PopulationIterator>::difference_type
|
||||||
|
_Difference;
|
||||||
|
typedef typename common_type<_Distance, _Difference>::type _CommonType;
|
||||||
|
_LIBCPP_ASSERT(__n >= 0, "N must be a positive number.");
|
||||||
|
return _VSTD_LFTS::__sample(
|
||||||
|
__first, __last, __out, _CommonType(__n),
|
||||||
|
_VSTD::forward<_UniformRandomNumberGenerator>(__g),
|
||||||
|
_PopCategory());
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */
|
590
include/experimental/any
Normal file
590
include/experimental/any
Normal file
@ -0,0 +1,590 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===------------------------------ any -----------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is distributed under the University of Illinois Open Source
|
||||||
|
// License. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXPERIMENTAL_ANY
|
||||||
|
#define _LIBCPP_EXPERIMENTAL_ANY
|
||||||
|
|
||||||
|
/*
|
||||||
|
experimental/any synopsis
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
namespace experimental {
|
||||||
|
inline namespace fundamentals_v1 {
|
||||||
|
|
||||||
|
class bad_any_cast : public bad_cast
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual const char* what() const noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
class any
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// 6.3.1 any construct/destruct
|
||||||
|
any() noexcept;
|
||||||
|
|
||||||
|
any(const any& other);
|
||||||
|
any(any&& other) noexcept;
|
||||||
|
|
||||||
|
template <class ValueType>
|
||||||
|
any(ValueType&& value);
|
||||||
|
|
||||||
|
~any();
|
||||||
|
|
||||||
|
// 6.3.2 any assignments
|
||||||
|
any& operator=(const any& rhs);
|
||||||
|
any& operator=(any&& rhs) noexcept;
|
||||||
|
|
||||||
|
template <class ValueType>
|
||||||
|
any& operator=(ValueType&& rhs);
|
||||||
|
|
||||||
|
// 6.3.3 any modifiers
|
||||||
|
void clear() noexcept;
|
||||||
|
void swap(any& rhs) noexcept;
|
||||||
|
|
||||||
|
// 6.3.4 any observers
|
||||||
|
bool empty() const noexcept;
|
||||||
|
const type_info& type() const noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 6.4 Non-member functions
|
||||||
|
void swap(any& x, any& y) noexcept;
|
||||||
|
|
||||||
|
template<class ValueType>
|
||||||
|
ValueType any_cast(const any& operand);
|
||||||
|
template<class ValueType>
|
||||||
|
ValueType any_cast(any& operand);
|
||||||
|
template<class ValueType>
|
||||||
|
ValueType any_cast(any&& operand);
|
||||||
|
|
||||||
|
template<class ValueType>
|
||||||
|
const ValueType* any_cast(const any* operand) noexcept;
|
||||||
|
template<class ValueType>
|
||||||
|
ValueType* any_cast(any* operand) noexcept;
|
||||||
|
|
||||||
|
} // namespace fundamentals_v1
|
||||||
|
} // namespace experimental
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <experimental/__config>
|
||||||
|
#include <memory>
|
||||||
|
#include <new>
|
||||||
|
#include <typeinfo>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
class _LIBCPP_EXCEPTION_ABI bad_any_cast : public bad_cast
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual const char* what() const _NOEXCEPT;
|
||||||
|
};
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11 // C++ > 11
|
||||||
|
|
||||||
|
_LIBCPP_NORETURN _LIBCPP_INLINE_VISIBILITY
|
||||||
|
inline void __throw_bad_any_cast()
|
||||||
|
{
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
throw bad_any_cast();
|
||||||
|
#else
|
||||||
|
assert(!"bad_any_cast");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
|
class any;
|
||||||
|
|
||||||
|
template <class _ValueType>
|
||||||
|
typename add_pointer<typename add_const<_ValueType>::type>::type
|
||||||
|
any_cast(any const *) _NOEXCEPT;
|
||||||
|
|
||||||
|
template <class _ValueType>
|
||||||
|
typename add_pointer<_ValueType>::type
|
||||||
|
any_cast(any *) _NOEXCEPT;
|
||||||
|
|
||||||
|
namespace __any_imp
|
||||||
|
{
|
||||||
|
typedef typename aligned_storage<3*sizeof(void*), alignment_of<void*>::value>::type
|
||||||
|
_Buffer;
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
struct _IsSmallObject
|
||||||
|
: public integral_constant<bool
|
||||||
|
, sizeof(_Tp) <= sizeof(_Buffer)
|
||||||
|
&& alignment_of<_Buffer>::value
|
||||||
|
% alignment_of<_Tp>::value == 0
|
||||||
|
&& is_nothrow_move_constructible<_Tp>::value
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
|
||||||
|
enum class _Action
|
||||||
|
{
|
||||||
|
_Destroy,
|
||||||
|
_Copy,
|
||||||
|
_Move,
|
||||||
|
_Get,
|
||||||
|
_TypeInfo
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
struct _SmallHandler;
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
struct _LargeHandler;
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
using _Handler = typename conditional<_IsSmallObject<_Tp>::value
|
||||||
|
, _SmallHandler<_Tp>
|
||||||
|
, _LargeHandler<_Tp>
|
||||||
|
>::type;
|
||||||
|
template <class _ValueType>
|
||||||
|
using _EnableIfNotAny = typename
|
||||||
|
enable_if<
|
||||||
|
!is_same<typename decay<_ValueType>::type, any>::value
|
||||||
|
>::type;
|
||||||
|
|
||||||
|
} // namespace __any_imp
|
||||||
|
|
||||||
|
class any
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// 6.3.1 any construct/destruct
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
any() _NOEXCEPT : __h(nullptr) {}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
any(any const & __other) : __h(nullptr)
|
||||||
|
{
|
||||||
|
if (__other.__h) __other.__call(_Action::_Copy, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
any(any && __other) _NOEXCEPT : __h(nullptr)
|
||||||
|
{
|
||||||
|
if (__other.__h) __other.__call(_Action::_Move, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class _ValueType
|
||||||
|
, class = __any_imp::_EnableIfNotAny<_ValueType>
|
||||||
|
>
|
||||||
|
any(_ValueType && __value);
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
~any()
|
||||||
|
{
|
||||||
|
this->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6.3.2 any assignments
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
any & operator=(any const & __rhs)
|
||||||
|
{
|
||||||
|
any(__rhs).swap(*this);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
any & operator=(any && __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
any(_VSTD::move(__rhs)).swap(*this);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class _ValueType
|
||||||
|
, class = __any_imp::_EnableIfNotAny<_ValueType>
|
||||||
|
>
|
||||||
|
any & operator=(_ValueType && __rhs);
|
||||||
|
|
||||||
|
// 6.3.3 any modifiers
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
void clear() _NOEXCEPT
|
||||||
|
{
|
||||||
|
if (__h) this->__call(_Action::_Destroy);
|
||||||
|
}
|
||||||
|
|
||||||
|
void swap(any & __rhs) _NOEXCEPT;
|
||||||
|
|
||||||
|
// 6.3.4 any observers
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool empty() const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __h == nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_NO_RTTI)
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
const type_info & type() const _NOEXCEPT
|
||||||
|
{
|
||||||
|
if (__h) {
|
||||||
|
return *static_cast<type_info const *>(this->__call(_Action::_TypeInfo));
|
||||||
|
} else {
|
||||||
|
return typeid(void);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef __any_imp::_Action _Action;
|
||||||
|
|
||||||
|
typedef void* (*_HandleFuncPtr)(_Action, any const *, any *, const type_info *);
|
||||||
|
|
||||||
|
union _Storage
|
||||||
|
{
|
||||||
|
void * __ptr;
|
||||||
|
__any_imp::_Buffer __buf;
|
||||||
|
};
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE
|
||||||
|
void * __call(_Action __a, any * __other = nullptr,
|
||||||
|
type_info const * __info = nullptr) const
|
||||||
|
{
|
||||||
|
return __h(__a, this, __other, __info);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE
|
||||||
|
void * __call(_Action __a, any * __other = nullptr,
|
||||||
|
type_info const * __info = nullptr)
|
||||||
|
{
|
||||||
|
return __h(__a, this, __other, __info);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class>
|
||||||
|
friend struct __any_imp::_SmallHandler;
|
||||||
|
template <class>
|
||||||
|
friend struct __any_imp::_LargeHandler;
|
||||||
|
|
||||||
|
template <class _ValueType>
|
||||||
|
friend typename add_pointer<typename add_const<_ValueType>::type>::type
|
||||||
|
any_cast(any const *) _NOEXCEPT;
|
||||||
|
|
||||||
|
template <class _ValueType>
|
||||||
|
friend typename add_pointer<_ValueType>::type
|
||||||
|
any_cast(any *) _NOEXCEPT;
|
||||||
|
|
||||||
|
_HandleFuncPtr __h;
|
||||||
|
_Storage __s;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace __any_imp
|
||||||
|
{
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
struct _LIBCPP_TYPE_VIS_ONLY _SmallHandler
|
||||||
|
{
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void* __handle(_Action __act, any const * __this, any * __other,
|
||||||
|
type_info const * __info)
|
||||||
|
{
|
||||||
|
switch (__act)
|
||||||
|
{
|
||||||
|
case _Action::_Destroy:
|
||||||
|
__destroy(const_cast<any &>(*__this));
|
||||||
|
return nullptr;
|
||||||
|
case _Action::_Copy:
|
||||||
|
__copy(*__this, *__other);
|
||||||
|
return nullptr;
|
||||||
|
case _Action::_Move:
|
||||||
|
__move(const_cast<any &>(*__this), *__other);
|
||||||
|
return nullptr;
|
||||||
|
case _Action::_Get:
|
||||||
|
return __get(const_cast<any &>(*__this), __info);
|
||||||
|
case _Action::_TypeInfo:
|
||||||
|
return __type_info();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Up>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __create(any & __dest, _Up && __v)
|
||||||
|
{
|
||||||
|
::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Up>(__v));
|
||||||
|
__dest.__h = &_SmallHandler::__handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __destroy(any & __this)
|
||||||
|
{
|
||||||
|
_Tp & __value = *static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf));
|
||||||
|
__value.~_Tp();
|
||||||
|
__this.__h = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __copy(any const & __this, any & __dest)
|
||||||
|
{
|
||||||
|
_SmallHandler::__create(__dest, *static_cast<_Tp const *>(
|
||||||
|
static_cast<void const *>(&__this.__s.__buf)));
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __move(any & __this, any & __dest)
|
||||||
|
{
|
||||||
|
_SmallHandler::__create(__dest, _VSTD::move(
|
||||||
|
*static_cast<_Tp*>(static_cast<void*>(&__this.__s.__buf))));
|
||||||
|
__destroy(__this);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void* __get(any & __this, type_info const * __info)
|
||||||
|
{
|
||||||
|
#if !defined(_LIBCPP_NO_RTTI)
|
||||||
|
if (typeid(_Tp) == *__info) {
|
||||||
|
return static_cast<void*>(&__this.__s.__buf);
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
#else
|
||||||
|
return static_cast<void*>(&__this.__s.__buf);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void* __type_info()
|
||||||
|
{
|
||||||
|
#if !defined(_LIBCPP_NO_RTTI)
|
||||||
|
return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
|
||||||
|
#else
|
||||||
|
return nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
struct _LIBCPP_TYPE_VIS_ONLY _LargeHandler
|
||||||
|
{
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void* __handle(_Action __act, any const * __this, any * __other,
|
||||||
|
type_info const * __info)
|
||||||
|
{
|
||||||
|
switch (__act)
|
||||||
|
{
|
||||||
|
case _Action::_Destroy:
|
||||||
|
__destroy(const_cast<any &>(*__this));
|
||||||
|
return nullptr;
|
||||||
|
case _Action::_Copy:
|
||||||
|
__copy(*__this, *__other);
|
||||||
|
return nullptr;
|
||||||
|
case _Action::_Move:
|
||||||
|
__move(const_cast<any &>(*__this), *__other);
|
||||||
|
return nullptr;
|
||||||
|
case _Action::_Get:
|
||||||
|
return __get(const_cast<any &>(*__this), __info);
|
||||||
|
case _Action::_TypeInfo:
|
||||||
|
return __type_info();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Up>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __create(any & __dest, _Up && __v)
|
||||||
|
{
|
||||||
|
typedef allocator<_Tp> _Alloc;
|
||||||
|
typedef __allocator_destructor<_Alloc> _Dp;
|
||||||
|
_Alloc __a;
|
||||||
|
unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||||
|
::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Up>(__v));
|
||||||
|
__dest.__s.__ptr = __hold.release();
|
||||||
|
__dest.__h = &_LargeHandler::__handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __destroy(any & __this)
|
||||||
|
{
|
||||||
|
delete static_cast<_Tp*>(__this.__s.__ptr);
|
||||||
|
__this.__h = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __copy(any const & __this, any & __dest)
|
||||||
|
{
|
||||||
|
_LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s.__ptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __move(any & __this, any & __dest)
|
||||||
|
{
|
||||||
|
__dest.__s.__ptr = __this.__s.__ptr;
|
||||||
|
__dest.__h = &_LargeHandler::__handle;
|
||||||
|
__this.__h = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void* __get(any & __this, type_info const * __info)
|
||||||
|
{
|
||||||
|
#if !defined(_LIBCPP_NO_RTTI)
|
||||||
|
if (typeid(_Tp) == *__info) {
|
||||||
|
return static_cast<void*>(__this.__s.__ptr);
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
#else
|
||||||
|
return static_cast<void*>(__this.__s.__ptr);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void* __type_info()
|
||||||
|
{
|
||||||
|
#if !defined(_LIBCPP_NO_RTTI)
|
||||||
|
return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
|
||||||
|
#else
|
||||||
|
return nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace __any_imp
|
||||||
|
|
||||||
|
|
||||||
|
template <class _ValueType, class>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
any::any(_ValueType && __v) : __h(nullptr)
|
||||||
|
{
|
||||||
|
typedef typename decay<_ValueType>::type _Tp;
|
||||||
|
static_assert(is_copy_constructible<_Tp>::value,
|
||||||
|
"_ValueType must be CopyConstructible.");
|
||||||
|
typedef __any_imp::_Handler<_Tp> _HandlerType;
|
||||||
|
_HandlerType::__create(*this, _VSTD::forward<_ValueType>(__v));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _ValueType, class>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
any & any::operator=(_ValueType && __v)
|
||||||
|
{
|
||||||
|
typedef typename decay<_ValueType>::type _Tp;
|
||||||
|
static_assert(is_copy_constructible<_Tp>::value,
|
||||||
|
"_ValueType must be CopyConstructible.");
|
||||||
|
any(_VSTD::forward<_ValueType>(__v)).swap(*this);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
void any::swap(any & __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
if (__h && __rhs.__h) {
|
||||||
|
any __tmp;
|
||||||
|
__rhs.__call(_Action::_Move, &__tmp);
|
||||||
|
this->__call(_Action::_Move, &__rhs);
|
||||||
|
__tmp.__call(_Action::_Move, this);
|
||||||
|
}
|
||||||
|
else if (__h) {
|
||||||
|
this->__call(_Action::_Move, &__rhs);
|
||||||
|
}
|
||||||
|
else if (__rhs.__h) {
|
||||||
|
__rhs.__call(_Action::_Move, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6.4 Non-member functions
|
||||||
|
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
void swap(any & __lhs, any & __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
__lhs.swap(__rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _ValueType>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
_ValueType any_cast(any const & __v)
|
||||||
|
{
|
||||||
|
static_assert(
|
||||||
|
is_reference<_ValueType>::value
|
||||||
|
|| is_copy_constructible<_ValueType>::value,
|
||||||
|
"_ValueType is required to be a reference or a CopyConstructible type.");
|
||||||
|
typedef typename add_const<typename remove_reference<_ValueType>::type>::type
|
||||||
|
_Tp;
|
||||||
|
_Tp * __tmp = any_cast<_Tp>(&__v);
|
||||||
|
if (__tmp == nullptr)
|
||||||
|
__throw_bad_any_cast();
|
||||||
|
return *__tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _ValueType>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
_ValueType any_cast(any & __v)
|
||||||
|
{
|
||||||
|
static_assert(
|
||||||
|
is_reference<_ValueType>::value
|
||||||
|
|| is_copy_constructible<_ValueType>::value,
|
||||||
|
"_ValueType is required to be a reference or a CopyConstructible type.");
|
||||||
|
typedef typename remove_reference<_ValueType>::type _Tp;
|
||||||
|
_Tp * __tmp = any_cast<_Tp>(&__v);
|
||||||
|
if (__tmp == nullptr)
|
||||||
|
__throw_bad_any_cast();
|
||||||
|
return *__tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _ValueType>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
_ValueType any_cast(any && __v)
|
||||||
|
{
|
||||||
|
static_assert(
|
||||||
|
is_reference<_ValueType>::value
|
||||||
|
|| is_copy_constructible<_ValueType>::value,
|
||||||
|
"_ValueType is required to be a reference or a CopyConstructible type.");
|
||||||
|
typedef typename remove_reference<_ValueType>::type _Tp;
|
||||||
|
_Tp * __tmp = any_cast<_Tp>(&__v);
|
||||||
|
if (__tmp == nullptr)
|
||||||
|
__throw_bad_any_cast();
|
||||||
|
return *__tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _ValueType>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename add_pointer<typename add_const<_ValueType>::type>::type
|
||||||
|
any_cast(any const * __any) _NOEXCEPT
|
||||||
|
{
|
||||||
|
static_assert(!is_reference<_ValueType>::value,
|
||||||
|
"_ValueType may not be a reference.");
|
||||||
|
return any_cast<_ValueType>(const_cast<any *>(__any));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _ValueType>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename add_pointer<_ValueType>::type
|
||||||
|
any_cast(any * __any) _NOEXCEPT
|
||||||
|
{
|
||||||
|
using __any_imp::_Action;
|
||||||
|
static_assert(!is_reference<_ValueType>::value,
|
||||||
|
"_ValueType may not be a reference.");
|
||||||
|
typedef typename add_pointer<_ValueType>::type _ReturnType;
|
||||||
|
if (__any && __any->__h) {
|
||||||
|
|
||||||
|
return static_cast<_ReturnType>(
|
||||||
|
__any->__call(_Action::_Get, nullptr,
|
||||||
|
#if !defined(_LIBCPP_NO_RTTI)
|
||||||
|
&typeid(_ValueType)
|
||||||
|
#else
|
||||||
|
nullptr
|
||||||
|
#endif
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _LIBCPP_STD_VER > 11
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
#endif // _LIBCPP_EXPERIMENTAL_ANY
|
59
include/experimental/chrono
Normal file
59
include/experimental/chrono
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===------------------------------ chrono ---------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is distributed under the University of Illinois Open Source
|
||||||
|
// License. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXPERIMENTAL_CHRONO
|
||||||
|
#define _LIBCPP_EXPERIMENTAL_CHRONO
|
||||||
|
|
||||||
|
/**
|
||||||
|
experimental/chrono synopsis
|
||||||
|
|
||||||
|
// C++1y
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
namespace chrono {
|
||||||
|
namespace experimental {
|
||||||
|
inline namespace fundamentals_v1 {
|
||||||
|
|
||||||
|
// See C++14 20.12.4, customization traits
|
||||||
|
template <class Rep> constexpr bool treat_as_floating_point_v
|
||||||
|
= treat_as_floating_point<Rep>::value;
|
||||||
|
|
||||||
|
} // namespace fundamentals_v1
|
||||||
|
} // namespace experimental
|
||||||
|
} // namespace chrono
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <experimental/__config>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_CHRONO_LFTS
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||||
|
|
||||||
|
template <class _Rep> _LIBCPP_CONSTEXPR bool treat_as_floating_point_v
|
||||||
|
= treat_as_floating_point<_Rep>::value;
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_CHRONO_LFTS
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_STD_VER > 11 */
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_EXPERIMENTAL_CHRONO */
|
316
include/experimental/dynarray
Normal file
316
include/experimental/dynarray
Normal file
@ -0,0 +1,316 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===-------------------------- dynarray ----------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_DYNARRAY
|
||||||
|
#define _LIBCPP_DYNARRAY
|
||||||
|
|
||||||
|
#include <__config>
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
|
||||||
|
/*
|
||||||
|
dynarray synopsis
|
||||||
|
|
||||||
|
namespace std { namespace experimental {
|
||||||
|
|
||||||
|
template< typename T >
|
||||||
|
class dynarray
|
||||||
|
{
|
||||||
|
// types:
|
||||||
|
typedef T value_type;
|
||||||
|
typedef T& reference;
|
||||||
|
typedef const T& const_reference;
|
||||||
|
typedef T* pointer;
|
||||||
|
typedef const T* const_pointer;
|
||||||
|
typedef implementation-defined iterator;
|
||||||
|
typedef implementation-defined const_iterator;
|
||||||
|
typedef reverse_iterator<iterator> reverse_iterator;
|
||||||
|
typedef reverse_iterator<const_iterator> const_reverse_iterator;
|
||||||
|
typedef size_t size_type;
|
||||||
|
typedef ptrdiff_t difference_type;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// construct/copy/destroy:
|
||||||
|
explicit dynarray(size_type c);
|
||||||
|
dynarray(size_type c, const T& v);
|
||||||
|
dynarray(const dynarray& d);
|
||||||
|
dynarray(initializer_list<T>);
|
||||||
|
|
||||||
|
template <class Alloc>
|
||||||
|
dynarray(allocator_arg_t, const Alloc& a, size_type c, const Alloc& alloc);
|
||||||
|
template <class Alloc>
|
||||||
|
dynarray(allocator_arg_t, const Alloc& a, size_type c, const T& v, const Alloc& alloc);
|
||||||
|
template <class Alloc>
|
||||||
|
dynarray(allocator_arg_t, const Alloc& a, const dynarray& d, const Alloc& alloc);
|
||||||
|
template <class Alloc>
|
||||||
|
dynarray(allocator_arg_t, const Alloc& a, initializer_list<T>, const Alloc& alloc);
|
||||||
|
dynarray& operator=(const dynarray&) = delete;
|
||||||
|
~dynarray();
|
||||||
|
|
||||||
|
// iterators:
|
||||||
|
iterator begin() noexcept;
|
||||||
|
const_iterator begin() const noexcept;
|
||||||
|
const_iterator cbegin() const noexcept;
|
||||||
|
iterator end() noexcept;
|
||||||
|
const_iterator end() const noexcept;
|
||||||
|
const_iterator cend() const noexcept;
|
||||||
|
|
||||||
|
reverse_iterator rbegin() noexcept;
|
||||||
|
const_reverse_iterator rbegin() const noexcept;
|
||||||
|
const_reverse_iterator crbegin() const noexcept;
|
||||||
|
reverse_iterator rend() noexcept;
|
||||||
|
const_reverse_iterator rend() const noexcept;
|
||||||
|
const_reverse_iterator crend() const noexcept;
|
||||||
|
|
||||||
|
// capacity:
|
||||||
|
size_type size() const noexcept;
|
||||||
|
size_type max_size() const noexcept;
|
||||||
|
bool empty() const noexcept;
|
||||||
|
|
||||||
|
// element access:
|
||||||
|
reference operator[](size_type n);
|
||||||
|
const_reference operator[](size_type n) const;
|
||||||
|
|
||||||
|
reference front();
|
||||||
|
const_reference front() const;
|
||||||
|
reference back();
|
||||||
|
const_reference back() const;
|
||||||
|
|
||||||
|
const_reference at(size_type n) const;
|
||||||
|
reference at(size_type n);
|
||||||
|
|
||||||
|
// data access:
|
||||||
|
T* data() noexcept;
|
||||||
|
const T* data() const noexcept;
|
||||||
|
|
||||||
|
// mutating member functions:
|
||||||
|
void fill(const T& v);
|
||||||
|
};
|
||||||
|
|
||||||
|
}} // std::experimental
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <__functional_base>
|
||||||
|
#include <iterator>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <initializer_list>
|
||||||
|
#include <new>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <__undef___deallocate>
|
||||||
|
|
||||||
|
#if defined(_LIBCPP_NO_EXCEPTIONS)
|
||||||
|
#include <cassert>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace std { namespace experimental { inline namespace __array_extensions_v1 {
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
struct _LIBCPP_TYPE_VIS_ONLY dynarray
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// types:
|
||||||
|
typedef dynarray __self;
|
||||||
|
typedef _Tp value_type;
|
||||||
|
typedef value_type& reference;
|
||||||
|
typedef const value_type& const_reference;
|
||||||
|
typedef value_type* iterator;
|
||||||
|
typedef const value_type* const_iterator;
|
||||||
|
typedef value_type* pointer;
|
||||||
|
typedef const value_type* const_pointer;
|
||||||
|
typedef size_t size_type;
|
||||||
|
typedef ptrdiff_t difference_type;
|
||||||
|
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||||
|
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||||
|
|
||||||
|
private:
|
||||||
|
size_t __size_;
|
||||||
|
value_type * __base_;
|
||||||
|
_LIBCPP_ALWAYS_INLINE dynarray () noexcept : __size_(0), __base_(nullptr) {}
|
||||||
|
|
||||||
|
static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count )
|
||||||
|
{
|
||||||
|
if ( numeric_limits<size_t>::max() / sizeof (value_type) <= count )
|
||||||
|
{
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
throw bad_array_length();
|
||||||
|
#else
|
||||||
|
assert(!"dynarray::allocation");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return static_cast<value_type *> (_VSTD::__allocate (sizeof(value_type) * count));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept
|
||||||
|
{
|
||||||
|
_VSTD::__deallocate (static_cast<void *> (__ptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit dynarray(size_type __c);
|
||||||
|
dynarray(size_type __c, const value_type& __v);
|
||||||
|
dynarray(const dynarray& __d);
|
||||||
|
dynarray(initializer_list<value_type>);
|
||||||
|
|
||||||
|
// We're not implementing these right now.
|
||||||
|
// Updated with the resolution of LWG issue #2255
|
||||||
|
// template <typename _Alloc>
|
||||||
|
// dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c);
|
||||||
|
// template <typename _Alloc>
|
||||||
|
// dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c, const value_type& __v);
|
||||||
|
// template <typename _Alloc>
|
||||||
|
// dynarray(allocator_arg_t, const _Alloc& __alloc, const dynarray& __d);
|
||||||
|
// template <typename _Alloc>
|
||||||
|
// dynarray(allocator_arg_t, const _Alloc& __alloc, initializer_list<value_type>);
|
||||||
|
|
||||||
|
dynarray& operator=(const dynarray&) = delete;
|
||||||
|
~dynarray();
|
||||||
|
|
||||||
|
// iterators:
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY iterator begin() noexcept { return iterator(data()); }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY const_iterator begin() const noexcept { return const_iterator(data()); }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const noexcept { return const_iterator(data()); }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY iterator end() noexcept { return iterator(data() + __size_); }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY const_iterator end() const noexcept { return const_iterator(data() + __size_); }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY const_iterator cend() const noexcept { return const_iterator(data() + __size_); }
|
||||||
|
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); }
|
||||||
|
|
||||||
|
// capacity:
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY size_type size() const noexcept { return __size_; }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY size_type max_size() const noexcept { return __size_; }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY bool empty() const noexcept { return __size_ == 0; }
|
||||||
|
|
||||||
|
// element access:
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) { return data()[__n]; }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const { return data()[__n]; }
|
||||||
|
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY reference front() { return data()[0]; }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY const_reference front() const { return data()[0]; }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY reference back() { return data()[__size_-1]; }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY const_reference back() const { return data()[__size_-1]; }
|
||||||
|
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY const_reference at(size_type __n) const;
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY reference at(size_type __n);
|
||||||
|
|
||||||
|
// data access:
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY _Tp* data() noexcept { return __base_; }
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY const _Tp* data() const noexcept { return __base_; }
|
||||||
|
|
||||||
|
// mutating member functions:
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __v) { fill_n(begin(), __size_, __v); }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
dynarray<_Tp>::dynarray(size_type __c) : dynarray ()
|
||||||
|
{
|
||||||
|
__base_ = __allocate (__c);
|
||||||
|
value_type *__data = data ();
|
||||||
|
for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
|
||||||
|
::new (__data) value_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
dynarray<_Tp>::dynarray(size_type __c, const value_type& __v) : dynarray ()
|
||||||
|
{
|
||||||
|
__base_ = __allocate (__c);
|
||||||
|
value_type *__data = data ();
|
||||||
|
for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
|
||||||
|
::new (__data) value_type (__v);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
dynarray<_Tp>::dynarray(initializer_list<value_type> __il) : dynarray ()
|
||||||
|
{
|
||||||
|
size_t sz = __il.size();
|
||||||
|
__base_ = __allocate (sz);
|
||||||
|
value_type *__data = data ();
|
||||||
|
auto src = __il.begin();
|
||||||
|
for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
|
||||||
|
::new (__data) value_type (*src);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
dynarray<_Tp>::dynarray(const dynarray& __d) : dynarray ()
|
||||||
|
{
|
||||||
|
size_t sz = __d.size();
|
||||||
|
__base_ = __allocate (sz);
|
||||||
|
value_type *__data = data ();
|
||||||
|
auto src = __d.begin();
|
||||||
|
for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
|
||||||
|
::new (__data) value_type (*src);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
dynarray<_Tp>::~dynarray()
|
||||||
|
{
|
||||||
|
value_type *__data = data () + __size_;
|
||||||
|
for ( size_t i = 0; i < __size_; ++i )
|
||||||
|
(--__data)->value_type::~value_type();
|
||||||
|
__deallocate ( __base_ );
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename dynarray<_Tp>::reference
|
||||||
|
dynarray<_Tp>::at(size_type __n)
|
||||||
|
{
|
||||||
|
if (__n >= __size_)
|
||||||
|
{
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
throw out_of_range("dynarray::at");
|
||||||
|
#else
|
||||||
|
assert(!"dynarray::at out_of_range");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return data()[__n];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename dynarray<_Tp>::const_reference
|
||||||
|
dynarray<_Tp>::at(size_type __n) const
|
||||||
|
{
|
||||||
|
if (__n >= __size_)
|
||||||
|
{
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
throw out_of_range("dynarray::at");
|
||||||
|
#else
|
||||||
|
assert(!"dynarray::at out_of_range");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return data()[__n];
|
||||||
|
}
|
||||||
|
|
||||||
|
}}}
|
||||||
|
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
template <class _Tp, class _Alloc>
|
||||||
|
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {};
|
||||||
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
#endif // if _LIBCPP_STD_VER > 11
|
||||||
|
#endif // _LIBCPP_DYNARRAY
|
454
include/experimental/functional
Normal file
454
include/experimental/functional
Normal file
@ -0,0 +1,454 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===-------------------------- functional --------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXPERIMENTAL_FUNCTIONAL
|
||||||
|
#define _LIBCPP_EXPERIMENTAL_FUNCTIONAL
|
||||||
|
|
||||||
|
/*
|
||||||
|
experimental/functional synopsis
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
namespace experimental {
|
||||||
|
inline namespace fundamentals_v1 {
|
||||||
|
|
||||||
|
// See C++14 20.9.9, Function object binders
|
||||||
|
template <class T> constexpr bool is_bind_expression_v
|
||||||
|
= is_bind_expression<T>::value;
|
||||||
|
template <class T> constexpr int is_placeholder_v
|
||||||
|
= is_placeholder<T>::value;
|
||||||
|
|
||||||
|
// 4.2, Class template function
|
||||||
|
template<class> class function; // undefined
|
||||||
|
template<class R, class... ArgTypes> class function<R(ArgTypes...)>;
|
||||||
|
|
||||||
|
template<class R, class... ArgTypes>
|
||||||
|
void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
|
||||||
|
|
||||||
|
template<class R, class... ArgTypes>
|
||||||
|
bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
|
||||||
|
template<class R, class... ArgTypes>
|
||||||
|
bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
|
||||||
|
template<class R, class... ArgTypes>
|
||||||
|
bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
|
||||||
|
template<class R, class... ArgTypes>
|
||||||
|
bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
|
||||||
|
|
||||||
|
// 4.3, Searchers
|
||||||
|
template<class ForwardIterator, class BinaryPredicate = equal_to<>>
|
||||||
|
class default_searcher;
|
||||||
|
|
||||||
|
template<class RandomAccessIterator,
|
||||||
|
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
|
||||||
|
class BinaryPredicate = equal_to<>>
|
||||||
|
class boyer_moore_searcher;
|
||||||
|
|
||||||
|
template<class RandomAccessIterator,
|
||||||
|
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
|
||||||
|
class BinaryPredicate = equal_to<>>
|
||||||
|
class boyer_moore_horspool_searcher;
|
||||||
|
|
||||||
|
template<class ForwardIterator, class BinaryPredicate = equal_to<>>
|
||||||
|
default_searcher<ForwardIterator, BinaryPredicate>
|
||||||
|
make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
|
||||||
|
BinaryPredicate pred = BinaryPredicate());
|
||||||
|
|
||||||
|
template<class RandomAccessIterator,
|
||||||
|
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
|
||||||
|
class BinaryPredicate = equal_to<>>
|
||||||
|
boyer_moore_searcher<RandomAccessIterator, Hash, BinaryPredicate>
|
||||||
|
make_boyer_moore_searcher(
|
||||||
|
RandomAccessIterator pat_first, RandomAccessIterator pat_last,
|
||||||
|
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
|
||||||
|
|
||||||
|
template<class RandomAccessIterator,
|
||||||
|
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
|
||||||
|
class BinaryPredicate = equal_to<>>
|
||||||
|
boyer_moore_horspool_searcher<RandomAccessIterator, Hash, BinaryPredicate>
|
||||||
|
make_boyer_moore_horspool_searcher(
|
||||||
|
RandomAccessIterator pat_first, RandomAccessIterator pat_last,
|
||||||
|
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
|
||||||
|
|
||||||
|
} // namespace fundamentals_v1
|
||||||
|
} // namespace experimental
|
||||||
|
|
||||||
|
template<class R, class... ArgTypes, class Alloc>
|
||||||
|
struct uses_allocator<experimental::function<R(ArgTypes...)>, Alloc>;
|
||||||
|
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <experimental/__config>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <vector>
|
||||||
|
#include <array>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
|
#include <__undef_min_max>
|
||||||
|
|
||||||
|
#include <__debug>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
// default searcher
|
||||||
|
template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
|
||||||
|
_LIBCPP_TYPE_VIS
|
||||||
|
class default_searcher {
|
||||||
|
public:
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
default_searcher(_ForwardIterator __f, _ForwardIterator __l,
|
||||||
|
_BinaryPredicate __p = _BinaryPredicate())
|
||||||
|
: __first_(__f), __last_(__l), __pred_(__p) {}
|
||||||
|
|
||||||
|
template <typename _ForwardIterator2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
_ForwardIterator2 operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const
|
||||||
|
{
|
||||||
|
return _VSTD::search(__f, __l, __first_, __last_, __pred_);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
_ForwardIterator __first_;
|
||||||
|
_ForwardIterator __last_;
|
||||||
|
_BinaryPredicate __pred_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
default_searcher<_ForwardIterator, _BinaryPredicate>
|
||||||
|
make_default_searcher( _ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate ())
|
||||||
|
{
|
||||||
|
return default_searcher<_ForwardIterator, _BinaryPredicate>(__f, __l, __p);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class _Key, class _Value, class _Hash, class _BinaryPredicate, bool /*useArray*/> class _BMSkipTable;
|
||||||
|
|
||||||
|
// General case for BM data searching; use a map
|
||||||
|
template<class _Key, typename _Value, class _Hash, class _BinaryPredicate>
|
||||||
|
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> {
|
||||||
|
public: // TODO private:
|
||||||
|
typedef _Value value_type;
|
||||||
|
typedef _Key key_type;
|
||||||
|
|
||||||
|
const _Value __default_value_;
|
||||||
|
std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table;
|
||||||
|
|
||||||
|
public:
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
_BMSkipTable(std::size_t __sz, _Value __default, _Hash __hf, _BinaryPredicate __pred)
|
||||||
|
: __default_value_(__default), __table(__sz, __hf, __pred) {}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
void insert(const key_type &__key, value_type __val)
|
||||||
|
{
|
||||||
|
__table [__key] = __val; // Would skip_.insert (val) be better here?
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
value_type operator [](const key_type & __key) const
|
||||||
|
{
|
||||||
|
auto __it = __table.find (__key);
|
||||||
|
return __it == __table.end() ? __default_value_ : __it->second;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Special case small numeric values; use an array
|
||||||
|
template<class _Key, typename _Value, class _Hash, class _BinaryPredicate>
|
||||||
|
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, true> {
|
||||||
|
private:
|
||||||
|
typedef _Value value_type;
|
||||||
|
typedef _Key key_type;
|
||||||
|
|
||||||
|
typedef typename std::make_unsigned<key_type>::type unsigned_key_type;
|
||||||
|
typedef std::array<value_type, _VSTD::numeric_limits<unsigned_key_type>::max()> skip_map;
|
||||||
|
skip_map __table;
|
||||||
|
|
||||||
|
public:
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
_BMSkipTable(std::size_t /*__sz*/, _Value __default, _Hash /*__hf*/, _BinaryPredicate /*__pred*/)
|
||||||
|
{
|
||||||
|
std::fill_n(__table.begin(), __table.size(), __default);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
void insert(key_type __key, value_type __val)
|
||||||
|
{
|
||||||
|
__table[static_cast<unsigned_key_type>(__key)] = __val;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
value_type operator [](key_type __key) const
|
||||||
|
{
|
||||||
|
return __table[static_cast<unsigned_key_type>(__key)];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <class _RandomAccessIterator1,
|
||||||
|
class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
|
||||||
|
class _BinaryPredicate = equal_to<>>
|
||||||
|
_LIBCPP_TYPE_VIS
|
||||||
|
class boyer_moore_searcher {
|
||||||
|
private:
|
||||||
|
typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
|
||||||
|
typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
|
||||||
|
typedef _BMSkipTable<value_type, difference_type, _Hash, _BinaryPredicate,
|
||||||
|
_VSTD::is_integral<value_type>::value && // what about enums?
|
||||||
|
sizeof(value_type) == 1 &&
|
||||||
|
is_same<_Hash, hash<value_type>>::value &&
|
||||||
|
is_same<_BinaryPredicate, equal_to<>>::value
|
||||||
|
> skip_table_type;
|
||||||
|
|
||||||
|
public:
|
||||||
|
boyer_moore_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
|
||||||
|
_Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
|
||||||
|
: __first_(__f), __last_(__l), __pred_(__pred),
|
||||||
|
__pattern_length_(_VSTD::distance(__first_, __last_)),
|
||||||
|
__skip_{make_shared<skip_table_type>(__pattern_length_, -1, __hf, __pred_)},
|
||||||
|
__suffix_{make_shared<vector<difference_type>>(__pattern_length_ + 1)}
|
||||||
|
{
|
||||||
|
// build the skip table
|
||||||
|
for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i )
|
||||||
|
__skip_->insert(*__f, __i);
|
||||||
|
|
||||||
|
this->__build_suffix_table ( __first_, __last_, __pred_ );
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename _RandomAccessIterator2>
|
||||||
|
_RandomAccessIterator2
|
||||||
|
operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
|
||||||
|
{
|
||||||
|
static_assert ( std::is_same<
|
||||||
|
typename std::decay<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
|
||||||
|
typename std::decay<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
|
||||||
|
>::value,
|
||||||
|
"Corpus and Pattern iterators must point to the same type" );
|
||||||
|
|
||||||
|
if (__f == __l ) return __l; // empty corpus
|
||||||
|
if (__first_ == __last_) return __f; // empty pattern
|
||||||
|
|
||||||
|
// If the pattern is larger than the corpus, we can't find it!
|
||||||
|
if ( __pattern_length_ > _VSTD::distance (__f, __l))
|
||||||
|
return __l;
|
||||||
|
|
||||||
|
// Do the search
|
||||||
|
return this->__search(__f, __l);
|
||||||
|
}
|
||||||
|
|
||||||
|
public: // TODO private:
|
||||||
|
_RandomAccessIterator1 __first_;
|
||||||
|
_RandomAccessIterator1 __last_;
|
||||||
|
_BinaryPredicate __pred_;
|
||||||
|
difference_type __pattern_length_;
|
||||||
|
shared_ptr<skip_table_type> __skip_;
|
||||||
|
shared_ptr<vector<difference_type>> __suffix_;
|
||||||
|
|
||||||
|
template <typename _RandomAccessIterator2>
|
||||||
|
_RandomAccessIterator2 __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
|
||||||
|
{
|
||||||
|
_RandomAccessIterator2 __cur = __f;
|
||||||
|
const _RandomAccessIterator2 __last = __l - __pattern_length_;
|
||||||
|
const skip_table_type & __skip = *__skip_.get();
|
||||||
|
const vector<difference_type> & __suffix = *__suffix_.get();
|
||||||
|
|
||||||
|
while (__cur <= __last)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Do we match right where we are?
|
||||||
|
difference_type __j = __pattern_length_;
|
||||||
|
while (__pred_(__first_ [__j-1], __cur [__j-1])) {
|
||||||
|
__j--;
|
||||||
|
// We matched - we're done!
|
||||||
|
if ( __j == 0 )
|
||||||
|
return __cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since we didn't match, figure out how far to skip forward
|
||||||
|
difference_type __k = __skip[__cur [ __j - 1 ]];
|
||||||
|
difference_type __m = __j - __k - 1;
|
||||||
|
if (__k < __j && __m > __suffix[ __j ])
|
||||||
|
__cur += __m;
|
||||||
|
else
|
||||||
|
__cur += __suffix[ __j ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return __l; // We didn't find anything
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename _Iterator, typename _Container>
|
||||||
|
void __compute_bm_prefix ( _Iterator __f, _Iterator __l, _BinaryPredicate __pred, _Container &__prefix )
|
||||||
|
{
|
||||||
|
const std::size_t __count = _VSTD::distance(__f, __l);
|
||||||
|
|
||||||
|
__prefix[0] = 0;
|
||||||
|
std::size_t __k = 0;
|
||||||
|
for ( std::size_t __i = 1; __i < __count; ++__i )
|
||||||
|
{
|
||||||
|
while ( __k > 0 && !__pred ( __f[__k], __f[__i] ))
|
||||||
|
__k = __prefix [ __k - 1 ];
|
||||||
|
|
||||||
|
if ( __pred ( __f[__k], __f[__i] ))
|
||||||
|
__k++;
|
||||||
|
__prefix [ __i ] = __k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
|
||||||
|
_BinaryPredicate __pred)
|
||||||
|
{
|
||||||
|
const std::size_t __count = _VSTD::distance(__f, __l);
|
||||||
|
vector<difference_type> & __suffix = *__suffix_.get();
|
||||||
|
if (__count > 0)
|
||||||
|
{
|
||||||
|
_VSTD::vector<value_type> __scratch(__count);
|
||||||
|
|
||||||
|
__compute_bm_prefix(__f, __l, __pred, __scratch);
|
||||||
|
for ( std::size_t __i = 0; __i <= __count; __i++ )
|
||||||
|
__suffix[__i] = __count - __scratch[__count-1];
|
||||||
|
|
||||||
|
typedef _VSTD::reverse_iterator<_RandomAccessIterator1> _RevIter;
|
||||||
|
__compute_bm_prefix(_RevIter(__l), _RevIter(__f), __pred, __scratch);
|
||||||
|
|
||||||
|
for ( std::size_t __i = 0; __i < __count; __i++ )
|
||||||
|
{
|
||||||
|
const std::size_t __j = __count - __scratch[__i];
|
||||||
|
const difference_type __k = __i - __scratch[__i] + 1;
|
||||||
|
|
||||||
|
if (__suffix[__j] > __k)
|
||||||
|
__suffix[__j] = __k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class _RandomAccessIterator,
|
||||||
|
class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
|
||||||
|
class _BinaryPredicate = equal_to<>>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
|
||||||
|
make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
|
||||||
|
_Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
|
||||||
|
{
|
||||||
|
return boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);
|
||||||
|
}
|
||||||
|
|
||||||
|
// boyer-moore-horspool
|
||||||
|
template <class _RandomAccessIterator1,
|
||||||
|
class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
|
||||||
|
class _BinaryPredicate = equal_to<>>
|
||||||
|
_LIBCPP_TYPE_VIS
|
||||||
|
class boyer_moore_horspool_searcher {
|
||||||
|
private:
|
||||||
|
typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
|
||||||
|
typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
|
||||||
|
typedef _BMSkipTable<value_type, difference_type, _Hash, _BinaryPredicate,
|
||||||
|
_VSTD::is_integral<value_type>::value && // what about enums?
|
||||||
|
sizeof(value_type) == 1 &&
|
||||||
|
is_same<_Hash, hash<value_type>>::value &&
|
||||||
|
is_same<_BinaryPredicate, equal_to<>>::value
|
||||||
|
> skip_table_type;
|
||||||
|
|
||||||
|
public:
|
||||||
|
boyer_moore_horspool_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
|
||||||
|
_Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
|
||||||
|
: __first_(__f), __last_(__l), __pred_(__pred),
|
||||||
|
__pattern_length_(_VSTD::distance(__first_, __last_)),
|
||||||
|
__skip_{_VSTD::make_shared<skip_table_type>(__pattern_length_, __pattern_length_, __hf, __pred_)}
|
||||||
|
{
|
||||||
|
// build the skip table
|
||||||
|
if ( __f != __l )
|
||||||
|
{
|
||||||
|
__l = __l - 1;
|
||||||
|
for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i )
|
||||||
|
__skip_->insert(*__f, __pattern_length_ - 1 - __i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename _RandomAccessIterator2>
|
||||||
|
_RandomAccessIterator2
|
||||||
|
operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
|
||||||
|
{
|
||||||
|
static_assert ( std::is_same<
|
||||||
|
typename std::decay<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
|
||||||
|
typename std::decay<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
|
||||||
|
>::value,
|
||||||
|
"Corpus and Pattern iterators must point to the same type" );
|
||||||
|
|
||||||
|
if (__f == __l ) return __l; // empty corpus
|
||||||
|
if (__first_ == __last_) return __f; // empty pattern
|
||||||
|
|
||||||
|
// If the pattern is larger than the corpus, we can't find it!
|
||||||
|
if ( __pattern_length_ > _VSTD::distance (__f, __l))
|
||||||
|
return __l;
|
||||||
|
|
||||||
|
// Do the search
|
||||||
|
return this->__search(__f, __l);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
_RandomAccessIterator1 __first_;
|
||||||
|
_RandomAccessIterator1 __last_;
|
||||||
|
_BinaryPredicate __pred_;
|
||||||
|
difference_type __pattern_length_;
|
||||||
|
shared_ptr<skip_table_type> __skip_;
|
||||||
|
|
||||||
|
template <typename _RandomAccessIterator2>
|
||||||
|
_RandomAccessIterator2 __search ( _RandomAccessIterator2 __f, _RandomAccessIterator2 __l ) const {
|
||||||
|
_RandomAccessIterator2 __cur = __f;
|
||||||
|
const _RandomAccessIterator2 __last = __l - __pattern_length_;
|
||||||
|
const skip_table_type & __skip = *__skip_.get();
|
||||||
|
|
||||||
|
while (__cur <= __last)
|
||||||
|
{
|
||||||
|
// Do we match right where we are?
|
||||||
|
difference_type __j = __pattern_length_;
|
||||||
|
while (__pred_(__first_[__j-1], __cur[__j-1]))
|
||||||
|
{
|
||||||
|
__j--;
|
||||||
|
// We matched - we're done!
|
||||||
|
if ( __j == 0 )
|
||||||
|
return __cur;
|
||||||
|
}
|
||||||
|
__cur += __skip[__cur[__pattern_length_-1]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return __l;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class _RandomAccessIterator,
|
||||||
|
class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
|
||||||
|
class _BinaryPredicate = equal_to<>>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
|
||||||
|
make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
|
||||||
|
_Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
|
||||||
|
{
|
||||||
|
return boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _LIBCPP_STD_VER > 11
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_EXPERIMENTAL_FUNCTIONAL */
|
894
include/experimental/optional
Normal file
894
include/experimental/optional
Normal file
@ -0,0 +1,894 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===-------------------------- optional ----------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_OPTIONAL
|
||||||
|
#define _LIBCPP_OPTIONAL
|
||||||
|
|
||||||
|
/*
|
||||||
|
optional synopsis
|
||||||
|
|
||||||
|
// C++1y
|
||||||
|
|
||||||
|
namespace std { namespace experimental { inline namespace fundamentals_v1 {
|
||||||
|
|
||||||
|
// 5.3, optional for object types
|
||||||
|
template <class T> class optional;
|
||||||
|
|
||||||
|
// 5.4, In-place construction
|
||||||
|
struct in_place_t{};
|
||||||
|
constexpr in_place_t in_place{};
|
||||||
|
|
||||||
|
// 5.5, No-value state indicator
|
||||||
|
struct nullopt_t{see below};
|
||||||
|
constexpr nullopt_t nullopt(unspecified);
|
||||||
|
|
||||||
|
// 5.6, Class bad_optional_access
|
||||||
|
class bad_optional_access;
|
||||||
|
|
||||||
|
// 5.7, Relational operators
|
||||||
|
template <class T>
|
||||||
|
constexpr bool operator==(const optional<T>&, const optional<T>&);
|
||||||
|
template <class T>
|
||||||
|
constexpr bool operator!=(const optional<T>&, const optional<T>&);
|
||||||
|
template <class T>
|
||||||
|
constexpr bool operator<(const optional<T>&, const optional<T>&);
|
||||||
|
template <class T>
|
||||||
|
constexpr bool operator>(const optional<T>&, const optional<T>&);
|
||||||
|
template <class T>
|
||||||
|
constexpr bool operator<=(const optional<T>&, const optional<T>&);
|
||||||
|
template <class T>
|
||||||
|
constexpr bool operator>=(const optional<T>&, const optional<T>&);
|
||||||
|
|
||||||
|
// 5.8, Comparison with nullopt
|
||||||
|
template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
|
||||||
|
template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
|
||||||
|
template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept;
|
||||||
|
template <class T> constexpr bool operator!=(nullopt_t, const optional<T>&) noexcept;
|
||||||
|
template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
|
||||||
|
template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;
|
||||||
|
template <class T> constexpr bool operator<=(const optional<T>&, nullopt_t) noexcept;
|
||||||
|
template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
|
||||||
|
template <class T> constexpr bool operator>(const optional<T>&, nullopt_t) noexcept;
|
||||||
|
template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
|
||||||
|
template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
|
||||||
|
template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept;
|
||||||
|
|
||||||
|
// 5.9, Comparison with T
|
||||||
|
template <class T> constexpr bool operator==(const optional<T>&, const T&);
|
||||||
|
template <class T> constexpr bool operator==(const T&, const optional<T>&);
|
||||||
|
template <class T> constexpr bool operator!=(const optional<T>&, const T&);
|
||||||
|
template <class T> constexpr bool operator!=(const T&, const optional<T>&);
|
||||||
|
template <class T> constexpr bool operator<(const optional<T>&, const T&);
|
||||||
|
template <class T> constexpr bool operator<(const T&, const optional<T>&);
|
||||||
|
template <class T> constexpr bool operator<=(const optional<T>&, const T&);
|
||||||
|
template <class T> constexpr bool operator<=(const T&, const optional<T>&);
|
||||||
|
template <class T> constexpr bool operator>(const optional<T>&, const T&);
|
||||||
|
template <class T> constexpr bool operator>(const T&, const optional<T>&);
|
||||||
|
template <class T> constexpr bool operator>=(const optional<T>&, const T&);
|
||||||
|
template <class T> constexpr bool operator>=(const T&, const optional<T>&);
|
||||||
|
|
||||||
|
// 5.10, Specialized algorithms
|
||||||
|
template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below);
|
||||||
|
template <class T> constexpr optional<see below> make_optional(T&&);
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class optional
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef T value_type;
|
||||||
|
|
||||||
|
// 5.3.1, Constructors
|
||||||
|
constexpr optional() noexcept;
|
||||||
|
constexpr optional(nullopt_t) noexcept;
|
||||||
|
optional(const optional&);
|
||||||
|
optional(optional&&) noexcept(see below);
|
||||||
|
constexpr optional(const T&);
|
||||||
|
constexpr optional(T&&);
|
||||||
|
template <class... Args> constexpr explicit optional(in_place_t, Args&&...);
|
||||||
|
template <class U, class... Args>
|
||||||
|
constexpr explicit optional(in_place_t, initializer_list<U>, Args&&...);
|
||||||
|
|
||||||
|
// 5.3.2, Destructor
|
||||||
|
~optional();
|
||||||
|
|
||||||
|
// 5.3.3, Assignment
|
||||||
|
optional& operator=(nullopt_t) noexcept;
|
||||||
|
optional& operator=(const optional&);
|
||||||
|
optional& operator=(optional&&) noexcept(see below);
|
||||||
|
template <class U> optional& operator=(U&&);
|
||||||
|
template <class... Args> void emplace(Args&&...);
|
||||||
|
template <class U, class... Args>
|
||||||
|
void emplace(initializer_list<U>, Args&&...);
|
||||||
|
|
||||||
|
// 5.3.4, Swap
|
||||||
|
void swap(optional&) noexcept(see below);
|
||||||
|
|
||||||
|
// 5.3.5, Observers
|
||||||
|
constexpr T const* operator ->() const;
|
||||||
|
constexpr T* operator ->();
|
||||||
|
constexpr T const& operator *() const &;
|
||||||
|
constexpr T& operator *() &;
|
||||||
|
constexpr T&& operator *() &&;
|
||||||
|
constexpr const T&& operator *() const &&;
|
||||||
|
constexpr explicit operator bool() const noexcept;
|
||||||
|
constexpr T const& value() const &;
|
||||||
|
constexpr T& value() &;
|
||||||
|
constexpr T&& value() &&;
|
||||||
|
constexpr const T&& value() const &&;
|
||||||
|
template <class U> constexpr T value_or(U&&) const &;
|
||||||
|
template <class U> constexpr T value_or(U&&) &&;
|
||||||
|
|
||||||
|
private:
|
||||||
|
T* val; // exposition only
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace fundamentals_v1
|
||||||
|
} // namespace experimental
|
||||||
|
|
||||||
|
// 5.11, Hash support
|
||||||
|
template <class T> struct hash;
|
||||||
|
template <class T> struct hash<experimental::optional<T>>;
|
||||||
|
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <experimental/__config>
|
||||||
|
#include <functional>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
|
||||||
|
class _LIBCPP_EXCEPTION_ABI bad_optional_access
|
||||||
|
: public std::logic_error
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bad_optional_access() : std::logic_error("Bad optional Access") {}
|
||||||
|
|
||||||
|
// Get the key function ~bad_optional_access() into the dylib
|
||||||
|
virtual ~bad_optional_access() _NOEXCEPT;
|
||||||
|
};
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_EXPERIMENTAL
|
||||||
|
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
|
||||||
|
#include <initializer_list>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <new>
|
||||||
|
#include <__functional_base>
|
||||||
|
#include <__undef_min_max>
|
||||||
|
#include <__debug>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
struct in_place_t {};
|
||||||
|
constexpr in_place_t in_place{};
|
||||||
|
|
||||||
|
struct nullopt_t
|
||||||
|
{
|
||||||
|
explicit constexpr nullopt_t(int) noexcept {}
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr nullopt_t nullopt{0};
|
||||||
|
|
||||||
|
template <class _Tp, bool = is_trivially_destructible<_Tp>::value>
|
||||||
|
class __optional_storage
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
typedef _Tp value_type;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
char __null_state_;
|
||||||
|
value_type __val_;
|
||||||
|
};
|
||||||
|
bool __engaged_ = false;
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
~__optional_storage()
|
||||||
|
{
|
||||||
|
if (__engaged_)
|
||||||
|
__val_.~value_type();
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr __optional_storage() noexcept
|
||||||
|
: __null_state_('\0') {}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
__optional_storage(const __optional_storage& __x)
|
||||||
|
: __engaged_(__x.__engaged_)
|
||||||
|
{
|
||||||
|
if (__engaged_)
|
||||||
|
::new(_VSTD::addressof(__val_)) value_type(__x.__val_);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
__optional_storage(__optional_storage&& __x)
|
||||||
|
noexcept(is_nothrow_move_constructible<value_type>::value)
|
||||||
|
: __engaged_(__x.__engaged_)
|
||||||
|
{
|
||||||
|
if (__engaged_)
|
||||||
|
::new(_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr __optional_storage(const value_type& __v)
|
||||||
|
: __val_(__v),
|
||||||
|
__engaged_(true) {}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr __optional_storage(value_type&& __v)
|
||||||
|
: __val_(_VSTD::move(__v)),
|
||||||
|
__engaged_(true) {}
|
||||||
|
|
||||||
|
template <class... _Args>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
explicit __optional_storage(in_place_t, _Args&&... __args)
|
||||||
|
: __val_(_VSTD::forward<_Args>(__args)...),
|
||||||
|
__engaged_(true) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
class __optional_storage<_Tp, true>
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
typedef _Tp value_type;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
char __null_state_;
|
||||||
|
value_type __val_;
|
||||||
|
};
|
||||||
|
bool __engaged_ = false;
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr __optional_storage() noexcept
|
||||||
|
: __null_state_('\0') {}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
__optional_storage(const __optional_storage& __x)
|
||||||
|
: __engaged_(__x.__engaged_)
|
||||||
|
{
|
||||||
|
if (__engaged_)
|
||||||
|
::new(_VSTD::addressof(__val_)) value_type(__x.__val_);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
__optional_storage(__optional_storage&& __x)
|
||||||
|
noexcept(is_nothrow_move_constructible<value_type>::value)
|
||||||
|
: __engaged_(__x.__engaged_)
|
||||||
|
{
|
||||||
|
if (__engaged_)
|
||||||
|
::new(_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr __optional_storage(const value_type& __v)
|
||||||
|
: __val_(__v),
|
||||||
|
__engaged_(true) {}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr __optional_storage(value_type&& __v)
|
||||||
|
: __val_(_VSTD::move(__v)),
|
||||||
|
__engaged_(true) {}
|
||||||
|
|
||||||
|
template <class... _Args>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
explicit __optional_storage(in_place_t, _Args&&... __args)
|
||||||
|
: __val_(_VSTD::forward<_Args>(__args)...),
|
||||||
|
__engaged_(true) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
class optional
|
||||||
|
: private __optional_storage<_Tp>
|
||||||
|
{
|
||||||
|
typedef __optional_storage<_Tp> __base;
|
||||||
|
public:
|
||||||
|
typedef _Tp value_type;
|
||||||
|
|
||||||
|
static_assert(!is_reference<value_type>::value,
|
||||||
|
"Instantiation of optional with a reference type is ill-formed.");
|
||||||
|
static_assert(!is_same<typename remove_cv<value_type>::type, in_place_t>::value,
|
||||||
|
"Instantiation of optional with a in_place_t type is ill-formed.");
|
||||||
|
static_assert(!is_same<typename remove_cv<value_type>::type, nullopt_t>::value,
|
||||||
|
"Instantiation of optional with a nullopt_t type is ill-formed.");
|
||||||
|
static_assert(is_object<value_type>::value,
|
||||||
|
"Instantiation of optional with a non-object type is undefined behavior.");
|
||||||
|
static_assert(is_nothrow_destructible<value_type>::value,
|
||||||
|
"Instantiation of optional with an object type that is not noexcept destructible is undefined behavior.");
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY optional(const optional&) = default;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY optional(optional&&) = default;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY ~optional() = default;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY constexpr optional(const value_type& __v)
|
||||||
|
: __base(__v) {}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY constexpr optional(value_type&& __v)
|
||||||
|
: __base(_VSTD::move(__v)) {}
|
||||||
|
|
||||||
|
template <class... _Args,
|
||||||
|
class = typename enable_if
|
||||||
|
<
|
||||||
|
is_constructible<value_type, _Args...>::value
|
||||||
|
>::type
|
||||||
|
>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
explicit optional(in_place_t, _Args&&... __args)
|
||||||
|
: __base(in_place, _VSTD::forward<_Args>(__args)...) {}
|
||||||
|
|
||||||
|
template <class _Up, class... _Args,
|
||||||
|
class = typename enable_if
|
||||||
|
<
|
||||||
|
is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
|
||||||
|
>::type
|
||||||
|
>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
|
||||||
|
: __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
optional& operator=(nullopt_t) noexcept
|
||||||
|
{
|
||||||
|
if (this->__engaged_)
|
||||||
|
{
|
||||||
|
this->__val_.~value_type();
|
||||||
|
this->__engaged_ = false;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
optional&
|
||||||
|
operator=(const optional& __opt)
|
||||||
|
{
|
||||||
|
if (this->__engaged_ == __opt.__engaged_)
|
||||||
|
{
|
||||||
|
if (this->__engaged_)
|
||||||
|
this->__val_ = __opt.__val_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this->__engaged_)
|
||||||
|
this->__val_.~value_type();
|
||||||
|
else
|
||||||
|
::new(_VSTD::addressof(this->__val_)) value_type(__opt.__val_);
|
||||||
|
this->__engaged_ = __opt.__engaged_;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
optional&
|
||||||
|
operator=(optional&& __opt)
|
||||||
|
noexcept(is_nothrow_move_assignable<value_type>::value &&
|
||||||
|
is_nothrow_move_constructible<value_type>::value)
|
||||||
|
{
|
||||||
|
if (this->__engaged_ == __opt.__engaged_)
|
||||||
|
{
|
||||||
|
if (this->__engaged_)
|
||||||
|
this->__val_ = _VSTD::move(__opt.__val_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this->__engaged_)
|
||||||
|
this->__val_.~value_type();
|
||||||
|
else
|
||||||
|
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::move(__opt.__val_));
|
||||||
|
this->__engaged_ = __opt.__engaged_;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Up,
|
||||||
|
class = typename enable_if
|
||||||
|
<
|
||||||
|
is_same<typename remove_reference<_Up>::type, value_type>::value &&
|
||||||
|
is_constructible<value_type, _Up>::value &&
|
||||||
|
is_assignable<value_type&, _Up>::value
|
||||||
|
>::type
|
||||||
|
>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
optional&
|
||||||
|
operator=(_Up&& __v)
|
||||||
|
{
|
||||||
|
if (this->__engaged_)
|
||||||
|
this->__val_ = _VSTD::forward<_Up>(__v);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Up>(__v));
|
||||||
|
this->__engaged_ = true;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class... _Args,
|
||||||
|
class = typename enable_if
|
||||||
|
<
|
||||||
|
is_constructible<value_type, _Args...>::value
|
||||||
|
>::type
|
||||||
|
>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
void
|
||||||
|
emplace(_Args&&... __args)
|
||||||
|
{
|
||||||
|
*this = nullopt;
|
||||||
|
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...);
|
||||||
|
this->__engaged_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Up, class... _Args,
|
||||||
|
class = typename enable_if
|
||||||
|
<
|
||||||
|
is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
|
||||||
|
>::type
|
||||||
|
>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
void
|
||||||
|
emplace(initializer_list<_Up> __il, _Args&&... __args)
|
||||||
|
{
|
||||||
|
*this = nullopt;
|
||||||
|
::new(_VSTD::addressof(this->__val_)) value_type(__il, _VSTD::forward<_Args>(__args)...);
|
||||||
|
this->__engaged_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
void
|
||||||
|
swap(optional& __opt)
|
||||||
|
noexcept(is_nothrow_move_constructible<value_type>::value &&
|
||||||
|
__is_nothrow_swappable<value_type>::value)
|
||||||
|
{
|
||||||
|
using _VSTD::swap;
|
||||||
|
if (this->__engaged_ == __opt.__engaged_)
|
||||||
|
{
|
||||||
|
if (this->__engaged_)
|
||||||
|
swap(this->__val_, __opt.__val_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this->__engaged_)
|
||||||
|
{
|
||||||
|
::new(_VSTD::addressof(__opt.__val_)) value_type(_VSTD::move(this->__val_));
|
||||||
|
this->__val_.~value_type();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::move(__opt.__val_));
|
||||||
|
__opt.__val_.~value_type();
|
||||||
|
}
|
||||||
|
swap(this->__engaged_, __opt.__engaged_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
value_type const*
|
||||||
|
operator->() const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
|
||||||
|
return __operator_arrow(__has_operator_addressof<value_type>{});
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
value_type*
|
||||||
|
operator->()
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
|
||||||
|
return _VSTD::addressof(this->__val_);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
const value_type&
|
||||||
|
operator*() const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
|
||||||
|
return this->__val_;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
value_type&
|
||||||
|
operator*()
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
|
||||||
|
return this->__val_;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr explicit operator bool() const noexcept {return this->__engaged_;}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr value_type const& value() const
|
||||||
|
{
|
||||||
|
if (!this->__engaged_)
|
||||||
|
throw bad_optional_access();
|
||||||
|
return this->__val_;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
value_type& value()
|
||||||
|
{
|
||||||
|
if (!this->__engaged_)
|
||||||
|
throw bad_optional_access();
|
||||||
|
return this->__val_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Up>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr value_type value_or(_Up&& __v) const&
|
||||||
|
{
|
||||||
|
static_assert(is_copy_constructible<value_type>::value,
|
||||||
|
"optional<T>::value_or: T must be copy constructible");
|
||||||
|
static_assert(is_convertible<_Up, value_type>::value,
|
||||||
|
"optional<T>::value_or: U must be convertible to T");
|
||||||
|
return this->__engaged_ ? this->__val_ :
|
||||||
|
static_cast<value_type>(_VSTD::forward<_Up>(__v));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Up>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
value_type value_or(_Up&& __v) &&
|
||||||
|
{
|
||||||
|
static_assert(is_move_constructible<value_type>::value,
|
||||||
|
"optional<T>::value_or: T must be move constructible");
|
||||||
|
static_assert(is_convertible<_Up, value_type>::value,
|
||||||
|
"optional<T>::value_or: U must be convertible to T");
|
||||||
|
return this->__engaged_ ? _VSTD::move(this->__val_) :
|
||||||
|
static_cast<value_type>(_VSTD::forward<_Up>(__v));
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
value_type const*
|
||||||
|
__operator_arrow(true_type) const
|
||||||
|
{
|
||||||
|
return _VSTD::addressof(this->__val_);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
value_type const*
|
||||||
|
__operator_arrow(false_type) const
|
||||||
|
{
|
||||||
|
return &this->__val_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Comparisons between optionals
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator==(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||||
|
{
|
||||||
|
if (static_cast<bool>(__x) != static_cast<bool>(__y))
|
||||||
|
return false;
|
||||||
|
if (!static_cast<bool>(__x))
|
||||||
|
return true;
|
||||||
|
return *__x == *__y;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||||
|
{
|
||||||
|
return !(__x == __y);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator<(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||||
|
{
|
||||||
|
if (!static_cast<bool>(__y))
|
||||||
|
return false;
|
||||||
|
if (!static_cast<bool>(__x))
|
||||||
|
return true;
|
||||||
|
return *__x < *__y;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator>(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||||
|
{
|
||||||
|
return __y < __x;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||||
|
{
|
||||||
|
return !(__y < __x);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator>=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||||
|
{
|
||||||
|
return !(__x < __y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Comparisons with nullopt
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator==(const optional<_Tp>& __x, nullopt_t) noexcept
|
||||||
|
{
|
||||||
|
return !static_cast<bool>(__x);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator==(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||||
|
{
|
||||||
|
return !static_cast<bool>(__x);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator!=(const optional<_Tp>& __x, nullopt_t) noexcept
|
||||||
|
{
|
||||||
|
return static_cast<bool>(__x);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator!=(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||||
|
{
|
||||||
|
return static_cast<bool>(__x);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator<(const optional<_Tp>&, nullopt_t) noexcept
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator<(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||||
|
{
|
||||||
|
return static_cast<bool>(__x);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator<=(const optional<_Tp>& __x, nullopt_t) noexcept
|
||||||
|
{
|
||||||
|
return !static_cast<bool>(__x);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator<=(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator>(const optional<_Tp>& __x, nullopt_t) noexcept
|
||||||
|
{
|
||||||
|
return static_cast<bool>(__x);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator>(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator>=(const optional<_Tp>&, nullopt_t) noexcept
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator>=(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||||
|
{
|
||||||
|
return !static_cast<bool>(__x);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comparisons with T
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator==(const optional<_Tp>& __x, const _Tp& __v)
|
||||||
|
{
|
||||||
|
return static_cast<bool>(__x) ? *__x == __v : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator==(const _Tp& __v, const optional<_Tp>& __x)
|
||||||
|
{
|
||||||
|
return static_cast<bool>(__x) ? *__x == __v : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator!=(const optional<_Tp>& __x, const _Tp& __v)
|
||||||
|
{
|
||||||
|
return static_cast<bool>(__x) ? !(*__x == __v) : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator!=(const _Tp& __v, const optional<_Tp>& __x)
|
||||||
|
{
|
||||||
|
return static_cast<bool>(__x) ? !(*__x == __v) : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator<(const optional<_Tp>& __x, const _Tp& __v)
|
||||||
|
{
|
||||||
|
return static_cast<bool>(__x) ? less<_Tp>{}(*__x, __v) : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator<(const _Tp& __v, const optional<_Tp>& __x)
|
||||||
|
{
|
||||||
|
return static_cast<bool>(__x) ? less<_Tp>{}(__v, *__x) : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator<=(const optional<_Tp>& __x, const _Tp& __v)
|
||||||
|
{
|
||||||
|
return !(__x > __v);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator<=(const _Tp& __v, const optional<_Tp>& __x)
|
||||||
|
{
|
||||||
|
return !(__v > __x);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator>(const optional<_Tp>& __x, const _Tp& __v)
|
||||||
|
{
|
||||||
|
return static_cast<bool>(__x) ? __v < __x : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator>(const _Tp& __v, const optional<_Tp>& __x)
|
||||||
|
{
|
||||||
|
return static_cast<bool>(__x) ? __x < __v : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator>=(const optional<_Tp>& __x, const _Tp& __v)
|
||||||
|
{
|
||||||
|
return !(__x < __v);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
bool
|
||||||
|
operator>=(const _Tp& __v, const optional<_Tp>& __x)
|
||||||
|
{
|
||||||
|
return !(__v < __x);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
void
|
||||||
|
swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y)))
|
||||||
|
{
|
||||||
|
__x.swap(__y);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
constexpr
|
||||||
|
optional<typename decay<_Tp>::type>
|
||||||
|
make_optional(_Tp&& __v)
|
||||||
|
{
|
||||||
|
return optional<typename decay<_Tp>::type>(_VSTD::forward<_Tp>(__v));
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
struct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::optional<_Tp> >
|
||||||
|
{
|
||||||
|
typedef std::experimental::optional<_Tp> argument_type;
|
||||||
|
typedef size_t result_type;
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
result_type operator()(const argument_type& __opt) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return static_cast<bool>(__opt) ? hash<_Tp>()(*__opt) : 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
#endif // _LIBCPP_STD_VER > 11
|
||||||
|
|
||||||
|
#endif // _LIBCPP_OPTIONAL
|
77
include/experimental/ratio
Normal file
77
include/experimental/ratio
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===------------------------------ ratio ---------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is distributed under the University of Illinois Open Source
|
||||||
|
// License. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXPERIMENTAL_RATIO
|
||||||
|
#define _LIBCPP_EXPERIMENTAL_RATIO
|
||||||
|
|
||||||
|
/**
|
||||||
|
experimental/ratio synopsis
|
||||||
|
C++1y
|
||||||
|
#include <ratio>
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
namespace experimental {
|
||||||
|
inline namespace fundamentals_v1 {
|
||||||
|
|
||||||
|
// See C++14 20.11.5, ratio comparison
|
||||||
|
template <class R1, class R2> constexpr bool ratio_equal_v
|
||||||
|
= ratio_equal<R1, R2>::value;
|
||||||
|
template <class R1, class R2> constexpr bool ratio_not_equal_v
|
||||||
|
= ratio_not_equal<R1, R2>::value;
|
||||||
|
template <class R1, class R2> constexpr bool ratio_less_v
|
||||||
|
= ratio_less<R1, R2>::value;
|
||||||
|
template <class R1, class R2> constexpr bool ratio_less_equal_v
|
||||||
|
= ratio_less_equal<R1, R2>::value;
|
||||||
|
template <class R1, class R2> constexpr bool ratio_greater_v
|
||||||
|
= ratio_greater<R1, R2>::value;
|
||||||
|
template <class R1, class R2> constexpr bool ratio_greater_equal_v
|
||||||
|
= ratio_greater_equal<R1, R2>::value;
|
||||||
|
|
||||||
|
} // namespace fundamentals_v1
|
||||||
|
} // namespace experimental
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <experimental/__config>
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
|
||||||
|
#include <ratio>
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||||
|
|
||||||
|
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_equal_v
|
||||||
|
= ratio_equal<_R1, _R2>::value;
|
||||||
|
|
||||||
|
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_not_equal_v
|
||||||
|
= ratio_not_equal<_R1, _R2>::value;
|
||||||
|
|
||||||
|
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_v
|
||||||
|
= ratio_less<_R1, _R2>::value;
|
||||||
|
|
||||||
|
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_equal_v
|
||||||
|
= ratio_less_equal<_R1, _R2>::value;
|
||||||
|
|
||||||
|
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_v
|
||||||
|
= ratio_greater<_R1, _R2>::value;
|
||||||
|
|
||||||
|
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
|
||||||
|
= ratio_greater_equal<_R1, _R2>::value;
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_STD_VER > 11 */
|
||||||
|
|
||||||
|
#endif // _LIBCPP_EXPERIMENTAL_RATIO
|
812
include/experimental/string_view
Normal file
812
include/experimental/string_view
Normal file
@ -0,0 +1,812 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===------------------------ string_view ---------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is distributed under the University of Illinois Open Source
|
||||||
|
// License. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_LFTS_STRING_VIEW
|
||||||
|
#define _LIBCPP_LFTS_STRING_VIEW
|
||||||
|
|
||||||
|
/*
|
||||||
|
string_view synopsis
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
namespace experimental {
|
||||||
|
inline namespace library_fundamentals_v1 {
|
||||||
|
|
||||||
|
// 7.2, Class template basic_string_view
|
||||||
|
template<class charT, class traits = char_traits<charT>>
|
||||||
|
class basic_string_view;
|
||||||
|
|
||||||
|
// 7.9, basic_string_view non-member comparison functions
|
||||||
|
template<class charT, class traits>
|
||||||
|
constexpr bool operator==(basic_string_view<charT, traits> x,
|
||||||
|
basic_string_view<charT, traits> y) noexcept;
|
||||||
|
template<class charT, class traits>
|
||||||
|
constexpr bool operator!=(basic_string_view<charT, traits> x,
|
||||||
|
basic_string_view<charT, traits> y) noexcept;
|
||||||
|
template<class charT, class traits>
|
||||||
|
constexpr bool operator< (basic_string_view<charT, traits> x,
|
||||||
|
basic_string_view<charT, traits> y) noexcept;
|
||||||
|
template<class charT, class traits>
|
||||||
|
constexpr bool operator> (basic_string_view<charT, traits> x,
|
||||||
|
basic_string_view<charT, traits> y) noexcept;
|
||||||
|
template<class charT, class traits>
|
||||||
|
constexpr bool operator<=(basic_string_view<charT, traits> x,
|
||||||
|
basic_string_view<charT, traits> y) noexcept;
|
||||||
|
template<class charT, class traits>
|
||||||
|
constexpr bool operator>=(basic_string_view<charT, traits> x,
|
||||||
|
basic_string_view<charT, traits> y) noexcept;
|
||||||
|
// see below, sufficient additional overloads of comparison functions
|
||||||
|
|
||||||
|
// 7.10, Inserters and extractors
|
||||||
|
template<class charT, class traits>
|
||||||
|
basic_ostream<charT, traits>&
|
||||||
|
operator<<(basic_ostream<charT, traits>& os,
|
||||||
|
basic_string_view<charT, traits> str);
|
||||||
|
|
||||||
|
// basic_string_view typedef names
|
||||||
|
typedef basic_string_view<char> string_view;
|
||||||
|
typedef basic_string_view<char16_t> u16string_view;
|
||||||
|
typedef basic_string_view<char32_t> u32string_view;
|
||||||
|
typedef basic_string_view<wchar_t> wstring_view;
|
||||||
|
|
||||||
|
template<class charT, class traits = char_traits<charT>>
|
||||||
|
class basic_string_view {
|
||||||
|
public:
|
||||||
|
// types
|
||||||
|
typedef traits traits_type;
|
||||||
|
typedef charT value_type;
|
||||||
|
typedef charT* pointer;
|
||||||
|
typedef const charT* const_pointer;
|
||||||
|
typedef charT& reference;
|
||||||
|
typedef const charT& const_reference;
|
||||||
|
typedef implementation-defined const_iterator;
|
||||||
|
typedef const_iterator iterator;
|
||||||
|
typedef reverse_iterator<const_iterator> const_reverse_iterator;
|
||||||
|
typedef const_reverse_iterator reverse_iterator;
|
||||||
|
typedef size_t size_type;
|
||||||
|
typedef ptrdiff_t difference_type;
|
||||||
|
static constexpr size_type npos = size_type(-1);
|
||||||
|
|
||||||
|
// 7.3, basic_string_view constructors and assignment operators
|
||||||
|
constexpr basic_string_view() noexcept;
|
||||||
|
constexpr basic_string_view(const basic_string_view&) noexcept = default;
|
||||||
|
basic_string_view& operator=(const basic_string_view&) noexcept = default;
|
||||||
|
template<class Allocator>
|
||||||
|
basic_string_view(const basic_string<charT, traits, Allocator>& str) noexcept;
|
||||||
|
constexpr basic_string_view(const charT* str);
|
||||||
|
constexpr basic_string_view(const charT* str, size_type len);
|
||||||
|
|
||||||
|
// 7.4, basic_string_view iterator support
|
||||||
|
constexpr const_iterator begin() const noexcept;
|
||||||
|
constexpr const_iterator end() const noexcept;
|
||||||
|
constexpr const_iterator cbegin() const noexcept;
|
||||||
|
constexpr const_iterator cend() const noexcept;
|
||||||
|
const_reverse_iterator rbegin() const noexcept;
|
||||||
|
const_reverse_iterator rend() const noexcept;
|
||||||
|
const_reverse_iterator crbegin() const noexcept;
|
||||||
|
const_reverse_iterator crend() const noexcept;
|
||||||
|
|
||||||
|
// 7.5, basic_string_view capacity
|
||||||
|
constexpr size_type size() const noexcept;
|
||||||
|
constexpr size_type length() const noexcept;
|
||||||
|
constexpr size_type max_size() const noexcept;
|
||||||
|
constexpr bool empty() const noexcept;
|
||||||
|
|
||||||
|
// 7.6, basic_string_view element access
|
||||||
|
constexpr const_reference operator[](size_type pos) const;
|
||||||
|
constexpr const_reference at(size_type pos) const;
|
||||||
|
constexpr const_reference front() const;
|
||||||
|
constexpr const_reference back() const;
|
||||||
|
constexpr const_pointer data() const noexcept;
|
||||||
|
|
||||||
|
// 7.7, basic_string_view modifiers
|
||||||
|
constexpr void clear() noexcept;
|
||||||
|
constexpr void remove_prefix(size_type n);
|
||||||
|
constexpr void remove_suffix(size_type n);
|
||||||
|
constexpr void swap(basic_string_view& s) noexcept;
|
||||||
|
|
||||||
|
// 7.8, basic_string_view string operations
|
||||||
|
template<class Allocator>
|
||||||
|
explicit operator basic_string<charT, traits, Allocator>() const;
|
||||||
|
template<class Allocator = allocator<charT>>
|
||||||
|
basic_string<charT, traits, Allocator> to_string(
|
||||||
|
const Allocator& a = Allocator()) const;
|
||||||
|
|
||||||
|
size_type copy(charT* s, size_type n, size_type pos = 0) const;
|
||||||
|
|
||||||
|
constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
|
||||||
|
constexpr int compare(basic_string_view s) const noexcept;
|
||||||
|
constexpr int compare(size_type pos1, size_type n1, basic_string_view s) const;
|
||||||
|
constexpr int compare(size_type pos1, size_type n1,
|
||||||
|
basic_string_view s, size_type pos2, size_type n2) const;
|
||||||
|
constexpr int compare(const charT* s) const;
|
||||||
|
constexpr int compare(size_type pos1, size_type n1, const charT* s) const;
|
||||||
|
constexpr int compare(size_type pos1, size_type n1,
|
||||||
|
const charT* s, size_type n2) const;
|
||||||
|
constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept;
|
||||||
|
constexpr size_type find(charT c, size_type pos = 0) const noexcept;
|
||||||
|
constexpr size_type find(const charT* s, size_type pos, size_type n) const;
|
||||||
|
constexpr size_type find(const charT* s, size_type pos = 0) const;
|
||||||
|
constexpr size_type rfind(basic_string_view s, size_type pos = npos) const noexcept;
|
||||||
|
constexpr size_type rfind(charT c, size_type pos = npos) const noexcept;
|
||||||
|
constexpr size_type rfind(const charT* s, size_type pos, size_type n) const;
|
||||||
|
constexpr size_type rfind(const charT* s, size_type pos = npos) const;
|
||||||
|
constexpr size_type find_first_of(basic_string_view s, size_type pos = 0) const noexcept;
|
||||||
|
constexpr size_type find_first_of(charT c, size_type pos = 0) const noexcept;
|
||||||
|
constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const;
|
||||||
|
constexpr size_type find_first_of(const charT* s, size_type pos = 0) const;
|
||||||
|
constexpr size_type find_last_of(basic_string_view s, size_type pos = npos) const noexcept;
|
||||||
|
constexpr size_type find_last_of(charT c, size_type pos = npos) const noexcept;
|
||||||
|
constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const;
|
||||||
|
constexpr size_type find_last_of(const charT* s, size_type pos = npos) const;
|
||||||
|
constexpr size_type find_first_not_of(basic_string_view s, size_type pos = 0) const noexcept;
|
||||||
|
constexpr size_type find_first_not_of(charT c, size_type pos = 0) const noexcept;
|
||||||
|
constexpr size_type find_first_not_of(const charT* s, size_type pos, size_type n) const;
|
||||||
|
constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const;
|
||||||
|
constexpr size_type find_last_not_of(basic_string_view s, size_type pos = npos) const noexcept;
|
||||||
|
constexpr size_type find_last_not_of(charT c, size_type pos = npos) const noexcept;
|
||||||
|
constexpr size_type find_last_not_of(const charT* s, size_type pos, size_type n) const;
|
||||||
|
constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const_pointer data_; // exposition only
|
||||||
|
size_type size_; // exposition only
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace fundamentals_v1
|
||||||
|
} // namespace experimental
|
||||||
|
|
||||||
|
// 7.11, Hash support
|
||||||
|
template <class T> struct hash;
|
||||||
|
template <> struct hash<experimental::string_view>;
|
||||||
|
template <> struct hash<experimental::u16string_view>;
|
||||||
|
template <> struct hash<experimental::u32string_view>;
|
||||||
|
template <> struct hash<experimental::wstring_view>;
|
||||||
|
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <experimental/__config>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <iterator>
|
||||||
|
#include <ostream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
#include <__debug>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits = _VSTD::char_traits<_CharT> >
|
||||||
|
class _LIBCPP_TYPE_VIS_ONLY basic_string_view {
|
||||||
|
public:
|
||||||
|
// types
|
||||||
|
typedef _Traits traits_type;
|
||||||
|
typedef _CharT value_type;
|
||||||
|
typedef const _CharT* pointer;
|
||||||
|
typedef const _CharT* const_pointer;
|
||||||
|
typedef const _CharT& reference;
|
||||||
|
typedef const _CharT& const_reference;
|
||||||
|
typedef const_pointer const_iterator; // See [string.view.iterators]
|
||||||
|
typedef const_iterator iterator;
|
||||||
|
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||||
|
typedef const_reverse_iterator reverse_iterator;
|
||||||
|
typedef size_t size_type;
|
||||||
|
typedef ptrdiff_t difference_type;
|
||||||
|
static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
|
||||||
|
|
||||||
|
// [string.view.cons], construct/copy
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
basic_string_view(const basic_string_view&) _NOEXCEPT = default;
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
|
||||||
|
|
||||||
|
template<class _Allocator>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
basic_string_view(const basic_string<_CharT, _Traits, _Allocator>& __str) _NOEXCEPT
|
||||||
|
: __data (__str.data()), __size(__str.size()) {}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
basic_string_view(const _CharT* __s, size_type __len)
|
||||||
|
: __data(__s), __size(__len)
|
||||||
|
{
|
||||||
|
// _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): recieved nullptr");
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
basic_string_view(const _CharT* __s)
|
||||||
|
: __data(__s), __size(_Traits::length(__s)) {}
|
||||||
|
|
||||||
|
// [string.view.iterators], iterators
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
const_iterator begin() const _NOEXCEPT { return cbegin(); }
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
const_iterator end() const _NOEXCEPT { return cend(); }
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
const_iterator cbegin() const _NOEXCEPT { return __data; }
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
const_iterator cend() const _NOEXCEPT { return __data + __size; }
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
|
||||||
|
|
||||||
|
// [string.view.capacity], capacity
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type size() const _NOEXCEPT { return __size; }
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type length() const _NOEXCEPT { return __size; }
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type max_size() const _NOEXCEPT { return _VSTD::numeric_limits<size_type>::max(); }
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR bool _LIBCPP_INLINE_VISIBILITY
|
||||||
|
empty() const _NOEXCEPT { return __size == 0; }
|
||||||
|
|
||||||
|
// [string.view.access], element access
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
const_reference operator[](size_type __pos) const { return __data[__pos]; }
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
const_reference at(size_type __pos) const
|
||||||
|
{
|
||||||
|
return __pos >= size()
|
||||||
|
? (throw out_of_range("string_view::at"), __data[0])
|
||||||
|
: __data[__pos];
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
const_reference front() const
|
||||||
|
{
|
||||||
|
return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
const_reference back() const
|
||||||
|
{
|
||||||
|
return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||||
|
const_pointer data() const _NOEXCEPT { return __data; }
|
||||||
|
|
||||||
|
// [string.view.modifiers], modifiers:
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
void clear() _NOEXCEPT
|
||||||
|
{
|
||||||
|
__data = nullptr;
|
||||||
|
__size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
void remove_prefix(size_type __n) _NOEXCEPT
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove more than size()");
|
||||||
|
__data += __n;
|
||||||
|
__size -= __n;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
void remove_suffix(size_type __n) _NOEXCEPT
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__n <= size(), "remove_suffix() can't remove more than size()");
|
||||||
|
__size -= __n;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
void swap(basic_string_view& __other) _NOEXCEPT
|
||||||
|
{
|
||||||
|
const value_type *__p = __data;
|
||||||
|
__data = __other.__data;
|
||||||
|
__other.__data = __p;
|
||||||
|
|
||||||
|
size_type __sz = __size;
|
||||||
|
__size = __other.__size;
|
||||||
|
__other.__size = __sz;
|
||||||
|
// _VSTD::swap( __data, __other.__data );
|
||||||
|
// _VSTD::swap( __size, __other.__size );
|
||||||
|
}
|
||||||
|
|
||||||
|
// [string.view.ops], string operations:
|
||||||
|
template<class _Allocator>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_EXPLICIT operator basic_string<_CharT, _Traits, _Allocator>() const
|
||||||
|
{ return basic_string<_CharT, _Traits, _Allocator>( begin(), end()); }
|
||||||
|
|
||||||
|
template<class _Allocator = allocator<_CharT> >
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
basic_string<_CharT, _Traits, _Allocator>
|
||||||
|
to_string( const _Allocator& __a = _Allocator()) const
|
||||||
|
{ return basic_string<_CharT, _Traits, _Allocator> ( begin(), end(), __a ); }
|
||||||
|
|
||||||
|
size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
|
||||||
|
{
|
||||||
|
if ( __pos > size())
|
||||||
|
throw out_of_range("string_view::copy");
|
||||||
|
size_type __rlen = _VSTD::min( __n, size() - __pos );
|
||||||
|
_VSTD::copy_n(begin() + __pos, __rlen, __s );
|
||||||
|
return __rlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
|
basic_string_view substr(size_type __pos = 0, size_type __n = npos) const
|
||||||
|
{
|
||||||
|
// if (__pos > size())
|
||||||
|
// throw out_of_range("string_view::substr");
|
||||||
|
// size_type __rlen = _VSTD::min( __n, size() - __pos );
|
||||||
|
// return basic_string_view(data() + __pos, __rlen);
|
||||||
|
return __pos > size()
|
||||||
|
? throw out_of_range("string_view::substr")
|
||||||
|
: basic_string_view(data() + __pos, _VSTD::min(__n, size() - __pos));
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
size_type __rlen = _VSTD::min( size(), __sv.size());
|
||||||
|
int __retval = _Traits::compare(data(), __sv.data(), __rlen);
|
||||||
|
if ( __retval == 0 ) // first __rlen chars matched
|
||||||
|
__retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 );
|
||||||
|
return __retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const
|
||||||
|
{
|
||||||
|
return substr(__pos1, __n1).compare(__sv);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
int compare( size_type __pos1, size_type __n1,
|
||||||
|
basic_string_view _sv, size_type __pos2, size_type __n2) const
|
||||||
|
{
|
||||||
|
return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2));
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
int compare(const _CharT* __s) const
|
||||||
|
{
|
||||||
|
return compare(basic_string_view(__s));
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
|
||||||
|
{
|
||||||
|
return substr(__pos1, __n1).compare(basic_string_view(__s));
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
|
||||||
|
{
|
||||||
|
return substr(__pos1, __n1).compare(basic_string_view(__s, __n2));
|
||||||
|
}
|
||||||
|
|
||||||
|
// find
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s.data(), __pos, __s.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __c, __pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find(const _CharT* __s, size_type __pos, size_type __n) const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s, __pos, __n);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find(const _CharT* __s, size_type __pos = 0) const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__s != nullptr, "string_view::find(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||||
|
}
|
||||||
|
|
||||||
|
// rfind
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr");
|
||||||
|
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s.data(), __pos, __s.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __c, __pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): recieved nullptr");
|
||||||
|
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s, __pos, __n);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type rfind(const _CharT* __s, size_type __pos=npos) const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): recieved nullptr");
|
||||||
|
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||||
|
}
|
||||||
|
|
||||||
|
// find_first_of
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s.data(), __pos, __s.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT
|
||||||
|
{ return find(__c, __pos); }
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s, __pos, __n);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_first_of(const _CharT* __s, size_type __pos=0) const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||||
|
}
|
||||||
|
|
||||||
|
// find_last_of
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s.data(), __pos, __s.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT
|
||||||
|
{ return rfind(__c, __pos); }
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s, __pos, __n);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_last_of(const _CharT* __s, size_type __pos=npos) const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||||
|
}
|
||||||
|
|
||||||
|
// find_first_not_of
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s.data(), __pos, __s.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __c, __pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s, __pos, __n);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||||
|
}
|
||||||
|
|
||||||
|
// find_last_not_of
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s.data(), __pos, __s.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __c, __pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s, __pos, __n);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const
|
||||||
|
{
|
||||||
|
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): recieved nullptr");
|
||||||
|
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||||
|
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const value_type* __data;
|
||||||
|
size_type __size;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// [string.view.comparison]
|
||||||
|
// operator ==
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator==(basic_string_view<_CharT, _Traits> __lhs,
|
||||||
|
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
if ( __lhs.size() != __rhs.size()) return false;
|
||||||
|
return __lhs.compare(__rhs) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator==(basic_string_view<_CharT, _Traits> __lhs,
|
||||||
|
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
if ( __lhs.size() != __rhs.size()) return false;
|
||||||
|
return __lhs.compare(__rhs) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator==(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||||
|
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
if ( __lhs.size() != __rhs.size()) return false;
|
||||||
|
return __lhs.compare(__rhs) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// operator !=
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
if ( __lhs.size() != __rhs.size())
|
||||||
|
return true;
|
||||||
|
return __lhs.compare(__rhs) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
|
||||||
|
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
if ( __lhs.size() != __rhs.size())
|
||||||
|
return true;
|
||||||
|
return __lhs.compare(__rhs) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator!=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||||
|
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
if ( __lhs.size() != __rhs.size())
|
||||||
|
return true;
|
||||||
|
return __lhs.compare(__rhs) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// operator <
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __lhs.compare(__rhs) < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator<(basic_string_view<_CharT, _Traits> __lhs,
|
||||||
|
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __lhs.compare(__rhs) < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator<(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||||
|
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __lhs.compare(__rhs) < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// operator >
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __lhs.compare(__rhs) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator>(basic_string_view<_CharT, _Traits> __lhs,
|
||||||
|
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __lhs.compare(__rhs) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator>(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||||
|
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __lhs.compare(__rhs) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// operator <=
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __lhs.compare(__rhs) <= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator<=(basic_string_view<_CharT, _Traits> __lhs,
|
||||||
|
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __lhs.compare(__rhs) <= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator<=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||||
|
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __lhs.compare(__rhs) <= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// operator >=
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __lhs.compare(__rhs) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator>=(basic_string_view<_CharT, _Traits> __lhs,
|
||||||
|
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __lhs.compare(__rhs) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool operator>=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||||
|
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __lhs.compare(__rhs) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// [string.view.io]
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
basic_ostream<_CharT, _Traits>&
|
||||||
|
operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv)
|
||||||
|
{
|
||||||
|
return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef basic_string_view<char> string_view;
|
||||||
|
typedef basic_string_view<char16_t> u16string_view;
|
||||||
|
typedef basic_string_view<char32_t> u32string_view;
|
||||||
|
typedef basic_string_view<wchar_t> wstring_view;
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_LFTS
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
// [string.view.hash]
|
||||||
|
// Shamelessly stolen from <string>
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
struct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::basic_string_view<_CharT, _Traits> >
|
||||||
|
: public unary_function<std::experimental::basic_string_view<_CharT, _Traits>, size_t>
|
||||||
|
{
|
||||||
|
size_t operator()(const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class _CharT, class _Traits>
|
||||||
|
size_t
|
||||||
|
hash<std::experimental::basic_string_view<_CharT, _Traits> >::operator()(
|
||||||
|
const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __do_string_hash(__val.data(), __val.data() + __val.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <class _CharT, class _Traits>
|
||||||
|
__quoted_output_proxy<_CharT, const _CharT *, _Traits>
|
||||||
|
quoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv,
|
||||||
|
_CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
|
||||||
|
{
|
||||||
|
return __quoted_output_proxy<_CharT, const _CharT *, _Traits>
|
||||||
|
( __sv.data(), __sv.data() + __sv.size(), __delim, __escape );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
#endif // _LIBCPP_LFTS_STRING_VIEW
|
63
include/experimental/system_error
Normal file
63
include/experimental/system_error
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===-------------------------- system_error ------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
|
||||||
|
#define _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
|
||||||
|
|
||||||
|
/**
|
||||||
|
experimental/system_error synopsis
|
||||||
|
|
||||||
|
// C++1y
|
||||||
|
|
||||||
|
#include <system_error>
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
namespace experimental {
|
||||||
|
inline namespace fundamentals_v1 {
|
||||||
|
|
||||||
|
// See C++14 19.5, System error support
|
||||||
|
template <class T> constexpr bool is_error_code_enum_v
|
||||||
|
= is_error_code_enum<T>::value;
|
||||||
|
template <class T> constexpr bool is_error_condition_enum_v
|
||||||
|
= is_error_condition_enum<T>::value;
|
||||||
|
|
||||||
|
} // namespace fundamentals_v1
|
||||||
|
} // namespace experimental
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <experimental/__config>
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
|
||||||
|
#include <system_error>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_error_code_enum_v
|
||||||
|
= is_error_code_enum<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_error_condition_enum_v
|
||||||
|
= is_error_condition_enum<_Tp>::value;
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_STD_VER > 11 */
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR */
|
81
include/experimental/tuple
Normal file
81
include/experimental/tuple
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===----------------------------- tuple ----------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXPERIMENTAL_TUPLE
|
||||||
|
#define _LIBCPP_EXPERIMENTAL_TUPLE
|
||||||
|
|
||||||
|
/*
|
||||||
|
experimental/tuple synopsis
|
||||||
|
|
||||||
|
// C++1y
|
||||||
|
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
namespace experimental {
|
||||||
|
inline namespace fundamentals_v1 {
|
||||||
|
|
||||||
|
// See C++14 20.4.2.5, tuple helper classes
|
||||||
|
template <class T> constexpr size_t tuple_size_v
|
||||||
|
= tuple_size<T>::value;
|
||||||
|
|
||||||
|
// 3.2.2, Calling a function with a tuple of arguments
|
||||||
|
template <class F, class Tuple>
|
||||||
|
constexpr decltype(auto) apply(F&& f, Tuple&& t);
|
||||||
|
|
||||||
|
} // namespace fundamentals_v1
|
||||||
|
} // namespace experimental
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
# include <experimental/__config>
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
|
||||||
|
# include <tuple>
|
||||||
|
# include <utility>
|
||||||
|
# include <__functional_base>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||||
|
template <class _Tp>
|
||||||
|
_LIBCPP_CONSTEXPR size_t tuple_size_v = tuple_size<_Tp>::value;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <class _Fn, class _Tuple, size_t ..._Id>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
decltype(auto) __apply_tuple_impl(_Fn && __f, _Tuple && __t,
|
||||||
|
integer_sequence<size_t, _Id...>) {
|
||||||
|
return _VSTD::__invoke(
|
||||||
|
_VSTD::forward<_Fn>(__f),
|
||||||
|
_VSTD::get<_Id>(_VSTD::forward<_Tuple>(__t))...
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Fn, class _Tuple>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
|
decltype(auto) apply(_Fn && __f, _Tuple && __t) {
|
||||||
|
return _VSTD_LFTS::__apply_tuple_impl(
|
||||||
|
_VSTD::forward<_Fn>(__f), _VSTD::forward<_Tuple>(__t),
|
||||||
|
make_index_sequence<tuple_size<typename decay<_Tuple>::type>::value>()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_STD_VER > 11 */
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_EXPERIMENTAL_TUPLE */
|
427
include/experimental/type_traits
Normal file
427
include/experimental/type_traits
Normal file
@ -0,0 +1,427 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===-------------------------- type_traits -------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXPERIMENTAL_TYPE_TRAITS
|
||||||
|
#define _LIBCPP_EXPERIMENTAL_TYPE_TRAITS
|
||||||
|
|
||||||
|
/**
|
||||||
|
experimental/type_traits synopsis
|
||||||
|
|
||||||
|
// C++1y
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
namespace experimental {
|
||||||
|
inline namespace fundamentals_v1 {
|
||||||
|
|
||||||
|
// See C++14 20.10.4.1, primary type categories
|
||||||
|
template <class T> constexpr bool is_void_v
|
||||||
|
= is_void<T>::value;
|
||||||
|
template <class T> constexpr bool is_null_pointer_v
|
||||||
|
= is_null_pointer<T>::value;
|
||||||
|
template <class T> constexpr bool is_integral_v
|
||||||
|
= is_integral<T>::value;
|
||||||
|
template <class T> constexpr bool is_floating_point_v
|
||||||
|
= is_floating_point<T>::value;
|
||||||
|
template <class T> constexpr bool is_array_v
|
||||||
|
= is_array<T>::value;
|
||||||
|
template <class T> constexpr bool is_pointer_v
|
||||||
|
= is_pointer<T>::value;
|
||||||
|
template <class T> constexpr bool is_lvalue_reference_v
|
||||||
|
= is_lvalue_reference<T>::value;
|
||||||
|
template <class T> constexpr bool is_rvalue_reference_v
|
||||||
|
= is_rvalue_reference<T>::value;
|
||||||
|
template <class T> constexpr bool is_member_object_pointer_v
|
||||||
|
= is_member_object_pointer<T>::value;
|
||||||
|
template <class T> constexpr bool is_member_function_pointer_v
|
||||||
|
= is_member_function_pointer<T>::value;
|
||||||
|
template <class T> constexpr bool is_enum_v
|
||||||
|
= is_enum<T>::value;
|
||||||
|
template <class T> constexpr bool is_union_v
|
||||||
|
= is_union<T>::value;
|
||||||
|
template <class T> constexpr bool is_class_v
|
||||||
|
= is_class<T>::value;
|
||||||
|
template <class T> constexpr bool is_function_v
|
||||||
|
= is_function<T>::value;
|
||||||
|
|
||||||
|
// See C++14 20.10.4.2, composite type categories
|
||||||
|
template <class T> constexpr bool is_reference_v
|
||||||
|
= is_reference<T>::value;
|
||||||
|
template <class T> constexpr bool is_arithmetic_v
|
||||||
|
= is_arithmetic<T>::value;
|
||||||
|
template <class T> constexpr bool is_fundamental_v
|
||||||
|
= is_fundamental<T>::value;
|
||||||
|
template <class T> constexpr bool is_object_v
|
||||||
|
= is_object<T>::value;
|
||||||
|
template <class T> constexpr bool is_scalar_v
|
||||||
|
= is_scalar<T>::value;
|
||||||
|
template <class T> constexpr bool is_compound_v
|
||||||
|
= is_compound<T>::value;
|
||||||
|
template <class T> constexpr bool is_member_pointer_v
|
||||||
|
= is_member_pointer<T>::value;
|
||||||
|
|
||||||
|
// See C++14 20.10.4.3, type properties
|
||||||
|
template <class T> constexpr bool is_const_v
|
||||||
|
= is_const<T>::value;
|
||||||
|
template <class T> constexpr bool is_volatile_v
|
||||||
|
= is_volatile<T>::value;
|
||||||
|
template <class T> constexpr bool is_trivial_v
|
||||||
|
= is_trivial<T>::value;
|
||||||
|
template <class T> constexpr bool is_trivially_copyable_v
|
||||||
|
= is_trivially_copyable<T>::value;
|
||||||
|
template <class T> constexpr bool is_standard_layout_v
|
||||||
|
= is_standard_layout<T>::value;
|
||||||
|
template <class T> constexpr bool is_pod_v
|
||||||
|
= is_pod<T>::value;
|
||||||
|
template <class T> constexpr bool is_literal_type_v
|
||||||
|
= is_literal_type<T>::value;
|
||||||
|
template <class T> constexpr bool is_empty_v
|
||||||
|
= is_empty<T>::value;
|
||||||
|
template <class T> constexpr bool is_polymorphic_v
|
||||||
|
= is_polymorphic<T>::value;
|
||||||
|
template <class T> constexpr bool is_abstract_v
|
||||||
|
= is_abstract<T>::value;
|
||||||
|
template <class T> constexpr bool is_final_v
|
||||||
|
= is_final<T>::value;
|
||||||
|
template <class T> constexpr bool is_signed_v
|
||||||
|
= is_signed<T>::value;
|
||||||
|
template <class T> constexpr bool is_unsigned_v
|
||||||
|
= is_unsigned<T>::value;
|
||||||
|
template <class T, class... Args> constexpr bool is_constructible_v
|
||||||
|
= is_constructible<T, Args...>::value;
|
||||||
|
template <class T> constexpr bool is_default_constructible_v
|
||||||
|
= is_default_constructible<T>::value;
|
||||||
|
template <class T> constexpr bool is_copy_constructible_v
|
||||||
|
= is_copy_constructible<T>::value;
|
||||||
|
template <class T> constexpr bool is_move_constructible_v
|
||||||
|
= is_move_constructible<T>::value;
|
||||||
|
template <class T, class U> constexpr bool is_assignable_v
|
||||||
|
= is_assignable<T, U>::value;
|
||||||
|
template <class T> constexpr bool is_copy_assignable_v
|
||||||
|
= is_copy_assignable<T>::value;
|
||||||
|
template <class T> constexpr bool is_move_assignable_v
|
||||||
|
= is_move_assignable<T>::value;
|
||||||
|
template <class T> constexpr bool is_destructible_v
|
||||||
|
= is_destructible<T>::value;
|
||||||
|
template <class T, class... Args> constexpr bool is_trivially_constructible_v
|
||||||
|
= is_trivially_constructible<T, Args...>::value;
|
||||||
|
template <class T> constexpr bool is_trivially_default_constructible_v
|
||||||
|
= is_trivially_default_constructible<T>::value;
|
||||||
|
template <class T> constexpr bool is_trivially_copy_constructible_v
|
||||||
|
= is_trivially_copy_constructible<T>::value;
|
||||||
|
template <class T> constexpr bool is_trivially_move_constructible_v
|
||||||
|
= is_trivially_move_constructible<T>::value;
|
||||||
|
template <class T, class U> constexpr bool is_trivially_assignable_v
|
||||||
|
= is_trivially_assignable<T, U>::value;
|
||||||
|
template <class T> constexpr bool is_trivially_copy_assignable_v
|
||||||
|
= is_trivially_copy_assignable<T>::value;
|
||||||
|
template <class T> constexpr bool is_trivially_move_assignable_v
|
||||||
|
= is_trivially_move_assignable<T>::value;
|
||||||
|
template <class T> constexpr bool is_trivially_destructible_v
|
||||||
|
= is_trivially_destructible<T>::value;
|
||||||
|
template <class T, class... Args> constexpr bool is_nothrow_constructible_v
|
||||||
|
= is_nothrow_constructible<T, Args...>::value;
|
||||||
|
template <class T> constexpr bool is_nothrow_default_constructible_v
|
||||||
|
= is_nothrow_default_constructible<T>::value;
|
||||||
|
template <class T> constexpr bool is_nothrow_copy_constructible_v
|
||||||
|
= is_nothrow_copy_constructible<T>::value;
|
||||||
|
template <class T> constexpr bool is_nothrow_move_constructible_v
|
||||||
|
= is_nothrow_move_constructible<T>::value;
|
||||||
|
template <class T, class U> constexpr bool is_nothrow_assignable_v
|
||||||
|
= is_nothrow_assignable<T, U>::value;
|
||||||
|
template <class T> constexpr bool is_nothrow_copy_assignable_v
|
||||||
|
= is_nothrow_copy_assignable<T>::value;
|
||||||
|
template <class T> constexpr bool is_nothrow_move_assignable_v
|
||||||
|
= is_nothrow_move_assignable<T>::value;
|
||||||
|
template <class T> constexpr bool is_nothrow_destructible_v
|
||||||
|
= is_nothrow_destructible<T>::value;
|
||||||
|
template <class T> constexpr bool has_virtual_destructor_v
|
||||||
|
= has_virtual_destructor<T>::value;
|
||||||
|
|
||||||
|
// See C++14 20.10.5, type property queries
|
||||||
|
template <class T> constexpr size_t alignment_of_v
|
||||||
|
= alignment_of<T>::value;
|
||||||
|
template <class T> constexpr size_t rank_v
|
||||||
|
= rank<T>::value;
|
||||||
|
template <class T, unsigned I = 0> constexpr size_t extent_v
|
||||||
|
= extent<T, I>::value;
|
||||||
|
|
||||||
|
// See C++14 20.10.6, type relations
|
||||||
|
template <class T, class U> constexpr bool is_same_v
|
||||||
|
= is_same<T, U>::value;
|
||||||
|
template <class Base, class Derived> constexpr bool is_base_of_v
|
||||||
|
= is_base_of<Base, Derived>::value;
|
||||||
|
template <class From, class To> constexpr bool is_convertible_v
|
||||||
|
= is_convertible<From, To>::value;
|
||||||
|
|
||||||
|
// 3.3.2, Other type transformations
|
||||||
|
template <class> class invocation_type; // not defined
|
||||||
|
template <class F, class... ArgTypes> class invocation_type<F(ArgTypes...)>;
|
||||||
|
template <class> class raw_invocation_type; // not defined
|
||||||
|
template <class F, class... ArgTypes> class raw_invocation_type<F(ArgTypes...)>;
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
using invocation_type_t = typename invocation_type<T>::type;
|
||||||
|
template <class T>
|
||||||
|
using raw_invocation_type_t = typename raw_invocation_type<T>::type;
|
||||||
|
|
||||||
|
} // namespace fundamentals_v1
|
||||||
|
} // namespace experimental
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <experimental/__config>
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||||
|
|
||||||
|
// C++14 20.10.4.1, primary type categories
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_void_v
|
||||||
|
= is_void<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_null_pointer_v
|
||||||
|
= is_null_pointer<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_integral_v
|
||||||
|
= is_integral<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_floating_point_v
|
||||||
|
= is_floating_point<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_array_v
|
||||||
|
= is_array<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_pointer_v
|
||||||
|
= is_pointer<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_lvalue_reference_v
|
||||||
|
= is_lvalue_reference<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_rvalue_reference_v
|
||||||
|
= is_rvalue_reference<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_object_pointer_v
|
||||||
|
= is_member_object_pointer<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_function_pointer_v
|
||||||
|
= is_member_function_pointer<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_enum_v
|
||||||
|
= is_enum<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_union_v
|
||||||
|
= is_union<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_class_v
|
||||||
|
= is_class<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_function_v
|
||||||
|
= is_function<_Tp>::value;
|
||||||
|
|
||||||
|
// C++14 20.10.4.2, composite type categories
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_reference_v
|
||||||
|
= is_reference<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_arithmetic_v
|
||||||
|
= is_arithmetic<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_fundamental_v
|
||||||
|
= is_fundamental<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_object_v
|
||||||
|
= is_object<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_scalar_v
|
||||||
|
= is_scalar<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_compound_v
|
||||||
|
= is_compound<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_pointer_v
|
||||||
|
= is_member_pointer<_Tp>::value;
|
||||||
|
|
||||||
|
// C++14 20.10.4.3, type properties
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_const_v
|
||||||
|
= is_const<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_volatile_v
|
||||||
|
= is_volatile<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivial_v
|
||||||
|
= is_trivial<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copyable_v
|
||||||
|
= is_trivially_copyable<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_standard_layout_v
|
||||||
|
= is_standard_layout<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_pod_v
|
||||||
|
= is_pod<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_literal_type_v
|
||||||
|
= is_literal_type<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v
|
||||||
|
= is_empty<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_polymorphic_v
|
||||||
|
= is_polymorphic<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v
|
||||||
|
= is_abstract<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v
|
||||||
|
= is_final<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_signed_v
|
||||||
|
= is_signed<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_unsigned_v
|
||||||
|
= is_unsigned<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_constructible_v
|
||||||
|
= is_constructible<_Tp, _Ts...>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_default_constructible_v
|
||||||
|
= is_default_constructible<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_constructible_v
|
||||||
|
= is_copy_constructible<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_constructible_v
|
||||||
|
= is_move_constructible<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_assignable_v
|
||||||
|
= is_assignable<_Tp, _Up>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_assignable_v
|
||||||
|
= is_copy_assignable<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_assignable_v
|
||||||
|
= is_move_assignable<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_destructible_v
|
||||||
|
= is_destructible<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v
|
||||||
|
= is_trivially_constructible<_Tp, _Ts...>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v
|
||||||
|
= is_trivially_default_constructible<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v
|
||||||
|
= is_trivially_copy_constructible<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v
|
||||||
|
= is_trivially_move_constructible<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_trivially_assignable_v
|
||||||
|
= is_trivially_assignable<_Tp, _Up>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v
|
||||||
|
= is_trivially_copy_assignable<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v
|
||||||
|
= is_trivially_move_assignable<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_destructible_v
|
||||||
|
= is_trivially_destructible<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v
|
||||||
|
= is_nothrow_constructible<_Tp, _Ts...>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v
|
||||||
|
= is_nothrow_default_constructible<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v
|
||||||
|
= is_nothrow_copy_constructible<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v
|
||||||
|
= is_nothrow_move_constructible<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v
|
||||||
|
= is_nothrow_assignable<_Tp, _Up>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v
|
||||||
|
= is_nothrow_copy_assignable<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v
|
||||||
|
= is_nothrow_move_assignable<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v
|
||||||
|
= is_nothrow_destructible<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR bool has_virtual_destructor_v
|
||||||
|
= has_virtual_destructor<_Tp>::value;
|
||||||
|
|
||||||
|
// C++14 20.10.5, type properties queries
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR size_t alignment_of_v
|
||||||
|
= alignment_of<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp> _LIBCPP_CONSTEXPR size_t rank_v
|
||||||
|
= rank<_Tp>::value;
|
||||||
|
|
||||||
|
template <class _Tp, unsigned _Id = 0> _LIBCPP_CONSTEXPR size_t extent_v
|
||||||
|
= extent<_Tp, _Id>::value;
|
||||||
|
|
||||||
|
// C++14 20.10.6, type relations
|
||||||
|
|
||||||
|
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_same_v
|
||||||
|
= is_same<_Tp, _Up>::value;
|
||||||
|
|
||||||
|
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_base_of_v
|
||||||
|
= is_base_of<_Tp, _Up>::value;
|
||||||
|
|
||||||
|
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_convertible_v
|
||||||
|
= is_convertible<_Tp, _Up>::value;
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
|
||||||
|
|
||||||
|
// 3.3.2, Other type transformations
|
||||||
|
/*
|
||||||
|
template <class>
|
||||||
|
class _LIBCPP_TYPE_VIS_ONLY raw_invocation_type;
|
||||||
|
|
||||||
|
template <class _Fn, class ..._Args>
|
||||||
|
class _LIBCPP_TYPE_VIS_ONLY raw_invocation_type<_Fn(_Args...)>;
|
||||||
|
|
||||||
|
template <class>
|
||||||
|
class _LIBCPP_TYPE_VIS_ONLY invokation_type;
|
||||||
|
|
||||||
|
template <class _Fn, class ..._Args>
|
||||||
|
class _LIBCPP_TYPE_VIS_ONLY invokation_type<_Fn(_Args...)>;
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
using invokation_type_t = typename invokation_type<_Tp>::type;
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
|
||||||
|
*/
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_STD_VER > 11 */
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_EXPERIMENTAL_TYPE_TRAITS */
|
47
include/experimental/utility
Normal file
47
include/experimental/utility
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===-------------------------- utility ----------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXPERIMENTAL_UTILITY
|
||||||
|
#define _LIBCPP_EXPERIMENTAL_UTILITY
|
||||||
|
|
||||||
|
/*
|
||||||
|
experimental/utility synopsis
|
||||||
|
|
||||||
|
// C++1y
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
namespace experimental {
|
||||||
|
inline namespace fundamentals_v1 {
|
||||||
|
|
||||||
|
3.1.2, erased-type placeholder
|
||||||
|
struct erased_type { };
|
||||||
|
|
||||||
|
} // namespace fundamentals_v1
|
||||||
|
} // namespace experimental
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <experimental/__config>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
struct _LIBCPP_TYPE_VIS_ONLY erased_type { };
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_LFTS
|
||||||
|
|
||||||
|
#endif /* _LIBCPP_EXPERIMENTAL_UTILITY */
|
@ -19,10 +19,9 @@
|
|||||||
namespace __gnu_cxx {
|
namespace __gnu_cxx {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
template <typename T> struct _LIBCPP_VISIBLE hash : public std::hash<T>
|
template <typename _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash { };
|
||||||
{ };
|
|
||||||
|
|
||||||
template <> struct _LIBCPP_VISIBLE hash<const char*>
|
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<const char*>
|
||||||
: public unary_function<const char*, size_t>
|
: public unary_function<const char*, size_t>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@ -32,7 +31,7 @@ template <> struct _LIBCPP_VISIBLE hash<const char*>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct _LIBCPP_VISIBLE hash<char *>
|
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<char *>
|
||||||
: public unary_function<char*, size_t>
|
: public unary_function<char*, size_t>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@ -41,6 +40,96 @@ template <> struct _LIBCPP_VISIBLE hash<char *>
|
|||||||
return __do_string_hash<const char *>(__c, __c + strlen(__c));
|
return __do_string_hash<const char *>(__c, __c + strlen(__c));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<char>
|
||||||
|
: public unary_function<char, size_t>
|
||||||
|
{
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_t operator()(char __c) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<signed char>
|
||||||
|
: public unary_function<signed char, size_t>
|
||||||
|
{
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_t operator()(signed char __c) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned char>
|
||||||
|
: public unary_function<unsigned char, size_t>
|
||||||
|
{
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_t operator()(unsigned char __c) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<short>
|
||||||
|
: public unary_function<short, size_t>
|
||||||
|
{
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_t operator()(short __c) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned short>
|
||||||
|
: public unary_function<unsigned short, size_t>
|
||||||
|
{
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_t operator()(unsigned short __c) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<int>
|
||||||
|
: public unary_function<int, size_t>
|
||||||
|
{
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_t operator()(int __c) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned int>
|
||||||
|
: public unary_function<unsigned int, size_t>
|
||||||
|
{
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_t operator()(unsigned int __c) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<long>
|
||||||
|
: public unary_function<long, size_t>
|
||||||
|
{
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_t operator()(long __c) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned long>
|
||||||
|
: public unary_function<unsigned long, size_t>
|
||||||
|
{
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
size_t operator()(unsigned long __c) const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return __c;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif _LIBCPP_EXT_HASH
|
#endif // _LIBCPP_EXT_HASH
|
||||||
|
@ -203,19 +203,28 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
|||||||
#include <__hash_table>
|
#include <__hash_table>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <type_traits>
|
||||||
#include <ext/__hash>
|
#include <ext/__hash>
|
||||||
|
|
||||||
#if __DEPRECATED
|
#if __DEPRECATED
|
||||||
#warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
|
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||||
|
_LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>")
|
||||||
|
#else
|
||||||
|
# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace __gnu_cxx {
|
namespace __gnu_cxx {
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
template <class _Tp, class _Hash, bool = is_empty<_Hash>::value>
|
template <class _Tp, class _Hash,
|
||||||
|
bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value
|
||||||
|
>
|
||||||
class __hash_map_hasher
|
class __hash_map_hasher
|
||||||
: private _Hash
|
: private _Hash
|
||||||
{
|
{
|
||||||
@ -247,7 +256,9 @@ public:
|
|||||||
{return __hash_(__x);}
|
{return __hash_(__x);}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _Pred, bool = is_empty<_Pred>::value>
|
template <class _Tp, class _Pred,
|
||||||
|
bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value
|
||||||
|
>
|
||||||
class __hash_map_equal
|
class __hash_map_equal
|
||||||
: private _Pred
|
: private _Pred
|
||||||
{
|
{
|
||||||
@ -353,7 +364,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _HashIterator>
|
template <class _HashIterator>
|
||||||
class _LIBCPP_VISIBLE __hash_map_iterator
|
class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator
|
||||||
{
|
{
|
||||||
_HashIterator __i_;
|
_HashIterator __i_;
|
||||||
|
|
||||||
@ -396,15 +407,15 @@ public:
|
|||||||
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
||||||
{return __x.__i_ != __y.__i_;}
|
{return __x.__i_ != __y.__i_;}
|
||||||
|
|
||||||
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
|
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_map;
|
||||||
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
|
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_multimap;
|
||||||
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
|
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
|
||||||
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
|
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
|
||||||
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
|
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _HashIterator>
|
template <class _HashIterator>
|
||||||
class _LIBCPP_VISIBLE __hash_map_const_iterator
|
class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator
|
||||||
{
|
{
|
||||||
_HashIterator __i_;
|
_HashIterator __i_;
|
||||||
|
|
||||||
@ -418,9 +429,9 @@ public:
|
|||||||
typedef const value_type& reference;
|
typedef const value_type& reference;
|
||||||
typedef typename __pointer_traits::template
|
typedef typename __pointer_traits::template
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
rebind<value_type>
|
rebind<const value_type>
|
||||||
#else
|
#else
|
||||||
rebind<value_type>::other
|
rebind<const value_type>::other
|
||||||
#endif
|
#endif
|
||||||
pointer;
|
pointer;
|
||||||
|
|
||||||
@ -455,15 +466,15 @@ public:
|
|||||||
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
||||||
{return __x.__i_ != __y.__i_;}
|
{return __x.__i_ != __y.__i_;}
|
||||||
|
|
||||||
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
|
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_map;
|
||||||
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
|
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_multimap;
|
||||||
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
|
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
|
||||||
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
|
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
|
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
|
||||||
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
||||||
class _LIBCPP_VISIBLE hash_map
|
class _LIBCPP_TYPE_VIS_ONLY hash_map
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types
|
// types
|
||||||
@ -481,13 +492,7 @@ private:
|
|||||||
typedef pair<key_type, mapped_type> __value_type;
|
typedef pair<key_type, mapped_type> __value_type;
|
||||||
typedef __hash_map_hasher<__value_type, hasher> __hasher;
|
typedef __hash_map_hasher<__value_type, hasher> __hasher;
|
||||||
typedef __hash_map_equal<__value_type, key_equal> __key_equal;
|
typedef __hash_map_equal<__value_type, key_equal> __key_equal;
|
||||||
typedef typename allocator_traits<allocator_type>::template
|
typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
|
||||||
rebind_alloc<__value_type>
|
|
||||||
#else
|
|
||||||
rebind_alloc<__value_type>::other
|
|
||||||
#endif
|
|
||||||
__allocator_type;
|
|
||||||
|
|
||||||
typedef __hash_table<__value_type, __hasher,
|
typedef __hash_table<__value_type, __hasher,
|
||||||
__key_equal, __allocator_type> __table;
|
__key_equal, __allocator_type> __table;
|
||||||
@ -499,8 +504,8 @@ private:
|
|||||||
typedef typename __table::__node_traits __node_traits;
|
typedef typename __table::__node_traits __node_traits;
|
||||||
typedef typename __table::__node_allocator __node_allocator;
|
typedef typename __table::__node_allocator __node_allocator;
|
||||||
typedef typename __table::__node __node;
|
typedef typename __table::__node __node;
|
||||||
typedef __hash_map_node_destructor<__node_allocator> _D;
|
typedef __hash_map_node_destructor<__node_allocator> _Dp;
|
||||||
typedef unique_ptr<__node, _D> __node_holder;
|
typedef unique_ptr<__node, _Dp> __node_holder;
|
||||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||||
public:
|
public:
|
||||||
typedef typename __alloc_traits::pointer pointer;
|
typedef typename __alloc_traits::pointer pointer;
|
||||||
@ -671,12 +676,12 @@ typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
|
|||||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
|
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
|
||||||
{
|
{
|
||||||
__node_allocator& __na = __table_.__node_alloc();
|
__node_allocator& __na = __table_.__node_alloc();
|
||||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
|
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
|
||||||
__h.get_deleter().__first_constructed = true;
|
__h.get_deleter().__first_constructed = true;
|
||||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||||
__h.get_deleter().__second_constructed = true;
|
__h.get_deleter().__second_constructed = true;
|
||||||
return _VSTD::move(__h);
|
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||||
@ -742,7 +747,7 @@ operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
|||||||
|
|
||||||
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
|
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
|
||||||
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
||||||
class _LIBCPP_VISIBLE hash_multimap
|
class _LIBCPP_TYPE_VIS_ONLY hash_multimap
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types
|
// types
|
||||||
@ -760,13 +765,7 @@ private:
|
|||||||
typedef pair<key_type, mapped_type> __value_type;
|
typedef pair<key_type, mapped_type> __value_type;
|
||||||
typedef __hash_map_hasher<__value_type, hasher> __hasher;
|
typedef __hash_map_hasher<__value_type, hasher> __hasher;
|
||||||
typedef __hash_map_equal<__value_type, key_equal> __key_equal;
|
typedef __hash_map_equal<__value_type, key_equal> __key_equal;
|
||||||
typedef typename allocator_traits<allocator_type>::template
|
typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
|
||||||
rebind_alloc<__value_type>
|
|
||||||
#else
|
|
||||||
rebind_alloc<__value_type>::other
|
|
||||||
#endif
|
|
||||||
__allocator_type;
|
|
||||||
|
|
||||||
typedef __hash_table<__value_type, __hasher,
|
typedef __hash_table<__value_type, __hasher,
|
||||||
__key_equal, __allocator_type> __table;
|
__key_equal, __allocator_type> __table;
|
||||||
@ -776,8 +775,8 @@ private:
|
|||||||
typedef typename __table::__node_traits __node_traits;
|
typedef typename __table::__node_traits __node_traits;
|
||||||
typedef typename __table::__node_allocator __node_allocator;
|
typedef typename __table::__node_allocator __node_allocator;
|
||||||
typedef typename __table::__node __node;
|
typedef typename __table::__node __node;
|
||||||
typedef __hash_map_node_destructor<__node_allocator> _D;
|
typedef __hash_map_node_destructor<__node_allocator> _Dp;
|
||||||
typedef unique_ptr<__node, _D> __node_holder;
|
typedef unique_ptr<__node, _Dp> __node_holder;
|
||||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||||
public:
|
public:
|
||||||
typedef typename __alloc_traits::pointer pointer;
|
typedef typename __alloc_traits::pointer pointer;
|
||||||
|
@ -199,7 +199,11 @@ template <class Value, class Hash, class Pred, class Alloc>
|
|||||||
#include <ext/__hash>
|
#include <ext/__hash>
|
||||||
|
|
||||||
#if __DEPRECATED
|
#if __DEPRECATED
|
||||||
#warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
|
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||||
|
_LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>")
|
||||||
|
#else
|
||||||
|
# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace __gnu_cxx {
|
namespace __gnu_cxx {
|
||||||
@ -208,7 +212,7 @@ using namespace std;
|
|||||||
|
|
||||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
||||||
class _Alloc = allocator<_Value> >
|
class _Alloc = allocator<_Value> >
|
||||||
class _LIBCPP_VISIBLE hash_set
|
class _LIBCPP_TYPE_VIS_ONLY hash_set
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types
|
// types
|
||||||
@ -429,7 +433,7 @@ operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
|||||||
|
|
||||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
||||||
class _Alloc = allocator<_Value> >
|
class _Alloc = allocator<_Value> >
|
||||||
class _LIBCPP_VISIBLE hash_multiset
|
class _LIBCPP_TYPE_VIS_ONLY hash_multiset
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types
|
// types
|
||||||
|
83
include/float.h
Normal file
83
include/float.h
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===--------------------------- float.h ----------------------------------===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
// Source Licenses. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_FLOAT_H
|
||||||
|
#define _LIBCPP_FLOAT_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
float.h synopsis
|
||||||
|
|
||||||
|
Macros:
|
||||||
|
|
||||||
|
FLT_ROUNDS
|
||||||
|
FLT_EVAL_METHOD // C99
|
||||||
|
FLT_RADIX
|
||||||
|
|
||||||
|
FLT_MANT_DIG
|
||||||
|
DBL_MANT_DIG
|
||||||
|
LDBL_MANT_DIG
|
||||||
|
|
||||||
|
DECIMAL_DIG // C99
|
||||||
|
|
||||||
|
FLT_DIG
|
||||||
|
DBL_DIG
|
||||||
|
LDBL_DIG
|
||||||
|
|
||||||
|
FLT_MIN_EXP
|
||||||
|
DBL_MIN_EXP
|
||||||
|
LDBL_MIN_EXP
|
||||||
|
|
||||||
|
FLT_MIN_10_EXP
|
||||||
|
DBL_MIN_10_EXP
|
||||||
|
LDBL_MIN_10_EXP
|
||||||
|
|
||||||
|
FLT_MAX_EXP
|
||||||
|
DBL_MAX_EXP
|
||||||
|
LDBL_MAX_EXP
|
||||||
|
|
||||||
|
FLT_MAX_10_EXP
|
||||||
|
DBL_MAX_10_EXP
|
||||||
|
LDBL_MAX_10_EXP
|
||||||
|
|
||||||
|
FLT_MAX
|
||||||
|
DBL_MAX
|
||||||
|
LDBL_MAX
|
||||||
|
|
||||||
|
FLT_EPSILON
|
||||||
|
DBL_EPSILON
|
||||||
|
LDBL_EPSILON
|
||||||
|
|
||||||
|
FLT_MIN
|
||||||
|
DBL_MIN
|
||||||
|
LDBL_MIN
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <__config>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include_next <float.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#ifndef FLT_EVAL_METHOD
|
||||||
|
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DECIMAL_DIG
|
||||||
|
#define DECIMAL_DIG __DECIMAL_DIG__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif // _LIBCPP_FLOAT_H
|
@ -38,6 +38,7 @@ public:
|
|||||||
noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
||||||
explicit forward_list(const allocator_type& a);
|
explicit forward_list(const allocator_type& a);
|
||||||
explicit forward_list(size_type n);
|
explicit forward_list(size_type n);
|
||||||
|
explicit forward_list(size_type n, const allocator_type& a); // C++14
|
||||||
forward_list(size_type n, const value_type& v);
|
forward_list(size_type n, const value_type& v);
|
||||||
forward_list(size_type n, const value_type& v, const allocator_type& a);
|
forward_list(size_type n, const value_type& v, const allocator_type& a);
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
@ -106,8 +107,7 @@ public:
|
|||||||
iterator erase_after(const_iterator first, const_iterator last);
|
iterator erase_after(const_iterator first, const_iterator last);
|
||||||
|
|
||||||
void swap(forward_list& x)
|
void swap(forward_list& x)
|
||||||
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
noexcept(allocator_traits<allocator_type>::is_always_equal::value); // C++17
|
||||||
__is_nothrow_swappable<allocator_type>::value);
|
|
||||||
|
|
||||||
void resize(size_type n);
|
void resize(size_type n);
|
||||||
void resize(size_type n, const value_type& v);
|
void resize(size_type n, const value_type& v);
|
||||||
@ -174,7 +174,11 @@ template <class T, class Allocator>
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <__undef_min_max>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@ -183,7 +187,6 @@ template <class _Tp, class _VoidPtr> struct __forward_list_node;
|
|||||||
template <class _NodePtr>
|
template <class _NodePtr>
|
||||||
struct __forward_begin_node
|
struct __forward_begin_node
|
||||||
{
|
{
|
||||||
typedef __forward_begin_node __self;
|
|
||||||
typedef _NodePtr pointer;
|
typedef _NodePtr pointer;
|
||||||
|
|
||||||
pointer __next_;
|
pointer __next_;
|
||||||
@ -192,27 +195,33 @@ struct __forward_begin_node
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _VoidPtr>
|
template <class _Tp, class _VoidPtr>
|
||||||
struct __forward_list_node
|
struct _LIBCPP_HIDDEN __begin_node_of
|
||||||
: public __forward_begin_node
|
{
|
||||||
<
|
typedef __forward_begin_node
|
||||||
typename pointer_traits<_VoidPtr>::template
|
<
|
||||||
|
typename pointer_traits<_VoidPtr>::template
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
rebind<__forward_list_node<_Tp, _VoidPtr> >
|
rebind<__forward_list_node<_Tp, _VoidPtr> >
|
||||||
#else
|
#else
|
||||||
rebind<__forward_list_node<_Tp, _VoidPtr> >::other
|
rebind<__forward_list_node<_Tp, _VoidPtr> >::other
|
||||||
#endif
|
#endif
|
||||||
>
|
> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _Tp, class _VoidPtr>
|
||||||
|
struct __forward_list_node
|
||||||
|
: public __begin_node_of<_Tp, _VoidPtr>::type
|
||||||
{
|
{
|
||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
|
|
||||||
value_type __value_;
|
value_type __value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class _Tp, class _Alloc> class forward_list;
|
template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TYPE_VIS_ONLY forward_list;
|
||||||
template<class _NodeConstPtr> class __forward_list_const_iterator;
|
template<class _NodeConstPtr> class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator;
|
||||||
|
|
||||||
template <class _NodePtr>
|
template <class _NodePtr>
|
||||||
class _LIBCPP_VISIBLE __forward_list_iterator
|
class _LIBCPP_TYPE_VIS_ONLY __forward_list_iterator
|
||||||
{
|
{
|
||||||
typedef _NodePtr __node_pointer;
|
typedef _NodePtr __node_pointer;
|
||||||
|
|
||||||
@ -221,14 +230,14 @@ class _LIBCPP_VISIBLE __forward_list_iterator
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
||||||
|
|
||||||
template<class, class> friend class forward_list;
|
template<class, class> friend class _LIBCPP_TYPE_VIS_ONLY forward_list;
|
||||||
template<class> friend class __forward_list_const_iterator;
|
template<class> friend class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef forward_iterator_tag iterator_category;
|
typedef forward_iterator_tag iterator_category;
|
||||||
typedef typename pointer_traits<__node_pointer>::element_type::value_type
|
typedef typename pointer_traits<__node_pointer>::element_type::value_type
|
||||||
value_type;
|
value_type;
|
||||||
typedef value_type& reference;
|
typedef value_type& reference;
|
||||||
typedef typename pointer_traits<__node_pointer>::difference_type
|
typedef typename pointer_traits<__node_pointer>::difference_type
|
||||||
difference_type;
|
difference_type;
|
||||||
typedef typename pointer_traits<__node_pointer>::template
|
typedef typename pointer_traits<__node_pointer>::template
|
||||||
@ -245,7 +254,7 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
reference operator*() const {return __ptr_->__value_;}
|
reference operator*() const {return __ptr_->__value_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
pointer operator->() const {return &__ptr_->__value_;}
|
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__forward_list_iterator& operator++()
|
__forward_list_iterator& operator++()
|
||||||
@ -272,7 +281,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _NodeConstPtr>
|
template <class _NodeConstPtr>
|
||||||
class _LIBCPP_VISIBLE __forward_list_const_iterator
|
class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator
|
||||||
{
|
{
|
||||||
typedef _NodeConstPtr __node_const_pointer;
|
typedef _NodeConstPtr __node_const_pointer;
|
||||||
|
|
||||||
@ -299,7 +308,7 @@ class _LIBCPP_VISIBLE __forward_list_const_iterator
|
|||||||
public:
|
public:
|
||||||
typedef forward_iterator_tag iterator_category;
|
typedef forward_iterator_tag iterator_category;
|
||||||
typedef typename __node::value_type value_type;
|
typedef typename __node::value_type value_type;
|
||||||
typedef const value_type& reference;
|
typedef const value_type& reference;
|
||||||
typedef typename pointer_traits<__node_const_pointer>::difference_type
|
typedef typename pointer_traits<__node_const_pointer>::difference_type
|
||||||
difference_type;
|
difference_type;
|
||||||
typedef typename pointer_traits<__node_const_pointer>::template
|
typedef typename pointer_traits<__node_const_pointer>::template
|
||||||
@ -319,7 +328,7 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
reference operator*() const {return __ptr_->__value_;}
|
reference operator*() const {return __ptr_->__value_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
pointer operator->() const {return &__ptr_->__value_;}
|
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__forward_list_const_iterator& operator++()
|
__forward_list_const_iterator& operator++()
|
||||||
@ -352,30 +361,27 @@ protected:
|
|||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
typedef _Alloc allocator_type;
|
typedef _Alloc allocator_type;
|
||||||
|
|
||||||
typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
|
typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
|
||||||
typedef __forward_list_node<value_type, void_pointer> __node;
|
typedef __forward_list_node<value_type, void_pointer> __node;
|
||||||
typedef typename __node::__self __begin_node;
|
typedef typename __begin_node_of<value_type, void_pointer>::type __begin_node;
|
||||||
typedef typename allocator_traits<allocator_type>::template
|
typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __node>::type __node_allocator;
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
|
||||||
rebind_alloc<__node>
|
|
||||||
#else
|
|
||||||
rebind_alloc<__node>::other
|
|
||||||
#endif
|
|
||||||
__node_allocator;
|
|
||||||
typedef allocator_traits<__node_allocator> __node_traits;
|
typedef allocator_traits<__node_allocator> __node_traits;
|
||||||
typedef typename __node_traits::pointer __node_pointer;
|
typedef typename __node_traits::pointer __node_pointer;
|
||||||
typedef typename __node_traits::const_pointer __node_const_pointer;
|
typedef typename __node_traits::pointer __node_const_pointer;
|
||||||
|
|
||||||
|
typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __begin_node>::type __begin_node_allocator;
|
||||||
|
typedef typename allocator_traits<__begin_node_allocator>::pointer __begin_node_pointer;
|
||||||
|
|
||||||
__compressed_pair<__begin_node, __node_allocator> __before_begin_;
|
__compressed_pair<__begin_node, __node_allocator> __before_begin_;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__node_pointer __before_begin() _NOEXCEPT
|
__node_pointer __before_begin() _NOEXCEPT
|
||||||
{return pointer_traits<__node_pointer>::pointer_to(
|
{return static_cast<__node_pointer>(pointer_traits<__begin_node_pointer>::
|
||||||
static_cast<__node&>(__before_begin_.first()));}
|
pointer_to(__before_begin_.first()));}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__node_const_pointer __before_begin() const _NOEXCEPT
|
__node_const_pointer __before_begin() const _NOEXCEPT
|
||||||
{return pointer_traits<__node_const_pointer>::pointer_to(
|
{return static_cast<__node_const_pointer>(pointer_traits<__begin_node_pointer>::
|
||||||
static_cast<const __node&>(__before_begin_.first()));}
|
pointer_to(const_cast<__begin_node&>(__before_begin_.first())));}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__node_allocator& __alloc() _NOEXCEPT
|
__node_allocator& __alloc() _NOEXCEPT
|
||||||
@ -385,7 +391,7 @@ protected:
|
|||||||
{return __before_begin_.second();}
|
{return __before_begin_.second();}
|
||||||
|
|
||||||
typedef __forward_list_iterator<__node_pointer> iterator;
|
typedef __forward_list_iterator<__node_pointer> iterator;
|
||||||
typedef __forward_list_const_iterator<__node_const_pointer> const_iterator;
|
typedef __forward_list_const_iterator<__node_pointer> const_iterator;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__forward_list_base()
|
__forward_list_base()
|
||||||
@ -424,8 +430,12 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void swap(__forward_list_base& __x)
|
void swap(__forward_list_base& __x)
|
||||||
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
#if _LIBCPP_STD_VER >= 14
|
||||||
__is_nothrow_swappable<__node_allocator>::value);
|
_NOEXCEPT;
|
||||||
|
#else
|
||||||
|
_NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
|
||||||
|
__is_nothrow_swappable<__node_allocator>::value);
|
||||||
|
#endif
|
||||||
protected:
|
protected:
|
||||||
void clear() _NOEXCEPT;
|
void clear() _NOEXCEPT;
|
||||||
|
|
||||||
@ -447,26 +457,6 @@ private:
|
|||||||
void __move_assign_alloc(__forward_list_base& __x, true_type)
|
void __move_assign_alloc(__forward_list_base& __x, true_type)
|
||||||
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
|
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
|
||||||
{__alloc() = _VSTD::move(__x.__alloc());}
|
{__alloc() = _VSTD::move(__x.__alloc());}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
|
|
||||||
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
|
||||||
__is_nothrow_swappable<__node_allocator>::value)
|
|
||||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
|
||||||
__node_traits::propagate_on_container_swap::value>());}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
|
|
||||||
false_type)
|
|
||||||
_NOEXCEPT
|
|
||||||
{}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
|
|
||||||
true_type)
|
|
||||||
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
|
|
||||||
{
|
|
||||||
using _VSTD::swap;
|
|
||||||
swap(__x, __y);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
@ -505,10 +495,15 @@ template <class _Tp, class _Alloc>
|
|||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
|
__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
|
||||||
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
#if _LIBCPP_STD_VER >= 14
|
||||||
__is_nothrow_swappable<__node_allocator>::value)
|
_NOEXCEPT
|
||||||
|
#else
|
||||||
|
_NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
|
||||||
|
__is_nothrow_swappable<__node_allocator>::value)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
__swap_alloc(__alloc(), __x.__alloc());
|
__swap_allocator(__alloc(), __x.__alloc(),
|
||||||
|
integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
|
||||||
using _VSTD::swap;
|
using _VSTD::swap;
|
||||||
swap(__before_begin()->__next_, __x.__before_begin()->__next_);
|
swap(__before_begin()->__next_, __x.__before_begin()->__next_);
|
||||||
}
|
}
|
||||||
@ -528,8 +523,8 @@ __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
|
|||||||
__before_begin()->__next_ = nullptr;
|
__before_begin()->__next_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Alloc = allocator<_Tp> >
|
template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
|
||||||
class _LIBCPP_VISIBLE forward_list
|
class _LIBCPP_TYPE_VIS_ONLY forward_list
|
||||||
: private __forward_list_base<_Tp, _Alloc>
|
: private __forward_list_base<_Tp, _Alloc>
|
||||||
{
|
{
|
||||||
typedef __forward_list_base<_Tp, _Alloc> base;
|
typedef __forward_list_base<_Tp, _Alloc> base;
|
||||||
@ -542,6 +537,9 @@ public:
|
|||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
typedef _Alloc allocator_type;
|
typedef _Alloc allocator_type;
|
||||||
|
|
||||||
|
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
|
||||||
|
"Allocator::value_type must be same type as value_type");
|
||||||
|
|
||||||
typedef value_type& reference;
|
typedef value_type& reference;
|
||||||
typedef const value_type& const_reference;
|
typedef const value_type& const_reference;
|
||||||
typedef typename allocator_traits<allocator_type>::pointer pointer;
|
typedef typename allocator_traits<allocator_type>::pointer pointer;
|
||||||
@ -558,6 +556,9 @@ public:
|
|||||||
{} // = default;
|
{} // = default;
|
||||||
explicit forward_list(const allocator_type& __a);
|
explicit forward_list(const allocator_type& __a);
|
||||||
explicit forward_list(size_type __n);
|
explicit forward_list(size_type __n);
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
explicit forward_list(size_type __n, const allocator_type& __a);
|
||||||
|
#endif
|
||||||
forward_list(size_type __n, const value_type& __v);
|
forward_list(size_type __n, const value_type& __v);
|
||||||
forward_list(size_type __n, const value_type& __v, const allocator_type& __a);
|
forward_list(size_type __n, const value_type& __v, const allocator_type& __a);
|
||||||
template <class _InputIterator>
|
template <class _InputIterator>
|
||||||
@ -693,8 +694,12 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void swap(forward_list& __x)
|
void swap(forward_list& __x)
|
||||||
|
#if _LIBCPP_STD_VER >= 14
|
||||||
|
_NOEXCEPT
|
||||||
|
#else
|
||||||
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
||||||
__is_nothrow_swappable<__node_allocator>::value)
|
__is_nothrow_swappable<__node_allocator>::value)
|
||||||
|
#endif
|
||||||
{base::swap(__x);}
|
{base::swap(__x);}
|
||||||
|
|
||||||
void resize(size_type __n);
|
void resize(size_type __n);
|
||||||
@ -768,8 +773,8 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
|
|||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
|
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
|
||||||
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
|
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
|
||||||
__p = __p->__next_)
|
__p = __p->__next_)
|
||||||
{
|
{
|
||||||
@ -781,6 +786,28 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <class _Tp, class _Alloc>
|
||||||
|
forward_list<_Tp, _Alloc>::forward_list(size_type __n, const allocator_type& __a)
|
||||||
|
: base ( __a )
|
||||||
|
{
|
||||||
|
if (__n > 0)
|
||||||
|
{
|
||||||
|
__node_allocator& __a = base::__alloc();
|
||||||
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
|
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
|
||||||
|
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
|
||||||
|
__p = __p->__next_)
|
||||||
|
{
|
||||||
|
__h.reset(__node_traits::allocate(__a, 1));
|
||||||
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_));
|
||||||
|
__h->__next_ = nullptr;
|
||||||
|
__p->__next_ = __h.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v)
|
forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v)
|
||||||
{
|
{
|
||||||
@ -844,8 +871,8 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
|
|||||||
{
|
{
|
||||||
if (base::__alloc() != __x.__alloc())
|
if (base::__alloc() != __x.__alloc())
|
||||||
{
|
{
|
||||||
typedef move_iterator<iterator> _I;
|
typedef move_iterator<iterator> _Ip;
|
||||||
insert_after(cbefore_begin(), _I(__x.begin()), _I(__x.end()));
|
insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -902,8 +929,8 @@ forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
|
|||||||
__move_assign(__x, true_type());
|
__move_assign(__x, true_type());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
typedef move_iterator<iterator> _I;
|
typedef move_iterator<iterator> _Ip;
|
||||||
assign(_I(__x.begin()), _I(__x.end()));
|
assign(_Ip(__x.begin()), _Ip(__x.end()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -947,7 +974,7 @@ forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
|
|||||||
iterator __i = before_begin();
|
iterator __i = before_begin();
|
||||||
iterator __j = _VSTD::next(__i);
|
iterator __j = _VSTD::next(__i);
|
||||||
iterator __e = end();
|
iterator __e = end();
|
||||||
for (; __j != __e && __f != __l; ++__i, ++__j, ++__f)
|
for (; __j != __e && __f != __l; ++__i, (void) ++__j, ++__f)
|
||||||
*__j = *__f;
|
*__j = *__f;
|
||||||
if (__j == __e)
|
if (__j == __e)
|
||||||
insert_after(__i, __f, __l);
|
insert_after(__i, __f, __l);
|
||||||
@ -991,8 +1018,8 @@ void
|
|||||||
forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
|
||||||
_VSTD::forward<_Args>(__args)...);
|
_VSTD::forward<_Args>(__args)...);
|
||||||
__h->__next_ = base::__before_begin()->__next_;
|
__h->__next_ = base::__before_begin()->__next_;
|
||||||
@ -1006,8 +1033,8 @@ void
|
|||||||
forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
|
forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
||||||
__h->__next_ = base::__before_begin()->__next_;
|
__h->__next_ = base::__before_begin()->__next_;
|
||||||
base::__before_begin()->__next_ = __h.release();
|
base::__before_begin()->__next_ = __h.release();
|
||||||
@ -1020,8 +1047,8 @@ void
|
|||||||
forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
|
forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||||
__h->__next_ = base::__before_begin()->__next_;
|
__h->__next_ = base::__before_begin()->__next_;
|
||||||
base::__before_begin()->__next_ = __h.release();
|
base::__before_begin()->__next_ = __h.release();
|
||||||
@ -1046,10 +1073,10 @@ template <class... _Args>
|
|||||||
typename forward_list<_Tp, _Alloc>::iterator
|
typename forward_list<_Tp, _Alloc>::iterator
|
||||||
forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
|
forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
|
||||||
{
|
{
|
||||||
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
|
__node_pointer const __r = __p.__ptr_;
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
|
||||||
_VSTD::forward<_Args>(__args)...);
|
_VSTD::forward<_Args>(__args)...);
|
||||||
__h->__next_ = __r->__next_;
|
__h->__next_ = __r->__next_;
|
||||||
@ -1063,10 +1090,10 @@ template <class _Tp, class _Alloc>
|
|||||||
typename forward_list<_Tp, _Alloc>::iterator
|
typename forward_list<_Tp, _Alloc>::iterator
|
||||||
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
|
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
|
||||||
{
|
{
|
||||||
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
|
__node_pointer const __r = __p.__ptr_;
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
||||||
__h->__next_ = __r->__next_;
|
__h->__next_ = __r->__next_;
|
||||||
__r->__next_ = __h.release();
|
__r->__next_ = __h.release();
|
||||||
@ -1079,10 +1106,10 @@ template <class _Tp, class _Alloc>
|
|||||||
typename forward_list<_Tp, _Alloc>::iterator
|
typename forward_list<_Tp, _Alloc>::iterator
|
||||||
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v)
|
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v)
|
||||||
{
|
{
|
||||||
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
|
__node_pointer const __r = __p.__ptr_;
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||||
__h->__next_ = __r->__next_;
|
__h->__next_ = __r->__next_;
|
||||||
__r->__next_ = __h.release();
|
__r->__next_ = __h.release();
|
||||||
@ -1094,12 +1121,12 @@ typename forward_list<_Tp, _Alloc>::iterator
|
|||||||
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
|
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
|
||||||
const value_type& __v)
|
const value_type& __v)
|
||||||
{
|
{
|
||||||
__node_pointer __r = const_cast<__node_pointer>(__p.__ptr_);
|
__node_pointer __r = __p.__ptr_;
|
||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||||
__node_pointer __first = __h.release();
|
__node_pointer __first = __h.release();
|
||||||
__node_pointer __last = __first;
|
__node_pointer __last = __first;
|
||||||
@ -1144,12 +1171,12 @@ typename enable_if
|
|||||||
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
|
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
|
||||||
_InputIterator __f, _InputIterator __l)
|
_InputIterator __f, _InputIterator __l)
|
||||||
{
|
{
|
||||||
__node_pointer __r = const_cast<__node_pointer>(__p.__ptr_);
|
__node_pointer __r = __p.__ptr_;
|
||||||
if (__f != __l)
|
if (__f != __l)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
|
||||||
__node_pointer __first = __h.release();
|
__node_pointer __first = __h.release();
|
||||||
__node_pointer __last = __first;
|
__node_pointer __last = __first;
|
||||||
@ -1157,7 +1184,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
for (++__f; __f != __l; ++__f, __last = __last->__next_)
|
for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_)))
|
||||||
{
|
{
|
||||||
__h.reset(__node_traits::allocate(__a, 1));
|
__h.reset(__node_traits::allocate(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
|
||||||
@ -1188,7 +1215,7 @@ template <class _Tp, class _Alloc>
|
|||||||
typename forward_list<_Tp, _Alloc>::iterator
|
typename forward_list<_Tp, _Alloc>::iterator
|
||||||
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
|
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
|
||||||
{
|
{
|
||||||
__node_pointer __p = const_cast<__node_pointer>(__f.__ptr_);
|
__node_pointer __p = __f.__ptr_;
|
||||||
__node_pointer __n = __p->__next_;
|
__node_pointer __n = __p->__next_;
|
||||||
__p->__next_ = __n->__next_;
|
__p->__next_ = __n->__next_;
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
@ -1201,10 +1228,10 @@ template <class _Tp, class _Alloc>
|
|||||||
typename forward_list<_Tp, _Alloc>::iterator
|
typename forward_list<_Tp, _Alloc>::iterator
|
||||||
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
|
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
|
||||||
{
|
{
|
||||||
__node_pointer __e = const_cast<__node_pointer>(__l.__ptr_);
|
__node_pointer __e = __l.__ptr_;
|
||||||
if (__f != __l)
|
if (__f != __l)
|
||||||
{
|
{
|
||||||
__node_pointer __p = const_cast<__node_pointer>(__f.__ptr_);
|
__node_pointer __p = __f.__ptr_;
|
||||||
__node_pointer __n = __p->__next_;
|
__node_pointer __n = __p->__next_;
|
||||||
if (__n != __e)
|
if (__n != __e)
|
||||||
{
|
{
|
||||||
@ -1240,8 +1267,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n)
|
|||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
|
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
|
||||||
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
|
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
|
||||||
__ptr = __ptr->__next_)
|
__ptr = __ptr->__next_)
|
||||||
{
|
{
|
||||||
@ -1272,8 +1299,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
|
|||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
|
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
|
||||||
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
|
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
|
||||||
__ptr = __ptr->__next_)
|
__ptr = __ptr->__next_)
|
||||||
{
|
{
|
||||||
@ -1298,12 +1325,10 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
|||||||
const_iterator __lm1 = __x.before_begin();
|
const_iterator __lm1 = __x.before_begin();
|
||||||
while (__lm1.__ptr_->__next_ != nullptr)
|
while (__lm1.__ptr_->__next_ != nullptr)
|
||||||
++__lm1;
|
++__lm1;
|
||||||
const_cast<__node_pointer>(__lm1.__ptr_)->__next_ =
|
__lm1.__ptr_->__next_ = __p.__ptr_->__next_;
|
||||||
const_cast<__node_pointer>(__p.__ptr_)->__next_;
|
|
||||||
}
|
}
|
||||||
const_cast<__node_pointer>(__p.__ptr_)->__next_ =
|
__p.__ptr_->__next_ = __x.__before_begin()->__next_;
|
||||||
const_cast<__node_pointer>(__x.__before_begin())->__next_;
|
__x.__before_begin()->__next_ = nullptr;
|
||||||
const_cast<__node_pointer>(__x.__before_begin())->__next_ = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1316,12 +1341,9 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
|||||||
const_iterator __lm1 = _VSTD::next(__i);
|
const_iterator __lm1 = _VSTD::next(__i);
|
||||||
if (__p != __i && __p != __lm1)
|
if (__p != __i && __p != __lm1)
|
||||||
{
|
{
|
||||||
const_cast<__node_pointer>(__i.__ptr_)->__next_ =
|
__i.__ptr_->__next_ = __lm1.__ptr_->__next_;
|
||||||
const_cast<__node_pointer>(__lm1.__ptr_)->__next_;
|
__lm1.__ptr_->__next_ = __p.__ptr_->__next_;
|
||||||
const_cast<__node_pointer>(__lm1.__ptr_)->__next_ =
|
__p.__ptr_->__next_ = __lm1.__ptr_;
|
||||||
const_cast<__node_pointer>(__p.__ptr_)->__next_;
|
|
||||||
const_cast<__node_pointer>(__p.__ptr_)->__next_ =
|
|
||||||
const_cast<__node_pointer>(__lm1.__ptr_);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1338,12 +1360,9 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
|||||||
++__lm1;
|
++__lm1;
|
||||||
if (__f != __lm1)
|
if (__f != __lm1)
|
||||||
{
|
{
|
||||||
const_cast<__node_pointer>(__lm1.__ptr_)->__next_ =
|
__lm1.__ptr_->__next_ = __p.__ptr_->__next_;
|
||||||
const_cast<__node_pointer>(__p.__ptr_)->__next_;
|
__p.__ptr_->__next_ = __f.__ptr_->__next_;
|
||||||
const_cast<__node_pointer>(__p.__ptr_)->__next_ =
|
__f.__ptr_->__next_ = __l.__ptr_;
|
||||||
const_cast<__node_pointer>(__f.__ptr_)->__next_;
|
|
||||||
const_cast<__node_pointer>(__f.__ptr_)->__next_ =
|
|
||||||
const_cast<__node_pointer>(__l.__ptr_);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1385,6 +1404,7 @@ template <class _Tp, class _Alloc>
|
|||||||
void
|
void
|
||||||
forward_list<_Tp, _Alloc>::remove(const value_type& __v)
|
forward_list<_Tp, _Alloc>::remove(const value_type& __v)
|
||||||
{
|
{
|
||||||
|
forward_list<_Tp, _Alloc> __deleted_nodes; // collect the nodes we're removing
|
||||||
iterator __e = end();
|
iterator __e = end();
|
||||||
for (iterator __i = before_begin(); __i.__ptr_->__next_ != nullptr;)
|
for (iterator __i = before_begin(); __i.__ptr_->__next_ != nullptr;)
|
||||||
{
|
{
|
||||||
@ -1393,7 +1413,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
|
|||||||
iterator __j = _VSTD::next(__i, 2);
|
iterator __j = _VSTD::next(__i, 2);
|
||||||
for (; __j != __e && *__j == __v; ++__j)
|
for (; __j != __e && *__j == __v; ++__j)
|
||||||
;
|
;
|
||||||
erase_after(__i, __j);
|
__deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
|
||||||
if (__j == __e)
|
if (__j == __e)
|
||||||
break;
|
break;
|
||||||
__i = __j;
|
__i = __j;
|
||||||
@ -1565,12 +1585,12 @@ template <class _Tp, class _Alloc>
|
|||||||
bool operator==(const forward_list<_Tp, _Alloc>& __x,
|
bool operator==(const forward_list<_Tp, _Alloc>& __x,
|
||||||
const forward_list<_Tp, _Alloc>& __y)
|
const forward_list<_Tp, _Alloc>& __y)
|
||||||
{
|
{
|
||||||
typedef forward_list<_Tp, _Alloc> _C;
|
typedef forward_list<_Tp, _Alloc> _Cp;
|
||||||
typedef typename _C::const_iterator _I;
|
typedef typename _Cp::const_iterator _Ip;
|
||||||
_I __ix = __x.begin();
|
_Ip __ix = __x.begin();
|
||||||
_I __ex = __x.end();
|
_Ip __ex = __x.end();
|
||||||
_I __iy = __y.begin();
|
_Ip __iy = __y.begin();
|
||||||
_I __ey = __y.end();
|
_Ip __ey = __y.end();
|
||||||
for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
|
for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
|
||||||
if (!(*__ix == *__iy))
|
if (!(*__ix == *__iy))
|
||||||
return false;
|
return false;
|
||||||
|
125
include/fstream
125
include/fstream
@ -171,12 +171,16 @@ typedef basic_fstream<wchar_t> wfstream;
|
|||||||
#include <__locale>
|
#include <__locale>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
#include <__undef_min_max>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
class _LIBCPP_VISIBLE basic_filebuf
|
class _LIBCPP_TYPE_VIS_ONLY basic_filebuf
|
||||||
: public basic_streambuf<_CharT, _Traits>
|
: public basic_streambuf<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -202,8 +206,10 @@ public:
|
|||||||
|
|
||||||
// 27.9.1.4 Members:
|
// 27.9.1.4 Members:
|
||||||
bool is_open() const;
|
bool is_open() const;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
basic_filebuf* open(const char* __s, ios_base::openmode __mode);
|
basic_filebuf* open(const char* __s, ios_base::openmode __mode);
|
||||||
basic_filebuf* open(const string& __s, ios_base::openmode __mode);
|
basic_filebuf* open(const string& __s, ios_base::openmode __mode);
|
||||||
|
#endif
|
||||||
basic_filebuf* close();
|
basic_filebuf* close();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -230,6 +236,7 @@ private:
|
|||||||
FILE* __file_;
|
FILE* __file_;
|
||||||
const codecvt<char_type, char, state_type>* __cv_;
|
const codecvt<char_type, char, state_type>* __cv_;
|
||||||
state_type __st_;
|
state_type __st_;
|
||||||
|
state_type __st_last_;
|
||||||
ios_base::openmode __om_;
|
ios_base::openmode __om_;
|
||||||
ios_base::openmode __cm_;
|
ios_base::openmode __cm_;
|
||||||
bool __owns_eb_;
|
bool __owns_eb_;
|
||||||
@ -249,14 +256,20 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
|
|||||||
__intbuf_(0),
|
__intbuf_(0),
|
||||||
__ibs_(0),
|
__ibs_(0),
|
||||||
__file_(0),
|
__file_(0),
|
||||||
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
|
__cv_(nullptr),
|
||||||
__st_(),
|
__st_(),
|
||||||
|
__st_last_(),
|
||||||
__om_(0),
|
__om_(0),
|
||||||
__cm_(0),
|
__cm_(0),
|
||||||
__owns_eb_(false),
|
__owns_eb_(false),
|
||||||
__owns_ib_(false),
|
__owns_ib_(false),
|
||||||
__always_noconv_(__cv_->always_noconv())
|
__always_noconv_(false)
|
||||||
{
|
{
|
||||||
|
if (has_facet<codecvt<char_type, char, state_type> >(this->getloc()))
|
||||||
|
{
|
||||||
|
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc());
|
||||||
|
__always_noconv_ = __cv_->always_noconv();
|
||||||
|
}
|
||||||
setbuf(0, 4096);
|
setbuf(0, 4096);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,6 +297,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
|
|||||||
__file_ = __rhs.__file_;
|
__file_ = __rhs.__file_;
|
||||||
__cv_ = __rhs.__cv_;
|
__cv_ = __rhs.__cv_;
|
||||||
__st_ = __rhs.__st_;
|
__st_ = __rhs.__st_;
|
||||||
|
__st_last_ = __rhs.__st_last_;
|
||||||
__om_ = __rhs.__om_;
|
__om_ = __rhs.__om_;
|
||||||
__cm_ = __rhs.__cm_;
|
__cm_ = __rhs.__cm_;
|
||||||
__owns_eb_ = __rhs.__owns_eb_;
|
__owns_eb_ = __rhs.__owns_eb_;
|
||||||
@ -316,6 +330,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
|
|||||||
__rhs.__ibs_ = 0;
|
__rhs.__ibs_ = 0;
|
||||||
__rhs.__file_ = 0;
|
__rhs.__file_ = 0;
|
||||||
__rhs.__st_ = state_type();
|
__rhs.__st_ = state_type();
|
||||||
|
__rhs.__st_last_ = state_type();
|
||||||
__rhs.__om_ = 0;
|
__rhs.__om_ = 0;
|
||||||
__rhs.__cm_ = 0;
|
__rhs.__cm_ = 0;
|
||||||
__rhs.__owns_eb_ = false;
|
__rhs.__owns_eb_ = false;
|
||||||
@ -331,6 +346,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
|
|||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
swap(__rhs);
|
swap(__rhs);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
@ -393,6 +409,7 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
|
|||||||
_VSTD::swap(__file_, __rhs.__file_);
|
_VSTD::swap(__file_, __rhs.__file_);
|
||||||
_VSTD::swap(__cv_, __rhs.__cv_);
|
_VSTD::swap(__cv_, __rhs.__cv_);
|
||||||
_VSTD::swap(__st_, __rhs.__st_);
|
_VSTD::swap(__st_, __rhs.__st_);
|
||||||
|
_VSTD::swap(__st_last_, __rhs.__st_last_);
|
||||||
_VSTD::swap(__om_, __rhs.__om_);
|
_VSTD::swap(__om_, __rhs.__om_);
|
||||||
_VSTD::swap(__cm_, __rhs.__cm_);
|
_VSTD::swap(__cm_, __rhs.__cm_);
|
||||||
_VSTD::swap(__owns_eb_, __rhs.__owns_eb_);
|
_VSTD::swap(__owns_eb_, __rhs.__owns_eb_);
|
||||||
@ -448,6 +465,7 @@ basic_filebuf<_CharT, _Traits>::is_open() const
|
|||||||
return __file_ != 0;
|
return __file_ != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
basic_filebuf<_CharT, _Traits>*
|
basic_filebuf<_CharT, _Traits>*
|
||||||
basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||||
@ -535,6 +553,7 @@ basic_filebuf<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mod
|
|||||||
{
|
{
|
||||||
return open(__s.c_str(), __mode);
|
return open(__s.c_str(), __mode);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
basic_filebuf<_CharT, _Traits>*
|
basic_filebuf<_CharT, _Traits>*
|
||||||
@ -545,7 +564,7 @@ basic_filebuf<_CharT, _Traits>::close()
|
|||||||
{
|
{
|
||||||
__rt = this;
|
__rt = this;
|
||||||
unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
|
unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
|
||||||
if ((__cm_ & ios_base::out) && sync())
|
if (sync())
|
||||||
__rt = 0;
|
__rt = 0;
|
||||||
if (fclose(__h.release()) == 0)
|
if (fclose(__h.release()) == 0)
|
||||||
__file_ = 0;
|
__file_ = 0;
|
||||||
@ -587,18 +606,22 @@ basic_filebuf<_CharT, _Traits>::underflow()
|
|||||||
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
||||||
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
|
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
|
||||||
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
|
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
|
||||||
size_t __nmemb = _VSTD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
|
size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz),
|
||||||
static_cast<size_t>(__extbufend_ - __extbufnext_));
|
static_cast<size_t>(__extbufend_ - __extbufnext_));
|
||||||
codecvt_base::result __r;
|
codecvt_base::result __r;
|
||||||
state_type __svs = __st_;
|
__st_last_ = __st_;
|
||||||
size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
|
size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
|
||||||
if (__nr != 0)
|
if (__nr != 0)
|
||||||
{
|
{
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
if (!__cv_)
|
||||||
|
throw bad_cast();
|
||||||
|
#endif
|
||||||
__extbufend_ = __extbufnext_ + __nr;
|
__extbufend_ = __extbufnext_ + __nr;
|
||||||
char_type* __inext;
|
char_type* __inext;
|
||||||
__r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
|
__r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
|
||||||
this->eback() + __unget_sz,
|
this->eback() + __unget_sz,
|
||||||
this->egptr(), __inext);
|
this->eback() + __ibs_, __inext);
|
||||||
if (__r == codecvt_base::noconv)
|
if (__r == codecvt_base::noconv)
|
||||||
{
|
{
|
||||||
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
|
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
|
||||||
@ -672,6 +695,10 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
|
|||||||
codecvt_base::result __r;
|
codecvt_base::result __r;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
if (!__cv_)
|
||||||
|
throw bad_cast();
|
||||||
|
#endif
|
||||||
const char_type* __e;
|
const char_type* __e;
|
||||||
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
|
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
|
||||||
__extbuf_, __extbuf_ + __ebs_, __extbe);
|
__extbuf_, __extbuf_ + __ebs_, __extbe);
|
||||||
@ -761,6 +788,10 @@ typename basic_filebuf<_CharT, _Traits>::pos_type
|
|||||||
basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
||||||
ios_base::openmode)
|
ios_base::openmode)
|
||||||
{
|
{
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
if (!__cv_)
|
||||||
|
throw bad_cast();
|
||||||
|
#endif
|
||||||
int __width = __cv_->encoding();
|
int __width = __cv_->encoding();
|
||||||
if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
|
if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
|
||||||
return pos_type(off_type(-1));
|
return pos_type(off_type(-1));
|
||||||
@ -780,9 +811,15 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
|||||||
default:
|
default:
|
||||||
return pos_type(off_type(-1));
|
return pos_type(off_type(-1));
|
||||||
}
|
}
|
||||||
|
#if defined(_WIN32) || defined(_NEWLIB_VERSION)
|
||||||
|
if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
|
||||||
|
return pos_type(off_type(-1));
|
||||||
|
pos_type __r = ftell(__file_);
|
||||||
|
#else
|
||||||
if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
|
if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
|
||||||
return pos_type(off_type(-1));
|
return pos_type(off_type(-1));
|
||||||
pos_type __r = ftello(__file_);
|
pos_type __r = ftello(__file_);
|
||||||
|
#endif
|
||||||
__r.state(__st_);
|
__r.state(__st_);
|
||||||
return __r;
|
return __r;
|
||||||
}
|
}
|
||||||
@ -793,8 +830,14 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
|
|||||||
{
|
{
|
||||||
if (__file_ == 0 || sync())
|
if (__file_ == 0 || sync())
|
||||||
return pos_type(off_type(-1));
|
return pos_type(off_type(-1));
|
||||||
|
#if defined(_WIN32) || defined(_NEWLIB_VERSION)
|
||||||
|
if (fseek(__file_, __sp, SEEK_SET))
|
||||||
|
return pos_type(off_type(-1));
|
||||||
|
#else
|
||||||
if (fseeko(__file_, __sp, SEEK_SET))
|
if (fseeko(__file_, __sp, SEEK_SET))
|
||||||
return pos_type(off_type(-1));
|
return pos_type(off_type(-1));
|
||||||
|
#endif
|
||||||
|
__st_ = __sp.state();
|
||||||
return __sp;
|
return __sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -804,6 +847,10 @@ basic_filebuf<_CharT, _Traits>::sync()
|
|||||||
{
|
{
|
||||||
if (__file_ == 0)
|
if (__file_ == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
if (!__cv_)
|
||||||
|
throw bad_cast();
|
||||||
|
#endif
|
||||||
if (__cm_ & ios_base::out)
|
if (__cm_ & ios_base::out)
|
||||||
{
|
{
|
||||||
if (this->pptr() != this->pbase())
|
if (this->pptr() != this->pbase())
|
||||||
@ -826,6 +873,8 @@ basic_filebuf<_CharT, _Traits>::sync()
|
|||||||
else if (__cm_ & ios_base::in)
|
else if (__cm_ & ios_base::in)
|
||||||
{
|
{
|
||||||
off_type __c;
|
off_type __c;
|
||||||
|
state_type __state = __st_last_;
|
||||||
|
bool __update_st = false;
|
||||||
if (__always_noconv_)
|
if (__always_noconv_)
|
||||||
__c = this->egptr() - this->gptr();
|
__c = this->egptr() - this->gptr();
|
||||||
else
|
else
|
||||||
@ -838,32 +887,24 @@ basic_filebuf<_CharT, _Traits>::sync()
|
|||||||
{
|
{
|
||||||
if (this->gptr() != this->egptr())
|
if (this->gptr() != this->egptr())
|
||||||
{
|
{
|
||||||
reverse(this->gptr(), this->egptr());
|
const int __off = __cv_->length(__state, __extbuf_,
|
||||||
codecvt_base::result __r;
|
__extbufnext_,
|
||||||
const char_type* __e = this->gptr();
|
this->gptr() - this->eback());
|
||||||
char* __extbe;
|
__c += __extbufnext_ - __extbuf_ - __off;
|
||||||
do
|
__update_st = true;
|
||||||
{
|
|
||||||
__r = __cv_->out(__st_, __e, this->egptr(), __e,
|
|
||||||
__extbuf_, __extbuf_ + __ebs_, __extbe);
|
|
||||||
switch (__r)
|
|
||||||
{
|
|
||||||
case codecvt_base::noconv:
|
|
||||||
__c += this->egptr() - this->gptr();
|
|
||||||
break;
|
|
||||||
case codecvt_base::ok:
|
|
||||||
case codecvt_base::partial:
|
|
||||||
__c += __extbe - __extbuf_;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} while (__r == codecvt_base::partial);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if defined(_WIN32) || defined(_NEWLIB_VERSION)
|
||||||
|
if (fseek(__file_, -__c, SEEK_CUR))
|
||||||
|
return -1;
|
||||||
|
#else
|
||||||
if (fseeko(__file_, -__c, SEEK_CUR))
|
if (fseeko(__file_, -__c, SEEK_CUR))
|
||||||
return -1;
|
return -1;
|
||||||
|
#endif
|
||||||
|
if (__update_st)
|
||||||
|
__st_ = __state;
|
||||||
|
__extbufnext_ = __extbufend_ = __extbuf_;
|
||||||
this->setg(0, 0, 0);
|
this->setg(0, 0, 0);
|
||||||
__cm_ = 0;
|
__cm_ = 0;
|
||||||
}
|
}
|
||||||
@ -957,7 +998,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
|
|||||||
// basic_ifstream
|
// basic_ifstream
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
class _LIBCPP_VISIBLE basic_ifstream
|
class _LIBCPP_TYPE_VIS_ONLY basic_ifstream
|
||||||
: public basic_istream<_CharT, _Traits>
|
: public basic_istream<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -968,8 +1009,10 @@ public:
|
|||||||
typedef typename traits_type::off_type off_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
|
|
||||||
basic_ifstream();
|
basic_ifstream();
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
|
explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
|
||||||
explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
|
explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
|
||||||
|
#endif
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
basic_ifstream(basic_ifstream&& __rhs);
|
basic_ifstream(basic_ifstream&& __rhs);
|
||||||
#endif
|
#endif
|
||||||
@ -981,8 +1024,10 @@ public:
|
|||||||
|
|
||||||
basic_filebuf<char_type, traits_type>* rdbuf() const;
|
basic_filebuf<char_type, traits_type>* rdbuf() const;
|
||||||
bool is_open() const;
|
bool is_open() const;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
void open(const char* __s, ios_base::openmode __mode = ios_base::in);
|
void open(const char* __s, ios_base::openmode __mode = ios_base::in);
|
||||||
void open(const string& __s, ios_base::openmode __mode = ios_base::in);
|
void open(const string& __s, ios_base::openmode __mode = ios_base::in);
|
||||||
|
#endif
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -996,6 +1041,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
|
basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
|
||||||
@ -1013,6 +1059,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
|
|||||||
if (__sb_.open(__s, __mode | ios_base::in) == 0)
|
if (__sb_.open(__s, __mode | ios_base::in) == 0)
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
@ -1070,6 +1117,7 @@ basic_ifstream<_CharT, _Traits>::is_open() const
|
|||||||
return __sb_.is_open();
|
return __sb_.is_open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
void
|
void
|
||||||
basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||||
@ -1089,6 +1137,7 @@ basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mo
|
|||||||
else
|
else
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
@ -1102,7 +1151,7 @@ basic_ifstream<_CharT, _Traits>::close()
|
|||||||
// basic_ofstream
|
// basic_ofstream
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
class _LIBCPP_VISIBLE basic_ofstream
|
class _LIBCPP_TYPE_VIS_ONLY basic_ofstream
|
||||||
: public basic_ostream<_CharT, _Traits>
|
: public basic_ostream<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -1126,8 +1175,10 @@ public:
|
|||||||
|
|
||||||
basic_filebuf<char_type, traits_type>* rdbuf() const;
|
basic_filebuf<char_type, traits_type>* rdbuf() const;
|
||||||
bool is_open() const;
|
bool is_open() const;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
void open(const char* __s, ios_base::openmode __mode = ios_base::out);
|
void open(const char* __s, ios_base::openmode __mode = ios_base::out);
|
||||||
void open(const string& __s, ios_base::openmode __mode = ios_base::out);
|
void open(const string& __s, ios_base::openmode __mode = ios_base::out);
|
||||||
|
#endif
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1141,6 +1192,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
|
basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
|
||||||
@ -1158,6 +1210,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
|
|||||||
if (__sb_.open(__s, __mode | ios_base::out) == 0)
|
if (__sb_.open(__s, __mode | ios_base::out) == 0)
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
@ -1215,6 +1268,7 @@ basic_ofstream<_CharT, _Traits>::is_open() const
|
|||||||
return __sb_.is_open();
|
return __sb_.is_open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
void
|
void
|
||||||
basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||||
@ -1234,6 +1288,7 @@ basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mo
|
|||||||
else
|
else
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
@ -1247,7 +1302,7 @@ basic_ofstream<_CharT, _Traits>::close()
|
|||||||
// basic_fstream
|
// basic_fstream
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
class _LIBCPP_VISIBLE basic_fstream
|
class _LIBCPP_TYPE_VIS_ONLY basic_fstream
|
||||||
: public basic_iostream<_CharT, _Traits>
|
: public basic_iostream<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -1258,8 +1313,10 @@ public:
|
|||||||
typedef typename traits_type::off_type off_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
|
|
||||||
basic_fstream();
|
basic_fstream();
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||||
explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||||
|
#endif
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
basic_fstream(basic_fstream&& __rhs);
|
basic_fstream(basic_fstream&& __rhs);
|
||||||
#endif
|
#endif
|
||||||
@ -1271,8 +1328,10 @@ public:
|
|||||||
|
|
||||||
basic_filebuf<char_type, traits_type>* rdbuf() const;
|
basic_filebuf<char_type, traits_type>* rdbuf() const;
|
||||||
bool is_open() const;
|
bool is_open() const;
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||||
void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||||
|
#endif
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1286,6 +1345,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
|
basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
|
||||||
@ -1303,6 +1363,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
|
|||||||
if (__sb_.open(__s, __mode) == 0)
|
if (__sb_.open(__s, __mode) == 0)
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
@ -1360,6 +1421,7 @@ basic_fstream<_CharT, _Traits>::is_open() const
|
|||||||
return __sb_.is_open();
|
return __sb_.is_open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
void
|
void
|
||||||
basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||||
@ -1379,6 +1441,7 @@ basic_fstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mod
|
|||||||
else
|
else
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user