Compare commits
717 Commits
release_30
...
release_34
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
532b0b423c | ||
|
|
8070ded699 | ||
|
|
59a3ba57d0 | ||
|
|
e356070e1a | ||
|
|
971d716332 | ||
|
|
efe0484110 | ||
|
|
306553d2b0 | ||
|
|
f01e998923 | ||
|
|
ea97ae3eed | ||
|
|
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://llvm-reviews.chandlerc.com/"
|
||||||
|
}
|
||||||
144
CMakeLists.txt
144
CMakeLists.txt
@@ -14,9 +14,9 @@ set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
|
|||||||
|
|
||||||
# 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,6 +26,10 @@ 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."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||||
|
set(LIBCXX_BUILT_STANDALONE 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Setup CMake Options
|
# Setup CMake Options
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
@@ -38,6 +42,15 @@ option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
|
|||||||
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_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_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
||||||
|
option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
|
||||||
|
|
||||||
|
set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++)
|
||||||
|
if (NOT DEFINED LIBCXX_CXX_ABI)
|
||||||
|
set(LIBCXX_CXX_ABI "none")
|
||||||
|
endif()
|
||||||
|
set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
|
||||||
|
"Specify C++ ABI library to use." FORCE)
|
||||||
|
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Configure System
|
# Configure System
|
||||||
@@ -58,6 +71,100 @@ get_target_triple(LIBCXX_TARGET_TRIPLE
|
|||||||
)
|
)
|
||||||
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
|
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# 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
|
||||||
|
# abilibs : A list of libraries 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 abipathvar abidefines abilibs abifiles abidirs)
|
||||||
|
list(APPEND LIBCXX_CXX_FEATURE_FLAGS ${abidefines})
|
||||||
|
set(${abipathvar} "${${abipathvar}}"
|
||||||
|
CACHE STRINGS
|
||||||
|
"Paths to ABI include directories separate by ';'."
|
||||||
|
)
|
||||||
|
set(LIBCXX_CXX_ABI_LIBRARIES ${abilibs})
|
||||||
|
set(LIBCXX_ABILIB_FILES ${abifiles})
|
||||||
|
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
|
||||||
|
foreach(_d ${abidirs})
|
||||||
|
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/${_d}")
|
||||||
|
endforeach()
|
||||||
|
set(LIBCXX_ABILIB_FILE_PATHS)
|
||||||
|
foreach(fpath ${LIBCXX_ABILIB_FILES})
|
||||||
|
set(found FALSE)
|
||||||
|
foreach(incpath ${${abipathvar}})
|
||||||
|
if (EXISTS "${incpath}/${fpath}")
|
||||||
|
set(found TRUE)
|
||||||
|
get_filename_component(dstdir ${fpath} PATH)
|
||||||
|
get_filename_component(ifile ${fpath} NAME)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${CMAKE_BINARY_DIR}/include/${dstdir}/${ifile}"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
"${incpath}/${fpath}"
|
||||||
|
"${CMAKE_BINARY_DIR}/include/${dstdir}"
|
||||||
|
MAIN_DEPENDENCY "${incpath}/${fpath}"
|
||||||
|
)
|
||||||
|
list(APPEND LIBCXX_CXX_ABI_DEPS
|
||||||
|
"${CMAKE_BINARY_DIR}/include/${dstdir}/${ifile}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if (NOT found)
|
||||||
|
message(FATAL_ERROR "Failed to find ${fpath}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
add_custom_target(abilib_headers DEPENDS ${LIBCXX_CXX_ABI_DEPS})
|
||||||
|
set(LIBCXX_CXX_ABI_DEPS abilib_headers)
|
||||||
|
include_directories("${CMAKE_BINARY_DIR}/include")
|
||||||
|
install(DIRECTORY "${CMAKE_BINARY_DIR}/include/"
|
||||||
|
DESTINATION include/c++/v1
|
||||||
|
FILES_MATCHING
|
||||||
|
PATTERN "*"
|
||||||
|
)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++" OR
|
||||||
|
"${LIBCXX_CXX_ABI}" 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}" STREQUAL "libstdc++")
|
||||||
|
set(_LIBSUPCXX_DEFINES "-DLIBSTDCXX")
|
||||||
|
set(_LIBSUPCXX_LIBNAME stdc++)
|
||||||
|
else()
|
||||||
|
set(_LIBSUPCXX_DEFINES "")
|
||||||
|
set(_LIBSUPCXX_LIBNAME supc++)
|
||||||
|
endif()
|
||||||
|
setup_abi_lib("LIBCXX_LIBSUPCXX_INCLUDE_PATHS"
|
||||||
|
"-D__GLIBCXX__ ${_LIBSUPCXX_DEFINES}"
|
||||||
|
"${_LIBSUPCXX_LIBNAME}" "${_LIBSUPCXX_INCLUDE_FILES}" "bits"
|
||||||
|
)
|
||||||
|
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi")
|
||||||
|
setup_abi_lib("LIBCXX_LIBCXXABI_INCLUDE_PATHS" ""
|
||||||
|
"c++abi" "cxxabi.h" ""
|
||||||
|
)
|
||||||
|
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxrt")
|
||||||
|
setup_abi_lib("LIBCXX_LIBCXXRT_INCLUDE_PATHS" "-DLIBCXXRT"
|
||||||
|
"cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""
|
||||||
|
)
|
||||||
|
elseif (NOT "${LIBCXX_CXX_ABI}" STREQUAL "none")
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Currently libstdc++, libsupc++, libcxxabi, libcxxrt and none are "
|
||||||
|
"supported for c++ abi."
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
# Configure compiler.
|
# Configure compiler.
|
||||||
include(config-ix)
|
include(config-ix)
|
||||||
|
|
||||||
@@ -87,17 +194,24 @@ macro(append_if list condition var)
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Get warning flags
|
# Get warning flags
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
|
if (NOT MSVC)
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
|
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
|
set(LIBCXX_CXX_REQUIRED_FLAGS, -Werror=return-type)
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
|
endif()
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
|
|
||||||
|
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
|
||||||
|
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
|
||||||
|
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
|
||||||
|
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
|
||||||
if (LIBCXX_ENABLE_WERROR)
|
if (LIBCXX_ENABLE_WERROR)
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
|
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
|
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
|
||||||
|
else()
|
||||||
|
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_ERROR_FLAG -Wno-error)
|
||||||
|
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_NO_WX_FLAG -WX-)
|
||||||
endif()
|
endif()
|
||||||
if (LIBCXX_ENABLE_PEDANTIC)
|
if (LIBCXX_ENABLE_PEDANTIC)
|
||||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
|
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Get feature flags.
|
# Get feature flags.
|
||||||
@@ -119,7 +233,8 @@ if (NOT LIBCXX_ENABLE_RTTI)
|
|||||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
|
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
|
||||||
endif()
|
endif()
|
||||||
# Assert
|
# Assert
|
||||||
if (LLVM_ENABLE_ASSERTIONS)
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
|
||||||
|
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)
|
if (NOT MSVC)
|
||||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
|
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
|
||||||
@@ -134,8 +249,16 @@ else()
|
|||||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
|
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
# Static library
|
||||||
|
if (NOT LIBCXX_ENABLE_SHARED)
|
||||||
|
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_BUILD_STATIC)
|
||||||
|
endif()
|
||||||
|
|
||||||
# This is the _ONLY_ place where add_definitions is called.
|
# This is the _ONLY_ place where add_definitions is called.
|
||||||
|
if (MSVC)
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_definitions(
|
add_definitions(
|
||||||
${LIBCXX_CXX_REQUIRED_FLAGS}
|
${LIBCXX_CXX_REQUIRED_FLAGS}
|
||||||
${LIBCXX_CXX_WARNING_FLAGS}
|
${LIBCXX_CXX_WARNING_FLAGS}
|
||||||
@@ -147,6 +270,7 @@ add_definitions(
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
|
add_subdirectory(include)
|
||||||
|
|
||||||
# Add source code. This also contains all of the logic for deciding linker flags
|
# Add source code. This also contains all of the logic for deciding linker flags
|
||||||
# soname, etc...
|
# soname, etc...
|
||||||
|
|||||||
117
CREDITS.TXT
117
CREDITS.TXT
@@ -8,27 +8,116 @@ 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: Dimitry Andric
|
||||||
E: marshall@idio.com
|
E: dimitry@andric.com
|
||||||
E: mclow@qualcomm.com
|
D: Visibility fixes, minor FreeBSD portability patches.
|
||||||
D: Minor patches and bug fixes.
|
|
||||||
|
|
||||||
N: Bjorn Reese
|
N: Holger Arnold
|
||||||
E: breese@users.sourceforge.net
|
E: holgerar@gmail.com
|
||||||
D: Initial regex prototype
|
D: Minor fix.
|
||||||
|
|
||||||
N: David Chisnall
|
|
||||||
E: theraven at theravensnest dot org
|
|
||||||
D: FreeBSD port and libcxxrt support.
|
|
||||||
|
|
||||||
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: 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: 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: 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-2013 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-2013 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
|
||||||
|
|||||||
60
Makefile
60
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,25 @@ 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=support .) | \
|
||||||
|
(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
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ 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(-Wno-long-long LIBCXX_HAS_WNO_LONG_LONG_FLAG)
|
||||||
check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG)
|
check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG)
|
||||||
check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG)
|
check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG)
|
||||||
|
check_cxx_compiler_flag(-Wno-error LIBCXX_HAS_WNO_ERROR_FLAG)
|
||||||
check_cxx_compiler_flag(-fno-exceptions LIBCXX_HAS_FNO_EXCEPTIONS_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(-fno-rtti LIBCXX_HAS_FNO_RTTI_FLAG)
|
||||||
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
|
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
|
||||||
|
check_cxx_compiler_flag(/WX- LIBCXX_HAS_NO_WX_FLAG)
|
||||||
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
|
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
|
||||||
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_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(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
|
||||||
|
|||||||
16
include/CMakeLists.txt
Normal file
16
include/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
|
||||||
|
set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(COPY .
|
||||||
|
DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1"
|
||||||
|
FILES_MATCHING
|
||||||
|
PATTERN "*"
|
||||||
|
PATTERN "CMakeLists.txt" EXCLUDE
|
||||||
|
PATTERN ".svn" EXCLUDE
|
||||||
|
${LIBCXX_SUPPORT_HEADER_PATTERN}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1/"
|
||||||
|
DESTINATION include/c++/v1/
|
||||||
|
)
|
||||||
@@ -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 _It(__first.__seg_, __first.__ctz_ + __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 _It(__first.__seg_, __first.__ctz_ + __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,20 +690,20 @@ 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(__first, __last, __result);
|
||||||
}
|
}
|
||||||
@@ -850,34 +873,40 @@ 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;
|
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 +914,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 +931,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 +952,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 +976,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 +1034,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 +1077,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 +1222,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 +1260,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
|
||||||
|
|||||||
384
include/__config
384
include/__config
@@ -11,9 +11,15 @@
|
|||||||
#ifndef _LIBCPP_CONFIG
|
#ifndef _LIBCPP_CONFIG
|
||||||
#define _LIBCPP_CONFIG
|
#define _LIBCPP_CONFIG
|
||||||
|
|
||||||
|
#if !defined(_MSC_VER) || defined(__clang__)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _LIBCPP_VERSION 1001
|
#ifdef __GNUC__
|
||||||
|
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _LIBCPP_VERSION 1101
|
||||||
|
|
||||||
#define _LIBCPP_ABI_VERSION 1
|
#define _LIBCPP_ABI_VERSION 1
|
||||||
|
|
||||||
@@ -45,17 +51,61 @@
|
|||||||
# 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 (GCC or MSVC)
|
||||||
# if (defined(_MSC_VER) && _MSC_VER >= 1400) || (__GNUC__ >= 4 && __GNUC_MINOR__ > 3)
|
# if defined(__clang__) \
|
||||||
# define _LIBCP_HAS_IS_BASE_OF
|
|| (defined(_MSC_VER) && _MSC_VER >= 1400) \
|
||||||
|
|| (defined(__GNUC__) && _GNUC_VER > 403)
|
||||||
|
# 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 __linux__
|
||||||
|
# if defined(__GNUC__) && _GNUC_VER >= 403
|
||||||
|
# define _LIBCPP_HAS_IS_BASE_OF
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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(_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,32 +119,98 @@
|
|||||||
# 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 __has_attribute
|
||||||
|
#define __has_attribute(__x) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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__))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _LIBCPP_EXCEPTION_ABI
|
#ifndef _LIBCPP_EXCEPTION_ABI
|
||||||
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
|
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
|
||||||
#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__)
|
||||||
|
|
||||||
|
#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
|
||||||
@@ -116,17 +232,23 @@ 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
|
||||||
|
|
||||||
|
#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 +291,7 @@ 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
|
#endif
|
||||||
|
|
||||||
// Objective-C++ features (opt-in)
|
// Objective-C++ features (opt-in)
|
||||||
@@ -179,22 +301,28 @@ 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
|
#endif
|
||||||
|
|
||||||
// Inline namespaces are available in Clang regardless of C++ dialect.
|
|
||||||
#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 {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !(__has_feature(cxx_constexpr))
|
#if !(__has_feature(cxx_constexpr))
|
||||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#define _LIBCPP_HAS_QUICK_EXIT
|
||||||
|
#define _LIBCPP_HAS_C11_FEATURES
|
||||||
|
#elif defined(__linux__)
|
||||||
|
#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
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (__has_feature(cxx_noexcept))
|
#if (__has_feature(cxx_noexcept))
|
||||||
# define _NOEXCEPT noexcept
|
# define _NOEXCEPT noexcept
|
||||||
# define _NOEXCEPT_(x) noexcept(x)
|
# define _NOEXCEPT_(x) noexcept(x)
|
||||||
@@ -207,11 +335,22 @@ namespace std {
|
|||||||
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
|
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// end defined(__clang__)
|
// Inline namespaces are available in Clang regardless of C++ dialect.
|
||||||
|
#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 {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#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))
|
||||||
|
|
||||||
#if !__EXCEPTIONS
|
#if !__EXCEPTIONS
|
||||||
#define _LIBCPP_NO_EXCEPTIONS
|
#define _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -241,15 +380,15 @@ namespace std {
|
|||||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||||
|
|
||||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
#if _GNUC_VER < 403
|
||||||
#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_ADVANCED_SFINAE
|
||||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||||
@@ -257,9 +396,9 @@ 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_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_NULLPTR
|
#define _LIBCPP_HAS_NO_NULLPTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -275,7 +414,63 @@ namespace _LIBCPP_NAMESPACE {
|
|||||||
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(__GNUC__)
|
#elif defined(_LIBCPP_MSVC)
|
||||||
|
|
||||||
|
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||||
|
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
|
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
|
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
|
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||||
|
#define __alignof__ __alignof
|
||||||
|
#define _LIBCPP_NORETURN __declspec(noreturn)
|
||||||
|
#define _ALIGNAS(x) __declspec(align(x))
|
||||||
|
#define _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
|
#define _NOEXCEPT throw()
|
||||||
|
#define _NOEXCEPT_(x)
|
||||||
|
|
||||||
|
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
|
||||||
|
#define _LIBCPP_END_NAMESPACE_STD }
|
||||||
|
#define _VSTD std
|
||||||
|
|
||||||
|
# define _LIBCPP_WEAK
|
||||||
|
namespace std {
|
||||||
|
}
|
||||||
|
|
||||||
|
#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 _NOEXCEPT throw()
|
||||||
|
#define _NOEXCEPT_(x)
|
||||||
|
|
||||||
|
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||||
|
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||||
|
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||||
|
#define _LIBCPP_HAS_NO_NULLPTR
|
||||||
|
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
|
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||||
|
#define _LIBCPP_HAS_IS_BASE_OF
|
||||||
|
|
||||||
|
#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 {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __clang__ || __GNUC___ || _MSC_VER || __IBMCPP__
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
|
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
typedef unsigned short char16_t;
|
typedef unsigned short char16_t;
|
||||||
@@ -298,39 +493,128 @@ template <unsigned> struct __static_assert_check {};
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
#define constexpr const
|
#define _LIBCPP_CONSTEXPR
|
||||||
|
#else
|
||||||
|
#define _LIBCPP_CONSTEXPR constexpr
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||||
|
#define _LIBCPP_DEFAULT {}
|
||||||
|
#else
|
||||||
|
#define _LIBCPP_DEFAULT = default;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define _NOALIAS __attribute__((__malloc__))
|
||||||
|
#else
|
||||||
|
#define _NOALIAS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __has_feature
|
#ifndef __has_feature
|
||||||
#define __has_feature(__x) 0
|
#define __has_feature(__x) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __APPLE__ || __FreeBSD__ || _WIN32
|
#if __has_feature(cxx_explicit_conversions)
|
||||||
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
# define _LIBCPP_EXPLICIT explicit
|
||||||
|
#else
|
||||||
|
# define _LIBCPP_EXPLICIT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __APPLE__ || __FreeBSD__
|
#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(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_EXTERN_TEMPLATE2
|
||||||
|
#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__)
|
||||||
|
#define _LIBCPP_LOCALE__L_EXTENSIONS 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
|
#if defined(__APPLE__)
|
||||||
# if _LIBCPP_DEBUG2 == 0
|
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
||||||
# define _LIBCPP_DEBUG_LEVEL 1
|
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 0
|
||||||
# elif _LIBCPP_DEBUG2 == 1
|
#endif
|
||||||
# define _LIBCPP_DEBUG_LEVEL 2
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
||||||
|
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_STD_VER
|
||||||
|
# if __cplusplus <= 201103L
|
||||||
|
# define _LIBCPP_STD_VER 11
|
||||||
# else
|
# else
|
||||||
# error Supported values for _LIBCPP_DEBUG2 are 0 and 1
|
# define _LIBCPP_STD_VER 13 // current year, or date of c++14 ratification
|
||||||
|
# endif
|
||||||
|
#endif // _LIBCPP_STD_VER
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
#define _LIBCPP_DEPRECATED [[deprecated]]
|
||||||
|
#else
|
||||||
|
#define _LIBCPP_DEPRECATED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER <= 11
|
||||||
|
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
|
#define _LIBCPP_EXPLICIT_AFTER_CXX11
|
||||||
|
#define _LIBCPP_DEPRECATED_AFTER_CXX11
|
||||||
|
#else
|
||||||
|
#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
|
||||||
|
#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
|
||||||
|
#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
|
||||||
|
#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(__GNUG__) && (__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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _LIBCPP_DEBUG2
|
#ifndef _LIBCPP_WEAK
|
||||||
# include <__debug>
|
# define _LIBCPP_WEAK __attribute__((__weak__))
|
||||||
#else
|
|
||||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _LIBCPP_CONFIG
|
#endif // _LIBCPP_CONFIG
|
||||||
|
|||||||
@@ -11,12 +11,18 @@
|
|||||||
#ifndef _LIBCPP_DEBUG_H
|
#ifndef _LIBCPP_DEBUG_H
|
||||||
#define _LIBCPP_DEBUG_H
|
#define _LIBCPP_DEBUG_H
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 1
|
#if _LIBCPP_DEBUG_LEVEL >= 1
|
||||||
|
|
||||||
# include <cstdlib>
|
# include <cstdlib>
|
||||||
# include <cstdio>
|
# include <cstdio>
|
||||||
# include <cstddef>
|
# include <cstddef>
|
||||||
|
# ifndef _LIBCPP_ASSERT
|
||||||
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
|
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
|
||||||
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -24,23 +30,30 @@
|
|||||||
|
|
||||||
_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 +61,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 +103,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 +113,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 +123,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 +133,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 +148,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 +196,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,39 +15,116 @@
|
|||||||
#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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#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;}
|
||||||
|
};
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <>
|
||||||
|
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
|
||||||
|
{ return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
|
||||||
|
typedef void is_transparent;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// addressof
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_Tp*
|
||||||
|
addressof(_Tp& __x) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
|
||||||
|
// Objective-C++ Automatic Reference Counting uses qualified pointers
|
||||||
|
// that require special addressof() signatures. When
|
||||||
|
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
|
||||||
|
// itself is providing these definitions. Otherwise, we provide them.
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
__strong _Tp*
|
||||||
|
addressof(__strong _Tp& __x) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return &__x;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
__weak _Tp*
|
||||||
|
addressof(__weak _Tp& __x) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return &__x;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
__autoreleasing _Tp*
|
||||||
|
addressof(__autoreleasing _Tp& __x) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return &__x;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
__unsafe_unretained _Tp*
|
||||||
|
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
|
||||||
|
{
|
||||||
|
return &__x;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
#include <__functional_base_03>
|
#include <__functional_base_03>
|
||||||
@@ -60,11 +137,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 +151,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 +206,175 @@ 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>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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;
|
||||||
};
|
};
|
||||||
|
|
||||||
// __invoke
|
// __invoke
|
||||||
|
|
||||||
// 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 +382,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,13 +404,13 @@ __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>
|
||||||
@@ -339,7 +420,7 @@ struct __invoke_return
|
|||||||
};
|
};
|
||||||
|
|
||||||
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 +431,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
|
||||||
@@ -409,13 +491,13 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
|||||||
#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 +505,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
147
include/__locale
147
include/__locale
@@ -19,27 +19,38 @@
|
|||||||
#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 _AIX
|
||||||
|
# include <support/ibm/xlocale.h>
|
||||||
|
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)
|
||||||
# include <xlocale.h>
|
# include <xlocale.h>
|
||||||
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
|
#endif // _WIN32 || __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 +105,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 +121,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 +177,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 +249,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 +283,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 +314,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__
|
#ifdef __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 +329,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,11 +341,13 @@ 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__)
|
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
|
||||||
#if __APPLE__
|
#ifdef __APPLE__
|
||||||
typedef __uint32_t mask;
|
typedef __uint32_t mask;
|
||||||
#elif __FreeBSD__
|
#elif defined(__FreeBSD__)
|
||||||
typedef unsigned long mask;
|
typedef unsigned long mask;
|
||||||
|
#elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
|
||||||
|
typedef unsigned short mask;
|
||||||
#endif
|
#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;
|
||||||
@@ -345,8 +358,24 @@ 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;
|
||||||
|
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ || __EMSCRIPTEN__ || __sun__
|
||||||
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;
|
||||||
@@ -365,10 +394,10 @@ public:
|
|||||||
_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 +499,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 +512,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 +527,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 +536,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 +598,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 +621,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 +642,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 +773,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 +782,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 +873,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 +956,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 +1042,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 +1128,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 +1147,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 +1244,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 +1336,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 +1370,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 +1402,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 +1423,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:
|
||||||
|
|||||||
@@ -16,27 +16,23 @@
|
|||||||
#include <system_error>
|
#include <system_error>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#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
|
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 +41,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 +91,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 +102,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 +137,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 +152,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 +165,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 +180,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 +251,33 @@ 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
|
struct _LIBCPP_TYPE_VIS cv_status
|
||||||
{
|
{
|
||||||
enum _ {
|
enum __lx {
|
||||||
no_timeout,
|
no_timeout,
|
||||||
timeout
|
timeout
|
||||||
};
|
};
|
||||||
|
|
||||||
_ __v_;
|
__lx __v_;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {}
|
_LIBCPP_INLINE_VISIBILITY cv_status(__lx __v) : __v_(__v) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
|
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
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 +285,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);
|
||||||
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,
|
||||||
@@ -369,28 +346,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,9 +376,17 @@ 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();
|
||||||
|
if (_Max - __d > __s_now)
|
||||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
|
__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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
@@ -91,7 +95,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);
|
||||||
@@ -129,8 +133,10 @@ public:
|
|||||||
|
|
||||||
_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,7 +154,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
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -167,7 +173,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT
|
static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -279,16 +285,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 _LIBCPP_INLINE_VISIBILITY
|
||||||
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 _LIBCPP_INLINE_VISIBILITY
|
||||||
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 +302,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 +320,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 +328,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 _LIBCPP_INLINE_VISIBILITY
|
||||||
__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 _LIBCPP_INLINE_VISIBILITY
|
||||||
__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 _LIBCPP_INLINE_VISIBILITY
|
||||||
__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 +394,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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,7 +492,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 +523,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 +541,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 +556,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 +587,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 +620,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 +640,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,26 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <new>
|
#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 _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,14 +43,14 @@ 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_;
|
||||||
|
|||||||
@@ -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,18 +178,28 @@ 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()))
|
||||||
|
{
|
||||||
|
if (!__last_consumed_is_next_)
|
||||||
|
{
|
||||||
|
__c = __last_consumed_;
|
||||||
|
__last_consumed_is_next_ = !traits_type::eq_int_type(__last_consumed_,
|
||||||
|
traits_type::eof());
|
||||||
|
}
|
||||||
return __c;
|
return __c;
|
||||||
|
}
|
||||||
|
if (__last_consumed_is_next_)
|
||||||
|
{
|
||||||
char __extbuf[__limit];
|
char __extbuf[__limit];
|
||||||
char* __enxt;
|
char* __enxt;
|
||||||
const char_type __ci = traits_type::to_char_type(__c);
|
const char_type __ci = traits_type::to_char_type(__last_consumed_);
|
||||||
const char_type* __inxt;
|
const char_type* __inxt;
|
||||||
switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt,
|
switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt,
|
||||||
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
|
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
|
||||||
{
|
{
|
||||||
case _VSTD::codecvt_base::ok:
|
case _VSTD::codecvt_base::ok:
|
||||||
break;
|
break;
|
||||||
case _VSTD::codecvt_base::noconv:
|
case _VSTD::codecvt_base::noconv:
|
||||||
__extbuf[0] = static_cast<char>(__c);
|
__extbuf[0] = static_cast<char>(__last_consumed_);
|
||||||
__enxt = __extbuf + 1;
|
__enxt = __extbuf + 1;
|
||||||
break;
|
break;
|
||||||
case codecvt_base::partial:
|
case codecvt_base::partial:
|
||||||
@@ -179,7 +209,10 @@ __stdinbuf<_CharT>::pbackfail(int_type __c)
|
|||||||
while (__enxt > __extbuf)
|
while (__enxt > __extbuf)
|
||||||
if (ungetc(*--__enxt, __file_) == EOF)
|
if (ungetc(*--__enxt, __file_) == EOF)
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
return traits_type::not_eof(__c);
|
}
|
||||||
|
__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,31 @@ __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;
|
||||||
|
char_type* epptr = pptr;
|
||||||
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 +298,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 +331,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);
|
||||||
|
|||||||
244
include/__tree
244
include/__tree
@@ -17,23 +17,25 @@
|
|||||||
#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>
|
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||||
class _LIBCPP_VISIBLE map;
|
class _LIBCPP_TYPE_VIS_ONLY map;
|
||||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||||
class _LIBCPP_VISIBLE multimap;
|
class _LIBCPP_TYPE_VIS_ONLY multimap;
|
||||||
template <class _Key, class _Compare, class _Allocator>
|
template <class _Key, class _Compare, class _Allocator>
|
||||||
class _LIBCPP_VISIBLE set;
|
class _LIBCPP_TYPE_VIS_ONLY set;
|
||||||
template <class _Key, class _Compare, class _Allocator>
|
template <class _Key, class _Compare, class _Allocator>
|
||||||
class _LIBCPP_VISIBLE multiset;
|
class _LIBCPP_TYPE_VIS_ONLY multiset;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -612,11 +614,11 @@ 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;
|
||||||
@@ -639,10 +641,15 @@ 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++()
|
||||||
@@ -671,20 +678,20 @@ 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 __node::base __node_base;
|
||||||
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<__node_base>
|
rebind<__node_base>
|
||||||
@@ -709,7 +716,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,7 +739,8 @@ 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++()
|
||||||
@@ -757,11 +770,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,8 +790,10 @@ 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 __tree_node<value_type, __void_pointer> __node;
|
||||||
|
typedef __tree_node_base<__void_pointer> __node_base;
|
||||||
typedef typename __alloc_traits::template
|
typedef typename __alloc_traits::template
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
rebind_alloc<__node>
|
rebind_alloc<__node>
|
||||||
@@ -788,9 +803,9 @@ public:
|
|||||||
__node_allocator;
|
__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 +817,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 +841,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 +878,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_(
|
||||||
@@ -930,14 +945,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 +1034,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:
|
||||||
@@ -1100,6 +1115,9 @@ private:
|
|||||||
|
|
||||||
__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>
|
||||||
@@ -1159,7 +1177,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 +1310,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 +1330,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 +1358,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;
|
||||||
@@ -1445,11 +1463,11 @@ __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
|
|||||||
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 +1499,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 +1509,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 +1538,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 +1548,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 +1579,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 +1616,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 +1626,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 +1664,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 +1685,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 +1698,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 +1727,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 +1745,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 +1763,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 +1777,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 +1790,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 +1809,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 +1821,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 +1851,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 _VSTD::move(__h); // explicitly moved for C++03
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
@@ -1852,7 +1870,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 +1887,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 +1900,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 +1911,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 +1925,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 +1942,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 +1954,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 +1965,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,7 +1973,7 @@ 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)
|
||||||
@@ -1975,7 +1993,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 +2069,7 @@ 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;
|
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)
|
||||||
@@ -2158,7 +2176,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 +2189,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 +2204,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 +2217,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 +2232,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 +2245,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 +2257,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 +2270,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 +2291,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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
|
|||||||
@@ -15,7 +15,9 @@
|
|||||||
#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
|
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
@@ -25,46 +27,46 @@
|
|||||||
|
|
||||||
_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 ..._Tp> class _LIBCPP_TYPE_VIS_ONLY tuple;
|
||||||
template <class _T1, class _T2> class _LIBCPP_VISIBLE pair;
|
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY pair;
|
||||||
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
|
template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY array;
|
||||||
|
|
||||||
template <class _Tp> struct __tuple_like : false_type {};
|
template <class _Tp> struct __tuple_like : false_type {};
|
||||||
|
|
||||||
@@ -77,38 +79,47 @@ 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 <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 _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;
|
||||||
|
|
||||||
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 _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;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@@ -143,7 +154,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 +162,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)>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
@@ -214,7 +225,7 @@ 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<true, __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<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@@ -233,6 +244,33 @@ struct __tuple_convertible<_Tp, _Up, true, true>
|
|||||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
// __tuple_constructible
|
||||||
|
|
||||||
|
template <bool, class _Tp, class _Up>
|
||||||
|
struct __tuple_constructible_imp : public false_type {};
|
||||||
|
|
||||||
|
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||||
|
struct __tuple_constructible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||||
|
: public integral_constant<bool,
|
||||||
|
is_constructible<_Up0, _Tp0>::value &&
|
||||||
|
__tuple_constructible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct __tuple_constructible_imp<true, __tuple_types<>, __tuple_types<> >
|
||||||
|
: public true_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_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||||
|
tuple_size<_Up>::value,
|
||||||
|
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||||
|
{};
|
||||||
|
|
||||||
// __tuple_assignable
|
// __tuple_assignable
|
||||||
|
|
||||||
template <bool, class _Tp, class _Up>
|
template <bool, class _Tp, class _Up>
|
||||||
|
|||||||
@@ -13,12 +13,14 @@
|
|||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
|
|
||||||
|
#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 tuple_size;
|
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_size;
|
||||||
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
|
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_element;
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
|||||||
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
|
||||||
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;
|
||||||
@@ -92,9 +92,9 @@ template <class T> class tuple_size;
|
|||||||
template <int I, class T> class tuple_element;
|
template <int 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 <int 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 <int 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 <int 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 <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
|
||||||
@@ -111,12 +111,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 +173,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 +210,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 +224,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 +232,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 +240,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 +248,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 +256,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 +264,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 +272,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 +285,54 @@ 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> {};
|
: public integral_constant<size_t, _Size> {};
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
class _LIBCPP_VISIBLE tuple_size<const array<_Tp, _Size> >
|
class _LIBCPP_TYPE_VIS_ONLY 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> >
|
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const array<_Tp, _Size> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef const _Tp type;
|
typedef const _Tp type;
|
||||||
};
|
};
|
||||||
|
|
||||||
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 __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]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|||||||
756
include/atomic
756
include/atomic
File diff suppressed because it is too large
Load Diff
101
include/bitset
101
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,12 +168,12 @@ 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_CONSTEXPR __bitset() _NOEXCEPT;
|
||||||
explicit __bitset(unsigned long long __v) _NOEXCEPT;
|
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);}
|
||||||
@@ -190,8 +194,10 @@ protected:
|
|||||||
bool any() const _NOEXCEPT;
|
bool any() const _NOEXCEPT;
|
||||||
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;
|
||||||
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;
|
||||||
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;
|
||||||
@@ -202,14 +208,22 @@ private:
|
|||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_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,17 +236,31 @@ __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_INLINE_VISIBILITY
|
||||||
|
_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 __SIZE_WIDTH__ == 64
|
||||||
|
: __first_{__v}
|
||||||
|
#elif __SIZE_WIDTH__ == 32
|
||||||
|
: __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>
|
||||||
@@ -402,9 +430,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 +441,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,12 +450,12 @@ 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_CONSTEXPR __bitset() _NOEXCEPT;
|
||||||
explicit __bitset(unsigned long long __v) _NOEXCEPT;
|
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);}
|
||||||
@@ -451,6 +479,7 @@ protected:
|
|||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
__bitset<1, _Size>::__bitset() _NOEXCEPT
|
__bitset<1, _Size>::__bitset() _NOEXCEPT
|
||||||
: __first_(0)
|
: __first_(0)
|
||||||
{
|
{
|
||||||
@@ -458,6 +487,7 @@ __bitset<1, _Size>::__bitset() _NOEXCEPT
|
|||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_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))
|
||||||
{
|
{
|
||||||
@@ -545,9 +575,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 +586,23 @@ 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_CONSTEXPR __bitset() _NOEXCEPT;
|
||||||
explicit __bitset(unsigned long long) _NOEXCEPT;
|
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 {}
|
||||||
@@ -591,22 +621,25 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_LIBCPP_CONSTEXPR
|
||||||
__bitset<0, 0>::__bitset() _NOEXCEPT
|
__bitset<0, 0>::__bitset() _NOEXCEPT
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
_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 +648,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,
|
||||||
@@ -643,7 +677,8 @@ public:
|
|||||||
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);}
|
||||||
unsigned long to_ulong() const;
|
unsigned long to_ulong() const;
|
||||||
unsigned long long to_ullong() const;
|
unsigned long long to_ullong() const;
|
||||||
@@ -659,7 +694,7 @@ public:
|
|||||||
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;
|
||||||
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;}
|
||||||
bool operator==(const bitset& __rhs) const _NOEXCEPT;
|
bool operator==(const bitset& __rhs) const _NOEXCEPT;
|
||||||
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;
|
||||||
@@ -691,11 +726,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 +760,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
|
||||||
@@ -1025,7 +1060,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
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,13 @@ int toupper(int c);
|
|||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#if defined(_LIBCPP_MSVCRT)
|
||||||
|
#include "support/win32/support.h"
|
||||||
|
#endif // _LIBCPP_MSVCRT
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ 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
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||||
|
|
||||||
|
|||||||
@@ -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,7 +63,9 @@ 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
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef FLT_EVAL_METHOD
|
#ifndef FLT_EVAL_METHOD
|
||||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||||
|
|||||||
352
include/chrono
352
include/chrono
@@ -20,6 +20,7 @@ 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);
|
||||||
|
|
||||||
@@ -29,9 +30,9 @@ 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 +47,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 +59,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 +68,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 +87,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 +111,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 +146,55 @@ 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
|
// 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 +208,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,7 +222,7 @@ 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);
|
||||||
@@ -223,7 +236,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 +250,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 +259,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 +281,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,7 +312,7 @@ 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,
|
||||||
@@ -302,7 +332,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 +342,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 +354,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 +366,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 +378,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 +390,56 @@ 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> {};
|
||||||
|
|
||||||
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();}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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 +447,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 +467,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 +501,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 +518,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 +529,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 +547,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 +559,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 +570,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 +588,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 +599,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 +610,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 +621,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 +654,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 +699,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 +722,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 +747,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 +760,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,23 +775,23 @@ 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,7 +800,7 @@ 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)
|
||||||
{
|
{
|
||||||
@@ -732,7 +810,7 @@ time_point_cast(const time_point<_Clock, _Duration>& __t)
|
|||||||
// 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 +820,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 +830,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 +840,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 +850,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 +860,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 +870,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 +891,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 +901,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,28 +912,28 @@ 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
|
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;
|
||||||
};
|
};
|
||||||
@@ -866,6 +942,86 @@ typedef steady_clock high_resolution_clock;
|
|||||||
|
|
||||||
} // 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,7 +239,9 @@ 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
|
||||||
|
|
||||||
|
|||||||
@@ -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,7 +38,9 @@ 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
|
||||||
|
|
||||||
|
|||||||
592
include/cmath
592
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
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
#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,19 +111,21 @@ 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
|
||||||
|
|
||||||
_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:
|
||||||
condition_variable_any();
|
condition_variable_any();
|
||||||
|
|
||||||
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);
|
||||||
@@ -159,17 +161,17 @@ condition_variable_any::condition_variable_any()
|
|||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
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 _LIBCPP_INLINE_VISIBILITY
|
||||||
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,8 +188,8 @@ 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()
|
||||||
|
|
||||||
@@ -208,8 +210,8 @@ 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()
|
||||||
|
|
||||||
@@ -246,7 +248,7 @@ 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
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ 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
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef setjmp
|
#ifndef setjmp
|
||||||
#define setjmp(env) setjmp(env)
|
#define setjmp(env) setjmp(env)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ Types:
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.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
|
||||||
|
|
||||||
@@ -54,33 +56,34 @@ typedef long double max_align_t;
|
|||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_NULLPTR
|
#ifdef _LIBCPP_HAS_NO_NULLPTR
|
||||||
|
|
||||||
struct _LIBCPP_VISIBLE nullptr_t
|
struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
|
||||||
{
|
{
|
||||||
void* _;
|
void* __lx;
|
||||||
|
|
||||||
struct __nat {int __for_bool_;};
|
struct __nat {int __for_bool_;};
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {}
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
|
||||||
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
|
||||||
operator _Tp* () const {return 0;}
|
operator _Tp* () const {return 0;}
|
||||||
|
|
||||||
template <class _Tp, class _Up>
|
template <class _Tp, class _Up>
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
operator _Tp _Up::* () const {return 0;}
|
operator _Tp _Up::* () const {return 0;}
|
||||||
|
|
||||||
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
|
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
|
||||||
friend _LIBCPP_ALWAYS_INLINE 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 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 bool operator<=(nullptr_t, nullptr_t) {return true;}
|
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
|
||||||
friend _LIBCPP_ALWAYS_INLINE 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 bool operator>=(nullptr_t, nullptr_t) {return true;}
|
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
||||||
|
|
||||||
#define nullptr _VSTD::__get_nullptr_t()
|
#define nullptr _VSTD::__get_nullptr_t()
|
||||||
|
|
||||||
|
|||||||
@@ -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,26 @@ 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
|
||||||
|
|
||||||
|
// snprintf
|
||||||
|
#if defined(_LIBCPP_MSVCRT)
|
||||||
|
#include "support/win32/support.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef getc
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
|
||||||
|
#undef getc
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
|
||||||
|
#endif // getc
|
||||||
|
|
||||||
|
#ifdef putc
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
|
||||||
|
#undef putc
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
|
||||||
|
#endif // putc
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@@ -124,20 +143,24 @@ 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 ::vscanf;
|
using ::vscanf;
|
||||||
|
using ::vsscanf;
|
||||||
|
#endif // _LIBCPP_MSVCRT
|
||||||
|
using ::vprintf;
|
||||||
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 ::getchar;
|
||||||
|
#if _LIBCPP_STD_VER <= 11
|
||||||
using ::gets;
|
using ::gets;
|
||||||
|
#endif
|
||||||
using ::putc;
|
using ::putc;
|
||||||
using ::putchar;
|
using ::putchar;
|
||||||
using ::puts;
|
using ::puts;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
@@ -81,26 +84,39 @@ size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
|
|||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#ifdef _LIBCPP_MSVCRT
|
||||||
|
#include "support/win32/locale_win32.h"
|
||||||
|
#endif // _LIBCPP_MSVCRT
|
||||||
|
|
||||||
|
#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 +133,39 @@ 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
|
||||||
using ::mblen;
|
using ::mblen;
|
||||||
using ::mbtowc;
|
using ::mbtowc;
|
||||||
using ::wctomb;
|
using ::wctomb;
|
||||||
using ::mbstowcs;
|
using ::mbstowcs;
|
||||||
using ::wcstombs;
|
using ::wcstombs;
|
||||||
|
#ifdef _LIBCPP_HAS_QUICK_EXIT
|
||||||
|
using ::at_quick_exit;
|
||||||
|
using ::quick_exit;
|
||||||
|
#endif
|
||||||
|
#ifdef _LIBCPP_HAS_C11_FEATURES
|
||||||
|
using ::aligned_alloc;
|
||||||
|
#endif
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) {return labs(__x);}
|
// MSVCRT already has the correct prototype in <stdlib.h> #ifdef __cplusplus
|
||||||
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
|
#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
|
||||||
|
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
|
||||||
|
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) {return ldiv(__x, __y);}
|
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
|
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
|
||||||
|
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||||
|
#endif // _LIBCPP_MSVCRT
|
||||||
|
|
||||||
_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);}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -106,11 +106,13 @@ 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
|
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||||
#include <support/win32/support.h> // pull in *swprintf defines
|
#include <support/win32/support.h> // pull in *swprintf defines
|
||||||
#endif // _WIN32
|
#endif // _LIBCPP_MSVCRT
|
||||||
|
|
||||||
|
#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,13 +124,15 @@ 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;
|
||||||
using ::vswscanf;
|
|
||||||
using ::vwprintf;
|
using ::vwprintf;
|
||||||
|
#ifndef _LIBCPP_MSVCRT
|
||||||
|
using ::swscanf;
|
||||||
|
using ::vfwscanf;
|
||||||
|
using ::vswscanf;
|
||||||
using ::vwscanf;
|
using ::vwscanf;
|
||||||
|
#endif // _LIBCPP_MSVCRT
|
||||||
using ::wprintf;
|
using ::wprintf;
|
||||||
using ::wscanf;
|
using ::wscanf;
|
||||||
using ::fgetwc;
|
using ::fgetwc;
|
||||||
@@ -142,12 +146,18 @@ using ::putwc;
|
|||||||
using ::putwchar;
|
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 +167,37 @@ using ::wcscoll;
|
|||||||
using ::wcsncmp;
|
using ::wcsncmp;
|
||||||
using ::wcsxfrm;
|
using ::wcsxfrm;
|
||||||
|
|
||||||
|
#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
|
||||||
|
|
||||||
|
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;
|
||||||
|
|||||||
@@ -54,7 +54,9 @@ 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
|
||||||
|
|
||||||
|
|||||||
109
include/deque
109
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>
|
||||||
@@ -150,7 +151,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 +163,15 @@ 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 _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>
|
||||||
@@ -258,7 +263,7 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
|
|||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
typedef _MapPointer __map_iterator;
|
typedef _MapPointer __map_iterator;
|
||||||
public:
|
public:
|
||||||
@@ -274,12 +279,16 @@ public:
|
|||||||
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, __block_size>& __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 +414,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>
|
||||||
@@ -911,7 +920,14 @@ protected:
|
|||||||
__pointer_allocator;
|
__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 __alloc_traits::template
|
||||||
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
rebind_alloc<const_pointer>
|
||||||
|
#else
|
||||||
|
rebind_alloc<const_pointer>::other
|
||||||
|
#endif
|
||||||
|
__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,
|
||||||
@@ -984,7 +1000,7 @@ 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
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -1003,7 +1019,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
|
static void __swap_alloc(allocator_type&, allocator_type&, false_type)
|
||||||
_NOEXCEPT
|
_NOEXCEPT
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
@@ -1049,7 +1065,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,7 +1083,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1163,7 +1179,7 @@ __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:
|
||||||
@@ -1194,6 +1210,9 @@ public:
|
|||||||
{}
|
{}
|
||||||
_LIBCPP_INLINE_VISIBILITY deque(const allocator_type& __a) : __base(__a) {}
|
_LIBCPP_INLINE_VISIBILITY 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>
|
||||||
@@ -1337,6 +1356,8 @@ public:
|
|||||||
_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 +1420,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 +1435,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)
|
||||||
{
|
{
|
||||||
@@ -1506,8 +1537,8 @@ deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1529,8 +1560,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());
|
||||||
@@ -1962,6 +1993,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 +2001,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 +2017,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;
|
||||||
@@ -2499,9 +2532,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 +2550,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 +2583,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 +2614,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 +2645,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 +2681,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));
|
||||||
@@ -2778,7 +2811,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 +2820,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 +2828,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 +2836,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 +2844,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 +2852,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 +2860,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)))
|
||||||
|
|||||||
@@ -80,7 +80,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 +105,23 @@ 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;
|
||||||
|
|
||||||
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 +132,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 +142,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 +174,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,7 +187,7 @@ 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<
|
||||||
@@ -204,7 +206,7 @@ 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<
|
||||||
@@ -222,11 +224,11 @@ 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*>(&__e);
|
||||||
@@ -234,11 +236,11 @@ rethrow_if_nested(const _E& __e, typename enable_if<
|
|||||||
__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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
314
include/experimental/dynarray
Normal file
314
include/experimental/dynarray
Normal file
@@ -0,0 +1,314 @@
|
|||||||
|
// -*- 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);
|
||||||
|
template <typename Alloc>
|
||||||
|
dynarray(size_type c, const Alloc& alloc);
|
||||||
|
dynarray(size_type c, const T& v);
|
||||||
|
template <typename Alloc>
|
||||||
|
dynarray(size_type c, const T& v, const Alloc& alloc);
|
||||||
|
dynarray(const dynarray& d);
|
||||||
|
template <typename Alloc>
|
||||||
|
dynarray(const dynarray& d, const Alloc& alloc);
|
||||||
|
dynarray(initializer_list<T>);
|
||||||
|
template <typename Alloc>
|
||||||
|
dynarray(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>
|
||||||
|
|
||||||
|
#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 : __base_(nullptr), __size_(0) {}
|
||||||
|
|
||||||
|
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 *> (::operator new (sizeof(value_type) * count));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept
|
||||||
|
{
|
||||||
|
::operator delete (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.
|
||||||
|
// Waiting for the resolution of LWG issue #2235
|
||||||
|
// template <typename _Alloc>
|
||||||
|
// dynarray(size_type __c, const _Alloc& __alloc);
|
||||||
|
// template <typename _Alloc>
|
||||||
|
// dynarray(size_type __c, const value_type& __v, const _Alloc& __alloc);
|
||||||
|
// template <typename _Alloc>
|
||||||
|
// dynarray(const dynarray& __d, const _Alloc& __alloc);
|
||||||
|
// template <typename _Alloc>
|
||||||
|
// dynarray(initializer_list<value_type>, const _Alloc& __alloc);
|
||||||
|
|
||||||
|
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
|
||||||
699
include/experimental/optional
Normal file
699
include/experimental/optional
Normal file
@@ -0,0 +1,699 @@
|
|||||||
|
// -*- 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
|
||||||
|
|
||||||
|
#include <initializer_list>
|
||||||
|
|
||||||
|
namespace std { namespace experimental {
|
||||||
|
|
||||||
|
// optional for object types
|
||||||
|
template <class T>
|
||||||
|
class optional
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef T value_type;
|
||||||
|
|
||||||
|
// constructors
|
||||||
|
constexpr optional() noexcept;
|
||||||
|
constexpr optional(nullopt_t) noexcept;
|
||||||
|
optional(const optional&);
|
||||||
|
optional(optional&&) noexcept(is_nothrow_move_constructible<T>::value);
|
||||||
|
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&&...);
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
~optional();
|
||||||
|
|
||||||
|
// assignment
|
||||||
|
optional& operator=(nullopt_t) noexcept;
|
||||||
|
optional& operator=(const optional&);
|
||||||
|
optional& operator=(optional&&)
|
||||||
|
noexcept(is_nothrow_move_assignable<T>::value &&
|
||||||
|
is_nothrow_move_constructible<T>::value);
|
||||||
|
template <class U> optional& operator=(U&&);
|
||||||
|
template <class... Args> void emplace(Args&&...);
|
||||||
|
template <class U, class... Args> void emplace(initializer_list<U>, Args&&...);
|
||||||
|
|
||||||
|
// swap
|
||||||
|
void swap(optional&)
|
||||||
|
noexcept(is_nothrow_move_constructible<T>::value &&
|
||||||
|
noexcept(swap(declval<T&>(), declval<T&>())));
|
||||||
|
|
||||||
|
// observers
|
||||||
|
constexpr T const* operator->() const;
|
||||||
|
T* operator->();
|
||||||
|
constexpr T const& operator*() const;
|
||||||
|
T& operator*();
|
||||||
|
constexpr explicit operator bool() const noexcept;
|
||||||
|
constexpr T const& value() const;
|
||||||
|
T& value();
|
||||||
|
template <class U> constexpr T value_or(U&&) const&;
|
||||||
|
template <class U> T value_or(U&&) &&;
|
||||||
|
};
|
||||||
|
|
||||||
|
// In-place construction
|
||||||
|
struct in_place_t{};
|
||||||
|
constexpr in_place_t in_place{};
|
||||||
|
|
||||||
|
// Disengaged state indicator
|
||||||
|
struct nullopt_t{see below};
|
||||||
|
constexpr nullopt_t nullopt(unspecified);
|
||||||
|
|
||||||
|
// class bad_optional_access
|
||||||
|
class bad_optional_access
|
||||||
|
: public logic_error
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit bad_optional_access(const string& what_arg);
|
||||||
|
explicit bad_optional_access(const char* what_arg);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 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>&);
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
// 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>&);
|
||||||
|
|
||||||
|
// Specialized algorithms
|
||||||
|
template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below);
|
||||||
|
template <class T> constexpr optional<typename decay<T>::type> make_optional(T&&);
|
||||||
|
|
||||||
|
// hash support
|
||||||
|
template <class T> struct hash;
|
||||||
|
template <class T> struct hash<optional<T>>;
|
||||||
|
|
||||||
|
}} // std::experimental
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <__config>
|
||||||
|
#include <functional>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
namespace std { namespace experimental {
|
||||||
|
|
||||||
|
class _LIBCPP_EXCEPTION_ABI bad_optional_access
|
||||||
|
: public logic_error
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
_LIBCPP_INLINE_VISIBILITY explicit bad_optional_access(const string& __arg)
|
||||||
|
: logic_error(__arg) {}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY explicit bad_optional_access(const char* __arg)
|
||||||
|
: logic_error(__arg) {}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY bad_optional_access(const bad_optional_access&) noexcept = default;
|
||||||
|
_LIBCPP_INLINE_VISIBILITY bad_optional_access& operator=(const bad_optional_access&) noexcept = default;
|
||||||
|
#else
|
||||||
|
private:
|
||||||
|
bad_optional_access(const bad_optional_access&);
|
||||||
|
bad_optional_access& operator=(const bad_optional_access&);
|
||||||
|
public:
|
||||||
|
#endif // _LIBCPP_STD_VER > 11
|
||||||
|
// Get the key function ~bad_optional_access() into the dylib even if not compiling for C++1y
|
||||||
|
virtual ~bad_optional_access() _NOEXCEPT;
|
||||||
|
};
|
||||||
|
|
||||||
|
}} // std::experimental
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
|
||||||
|
#include <initializer_list>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <new>
|
||||||
|
#include <__functional_base>
|
||||||
|
|
||||||
|
#include <__undef_min_max>
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_DEBUG
|
||||||
|
# include <__debug>
|
||||||
|
#else
|
||||||
|
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace std { namespace experimental { inline namespace __library_fundamentals_v1 {
|
||||||
|
|
||||||
|
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("optional<T>::value: not engaged");
|
||||||
|
return this->__val_;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
value_type& value()
|
||||||
|
{
|
||||||
|
if (!this->__engaged_)
|
||||||
|
throw bad_optional_access("optional<T>::value: not engaged");
|
||||||
|
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_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (!static_cast<bool>(__y))
|
||||||
|
return false;
|
||||||
|
if (!static_cast<bool>(__x))
|
||||||
|
return true;
|
||||||
|
return less<_Tp>{}(*__x, *__y);
|
||||||
|
}
|
||||||
|
|
||||||
|
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, 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) ? 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
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}}} // namespace std::experimental::__library_fundamentals_v1
|
||||||
|
|
||||||
|
_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_ARRAY
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
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 : public std::hash<_Tp>
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
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 +32,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
|
||||||
@@ -43,4 +43,4 @@ template <> struct _LIBCPP_VISIBLE hash<char *>
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif _LIBCPP_EXT_HASH
|
#endif // _LIBCPP_EXT_HASH
|
||||||
|
|||||||
@@ -206,7 +206,11 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
|||||||
#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
|
||||||
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
@@ -215,7 +219,11 @@ 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
|
||||||
|
#if __has_feature(is_final)
|
||||||
|
&& !__is_final(_Hash)
|
||||||
|
#endif
|
||||||
|
>
|
||||||
class __hash_map_hasher
|
class __hash_map_hasher
|
||||||
: private _Hash
|
: private _Hash
|
||||||
{
|
{
|
||||||
@@ -247,7 +255,11 @@ 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
|
||||||
|
#if __has_feature(is_final)
|
||||||
|
&& !__is_final(_Pred)
|
||||||
|
#endif
|
||||||
|
>
|
||||||
class __hash_map_equal
|
class __hash_map_equal
|
||||||
: private _Pred
|
: private _Pred
|
||||||
{
|
{
|
||||||
@@ -353,7 +365,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 +408,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_;
|
||||||
|
|
||||||
@@ -455,15 +467,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
|
||||||
@@ -499,8 +511,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 +683,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 _VSTD::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 +754,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
|
||||||
@@ -776,8 +788,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
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -174,7 +175,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
|
||||||
|
|
||||||
@@ -208,11 +213,11 @@ struct __forward_list_node
|
|||||||
value_type __value_;
|
value_type __value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class _Tp, class _Alloc> class forward_list;
|
template<class _Tp, class _Alloc> 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,8 +226,8 @@ 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;
|
||||||
@@ -245,7 +250,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 +277,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;
|
||||||
|
|
||||||
@@ -319,7 +324,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++()
|
||||||
@@ -364,18 +369,27 @@ protected:
|
|||||||
__node_allocator;
|
__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 allocator_traits<allocator_type>::template
|
||||||
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
rebind_alloc<__begin_node>
|
||||||
|
#else
|
||||||
|
rebind_alloc<__begin_node>::other
|
||||||
|
#endif
|
||||||
|
__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 +399,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()
|
||||||
@@ -529,7 +543,7 @@ __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
@@ -558,6 +572,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>
|
||||||
@@ -768,8 +785,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 +798,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 +883,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 +941,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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -991,8 +1030,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 +1045,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 +1059,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 +1085,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 +1102,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 +1118,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 +1133,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 +1183,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;
|
||||||
@@ -1188,7 +1227,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 +1240,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 +1279,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 +1311,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 +1337,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 +1353,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 +1372,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_);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1565,12 +1596,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;
|
||||||
|
|||||||
103
include/fstream
103
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:
|
||||||
@@ -230,6 +234,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 +254,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 +295,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 +328,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 +344,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 +407,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_);
|
||||||
@@ -545,7 +560,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 +602,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 +691,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 +784,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 +807,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 _WIN32
|
||||||
|
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 +826,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 _WIN32
|
||||||
|
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 +843,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 +869,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 +883,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)
|
#if _WIN32
|
||||||
{
|
if (fseek(__file_, -__c, SEEK_CUR))
|
||||||
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;
|
return -1;
|
||||||
}
|
#else
|
||||||
} while (__r == codecvt_base::partial);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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 +994,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:
|
||||||
@@ -1102,7 +1139,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:
|
||||||
@@ -1247,7 +1284,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:
|
||||||
|
|||||||
1263
include/functional
1263
include/functional
File diff suppressed because it is too large
Load Diff
1196
include/future
1196
include/future
File diff suppressed because it is too large
Load Diff
@@ -29,15 +29,15 @@ public:
|
|||||||
typedef const E* iterator;
|
typedef const E* iterator;
|
||||||
typedef const E* const_iterator;
|
typedef const E* const_iterator;
|
||||||
|
|
||||||
initializer_list() noexcept;
|
initializer_list() noexcept; // constexpr in C++14
|
||||||
|
|
||||||
size_t size() const noexcept;
|
size_t size() const noexcept; // constexpr in C++14
|
||||||
const E* begin() const noexcept;
|
const E* begin() const noexcept; // constexpr in C++14
|
||||||
const E* end() const noexcept;
|
const E* end() const noexcept; // constexpr in C++14
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class E> const E* begin(initializer_list<E> il) noexcept;
|
template<class E> const E* begin(initializer_list<E> il) noexcept; // constexpr in C++14
|
||||||
template<class E> const E* end(initializer_list<E> il) noexcept;
|
template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in C++14
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
|
||||||
@@ -46,52 +46,67 @@ template<class E> const E* end(initializer_list<E> il) noexcept;
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace std // purposefully not versioned
|
namespace std // purposefully not versioned
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||||
|
|
||||||
template<class _E>
|
template<class _Ep>
|
||||||
class _LIBCPP_VISIBLE initializer_list
|
class _LIBCPP_TYPE_VIS_ONLY initializer_list
|
||||||
{
|
{
|
||||||
const _E* __begin_;
|
const _Ep* __begin_;
|
||||||
size_t __size_;
|
size_t __size_;
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
initializer_list(const _E* __b, size_t __s) _NOEXCEPT
|
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
|
initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
|
||||||
: __begin_(__b),
|
: __begin_(__b),
|
||||||
__size_(__s)
|
__size_(__s)
|
||||||
{}
|
{}
|
||||||
public:
|
public:
|
||||||
typedef _E value_type;
|
typedef _Ep value_type;
|
||||||
typedef const _E& reference;
|
typedef const _Ep& reference;
|
||||||
typedef const _E& const_reference;
|
typedef const _Ep& const_reference;
|
||||||
typedef size_t size_type;
|
typedef size_t size_type;
|
||||||
|
|
||||||
typedef const _E* iterator;
|
typedef const _Ep* iterator;
|
||||||
typedef const _E* const_iterator;
|
typedef const _Ep* const_iterator;
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
|
_LIBCPP_ALWAYS_INLINE
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
|
initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE size_t size() const _NOEXCEPT {return __size_;}
|
_LIBCPP_ALWAYS_INLINE
|
||||||
_LIBCPP_ALWAYS_INLINE const _E* begin() const _NOEXCEPT {return __begin_;}
|
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
_LIBCPP_ALWAYS_INLINE const _E* end() const _NOEXCEPT {return __begin_ + __size_;}
|
size_t size() const _NOEXCEPT {return __size_;}
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
|
const _Ep* begin() const _NOEXCEPT {return __begin_;}
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE
|
||||||
|
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
|
const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class _E>
|
template<class _Ep>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
const _E*
|
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
begin(initializer_list<_E> __il) _NOEXCEPT
|
const _Ep*
|
||||||
|
begin(initializer_list<_Ep> __il) _NOEXCEPT
|
||||||
{
|
{
|
||||||
return __il.begin();
|
return __il.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class _E>
|
template<class _Ep>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
const _E*
|
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||||
end(initializer_list<_E> __il) _NOEXCEPT
|
const _Ep*
|
||||||
|
end(initializer_list<_Ep> __il) _NOEXCEPT
|
||||||
{
|
{
|
||||||
return __il.end();
|
return __il.end();
|
||||||
}
|
}
|
||||||
|
|||||||
203
include/iomanip
203
include/iomanip
@@ -14,6 +14,8 @@
|
|||||||
/*
|
/*
|
||||||
iomanip synopsis
|
iomanip synopsis
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
|
||||||
// types T1, T2, ... are unspecified implementation types
|
// types T1, T2, ... are unspecified implementation types
|
||||||
T1 resetiosflags(ios_base::fmtflags mask);
|
T1 resetiosflags(ios_base::fmtflags mask);
|
||||||
T2 setiosflags (ios_base::fmtflags mask);
|
T2 setiosflags (ios_base::fmtflags mask);
|
||||||
@@ -26,6 +28,17 @@ template <class charT, class moneyT> T8 put_money(const moneyT& mon, bool intl =
|
|||||||
template <class charT> T9 get_time(struct tm* tmb, const charT* fmt);
|
template <class charT> T9 get_time(struct tm* tmb, const charT* fmt);
|
||||||
template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
|
template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
|
||||||
|
|
||||||
|
template <class charT>
|
||||||
|
T11 quoted(const charT* s, charT delim=charT('"'), charT escape=charT('\\')); // C++14
|
||||||
|
|
||||||
|
template <class charT, class traits, class Allocator>
|
||||||
|
T12 quoted(const basic_string<charT, traits, Allocator>& s,
|
||||||
|
charT delim=charT('"'), charT escape=charT('\\')); // C++14
|
||||||
|
|
||||||
|
template <class charT, class traits, class Allocator>
|
||||||
|
T13 quoted(basic_string<charT, traits, Allocator>& s,
|
||||||
|
charT delim=charT('"'), charT escape=charT('\\')); // C++14
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@@ -33,7 +46,9 @@ template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
@@ -275,10 +290,10 @@ public:
|
|||||||
__iom_t7(_MoneyT& __mon, bool __intl)
|
__iom_t7(_MoneyT& __mon, bool __intl)
|
||||||
: __mon_(__mon), __intl_(__intl) {}
|
: __mon_(__mon), __intl_(__intl) {}
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _M>
|
template <class _CharT, class _Traits, class _Mp>
|
||||||
friend
|
friend
|
||||||
basic_istream<_CharT, _Traits>&
|
basic_istream<_CharT, _Traits>&
|
||||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_M>& __x);
|
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _MoneyT>
|
template <class _CharT, class _Traits, class _MoneyT>
|
||||||
@@ -292,11 +307,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
|
|||||||
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||||
typedef money_get<_CharT, _I> _F;
|
typedef money_get<_CharT, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
const _F& __mf = use_facet<_F>(__is.getloc());
|
const _Fp& __mf = use_facet<_Fp>(__is.getloc());
|
||||||
__mf.get(_I(__is), _I(), __x.__intl_, __is, __err, __x.__mon_);
|
__mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
|
||||||
__is.setstate(__err);
|
__is.setstate(__err);
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -335,10 +350,10 @@ public:
|
|||||||
__iom_t8(const _MoneyT& __mon, bool __intl)
|
__iom_t8(const _MoneyT& __mon, bool __intl)
|
||||||
: __mon_(__mon), __intl_(__intl) {}
|
: __mon_(__mon), __intl_(__intl) {}
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _M>
|
template <class _CharT, class _Traits, class _Mp>
|
||||||
friend
|
friend
|
||||||
basic_ostream<_CharT, _Traits>&
|
basic_ostream<_CharT, _Traits>&
|
||||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_M>& __x);
|
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _MoneyT>
|
template <class _CharT, class _Traits, class _MoneyT>
|
||||||
@@ -352,10 +367,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
|
|||||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||||
typedef money_put<_CharT, _O> _F;
|
typedef money_put<_CharT, _Op> _Fp;
|
||||||
const _F& __mf = use_facet<_F>(__os.getloc());
|
const _Fp& __mf = use_facet<_Fp>(__os.getloc());
|
||||||
if (__mf.put(_O(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
|
if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
|
||||||
__os.setstate(ios_base::badbit);
|
__os.setstate(ios_base::badbit);
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -394,10 +409,10 @@ public:
|
|||||||
__iom_t9(tm* __tm, const _CharT* __fmt)
|
__iom_t9(tm* __tm, const _CharT* __fmt)
|
||||||
: __tm_(__tm), __fmt_(__fmt) {}
|
: __tm_(__tm), __fmt_(__fmt) {}
|
||||||
|
|
||||||
template <class _C, class _Traits>
|
template <class _Cp, class _Traits>
|
||||||
friend
|
friend
|
||||||
basic_istream<_C, _Traits>&
|
basic_istream<_Cp, _Traits>&
|
||||||
operator>>(basic_istream<_C, _Traits>& __is, const __iom_t9<_C>& __x);
|
operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
@@ -411,11 +426,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
|
|||||||
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||||
typedef time_get<_CharT, _I> _F;
|
typedef time_get<_CharT, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
const _F& __tf = use_facet<_F>(__is.getloc());
|
const _Fp& __tf = use_facet<_Fp>(__is.getloc());
|
||||||
__tf.get(_I(__is), _I(), __is, __err, __x.__tm_,
|
__tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_,
|
||||||
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
|
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
|
||||||
__is.setstate(__err);
|
__is.setstate(__err);
|
||||||
}
|
}
|
||||||
@@ -455,10 +470,10 @@ public:
|
|||||||
__iom_t10(const tm* __tm, const _CharT* __fmt)
|
__iom_t10(const tm* __tm, const _CharT* __fmt)
|
||||||
: __tm_(__tm), __fmt_(__fmt) {}
|
: __tm_(__tm), __fmt_(__fmt) {}
|
||||||
|
|
||||||
template <class _C, class _Traits>
|
template <class _Cp, class _Traits>
|
||||||
friend
|
friend
|
||||||
basic_ostream<_C, _Traits>&
|
basic_ostream<_Cp, _Traits>&
|
||||||
operator<<(basic_ostream<_C, _Traits>& __os, const __iom_t10<_C>& __x);
|
operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
@@ -472,10 +487,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
|
|||||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||||
typedef time_put<_CharT, _O> _F;
|
typedef time_put<_CharT, _Op> _Fp;
|
||||||
const _F& __tf = use_facet<_F>(__os.getloc());
|
const _Fp& __tf = use_facet<_Fp>(__os.getloc());
|
||||||
if (__tf.put(_O(__os), __os, __os.fill(), __x.__tm_,
|
if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_,
|
||||||
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
|
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
|
||||||
__os.setstate(ios_base::badbit);
|
__os.setstate(ios_base::badbit);
|
||||||
}
|
}
|
||||||
@@ -497,6 +512,142 @@ put_time(const tm* __tm, const _CharT* __fmt)
|
|||||||
return __iom_t10<_CharT>(__tm, __fmt);
|
return __iom_t10<_CharT>(__tm, __fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
|
||||||
|
template <class _CharT, class _Traits, class _ForwardIterator>
|
||||||
|
std::basic_ostream<_CharT, _Traits> &
|
||||||
|
__quoted_output ( basic_ostream<_CharT, _Traits> &__os,
|
||||||
|
_ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape )
|
||||||
|
{
|
||||||
|
__os << __delim;
|
||||||
|
for ( ; __first != __last; ++ __first )
|
||||||
|
{
|
||||||
|
if (_Traits::eq (*__first, __escape) || _Traits::eq (*__first, __delim))
|
||||||
|
__os << __escape;
|
||||||
|
__os << *__first;
|
||||||
|
}
|
||||||
|
__os << __delim;
|
||||||
|
return __os;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _CharT, class _Traits, class _String>
|
||||||
|
basic_istream<_CharT, _Traits> &
|
||||||
|
__quoted_input ( basic_istream<_CharT, _Traits> &__is, _String & __string, _CharT __delim, _CharT __escape )
|
||||||
|
{
|
||||||
|
__string.clear ();
|
||||||
|
_CharT __c;
|
||||||
|
__is >> __c;
|
||||||
|
if ( __is.fail ())
|
||||||
|
return __is;
|
||||||
|
|
||||||
|
if (!_Traits::eq (__c, __delim)) // no delimiter, read the whole string
|
||||||
|
{
|
||||||
|
__is.unget ();
|
||||||
|
__is >> __string;
|
||||||
|
return __is;
|
||||||
|
}
|
||||||
|
|
||||||
|
__save_flags<_CharT, _Traits> sf(__is);
|
||||||
|
noskipws (__is);
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
__is >> __c;
|
||||||
|
if ( __is.fail ())
|
||||||
|
break;
|
||||||
|
if (_Traits::eq (__c, __escape))
|
||||||
|
{
|
||||||
|
__is >> __c;
|
||||||
|
if ( __is.fail ())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (_Traits::eq (__c, __delim))
|
||||||
|
break;
|
||||||
|
__string.push_back ( __c );
|
||||||
|
}
|
||||||
|
return __is;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class _CharT, class _Iter, class _Traits=char_traits<_CharT>>
|
||||||
|
struct __quoted_output_proxy
|
||||||
|
{
|
||||||
|
_Iter __first;
|
||||||
|
_Iter __last;
|
||||||
|
_CharT __delim;
|
||||||
|
_CharT __escape;
|
||||||
|
|
||||||
|
__quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e)
|
||||||
|
: __first(__f), __last(__l), __delim(__d), __escape(__e) {}
|
||||||
|
// This would be a nice place for a string_ref
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _CharT, class _Traits, class _Iter>
|
||||||
|
basic_ostream<_CharT, _Traits>& operator<<(
|
||||||
|
basic_ostream<_CharT, _Traits>& __os,
|
||||||
|
const __quoted_output_proxy<_CharT, _Iter, _Traits> & __proxy)
|
||||||
|
{
|
||||||
|
return __quoted_output (__os, __proxy.__first, __proxy.__last, __proxy.__delim, __proxy.__escape);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
|
struct __quoted_proxy
|
||||||
|
{
|
||||||
|
basic_string<_CharT, _Traits, _Allocator> &__string;
|
||||||
|
_CharT __delim;
|
||||||
|
_CharT __escape;
|
||||||
|
|
||||||
|
__quoted_proxy(basic_string<_CharT, _Traits, _Allocator> &__s, _CharT __d, _CharT __e)
|
||||||
|
: __string(__s), __delim(__d), __escape(__e) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
basic_ostream<_CharT, _Traits>& operator<<(
|
||||||
|
basic_ostream<_CharT, _Traits>& __os,
|
||||||
|
const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
|
||||||
|
{
|
||||||
|
return __quoted_output (__os, __proxy.__string.cbegin (), __proxy.__string.cend (), __proxy.__delim, __proxy.__escape);
|
||||||
|
}
|
||||||
|
|
||||||
|
// extractor for non-const basic_string& proxies
|
||||||
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
basic_istream<_CharT, _Traits>& operator>>(
|
||||||
|
basic_istream<_CharT, _Traits>& __is,
|
||||||
|
const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
|
||||||
|
{
|
||||||
|
return __quoted_input ( __is, __proxy.__string, __proxy.__delim, __proxy.__escape );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class _CharT>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
__quoted_output_proxy<_CharT, const _CharT *>
|
||||||
|
quoted ( const _CharT *__s, _CharT __delim = _CharT('"'), _CharT __escape =_CharT('\\'))
|
||||||
|
{
|
||||||
|
const _CharT *__end = __s;
|
||||||
|
while ( *__end ) ++__end;
|
||||||
|
return __quoted_output_proxy<_CharT, const _CharT *> ( __s, __end, __delim, __escape );
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
__quoted_output_proxy<_CharT, typename basic_string <_CharT, _Traits, _Allocator>::const_iterator>
|
||||||
|
quoted ( const basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
|
||||||
|
{
|
||||||
|
return __quoted_output_proxy<_CharT,
|
||||||
|
typename basic_string <_CharT, _Traits, _Allocator>::const_iterator>
|
||||||
|
( __s.cbegin(), __s.cend (), __delim, __escape );
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
|
__quoted_proxy<_CharT, _Traits, _Allocator>
|
||||||
|
quoted ( basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
|
||||||
|
{
|
||||||
|
return __quoted_proxy<_CharT, _Traits, _Allocator>( __s, __delim, __escape );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP_IOMANIP
|
#endif // _LIBCPP_IOMANIP
|
||||||
|
|||||||
172
include/ios
172
include/ios
@@ -29,43 +29,43 @@ public:
|
|||||||
class failure;
|
class failure;
|
||||||
|
|
||||||
typedef T1 fmtflags;
|
typedef T1 fmtflags;
|
||||||
static const fmtflags boolalpha;
|
static constexpr fmtflags boolalpha;
|
||||||
static const fmtflags dec;
|
static constexpr fmtflags dec;
|
||||||
static const fmtflags fixed;
|
static constexpr fmtflags fixed;
|
||||||
static const fmtflags hex;
|
static constexpr fmtflags hex;
|
||||||
static const fmtflags internal;
|
static constexpr fmtflags internal;
|
||||||
static const fmtflags left;
|
static constexpr fmtflags left;
|
||||||
static const fmtflags oct;
|
static constexpr fmtflags oct;
|
||||||
static const fmtflags right;
|
static constexpr fmtflags right;
|
||||||
static const fmtflags scientific;
|
static constexpr fmtflags scientific;
|
||||||
static const fmtflags showbase;
|
static constexpr fmtflags showbase;
|
||||||
static const fmtflags showpoint;
|
static constexpr fmtflags showpoint;
|
||||||
static const fmtflags showpos;
|
static constexpr fmtflags showpos;
|
||||||
static const fmtflags skipws;
|
static constexpr fmtflags skipws;
|
||||||
static const fmtflags unitbuf;
|
static constexpr fmtflags unitbuf;
|
||||||
static const fmtflags uppercase;
|
static constexpr fmtflags uppercase;
|
||||||
static const fmtflags adjustfield;
|
static constexpr fmtflags adjustfield;
|
||||||
static const fmtflags basefield;
|
static constexpr fmtflags basefield;
|
||||||
static const fmtflags floatfield;
|
static constexpr fmtflags floatfield;
|
||||||
|
|
||||||
typedef T2 iostate;
|
typedef T2 iostate;
|
||||||
static const iostate badbit;
|
static constexpr iostate badbit;
|
||||||
static const iostate eofbit;
|
static constexpr iostate eofbit;
|
||||||
static const iostate failbit;
|
static constexpr iostate failbit;
|
||||||
static const iostate goodbit;
|
static constexpr iostate goodbit;
|
||||||
|
|
||||||
typedef T3 openmode;
|
typedef T3 openmode;
|
||||||
static const openmode app;
|
static constexpr openmode app;
|
||||||
static const openmode ate;
|
static constexpr openmode ate;
|
||||||
static const openmode binary;
|
static constexpr openmode binary;
|
||||||
static const openmode in;
|
static constexpr openmode in;
|
||||||
static const openmode out;
|
static constexpr openmode out;
|
||||||
static const openmode trunc;
|
static constexpr openmode trunc;
|
||||||
|
|
||||||
typedef T4 seekdir;
|
typedef T4 seekdir;
|
||||||
static const seekdir beg;
|
static constexpr seekdir beg;
|
||||||
static const seekdir cur;
|
static constexpr seekdir cur;
|
||||||
static const seekdir end;
|
static constexpr seekdir end;
|
||||||
|
|
||||||
class Init;
|
class Init;
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ protected:
|
|||||||
basic_ios();
|
basic_ios();
|
||||||
void init(basic_streambuf<charT,traits>* sb);
|
void init(basic_streambuf<charT,traits>* sb);
|
||||||
void move(basic_ios& rhs);
|
void move(basic_ios& rhs);
|
||||||
void swap(basic_ios& rhs);
|
void swap(basic_ios& rhs) noexcept;
|
||||||
void set_rdbuf(basic_streambuf<charT, traits>* sb);
|
void set_rdbuf(basic_streambuf<charT, traits>* sb);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -203,9 +203,9 @@ enum class io_errc
|
|||||||
};
|
};
|
||||||
|
|
||||||
concept_map ErrorCodeEnum<io_errc> { };
|
concept_map ErrorCodeEnum<io_errc> { };
|
||||||
error_code make_error_code(io_errc e);
|
error_code make_error_code(io_errc e) noexcept;
|
||||||
error_condition make_error_condition(io_errc e);
|
error_condition make_error_condition(io_errc e) noexcept;
|
||||||
storage-class-specifier const error_category& iostream_category;
|
storage-class-specifier const error_category& iostream_category() noexcept;
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
|
||||||
@@ -216,16 +216,22 @@ storage-class-specifier const error_category& iostream_category;
|
|||||||
#include <__locale>
|
#include <__locale>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
|
||||||
|
#if __has_feature(cxx_atomic)
|
||||||
|
#include <atomic> // for __xindex_
|
||||||
|
#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
|
||||||
|
|
||||||
typedef ptrdiff_t streamsize;
|
typedef ptrdiff_t streamsize;
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE ios_base
|
class _LIBCPP_TYPE_VIS ios_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class failure;
|
class _LIBCPP_TYPE_VIS failure;
|
||||||
|
|
||||||
typedef unsigned int fmtflags;
|
typedef unsigned int fmtflags;
|
||||||
static const fmtflags boolalpha = 0x0001;
|
static const fmtflags boolalpha = 0x0001;
|
||||||
@@ -269,7 +275,7 @@ public:
|
|||||||
typedef _VSTD::streamoff streamoff;
|
typedef _VSTD::streamoff streamoff;
|
||||||
typedef _VSTD::streampos streampos;
|
typedef _VSTD::streampos streampos;
|
||||||
|
|
||||||
class Init;
|
class _LIBCPP_TYPE_VIS Init;
|
||||||
|
|
||||||
// 27.5.2.2 fmtflags state:
|
// 27.5.2.2 fmtflags state:
|
||||||
_LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
|
_LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
|
||||||
@@ -317,7 +323,7 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY bool bad() const;
|
_LIBCPP_INLINE_VISIBILITY bool bad() const;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
|
_LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
|
||||||
_LIBCPP_INLINE_VISIBILITY void exceptions(iostate __except);
|
_LIBCPP_INLINE_VISIBILITY void exceptions(iostate __iostate);
|
||||||
|
|
||||||
void __set_badbit_and_consider_rethrow();
|
void __set_badbit_and_consider_rethrow();
|
||||||
void __set_failbit_and_consider_rethrow();
|
void __set_failbit_and_consider_rethrow();
|
||||||
@@ -340,7 +346,7 @@ protected:
|
|||||||
void __call_callbacks(event);
|
void __call_callbacks(event);
|
||||||
void copyfmt(const ios_base&);
|
void copyfmt(const ios_base&);
|
||||||
void move(ios_base&);
|
void move(ios_base&);
|
||||||
void swap(ios_base&);
|
void swap(ios_base&) _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
void set_rdbuf(void* __sb)
|
void set_rdbuf(void* __sb)
|
||||||
@@ -361,7 +367,11 @@ private:
|
|||||||
int* __index_;
|
int* __index_;
|
||||||
size_t __event_size_;
|
size_t __event_size_;
|
||||||
size_t __event_cap_;
|
size_t __event_cap_;
|
||||||
|
#if __has_feature(cxx_atomic)
|
||||||
|
static atomic<int> __xindex_;
|
||||||
|
#else
|
||||||
static int __xindex_;
|
static int __xindex_;
|
||||||
|
#endif
|
||||||
long* __iarray_;
|
long* __iarray_;
|
||||||
size_t __iarray_size_;
|
size_t __iarray_size_;
|
||||||
size_t __iarray_cap_;
|
size_t __iarray_cap_;
|
||||||
@@ -371,35 +381,33 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//enum class io_errc
|
//enum class io_errc
|
||||||
struct _LIBCPP_VISIBLE io_errc
|
_LIBCPP_DECLARE_STRONG_ENUM(io_errc)
|
||||||
{
|
{
|
||||||
enum _ {
|
|
||||||
stream = 1
|
stream = 1
|
||||||
};
|
};
|
||||||
_ __v_;
|
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE io_errc(_ __v) : __v_(__v) {}
|
|
||||||
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
|
struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc> : public true_type { };
|
||||||
template <>
|
|
||||||
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::_> : public true_type { };
|
|
||||||
|
|
||||||
_LIBCPP_VISIBLE
|
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||||
const error_category& iostream_category();
|
template <>
|
||||||
|
struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc::__lx> : public true_type { };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_FUNC_VIS
|
||||||
|
const error_category& iostream_category() _NOEXCEPT;
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
error_code
|
error_code
|
||||||
make_error_code(io_errc __e)
|
make_error_code(io_errc __e) _NOEXCEPT
|
||||||
{
|
{
|
||||||
return error_code(static_cast<int>(__e), iostream_category());
|
return error_code(static_cast<int>(__e), iostream_category());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
error_condition
|
error_condition
|
||||||
make_error_condition(io_errc __e)
|
make_error_condition(io_errc __e) _NOEXCEPT
|
||||||
{
|
{
|
||||||
return error_condition(static_cast<int>(__e), iostream_category());
|
return error_condition(static_cast<int>(__e), iostream_category());
|
||||||
}
|
}
|
||||||
@@ -413,7 +421,7 @@ public:
|
|||||||
virtual ~failure() throw();
|
virtual ~failure() throw();
|
||||||
};
|
};
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE ios_base::Init
|
class _LIBCPP_TYPE_VIS ios_base::Init
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Init();
|
Init();
|
||||||
@@ -527,21 +535,21 @@ inline _LIBCPP_INLINE_VISIBILITY
|
|||||||
bool
|
bool
|
||||||
ios_base::eof() const
|
ios_base::eof() const
|
||||||
{
|
{
|
||||||
return __rdstate_ & eofbit;
|
return (__rdstate_ & eofbit) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
ios_base::fail() const
|
ios_base::fail() const
|
||||||
{
|
{
|
||||||
return __rdstate_ & (failbit | badbit);
|
return (__rdstate_ & (failbit | badbit)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
ios_base::bad() const
|
ios_base::bad() const
|
||||||
{
|
{
|
||||||
return __rdstate_ & badbit;
|
return (__rdstate_ & badbit) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -553,14 +561,14 @@ ios_base::exceptions() const
|
|||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
ios_base::exceptions(iostate __except)
|
ios_base::exceptions(iostate __iostate)
|
||||||
{
|
{
|
||||||
__exceptions_ = __except;
|
__exceptions_ = __iostate;
|
||||||
clear(__rdstate_);
|
clear(__rdstate_);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
class _LIBCPP_VISIBLE basic_ios
|
class _LIBCPP_TYPE_VIS_ONLY basic_ios
|
||||||
: public ios_base
|
: public ios_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -572,7 +580,8 @@ public:
|
|||||||
typedef typename traits_type::pos_type pos_type;
|
typedef typename traits_type::pos_type pos_type;
|
||||||
typedef typename traits_type::off_type off_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE // explicit
|
_LIBCPP_ALWAYS_INLINE
|
||||||
|
_LIBCPP_EXPLICIT
|
||||||
operator bool() const {return !fail();}
|
operator bool() const {return !fail();}
|
||||||
_LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();}
|
_LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();}
|
||||||
_LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();}
|
_LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();}
|
||||||
@@ -584,7 +593,7 @@ public:
|
|||||||
_LIBCPP_ALWAYS_INLINE bool bad() const {return ios_base::bad();}
|
_LIBCPP_ALWAYS_INLINE bool bad() const {return ios_base::bad();}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();}
|
_LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();}
|
||||||
_LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);}
|
_LIBCPP_ALWAYS_INLINE void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);}
|
||||||
|
|
||||||
// 27.5.4.1 Constructor/destructor:
|
// 27.5.4.1 Constructor/destructor:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -631,12 +640,12 @@ protected:
|
|||||||
void move(basic_ios&& __rhs) {move(__rhs);}
|
void move(basic_ios&& __rhs) {move(__rhs);}
|
||||||
#endif
|
#endif
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void swap(basic_ios& __rhs);
|
void swap(basic_ios& __rhs) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
|
void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
|
||||||
private:
|
private:
|
||||||
basic_ostream<char_type, traits_type>* __tie_;
|
basic_ostream<char_type, traits_type>* __tie_;
|
||||||
char_type __fill_;
|
mutable int_type __fill_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
@@ -658,7 +667,7 @@ basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
|
|||||||
{
|
{
|
||||||
ios_base::init(__sb);
|
ios_base::init(__sb);
|
||||||
__tie_ = 0;
|
__tie_ = 0;
|
||||||
__fill_ = widen(' ');
|
__fill_ = traits_type::eof();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
@@ -730,6 +739,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
|||||||
_CharT
|
_CharT
|
||||||
basic_ios<_CharT, _Traits>::fill() const
|
basic_ios<_CharT, _Traits>::fill() const
|
||||||
{
|
{
|
||||||
|
if (traits_type::eq_int_type(traits_type::eof(), __fill_))
|
||||||
|
__fill_ = widen(' ');
|
||||||
return __fill_;
|
return __fill_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -773,7 +784,7 @@ basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
|
|||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs)
|
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT
|
||||||
{
|
{
|
||||||
ios_base::swap(__rhs);
|
ios_base::swap(__rhs);
|
||||||
_VSTD::swap(__tie_, __rhs.__tie_);
|
_VSTD::swap(__tie_, __rhs.__tie_);
|
||||||
@@ -980,6 +991,33 @@ defaultfloat(ios_base& __str)
|
|||||||
return __str;
|
return __str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class _CharT, class _Traits>
|
||||||
|
class __save_flags
|
||||||
|
{
|
||||||
|
typedef basic_ios<_CharT, _Traits> __stream_type;
|
||||||
|
typedef typename __stream_type::fmtflags fmtflags;
|
||||||
|
|
||||||
|
__stream_type& __stream_;
|
||||||
|
fmtflags __fmtflags_;
|
||||||
|
_CharT __fill_;
|
||||||
|
|
||||||
|
__save_flags(const __save_flags&);
|
||||||
|
__save_flags& operator=(const __save_flags&);
|
||||||
|
public:
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
explicit __save_flags(__stream_type& __stream)
|
||||||
|
: __stream_(__stream),
|
||||||
|
__fmtflags_(__stream.flags()),
|
||||||
|
__fill_(__stream.fill())
|
||||||
|
{}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
~__save_flags()
|
||||||
|
{
|
||||||
|
__stream_.flags(__fmtflags_);
|
||||||
|
__stream_.fill(__fill_);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP_IOS
|
#endif // _LIBCPP_IOS
|
||||||
|
|||||||
@@ -89,53 +89,55 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <wchar.h> // for mbstate_t
|
#include <wchar.h> // for mbstate_t
|
||||||
|
|
||||||
|
#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 ios_base;
|
class _LIBCPP_TYPE_VIS ios_base;
|
||||||
|
|
||||||
template<class _CharT> struct _LIBCPP_VISIBLE char_traits;
|
template<class _CharT> struct _LIBCPP_TYPE_VIS_ONLY char_traits;
|
||||||
template<class _Tp> class _LIBCPP_VISIBLE allocator;
|
template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY allocator;
|
||||||
|
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_ios;
|
class _LIBCPP_TYPE_VIS_ONLY basic_ios;
|
||||||
|
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_streambuf;
|
class _LIBCPP_TYPE_VIS_ONLY basic_streambuf;
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_istream;
|
class _LIBCPP_TYPE_VIS_ONLY basic_istream;
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_ostream;
|
class _LIBCPP_TYPE_VIS_ONLY basic_ostream;
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_iostream;
|
class _LIBCPP_TYPE_VIS_ONLY basic_iostream;
|
||||||
|
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||||
class _Allocator = allocator<_CharT> >
|
class _Allocator = allocator<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_stringbuf;
|
class _LIBCPP_TYPE_VIS_ONLY basic_stringbuf;
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||||
class _Allocator = allocator<_CharT> >
|
class _Allocator = allocator<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_istringstream;
|
class _LIBCPP_TYPE_VIS_ONLY basic_istringstream;
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||||
class _Allocator = allocator<_CharT> >
|
class _Allocator = allocator<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_ostringstream;
|
class _LIBCPP_TYPE_VIS_ONLY basic_ostringstream;
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||||
class _Allocator = allocator<_CharT> >
|
class _Allocator = allocator<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_stringstream;
|
class _LIBCPP_TYPE_VIS_ONLY basic_stringstream;
|
||||||
|
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_filebuf;
|
class _LIBCPP_TYPE_VIS_ONLY basic_filebuf;
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_ifstream;
|
class _LIBCPP_TYPE_VIS_ONLY basic_ifstream;
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_ofstream;
|
class _LIBCPP_TYPE_VIS_ONLY basic_ofstream;
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_fstream;
|
class _LIBCPP_TYPE_VIS_ONLY basic_fstream;
|
||||||
|
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE istreambuf_iterator;
|
class _LIBCPP_TYPE_VIS_ONLY istreambuf_iterator;
|
||||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE ostreambuf_iterator;
|
class _LIBCPP_TYPE_VIS_ONLY ostreambuf_iterator;
|
||||||
|
|
||||||
typedef basic_ios<char> ios;
|
typedef basic_ios<char> ios;
|
||||||
typedef basic_ios<wchar_t> wios;
|
typedef basic_ios<wchar_t> wios;
|
||||||
@@ -170,7 +172,7 @@ typedef basic_ifstream<wchar_t> wifstream;
|
|||||||
typedef basic_ofstream<wchar_t> wofstream;
|
typedef basic_ofstream<wchar_t> wofstream;
|
||||||
typedef basic_fstream<wchar_t> wfstream;
|
typedef basic_fstream<wchar_t> wfstream;
|
||||||
|
|
||||||
template <class _State> class _LIBCPP_VISIBLE fpos;
|
template <class _State> class _LIBCPP_TYPE_VIS_ONLY fpos;
|
||||||
typedef fpos<mbstate_t> streampos;
|
typedef fpos<mbstate_t> streampos;
|
||||||
typedef fpos<mbstate_t> wstreampos;
|
typedef fpos<mbstate_t> wstreampos;
|
||||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
@@ -183,7 +185,7 @@ typedef long long streamoff; // for char_traits in <string>
|
|||||||
template <class _CharT, // for <stdexcept>
|
template <class _CharT, // for <stdexcept>
|
||||||
class _Traits = char_traits<_CharT>,
|
class _Traits = char_traits<_CharT>,
|
||||||
class _Allocator = allocator<_CharT> >
|
class _Allocator = allocator<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_string;
|
class _LIBCPP_TYPE_VIS_ONLY basic_string;
|
||||||
typedef basic_string<char, char_traits<char>, allocator<char> > string;
|
typedef basic_string<char, char_traits<char>, allocator<char> > string;
|
||||||
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
|
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
|
||||||
|
|
||||||
|
|||||||
@@ -40,18 +40,20 @@ extern wostream wclog;
|
|||||||
#include <istream>
|
#include <istream>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
extern _LIBCPP_VISIBLE istream cin;
|
extern _LIBCPP_FUNC_VIS istream cin;
|
||||||
extern _LIBCPP_VISIBLE ostream cout;
|
extern _LIBCPP_FUNC_VIS ostream cout;
|
||||||
extern _LIBCPP_VISIBLE ostream cerr;
|
extern _LIBCPP_FUNC_VIS ostream cerr;
|
||||||
extern _LIBCPP_VISIBLE ostream clog;
|
extern _LIBCPP_FUNC_VIS ostream clog;
|
||||||
extern _LIBCPP_VISIBLE wistream wcin;
|
extern _LIBCPP_FUNC_VIS wistream wcin;
|
||||||
extern _LIBCPP_VISIBLE wostream wcout;
|
extern _LIBCPP_FUNC_VIS wostream wcout;
|
||||||
extern _LIBCPP_VISIBLE wostream wcerr;
|
extern _LIBCPP_FUNC_VIS wostream wcerr;
|
||||||
extern _LIBCPP_VISIBLE wostream wclog;
|
extern _LIBCPP_FUNC_VIS wostream wclog;
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
|||||||
137
include/istream
137
include/istream
@@ -155,12 +155,16 @@ template <class charT, class traits, class T>
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
|
#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_istream
|
class _LIBCPP_TYPE_VIS_ONLY basic_istream
|
||||||
: virtual public basic_ios<_CharT, _Traits>
|
: virtual public basic_ios<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
streamsize __gc_;
|
streamsize __gc_;
|
||||||
@@ -190,7 +194,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
// 27.7.1.1.3 Prefix/suffix:
|
// 27.7.1.1.3 Prefix/suffix:
|
||||||
class sentry;
|
class _LIBCPP_TYPE_VIS_ONLY sentry;
|
||||||
|
|
||||||
// 27.7.1.2 Formatted input:
|
// 27.7.1.2 Formatted input:
|
||||||
basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&));
|
basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&));
|
||||||
@@ -240,7 +244,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
class _LIBCPP_VISIBLE basic_istream<_CharT, _Traits>::sentry
|
class _LIBCPP_TYPE_VIS_ONLY basic_istream<_CharT, _Traits>::sentry
|
||||||
{
|
{
|
||||||
bool __ok_;
|
bool __ok_;
|
||||||
|
|
||||||
@@ -252,7 +256,7 @@ public:
|
|||||||
// ~sentry() = default;
|
// ~sentry() = default;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
// explicit
|
_LIBCPP_EXPLICIT
|
||||||
operator bool() const {return __ok_;}
|
operator bool() const {return __ok_;}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -267,10 +271,10 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _
|
|||||||
__is.tie()->flush();
|
__is.tie()->flush();
|
||||||
if (!__noskipws && (__is.flags() & ios_base::skipws))
|
if (!__noskipws && (__is.flags() & ios_base::skipws))
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||||
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
|
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
|
||||||
_I __i(__is);
|
_Ip __i(__is);
|
||||||
_I __eof;
|
_Ip __eof;
|
||||||
for (; __i != __eof; ++__i)
|
for (; __i != __eof; ++__i)
|
||||||
if (!__ct.is(__ct.space, *__i))
|
if (!__ct.is(__ct.space, *__i))
|
||||||
break;
|
break;
|
||||||
@@ -338,10 +342,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||||
typedef num_get<char_type, _I> _F;
|
typedef num_get<char_type, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||||
this->setstate(__err);
|
this->setstate(__err);
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -365,10 +369,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||||
typedef num_get<char_type, _I> _F;
|
typedef num_get<char_type, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||||
this->setstate(__err);
|
this->setstate(__err);
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -392,10 +396,10 @@ basic_istream<_CharT, _Traits>::operator>>(long& __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||||
typedef num_get<char_type, _I> _F;
|
typedef num_get<char_type, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||||
this->setstate(__err);
|
this->setstate(__err);
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -419,10 +423,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||||
typedef num_get<char_type, _I> _F;
|
typedef num_get<char_type, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||||
this->setstate(__err);
|
this->setstate(__err);
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -446,10 +450,10 @@ basic_istream<_CharT, _Traits>::operator>>(long long& __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||||
typedef num_get<char_type, _I> _F;
|
typedef num_get<char_type, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||||
this->setstate(__err);
|
this->setstate(__err);
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -473,10 +477,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||||
typedef num_get<char_type, _I> _F;
|
typedef num_get<char_type, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||||
this->setstate(__err);
|
this->setstate(__err);
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -500,10 +504,10 @@ basic_istream<_CharT, _Traits>::operator>>(float& __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||||
typedef num_get<char_type, _I> _F;
|
typedef num_get<char_type, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||||
this->setstate(__err);
|
this->setstate(__err);
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -527,10 +531,10 @@ basic_istream<_CharT, _Traits>::operator>>(double& __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||||
typedef num_get<char_type, _I> _F;
|
typedef num_get<char_type, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||||
this->setstate(__err);
|
this->setstate(__err);
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -554,10 +558,10 @@ basic_istream<_CharT, _Traits>::operator>>(long double& __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||||
typedef num_get<char_type, _I> _F;
|
typedef num_get<char_type, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||||
this->setstate(__err);
|
this->setstate(__err);
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -581,10 +585,10 @@ basic_istream<_CharT, _Traits>::operator>>(bool& __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||||
typedef num_get<char_type, _I> _F;
|
typedef num_get<char_type, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||||
this->setstate(__err);
|
this->setstate(__err);
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -608,10 +612,10 @@ basic_istream<_CharT, _Traits>::operator>>(void*& __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||||
typedef num_get<char_type, _I> _F;
|
typedef num_get<char_type, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||||
this->setstate(__err);
|
this->setstate(__err);
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -635,11 +639,11 @@ basic_istream<_CharT, _Traits>::operator>>(short& __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||||
typedef num_get<char_type, _I> _F;
|
typedef num_get<char_type, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
long __temp;
|
long __temp;
|
||||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
|
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
|
||||||
if (__temp < numeric_limits<short>::min())
|
if (__temp < numeric_limits<short>::min())
|
||||||
{
|
{
|
||||||
__err |= ios_base::failbit;
|
__err |= ios_base::failbit;
|
||||||
@@ -675,11 +679,11 @@ basic_istream<_CharT, _Traits>::operator>>(int& __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||||
typedef num_get<char_type, _I> _F;
|
typedef num_get<char_type, _Ip> _Fp;
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
ios_base::iostate __err = ios_base::goodbit;
|
||||||
long __temp;
|
long __temp;
|
||||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
|
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
|
||||||
if (__temp < numeric_limits<int>::min())
|
if (__temp < numeric_limits<int>::min())
|
||||||
{
|
{
|
||||||
__err |= ios_base::failbit;
|
__err |= ios_base::failbit;
|
||||||
@@ -1140,8 +1144,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++__gc_;
|
++__gc_;
|
||||||
char_type __ch = traits_type::to_char_type(__i);
|
if (traits_type::eq_int_type(__i, __dlm))
|
||||||
if (traits_type::eq(__ch, __dlm))
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1156,8 +1159,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++__gc_;
|
++__gc_;
|
||||||
char_type __ch = traits_type::to_char_type(__i);
|
if (traits_type::eq_int_type(__i, __dlm))
|
||||||
if (traits_type::eq(__ch, __dlm))
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1185,7 +1187,11 @@ basic_istream<_CharT, _Traits>::peek()
|
|||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
sentry __sen(*this, true);
|
sentry __sen(*this, true);
|
||||||
if (__sen)
|
if (__sen)
|
||||||
|
{
|
||||||
__r = this->rdbuf()->sgetc();
|
__r = this->rdbuf()->sgetc();
|
||||||
|
if (traits_type::eq_int_type(__r, traits_type::eof()))
|
||||||
|
this->setstate(ios_base::eofbit);
|
||||||
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
@@ -1208,17 +1214,9 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
|
|||||||
sentry __sen(*this, true);
|
sentry __sen(*this, true);
|
||||||
if (__sen)
|
if (__sen)
|
||||||
{
|
{
|
||||||
ios_base::iostate __err = ios_base::goodbit;
|
__gc_ = this->rdbuf()->sgetn(__s, __n);
|
||||||
for (; __gc_ < __n; ++__gc_)
|
if (__gc_ != __n)
|
||||||
{
|
|
||||||
typename traits_type::int_type __i = this->rdbuf()->sbumpc();
|
|
||||||
if (traits_type::eq_int_type(__i, traits_type::eof()))
|
|
||||||
{
|
|
||||||
this->setstate(ios_base::failbit | ios_base::eofbit);
|
this->setstate(ios_base::failbit | ios_base::eofbit);
|
||||||
break;
|
|
||||||
}
|
|
||||||
*__s++ = traits_type::to_char_type(__i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
@@ -1236,6 +1234,7 @@ template<class _CharT, class _Traits>
|
|||||||
streamsize
|
streamsize
|
||||||
basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
|
basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
|
||||||
{
|
{
|
||||||
|
__gc_ = 0;
|
||||||
streamsize __c = this->rdbuf()->in_avail();
|
streamsize __c = this->rdbuf()->in_avail();
|
||||||
switch (__c)
|
switch (__c)
|
||||||
{
|
{
|
||||||
@@ -1260,6 +1259,7 @@ basic_istream<_CharT, _Traits>::putback(char_type __c)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
|
this->clear(this->rdstate() & ~ios_base::eofbit);
|
||||||
sentry __sen(*this, true);
|
sentry __sen(*this, true);
|
||||||
if (__sen)
|
if (__sen)
|
||||||
{
|
{
|
||||||
@@ -1287,6 +1287,7 @@ basic_istream<_CharT, _Traits>::unget()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
|
this->clear(this->rdstate() & ~ios_base::eofbit);
|
||||||
sentry __sen(*this, true);
|
sentry __sen(*this, true);
|
||||||
if (__sen)
|
if (__sen)
|
||||||
{
|
{
|
||||||
@@ -1365,10 +1366,13 @@ basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
|
this->clear(this->rdstate() & ~ios_base::eofbit);
|
||||||
sentry __sen(*this, true);
|
sentry __sen(*this, true);
|
||||||
if (__sen)
|
if (__sen)
|
||||||
|
{
|
||||||
if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
|
if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
@@ -1389,7 +1393,10 @@ basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
|
|||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
sentry __sen(*this, true);
|
sentry __sen(*this, true);
|
||||||
if (__sen)
|
if (__sen)
|
||||||
this->rdbuf()->pubseekoff(__off, __dir, ios_base::in);
|
{
|
||||||
|
if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
|
||||||
|
this->setstate(ios_base::failbit);
|
||||||
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
@@ -1449,7 +1456,7 @@ operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
|
|||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
class _LIBCPP_VISIBLE basic_iostream
|
class _LIBCPP_TYPE_VIS_ONLY basic_iostream
|
||||||
: public basic_istream<_CharT, _Traits>,
|
: public basic_istream<_CharT, _Traits>,
|
||||||
public basic_ostream<_CharT, _Traits>
|
public basic_ostream<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
@@ -1700,9 +1707,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
|
|||||||
return __is;
|
return __is;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern template class basic_istream<char>;
|
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_istream<char>)
|
||||||
extern template class basic_istream<wchar_t>;
|
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_istream<wchar_t>)
|
||||||
extern template class basic_iostream<char>;
|
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_iostream<char>)
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
|||||||
783
include/iterator
783
include/iterator
File diff suppressed because it is too large
Load Diff
928
include/limits
928
include/limits
File diff suppressed because it is too large
Load Diff
368
include/list
368
include/list
@@ -40,6 +40,7 @@ public:
|
|||||||
noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
||||||
explicit list(const allocator_type& a);
|
explicit list(const allocator_type& a);
|
||||||
explicit list(size_type n);
|
explicit list(size_type n);
|
||||||
|
explicit list(size_type n, const allocator_type& a); // C++14
|
||||||
list(size_type n, const value_type& value);
|
list(size_type n, const value_type& value);
|
||||||
list(size_type n, const value_type& value, const allocator_type& a);
|
list(size_type n, const value_type& value, const allocator_type& a);
|
||||||
template <class Iter>
|
template <class Iter>
|
||||||
@@ -176,7 +177,17 @@ template <class T, class Alloc>
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <__undef_min_max>
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_DEBUG
|
||||||
|
# include <__debug>
|
||||||
|
#else
|
||||||
|
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||||
|
#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
|
||||||
|
|
||||||
@@ -192,13 +203,20 @@ struct __list_node_base
|
|||||||
rebind<__list_node<_Tp, _VoidPtr> >::other pointer;
|
rebind<__list_node<_Tp, _VoidPtr> >::other pointer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef typename pointer_traits<_VoidPtr>::template
|
||||||
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
rebind<__list_node_base> __base_pointer;
|
||||||
|
#else
|
||||||
|
rebind<__list_node_base>::other __base_pointer;
|
||||||
|
#endif
|
||||||
|
|
||||||
pointer __prev_;
|
pointer __prev_;
|
||||||
pointer __next_;
|
pointer __next_;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__list_node_base()
|
__list_node_base()
|
||||||
: __prev_(static_cast<pointer>(this)),
|
: __prev_(static_cast<pointer>(pointer_traits<__base_pointer>::pointer_to(*this))),
|
||||||
__next_(static_cast<pointer>(this))
|
__next_(static_cast<pointer>(pointer_traits<__base_pointer>::pointer_to(*this)))
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -209,12 +227,12 @@ struct __list_node
|
|||||||
_Tp __value_;
|
_Tp __value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _Alloc> class list;
|
template <class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS_ONLY list;
|
||||||
template <class _Tp, class _Alloc> class __list_imp;
|
template <class _Tp, class _Alloc> class __list_imp;
|
||||||
template <class _Tp, class _VoidPtr> class __list_const_iterator;
|
template <class _Tp, class _VoidPtr> class _LIBCPP_TYPE_VIS_ONLY __list_const_iterator;
|
||||||
|
|
||||||
template <class _Tp, class _VoidPtr>
|
template <class _Tp, class _VoidPtr>
|
||||||
class _LIBCPP_VISIBLE __list_iterator
|
class _LIBCPP_TYPE_VIS_ONLY __list_iterator
|
||||||
{
|
{
|
||||||
typedef typename pointer_traits<_VoidPtr>::template
|
typedef typename pointer_traits<_VoidPtr>::template
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
@@ -256,7 +274,7 @@ public:
|
|||||||
typedef typename pointer_traits<pointer>::difference_type difference_type;
|
typedef typename pointer_traits<pointer>::difference_type difference_type;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__list_iterator() _NOEXCEPT
|
__list_iterator() _NOEXCEPT : __ptr_(nullptr)
|
||||||
{
|
{
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
__get_db()->__insert_i(this);
|
__get_db()->__insert_i(this);
|
||||||
@@ -301,7 +319,14 @@ public:
|
|||||||
return __ptr_->__value_;
|
return __ptr_->__value_;
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
pointer operator->() const {return &(operator*());}
|
pointer operator->() const
|
||||||
|
{
|
||||||
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
|
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||||
|
"Attempted to dereference a non-dereferenceable list::iterator");
|
||||||
|
#endif
|
||||||
|
return pointer_traits<pointer>::pointer_to(__ptr_->__value_);
|
||||||
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__list_iterator& operator++()
|
__list_iterator& operator++()
|
||||||
@@ -332,10 +357,6 @@ public:
|
|||||||
friend _LIBCPP_INLINE_VISIBILITY
|
friend _LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator==(const __list_iterator& __x, const __list_iterator& __y)
|
bool operator==(const __list_iterator& __x, const __list_iterator& __y)
|
||||||
{
|
{
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
|
||||||
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
|
|
||||||
"Attempted to compare non-comparable list::iterator");
|
|
||||||
#endif
|
|
||||||
return __x.__ptr_ == __y.__ptr_;
|
return __x.__ptr_ == __y.__ptr_;
|
||||||
}
|
}
|
||||||
friend _LIBCPP_INLINE_VISIBILITY
|
friend _LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -344,13 +365,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _VoidPtr>
|
template <class _Tp, class _VoidPtr>
|
||||||
class _LIBCPP_VISIBLE __list_const_iterator
|
class _LIBCPP_TYPE_VIS_ONLY __list_const_iterator
|
||||||
{
|
{
|
||||||
typedef typename pointer_traits<_VoidPtr>::template
|
typedef typename pointer_traits<_VoidPtr>::template
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
rebind<const __list_node<_Tp, _VoidPtr> > __node_pointer;
|
rebind<__list_node<_Tp, _VoidPtr> > __node_pointer;
|
||||||
#else
|
#else
|
||||||
rebind<const __list_node<_Tp, _VoidPtr> >::other __node_pointer;
|
rebind<__list_node<_Tp, _VoidPtr> >::other __node_pointer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__node_pointer __ptr_;
|
__node_pointer __ptr_;
|
||||||
@@ -383,14 +404,14 @@ public:
|
|||||||
typedef typename pointer_traits<pointer>::difference_type difference_type;
|
typedef typename pointer_traits<pointer>::difference_type difference_type;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__list_const_iterator() _NOEXCEPT
|
__list_const_iterator() _NOEXCEPT : __ptr_(nullptr)
|
||||||
{
|
{
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
__get_db()->__insert_i(this);
|
__get_db()->__insert_i(this);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__list_const_iterator(__list_iterator<_Tp, _VoidPtr> __p) _NOEXCEPT
|
__list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT
|
||||||
: __ptr_(__p.__ptr_)
|
: __ptr_(__p.__ptr_)
|
||||||
{
|
{
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
@@ -435,7 +456,14 @@ public:
|
|||||||
return __ptr_->__value_;
|
return __ptr_->__value_;
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
pointer operator->() const {return &(operator*());}
|
pointer operator->() const
|
||||||
|
{
|
||||||
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
|
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||||
|
"Attempted to dereference a non-dereferenceable list::iterator");
|
||||||
|
#endif
|
||||||
|
return pointer_traits<pointer>::pointer_to(__ptr_->__value_);
|
||||||
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__list_const_iterator& operator++()
|
__list_const_iterator& operator++()
|
||||||
@@ -466,10 +494,6 @@ public:
|
|||||||
friend _LIBCPP_INLINE_VISIBILITY
|
friend _LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y)
|
bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y)
|
||||||
{
|
{
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
|
||||||
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
|
|
||||||
"Attempted to compare non-comparable list::const_iterator");
|
|
||||||
#endif
|
|
||||||
return __x.__ptr_ == __y.__ptr_;
|
return __x.__ptr_ == __y.__ptr_;
|
||||||
}
|
}
|
||||||
friend _LIBCPP_INLINE_VISIBILITY
|
friend _LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -501,11 +525,20 @@ protected:
|
|||||||
__node_allocator;
|
__node_allocator;
|
||||||
typedef allocator_traits<__node_allocator> __node_alloc_traits;
|
typedef allocator_traits<__node_allocator> __node_alloc_traits;
|
||||||
typedef typename __node_alloc_traits::pointer __node_pointer;
|
typedef typename __node_alloc_traits::pointer __node_pointer;
|
||||||
typedef typename __node_alloc_traits::const_pointer __node_const_pointer;
|
typedef typename __node_alloc_traits::pointer __node_const_pointer;
|
||||||
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;
|
||||||
typedef typename __alloc_traits::difference_type difference_type;
|
typedef typename __alloc_traits::difference_type difference_type;
|
||||||
|
|
||||||
|
typedef typename __alloc_traits::template
|
||||||
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
rebind_alloc<__node_base>
|
||||||
|
#else
|
||||||
|
rebind_alloc<__node_base>::other
|
||||||
|
#endif
|
||||||
|
__node_base_allocator;
|
||||||
|
typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer;
|
||||||
|
|
||||||
__node_base __end_;
|
__node_base __end_;
|
||||||
__compressed_pair<size_type, __node_allocator> __size_alloc_;
|
__compressed_pair<size_type, __node_allocator> __size_alloc_;
|
||||||
|
|
||||||
@@ -521,7 +554,7 @@ protected:
|
|||||||
const __node_allocator& __node_alloc() const _NOEXCEPT
|
const __node_allocator& __node_alloc() const _NOEXCEPT
|
||||||
{return __size_alloc_.second();}
|
{return __size_alloc_.second();}
|
||||||
|
|
||||||
static void __unlink_nodes(__node_base& __f, __node_base& __l) _NOEXCEPT;
|
static void __unlink_nodes(__node_pointer __f, __node_pointer __l) _NOEXCEPT;
|
||||||
|
|
||||||
__list_imp()
|
__list_imp()
|
||||||
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value);
|
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value);
|
||||||
@@ -553,18 +586,22 @@ protected:
|
|||||||
iterator end() _NOEXCEPT
|
iterator end() _NOEXCEPT
|
||||||
{
|
{
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
return iterator(static_cast<__node_pointer>(&__end_), this);
|
return iterator(static_cast<__node_pointer>(
|
||||||
|
pointer_traits<__node_base_pointer>::pointer_to(__end_)), this);
|
||||||
#else
|
#else
|
||||||
return iterator(static_cast<__node_pointer>(&__end_));
|
return iterator(static_cast<__node_pointer>(
|
||||||
|
pointer_traits<__node_base_pointer>::pointer_to(__end_)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_iterator end() const _NOEXCEPT
|
const_iterator end() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
return const_iterator(static_cast<__node_const_pointer>(&__end_), this);
|
return const_iterator(static_cast<__node_const_pointer>(
|
||||||
|
pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(__end_))), this);
|
||||||
#else
|
#else
|
||||||
return const_iterator(static_cast<__node_const_pointer>(&__end_));
|
return const_iterator(static_cast<__node_const_pointer>(
|
||||||
|
pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(__end_))));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -633,11 +670,11 @@ private:
|
|||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__list_imp<_Tp, _Alloc>::__unlink_nodes(__node_base& __f, __node_base& __l)
|
__list_imp<_Tp, _Alloc>::__unlink_nodes(__node_pointer __f, __node_pointer __l)
|
||||||
_NOEXCEPT
|
_NOEXCEPT
|
||||||
{
|
{
|
||||||
__f.__prev_->__next_ = __l.__next_;
|
__f->__prev_->__next_ = __l->__next_;
|
||||||
__l.__next_->__prev_ = __f.__prev_;
|
__l->__next_->__prev_ = __f->__prev_;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
@@ -672,15 +709,16 @@ __list_imp<_Tp, _Alloc>::clear() _NOEXCEPT
|
|||||||
{
|
{
|
||||||
__node_allocator& __na = __node_alloc();
|
__node_allocator& __na = __node_alloc();
|
||||||
__node_pointer __f = __end_.__next_;
|
__node_pointer __f = __end_.__next_;
|
||||||
__node_pointer __l = static_cast<__node_pointer>(&__end_);
|
__node_pointer __l = static_cast<__node_pointer>(
|
||||||
__unlink_nodes(*__f, *__l->__prev_);
|
pointer_traits<__node_base_pointer>::pointer_to(__end_));
|
||||||
|
__unlink_nodes(__f, __l->__prev_);
|
||||||
__sz() = 0;
|
__sz() = 0;
|
||||||
while (__f != __l)
|
while (__f != __l)
|
||||||
{
|
{
|
||||||
__node& __n = *__f;
|
__node_pointer __n = __f;
|
||||||
__f = __f->__next_;
|
__f = __f->__next_;
|
||||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
|
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
|
||||||
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
|
__node_alloc_traits::deallocate(__na, __n, 1);
|
||||||
}
|
}
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||||
@@ -715,16 +753,20 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
|
|||||||
swap(__sz(), __c.__sz());
|
swap(__sz(), __c.__sz());
|
||||||
swap(__end_, __c.__end_);
|
swap(__end_, __c.__end_);
|
||||||
if (__sz() == 0)
|
if (__sz() == 0)
|
||||||
__end_.__next_ = __end_.__prev_ = &static_cast<__node&>(__end_);
|
__end_.__next_ = __end_.__prev_ = static_cast<__node_pointer>(
|
||||||
|
pointer_traits<__node_base_pointer>::pointer_to(__end_));
|
||||||
else
|
else
|
||||||
__end_.__prev_->__next_ = __end_.__next_->__prev_
|
__end_.__prev_->__next_ = __end_.__next_->__prev_
|
||||||
= &static_cast<__node&>(__end_);
|
= static_cast<__node_pointer>(
|
||||||
|
pointer_traits<__node_base_pointer>::pointer_to(__end_));
|
||||||
if (__c.__sz() == 0)
|
if (__c.__sz() == 0)
|
||||||
__c.__end_.__next_ = __c.__end_.__prev_
|
__c.__end_.__next_ = __c.__end_.__prev_
|
||||||
= &static_cast<__node&>(__c.__end_);
|
= static_cast<__node_pointer>(
|
||||||
|
pointer_traits<__node_base_pointer>::pointer_to(__c.__end_));
|
||||||
else
|
else
|
||||||
__c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_
|
__c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_
|
||||||
= &static_cast<__node&>(__c.__end_);
|
= static_cast<__node_pointer>(
|
||||||
|
pointer_traits<__node_base_pointer>::pointer_to(__c.__end_));
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
__libcpp_db* __db = __get_db();
|
__libcpp_db* __db = __get_db();
|
||||||
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
||||||
@@ -736,7 +778,8 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
|
|||||||
{
|
{
|
||||||
--__p;
|
--__p;
|
||||||
const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
|
const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
|
||||||
if (__i->__ptr_ == static_cast<__node_pointer>(&__c.__end_))
|
if (__i->__ptr_ == static_cast<__node_pointer>(
|
||||||
|
pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)))
|
||||||
{
|
{
|
||||||
__cn2->__add(*__p);
|
__cn2->__add(*__p);
|
||||||
if (--__cn1->end_ != __p)
|
if (--__cn1->end_ != __p)
|
||||||
@@ -749,7 +792,8 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
|
|||||||
{
|
{
|
||||||
--__p;
|
--__p;
|
||||||
const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
|
const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
|
||||||
if (__i->__ptr_ == static_cast<__node_pointer>(&__end_))
|
if (__i->__ptr_ == static_cast<__node_pointer>(
|
||||||
|
pointer_traits<__node_base_pointer>::pointer_to(__end_)))
|
||||||
{
|
{
|
||||||
__cn1->__add(*__p);
|
__cn1->__add(*__p);
|
||||||
if (--__cn2->end_ != __p)
|
if (--__cn2->end_ != __p)
|
||||||
@@ -763,7 +807,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Alloc = allocator<_Tp> >
|
template <class _Tp, class _Alloc = allocator<_Tp> >
|
||||||
class _LIBCPP_VISIBLE list
|
class _LIBCPP_TYPE_VIS_ONLY list
|
||||||
: private __list_imp<_Tp, _Alloc>
|
: private __list_imp<_Tp, _Alloc>
|
||||||
{
|
{
|
||||||
typedef __list_imp<_Tp, _Alloc> base;
|
typedef __list_imp<_Tp, _Alloc> base;
|
||||||
@@ -771,6 +815,8 @@ class _LIBCPP_VISIBLE list
|
|||||||
typedef typename base::__node_allocator __node_allocator;
|
typedef typename base::__node_allocator __node_allocator;
|
||||||
typedef typename base::__node_pointer __node_pointer;
|
typedef typename base::__node_pointer __node_pointer;
|
||||||
typedef typename base::__node_alloc_traits __node_alloc_traits;
|
typedef typename base::__node_alloc_traits __node_alloc_traits;
|
||||||
|
typedef typename base::__node_base __node_base;
|
||||||
|
typedef typename base::__node_base_pointer __node_base_pointer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
@@ -797,13 +843,16 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
list(const allocator_type& __a) : base(__a)
|
explicit list(const allocator_type& __a) : base(__a)
|
||||||
{
|
{
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
__get_db()->__insert_c(this);
|
__get_db()->__insert_c(this);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
list(size_type __n);
|
explicit list(size_type __n);
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
explicit list(size_type __n, const allocator_type& __a);
|
||||||
|
#endif
|
||||||
list(size_type __n, const value_type& __x);
|
list(size_type __n, const value_type& __x);
|
||||||
list(size_type __n, const value_type& __x, const allocator_type& __a);
|
list(size_type __n, const value_type& __x, const allocator_type& __a);
|
||||||
template <class _InpIter>
|
template <class _InpIter>
|
||||||
@@ -1010,7 +1059,7 @@ public:
|
|||||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void __link_nodes(__node& __p, __node& __f, __node& __l);
|
static void __link_nodes(__node_pointer __p, __node_pointer __f, __node_pointer __l);
|
||||||
iterator __iterator(size_type __n);
|
iterator __iterator(size_type __n);
|
||||||
template <class _Comp>
|
template <class _Comp>
|
||||||
static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp);
|
static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp);
|
||||||
@@ -1024,12 +1073,12 @@ private:
|
|||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
list<_Tp, _Alloc>::__link_nodes(__node& __p, __node& __f, __node& __l)
|
list<_Tp, _Alloc>::__link_nodes(__node_pointer __p, __node_pointer __f, __node_pointer __l)
|
||||||
{
|
{
|
||||||
__p.__prev_->__next_ = &__f;
|
__p->__prev_->__next_ = __f;
|
||||||
__f.__prev_ = __p.__prev_;
|
__f->__prev_ = __p->__prev_;
|
||||||
__p.__prev_ = &__l;
|
__p->__prev_ = __l;
|
||||||
__l.__next_ = &__p;
|
__l->__next_ = __p;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
@@ -1055,6 +1104,22 @@ list<_Tp, _Alloc>::list(size_type __n)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <class _Tp, class _Alloc>
|
||||||
|
list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
|
||||||
|
{
|
||||||
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
|
__get_db()->__insert_c(this);
|
||||||
|
#endif
|
||||||
|
for (; __n > 0; --__n)
|
||||||
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
emplace_back();
|
||||||
|
#else
|
||||||
|
push_back(value_type());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
list<_Tp, _Alloc>::list(size_type __n, const value_type& __x)
|
list<_Tp, _Alloc>::list(size_type __n, const value_type& __x)
|
||||||
{
|
{
|
||||||
@@ -1191,8 +1256,8 @@ list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a)
|
|||||||
splice(end(), __c);
|
splice(end(), __c);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
typedef move_iterator<iterator> _I;
|
typedef move_iterator<iterator> _Ip;
|
||||||
assign(_I(__c.begin()), _I(__c.end()));
|
assign(_Ip(__c.begin()), _Ip(__c.end()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1215,8 +1280,8 @@ list<_Tp, _Alloc>::__move_assign(list& __c, false_type)
|
|||||||
{
|
{
|
||||||
if (base::__node_alloc() != __c.__node_alloc())
|
if (base::__node_alloc() != __c.__node_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());
|
||||||
@@ -1282,13 +1347,17 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
|
|||||||
" referring to this list");
|
" referring to this list");
|
||||||
#endif
|
#endif
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||||
__hold->__prev_ = 0;
|
__hold->__prev_ = 0;
|
||||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
|
__link_nodes(__p.__ptr_, __hold.get(), __hold.get());
|
||||||
++base::__sz();
|
++base::__sz();
|
||||||
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
|
return iterator(__hold.release(), this);
|
||||||
|
#else
|
||||||
return iterator(__hold.release());
|
return iterator(__hold.release());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
@@ -1299,16 +1368,16 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
|
|||||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||||
"list::insert(iterator, n, x) called with an iterator not"
|
"list::insert(iterator, n, x) called with an iterator not"
|
||||||
" referring to this list");
|
" referring to this list");
|
||||||
iterator __r(const_cast<__node_pointer>(__p.__ptr_), this);
|
iterator __r(__p.__ptr_, this);
|
||||||
#else
|
#else
|
||||||
iterator __r(const_cast<__node_pointer>(__p.__ptr_));
|
iterator __r(__p.__ptr_);
|
||||||
#endif
|
#endif
|
||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
size_type __ds = 0;
|
size_type __ds = 0;
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||||
__hold->__prev_ = 0;
|
__hold->__prev_ = 0;
|
||||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||||
++__ds;
|
++__ds;
|
||||||
@@ -1351,7 +1420,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__r.__ptr_, *__e.__ptr_);
|
__link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
|
||||||
base::__sz() += __ds;
|
base::__sz() += __ds;
|
||||||
}
|
}
|
||||||
return __r;
|
return __r;
|
||||||
@@ -1367,16 +1436,16 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
|||||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||||
"list::insert(iterator, range) called with an iterator not"
|
"list::insert(iterator, range) called with an iterator not"
|
||||||
" referring to this list");
|
" referring to this list");
|
||||||
iterator __r(const_cast<__node_pointer>(__p.__ptr_), this);
|
iterator __r(__p.__ptr_, this);
|
||||||
#else
|
#else
|
||||||
iterator __r(const_cast<__node_pointer>(__p.__ptr_));
|
iterator __r(__p.__ptr_);
|
||||||
#endif
|
#endif
|
||||||
if (__f != __l)
|
if (__f != __l)
|
||||||
{
|
{
|
||||||
size_type __ds = 0;
|
size_type __ds = 0;
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||||
__hold->__prev_ = 0;
|
__hold->__prev_ = 0;
|
||||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
|
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
|
||||||
++__ds;
|
++__ds;
|
||||||
@@ -1419,7 +1488,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__r.__ptr_, *__e.__ptr_);
|
__link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
|
||||||
base::__sz() += __ds;
|
base::__sz() += __ds;
|
||||||
}
|
}
|
||||||
return __r;
|
return __r;
|
||||||
@@ -1430,10 +1499,10 @@ void
|
|||||||
list<_Tp, _Alloc>::push_front(const value_type& __x)
|
list<_Tp, _Alloc>::push_front(const value_type& __x)
|
||||||
{
|
{
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||||
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
|
__link_nodes(base::__end_.__next_, __hold.get(), __hold.get());
|
||||||
++base::__sz();
|
++base::__sz();
|
||||||
__hold.release();
|
__hold.release();
|
||||||
}
|
}
|
||||||
@@ -1443,10 +1512,11 @@ void
|
|||||||
list<_Tp, _Alloc>::push_back(const value_type& __x)
|
list<_Tp, _Alloc>::push_back(const value_type& __x)
|
||||||
{
|
{
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||||
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
|
__link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::
|
||||||
|
pointer_to(base::__end_)), __hold.get(), __hold.get());
|
||||||
++base::__sz();
|
++base::__sz();
|
||||||
__hold.release();
|
__hold.release();
|
||||||
}
|
}
|
||||||
@@ -1458,10 +1528,10 @@ void
|
|||||||
list<_Tp, _Alloc>::push_front(value_type&& __x)
|
list<_Tp, _Alloc>::push_front(value_type&& __x)
|
||||||
{
|
{
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
|
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
|
||||||
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
|
__link_nodes(base::__end_.__next_, __hold.get(), __hold.get());
|
||||||
++base::__sz();
|
++base::__sz();
|
||||||
__hold.release();
|
__hold.release();
|
||||||
}
|
}
|
||||||
@@ -1471,10 +1541,11 @@ void
|
|||||||
list<_Tp, _Alloc>::push_back(value_type&& __x)
|
list<_Tp, _Alloc>::push_back(value_type&& __x)
|
||||||
{
|
{
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
|
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
|
||||||
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
|
__link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::
|
||||||
|
pointer_to(base::__end_)), __hold.get(), __hold.get());
|
||||||
++base::__sz();
|
++base::__sz();
|
||||||
__hold.release();
|
__hold.release();
|
||||||
}
|
}
|
||||||
@@ -1487,10 +1558,10 @@ void
|
|||||||
list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
||||||
{
|
{
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
||||||
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
|
__link_nodes(base::__end_.__next_, __hold.get(), __hold.get());
|
||||||
++base::__sz();
|
++base::__sz();
|
||||||
__hold.release();
|
__hold.release();
|
||||||
}
|
}
|
||||||
@@ -1501,10 +1572,11 @@ void
|
|||||||
list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
|
list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
|
||||||
{
|
{
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
||||||
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
|
__link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::
|
||||||
|
pointer_to(base::__end_)), __hold.get(), __hold.get());
|
||||||
++base::__sz();
|
++base::__sz();
|
||||||
__hold.release();
|
__hold.release();
|
||||||
}
|
}
|
||||||
@@ -1514,12 +1586,17 @@ template <class... _Args>
|
|||||||
typename list<_Tp, _Alloc>::iterator
|
typename list<_Tp, _Alloc>::iterator
|
||||||
list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
|
list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
|
||||||
{
|
{
|
||||||
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
|
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||||
|
"list::emplace(iterator, args...) called with an iterator not"
|
||||||
|
" referring to this list");
|
||||||
|
#endif
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||||
__hold->__prev_ = 0;
|
__hold->__prev_ = 0;
|
||||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
||||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
|
__link_nodes(__p.__ptr_, __hold.get(), __hold.get());
|
||||||
++base::__sz();
|
++base::__sz();
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
return iterator(__hold.release(), this);
|
return iterator(__hold.release(), this);
|
||||||
@@ -1540,11 +1617,11 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
|
|||||||
" referring to this list");
|
" referring to this list");
|
||||||
#endif
|
#endif
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||||
__hold->__prev_ = 0;
|
__hold->__prev_ = 0;
|
||||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
|
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
|
||||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
|
__link_nodes(__p.__ptr_, __hold.get(), __hold.get());
|
||||||
++base::__sz();
|
++base::__sz();
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
return iterator(__hold.release(), this);
|
return iterator(__hold.release(), this);
|
||||||
@@ -1561,7 +1638,7 @@ list<_Tp, _Alloc>::pop_front()
|
|||||||
{
|
{
|
||||||
_LIBCPP_ASSERT(!empty(), "list::pop_front() called with empty list");
|
_LIBCPP_ASSERT(!empty(), "list::pop_front() called with empty list");
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
__node& __n = *base::__end_.__next_;
|
__node_pointer __n = base::__end_.__next_;
|
||||||
base::__unlink_nodes(__n, __n);
|
base::__unlink_nodes(__n, __n);
|
||||||
--base::__sz();
|
--base::__sz();
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
@@ -1570,7 +1647,7 @@ list<_Tp, _Alloc>::pop_front()
|
|||||||
{
|
{
|
||||||
--__p;
|
--__p;
|
||||||
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
||||||
if (__i->__ptr_ == &__n)
|
if (__i->__ptr_ == __n)
|
||||||
{
|
{
|
||||||
(*__p)->__c_ = nullptr;
|
(*__p)->__c_ = nullptr;
|
||||||
if (--__c->end_ != __p)
|
if (--__c->end_ != __p)
|
||||||
@@ -1579,17 +1656,17 @@ list<_Tp, _Alloc>::pop_front()
|
|||||||
}
|
}
|
||||||
__get_db()->unlock();
|
__get_db()->unlock();
|
||||||
#endif
|
#endif
|
||||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
|
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
|
||||||
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
|
__node_alloc_traits::deallocate(__na, __n, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
void
|
void
|
||||||
list<_Tp, _Alloc>::pop_back()
|
list<_Tp, _Alloc>::pop_back()
|
||||||
{
|
{
|
||||||
_LIBCPP_ASSERT(!empty(), "list::pop_front() called with empty list");
|
_LIBCPP_ASSERT(!empty(), "list::pop_back() called with empty list");
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
__node& __n = *base::__end_.__prev_;
|
__node_pointer __n = base::__end_.__prev_;
|
||||||
base::__unlink_nodes(__n, __n);
|
base::__unlink_nodes(__n, __n);
|
||||||
--base::__sz();
|
--base::__sz();
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
@@ -1598,7 +1675,7 @@ list<_Tp, _Alloc>::pop_back()
|
|||||||
{
|
{
|
||||||
--__p;
|
--__p;
|
||||||
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
||||||
if (__i->__ptr_ == &__n)
|
if (__i->__ptr_ == __n)
|
||||||
{
|
{
|
||||||
(*__p)->__c_ = nullptr;
|
(*__p)->__c_ = nullptr;
|
||||||
if (--__c->end_ != __p)
|
if (--__c->end_ != __p)
|
||||||
@@ -1607,8 +1684,8 @@ list<_Tp, _Alloc>::pop_back()
|
|||||||
}
|
}
|
||||||
__get_db()->unlock();
|
__get_db()->unlock();
|
||||||
#endif
|
#endif
|
||||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
|
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
|
||||||
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
|
__node_alloc_traits::deallocate(__na, __n, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
@@ -1620,9 +1697,11 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
|
|||||||
"list::erase(iterator) called with an iterator not"
|
"list::erase(iterator) called with an iterator not"
|
||||||
" referring to this list");
|
" referring to this list");
|
||||||
#endif
|
#endif
|
||||||
|
_LIBCPP_ASSERT(__p != end(),
|
||||||
|
"list::erase(iterator) called with a non-dereferenceable iterator");
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
__node& __n = const_cast<__node&>(*__p.__ptr_);
|
__node_pointer __n = __p.__ptr_;
|
||||||
__node_pointer __r = __n.__next_;
|
__node_pointer __r = __n->__next_;
|
||||||
base::__unlink_nodes(__n, __n);
|
base::__unlink_nodes(__n, __n);
|
||||||
--base::__sz();
|
--base::__sz();
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
@@ -1631,7 +1710,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
|
|||||||
{
|
{
|
||||||
--__p;
|
--__p;
|
||||||
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
||||||
if (__i->__ptr_ == &__n)
|
if (__i->__ptr_ == __n)
|
||||||
{
|
{
|
||||||
(*__p)->__c_ = nullptr;
|
(*__p)->__c_ = nullptr;
|
||||||
if (--__c->end_ != __p)
|
if (--__c->end_ != __p)
|
||||||
@@ -1640,8 +1719,8 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
|
|||||||
}
|
}
|
||||||
__get_db()->unlock();
|
__get_db()->unlock();
|
||||||
#endif
|
#endif
|
||||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
|
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
|
||||||
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
|
__node_alloc_traits::deallocate(__na, __n, 1);
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
return iterator(__r, this);
|
return iterator(__r, this);
|
||||||
#else
|
#else
|
||||||
@@ -1661,10 +1740,10 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
|
|||||||
if (__f != __l)
|
if (__f != __l)
|
||||||
{
|
{
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
base::__unlink_nodes(const_cast<__node&>(*__f.__ptr_), *__l.__ptr_->__prev_);
|
base::__unlink_nodes(__f.__ptr_, __l.__ptr_->__prev_);
|
||||||
while (__f != __l)
|
while (__f != __l)
|
||||||
{
|
{
|
||||||
__node& __n = const_cast<__node&>(*__f.__ptr_);
|
__node_pointer __n = __f.__ptr_;
|
||||||
++__f;
|
++__f;
|
||||||
--base::__sz();
|
--base::__sz();
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
@@ -1673,7 +1752,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
|
|||||||
{
|
{
|
||||||
--__p;
|
--__p;
|
||||||
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
||||||
if (__i->__ptr_ == &__n)
|
if (__i->__ptr_ == __n)
|
||||||
{
|
{
|
||||||
(*__p)->__c_ = nullptr;
|
(*__p)->__c_ = nullptr;
|
||||||
if (--__c->end_ != __p)
|
if (--__c->end_ != __p)
|
||||||
@@ -1682,14 +1761,14 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
|
|||||||
}
|
}
|
||||||
__get_db()->unlock();
|
__get_db()->unlock();
|
||||||
#endif
|
#endif
|
||||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
|
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
|
||||||
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
|
__node_alloc_traits::deallocate(__na, __n, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
return iterator(const_cast<__node_pointer>(__l.__ptr_), this);
|
return iterator(__l.__ptr_, this);
|
||||||
#else
|
#else
|
||||||
return iterator(const_cast<__node_pointer>(__l.__ptr_));
|
return iterator(__l.__ptr_);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1704,8 +1783,8 @@ list<_Tp, _Alloc>::resize(size_type __n)
|
|||||||
__n -= base::__sz();
|
__n -= base::__sz();
|
||||||
size_type __ds = 0;
|
size_type __ds = 0;
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||||
__hold->__prev_ = 0;
|
__hold->__prev_ = 0;
|
||||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
|
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
|
||||||
++__ds;
|
++__ds;
|
||||||
@@ -1747,7 +1826,8 @@ list<_Tp, _Alloc>::resize(size_type __n)
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
__link_nodes(static_cast<__node&>(base::__end_), *__r.__ptr_, *__e.__ptr_);
|
__link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::
|
||||||
|
pointer_to(base::__end_)), __r.__ptr_, __e.__ptr_);
|
||||||
base::__sz() += __ds;
|
base::__sz() += __ds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1763,8 +1843,8 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
|
|||||||
__n -= base::__sz();
|
__n -= base::__sz();
|
||||||
size_type __ds = 0;
|
size_type __ds = 0;
|
||||||
__node_allocator& __na = base::__node_alloc();
|
__node_allocator& __na = base::__node_alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _D;
|
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||||
__hold->__prev_ = 0;
|
__hold->__prev_ = 0;
|
||||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||||
++__ds;
|
++__ds;
|
||||||
@@ -1806,7 +1886,8 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
__link_nodes(static_cast<__node&>(base::__end_), *__r.__ptr_, *__e.__ptr_);
|
__link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::
|
||||||
|
pointer_to(base::__end_)), __r.__ptr_, __e.__ptr_);
|
||||||
base::__sz() += __ds;
|
base::__sz() += __ds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1824,10 +1905,10 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
|
|||||||
#endif
|
#endif
|
||||||
if (!__c.empty())
|
if (!__c.empty())
|
||||||
{
|
{
|
||||||
__node& __f = *__c.__end_.__next_;
|
__node_pointer __f = __c.__end_.__next_;
|
||||||
__node& __l = *__c.__end_.__prev_;
|
__node_pointer __l = __c.__end_.__prev_;
|
||||||
base::__unlink_nodes(__f, __l);
|
base::__unlink_nodes(__f, __l);
|
||||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), __f, __l);
|
__link_nodes(__p.__ptr_, __f, __l);
|
||||||
base::__sz() += __c.__sz();
|
base::__sz() += __c.__sz();
|
||||||
__c.__sz() = 0;
|
__c.__sz() = 0;
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
@@ -1838,7 +1919,8 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
|
|||||||
{
|
{
|
||||||
--__p;
|
--__p;
|
||||||
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
||||||
if (__i->__ptr_ != static_cast<__node_pointer>(&__c.__end_))
|
if (__i->__ptr_ != static_cast<__node_pointer>(
|
||||||
|
pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)))
|
||||||
{
|
{
|
||||||
__cn1->__add(*__p);
|
__cn1->__add(*__p);
|
||||||
(*__p)->__c_ = __cn1;
|
(*__p)->__c_ = __cn1;
|
||||||
@@ -1868,9 +1950,9 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
|
|||||||
#endif
|
#endif
|
||||||
if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_)
|
if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_)
|
||||||
{
|
{
|
||||||
__node& __f = const_cast<__node&>(*__i.__ptr_);
|
__node_pointer __f = __i.__ptr_;
|
||||||
base::__unlink_nodes(__f, __f);
|
base::__unlink_nodes(__f, __f);
|
||||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), __f, __f);
|
__link_nodes(__p.__ptr_, __f, __f);
|
||||||
--__c.__sz();
|
--__c.__sz();
|
||||||
++base::__sz();
|
++base::__sz();
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
@@ -1881,7 +1963,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
|
|||||||
{
|
{
|
||||||
--__p;
|
--__p;
|
||||||
iterator* __j = static_cast<iterator*>((*__p)->__i_);
|
iterator* __j = static_cast<iterator*>((*__p)->__i_);
|
||||||
if (__j->__ptr_ == &__f)
|
if (__j->__ptr_ == __f)
|
||||||
{
|
{
|
||||||
__cn1->__add(*__p);
|
__cn1->__add(*__p);
|
||||||
(*__p)->__c_ = __cn1;
|
(*__p)->__c_ = __cn1;
|
||||||
@@ -1922,11 +2004,11 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
|
|||||||
__c.__sz() -= __s;
|
__c.__sz() -= __s;
|
||||||
base::__sz() += __s;
|
base::__sz() += __s;
|
||||||
}
|
}
|
||||||
__node& __first = const_cast<__node&>(*__f.__ptr_);
|
__node_pointer __first = __f.__ptr_;
|
||||||
--__l;
|
--__l;
|
||||||
__node& __last = const_cast<__node&>(*__l.__ptr_);
|
__node_pointer __last = __l.__ptr_;
|
||||||
base::__unlink_nodes(__first, __last);
|
base::__unlink_nodes(__first, __last);
|
||||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), __first, __last);
|
__link_nodes(__p.__ptr_, __first, __last);
|
||||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||||
__libcpp_db* __db = __get_db();
|
__libcpp_db* __db = __get_db();
|
||||||
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
||||||
@@ -1935,7 +2017,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
|
|||||||
{
|
{
|
||||||
--__p;
|
--__p;
|
||||||
iterator* __j = static_cast<iterator*>((*__p)->__i_);
|
iterator* __j = static_cast<iterator*>((*__p)->__i_);
|
||||||
for (__node_pointer __k = const_cast<__node_pointer>(__f.__ptr_);
|
for (__node_pointer __k = __f.__ptr_;
|
||||||
__k != __l.__ptr_; __k = __k->__next_)
|
__k != __l.__ptr_; __k = __k->__next_)
|
||||||
{
|
{
|
||||||
if (__j->__ptr_ == __k)
|
if (__j->__ptr_ == __k)
|
||||||
@@ -2041,12 +2123,12 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
|
|||||||
;
|
;
|
||||||
base::__sz() += __ds;
|
base::__sz() += __ds;
|
||||||
__c.__sz() -= __ds;
|
__c.__sz() -= __ds;
|
||||||
__node& __f = *__f2.__ptr_;
|
__node_pointer __f = __f2.__ptr_;
|
||||||
__node& __l = *__m2.__ptr_->__prev_;
|
__node_pointer __l = __m2.__ptr_->__prev_;
|
||||||
__f2 = __m2;
|
__f2 = __m2;
|
||||||
base::__unlink_nodes(__f, __l);
|
base::__unlink_nodes(__f, __l);
|
||||||
__m2 = _VSTD::next(__f1);
|
__m2 = _VSTD::next(__f1);
|
||||||
__link_nodes(*__f1.__ptr_, __f, __l);
|
__link_nodes(__f1.__ptr_, __f, __l);
|
||||||
__f1 = __m2;
|
__f1 = __m2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2061,7 +2143,8 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
|
|||||||
{
|
{
|
||||||
--__p;
|
--__p;
|
||||||
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
||||||
if (__i->__ptr_ != static_cast<__node_pointer>(&__c.__end_))
|
if (__i->__ptr_ != static_cast<__node_pointer>(
|
||||||
|
pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)))
|
||||||
{
|
{
|
||||||
__cn1->__add(*__p);
|
__cn1->__add(*__p);
|
||||||
(*__p)->__c_ = __cn1;
|
(*__p)->__c_ = __cn1;
|
||||||
@@ -2104,9 +2187,9 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
|
|||||||
case 2:
|
case 2:
|
||||||
if (__comp(*--__e2, *__f1))
|
if (__comp(*--__e2, *__f1))
|
||||||
{
|
{
|
||||||
__node& __f = *__e2.__ptr_;
|
__node_pointer __f = __e2.__ptr_;
|
||||||
base::__unlink_nodes(__f, __f);
|
base::__unlink_nodes(__f, __f);
|
||||||
__link_nodes(*__f1.__ptr_, __f, __f);
|
__link_nodes(__f1.__ptr_, __f, __f);
|
||||||
return __e2;
|
return __e2;
|
||||||
}
|
}
|
||||||
return __f1;
|
return __f1;
|
||||||
@@ -2120,13 +2203,13 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
|
|||||||
iterator __m2 = _VSTD::next(__f2);
|
iterator __m2 = _VSTD::next(__f2);
|
||||||
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
|
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
|
||||||
;
|
;
|
||||||
__node& __f = *__f2.__ptr_;
|
__node_pointer __f = __f2.__ptr_;
|
||||||
__node& __l = *__m2.__ptr_->__prev_;
|
__node_pointer __l = __m2.__ptr_->__prev_;
|
||||||
__r = __f2;
|
__r = __f2;
|
||||||
__e1 = __f2 = __m2;
|
__e1 = __f2 = __m2;
|
||||||
base::__unlink_nodes(__f, __l);
|
base::__unlink_nodes(__f, __l);
|
||||||
__m2 = _VSTD::next(__f1);
|
__m2 = _VSTD::next(__f1);
|
||||||
__link_nodes(*__f1.__ptr_, __f, __l);
|
__link_nodes(__f1.__ptr_, __f, __l);
|
||||||
__f1 = __m2;
|
__f1 = __m2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2138,14 +2221,14 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
|
|||||||
iterator __m2 = _VSTD::next(__f2);
|
iterator __m2 = _VSTD::next(__f2);
|
||||||
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
|
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
|
||||||
;
|
;
|
||||||
__node& __f = *__f2.__ptr_;
|
__node_pointer __f = __f2.__ptr_;
|
||||||
__node& __l = *__m2.__ptr_->__prev_;
|
__node_pointer __l = __m2.__ptr_->__prev_;
|
||||||
if (__e1 == __f2)
|
if (__e1 == __f2)
|
||||||
__e1 = __m2;
|
__e1 = __m2;
|
||||||
__f2 = __m2;
|
__f2 = __m2;
|
||||||
base::__unlink_nodes(__f, __l);
|
base::__unlink_nodes(__f, __l);
|
||||||
__m2 = _VSTD::next(__f1);
|
__m2 = _VSTD::next(__f1);
|
||||||
__link_nodes(*__f1.__ptr_, __f, __l);
|
__link_nodes(__f1.__ptr_, __f, __l);
|
||||||
__f1 = __m2;
|
__f1 = __m2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2183,7 +2266,8 @@ template <class _Tp, class _Alloc>
|
|||||||
bool
|
bool
|
||||||
list<_Tp, _Alloc>::__dereferenceable(const const_iterator* __i) const
|
list<_Tp, _Alloc>::__dereferenceable(const const_iterator* __i) const
|
||||||
{
|
{
|
||||||
return __i->__ptr_ != &this->__end_;
|
return __i->__ptr_ != static_cast<__node_pointer>(
|
||||||
|
pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(this->__end_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
|
|||||||
814
include/locale
814
include/locale
File diff suppressed because it is too large
Load Diff
752
include/map
752
include/map
File diff suppressed because it is too large
Load Diff
1908
include/memory
1908
include/memory
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ namespace std
|
|||||||
class mutex
|
class mutex
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
mutex();
|
constexpr mutex() noexcept;
|
||||||
~mutex();
|
~mutex();
|
||||||
|
|
||||||
mutex(const mutex&) = delete;
|
mutex(const mutex&) = delete;
|
||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
recursive_mutex& operator=(const recursive_mutex&) = delete;
|
recursive_mutex& operator=(const recursive_mutex&) = delete;
|
||||||
|
|
||||||
void lock();
|
void lock();
|
||||||
bool try_lock();
|
bool try_lock() noexcept;
|
||||||
void unlock();
|
void unlock();
|
||||||
|
|
||||||
typedef pthread_mutex_t* native_handle_type;
|
typedef pthread_mutex_t* native_handle_type;
|
||||||
@@ -79,7 +79,7 @@ public:
|
|||||||
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
|
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
|
||||||
|
|
||||||
void lock();
|
void lock();
|
||||||
bool try_lock();
|
bool try_lock() noexcept;
|
||||||
template <class Rep, class Period>
|
template <class Rep, class Period>
|
||||||
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
||||||
template <class Clock, class Duration>
|
template <class Clock, class Duration>
|
||||||
@@ -114,9 +114,9 @@ class unique_lock
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef Mutex mutex_type;
|
typedef Mutex mutex_type;
|
||||||
unique_lock();
|
unique_lock() noexcept;
|
||||||
explicit unique_lock(mutex_type& m);
|
explicit unique_lock(mutex_type& m);
|
||||||
unique_lock(mutex_type& m, defer_lock_t);
|
unique_lock(mutex_type& m, defer_lock_t) noexcept;
|
||||||
unique_lock(mutex_type& m, try_to_lock_t);
|
unique_lock(mutex_type& m, try_to_lock_t);
|
||||||
unique_lock(mutex_type& m, adopt_lock_t);
|
unique_lock(mutex_type& m, adopt_lock_t);
|
||||||
template <class Clock, class Duration>
|
template <class Clock, class Duration>
|
||||||
@@ -128,8 +128,8 @@ public:
|
|||||||
unique_lock(unique_lock const&) = delete;
|
unique_lock(unique_lock const&) = delete;
|
||||||
unique_lock& operator=(unique_lock const&) = delete;
|
unique_lock& operator=(unique_lock const&) = delete;
|
||||||
|
|
||||||
unique_lock(unique_lock&& u);
|
unique_lock(unique_lock&& u) noexcept;
|
||||||
unique_lock& operator=(unique_lock&& u);
|
unique_lock& operator=(unique_lock&& u) noexcept;
|
||||||
|
|
||||||
void lock();
|
void lock();
|
||||||
bool try_lock();
|
bool try_lock();
|
||||||
@@ -141,16 +141,16 @@ public:
|
|||||||
|
|
||||||
void unlock();
|
void unlock();
|
||||||
|
|
||||||
void swap(unique_lock& u);
|
void swap(unique_lock& u) noexcept;
|
||||||
mutex_type* release();
|
mutex_type* release() noexcept;
|
||||||
|
|
||||||
bool owns_lock() const;
|
bool owns_lock() const noexcept;
|
||||||
explicit operator bool () const;
|
explicit operator bool () const noexcept;
|
||||||
mutex_type* mutex() const;
|
mutex_type* mutex() const noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Mutex>
|
template <class Mutex>
|
||||||
void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y);
|
void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y) noexcept;
|
||||||
|
|
||||||
template <class L1, class L2, class... L3>
|
template <class L1, class L2, class... L3>
|
||||||
int try_lock(L1&, L2&, L3&...);
|
int try_lock(L1&, L2&, L3&...);
|
||||||
@@ -159,7 +159,7 @@ template <class L1, class L2, class... L3>
|
|||||||
|
|
||||||
struct once_flag
|
struct once_flag
|
||||||
{
|
{
|
||||||
constexpr once_flag();
|
constexpr once_flag() noexcept;
|
||||||
|
|
||||||
once_flag(const once_flag&) = delete;
|
once_flag(const once_flag&) = delete;
|
||||||
once_flag& operator=(const once_flag&) = delete;
|
once_flag& operator=(const once_flag&) = delete;
|
||||||
@@ -179,11 +179,15 @@ template<class Callable, class ...Args>
|
|||||||
#include <tuple>
|
#include <tuple>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE recursive_mutex
|
class _LIBCPP_TYPE_VIS recursive_mutex
|
||||||
{
|
{
|
||||||
pthread_mutex_t __m_;
|
pthread_mutex_t __m_;
|
||||||
|
|
||||||
@@ -197,15 +201,15 @@ 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
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
native_handle_type native_handle() {return &__m_;}
|
native_handle_type native_handle() {return &__m_;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE timed_mutex
|
class _LIBCPP_TYPE_VIS timed_mutex
|
||||||
{
|
{
|
||||||
mutex __m_;
|
mutex __m_;
|
||||||
condition_variable __cv_;
|
condition_variable __cv_;
|
||||||
@@ -220,14 +224,14 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void lock();
|
void lock();
|
||||||
bool try_lock();
|
bool try_lock() _NOEXCEPT;
|
||||||
template <class _Rep, class _Period>
|
template <class _Rep, class _Period>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||||
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
||||||
template <class _Clock, class _Duration>
|
template <class _Clock, class _Duration>
|
||||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||||
void unlock();
|
void unlock() _NOEXCEPT;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Clock, class _Duration>
|
template <class _Clock, class _Duration>
|
||||||
@@ -247,7 +251,7 @@ timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE recursive_timed_mutex
|
class _LIBCPP_TYPE_VIS recursive_timed_mutex
|
||||||
{
|
{
|
||||||
mutex __m_;
|
mutex __m_;
|
||||||
condition_variable __cv_;
|
condition_variable __cv_;
|
||||||
@@ -263,14 +267,14 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void lock();
|
void lock();
|
||||||
bool try_lock();
|
bool try_lock() _NOEXCEPT;
|
||||||
template <class _Rep, class _Period>
|
template <class _Rep, class _Period>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||||
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
||||||
template <class _Clock, class _Duration>
|
template <class _Clock, class _Duration>
|
||||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||||
void unlock();
|
void unlock() _NOEXCEPT;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Clock, class _Duration>
|
template <class _Clock, class _Duration>
|
||||||
@@ -421,25 +425,27 @@ lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
|
|||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
struct once_flag;
|
struct _LIBCPP_TYPE_VIS once_flag;
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
template<class _Callable, class... _Args>
|
template<class _Callable, class... _Args>
|
||||||
void call_once(once_flag&, _Callable&&, _Args&&...);
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
void call_once(once_flag&, _Callable&&, _Args&&...);
|
||||||
|
|
||||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
template<class _Callable>
|
template<class _Callable>
|
||||||
void call_once(once_flag&, _Callable);
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
void call_once(once_flag&, _Callable);
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
struct _LIBCPP_VISIBLE once_flag
|
struct _LIBCPP_TYPE_VIS_ONLY once_flag
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
// constexpr
|
_LIBCPP_CONSTEXPR
|
||||||
once_flag() {}
|
once_flag() _NOEXCEPT : __state_(0) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
once_flag(const once_flag&); // = delete;
|
once_flag(const once_flag&); // = delete;
|
||||||
@@ -460,23 +466,23 @@ private:
|
|||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
template <class _F>
|
template <class _Fp>
|
||||||
class __call_once_param
|
class __call_once_param
|
||||||
{
|
{
|
||||||
_F __f_;
|
_Fp __f_;
|
||||||
public:
|
public:
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
|
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
|
||||||
#else
|
#else
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __call_once_param(const _F& __f) : __f_(__f) {}
|
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void operator()()
|
void operator()()
|
||||||
{
|
{
|
||||||
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
|
typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index;
|
||||||
__execute(_Index());
|
__execute(_Index());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,17 +497,17 @@ private:
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
template <class _F>
|
template <class _Fp>
|
||||||
class __call_once_param
|
class __call_once_param
|
||||||
{
|
{
|
||||||
_F __f_;
|
_Fp __f_;
|
||||||
public:
|
public:
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
|
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
|
||||||
#else
|
#else
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __call_once_param(const _F& __f) : __f_(__f) {}
|
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -513,15 +519,15 @@ public:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <class _F>
|
template <class _Fp>
|
||||||
void
|
void
|
||||||
__call_once_proxy(void* __vp)
|
__call_once_proxy(void* __vp)
|
||||||
{
|
{
|
||||||
__call_once_param<_F>* __p = static_cast<__call_once_param<_F>*>(__vp);
|
__call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp);
|
||||||
(*__p)();
|
(*__p)();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __call_once(volatile unsigned long&, void*, void(*)(void*));
|
_LIBCPP_FUNC_VIS void __call_once(volatile unsigned long&, void*, void(*)(void*));
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
@@ -530,12 +536,12 @@ inline _LIBCPP_INLINE_VISIBILITY
|
|||||||
void
|
void
|
||||||
call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
|
call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
|
||||||
{
|
{
|
||||||
if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul)
|
if (__flag.__state_ != ~0ul)
|
||||||
{
|
{
|
||||||
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _G;
|
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _Gp;
|
||||||
__call_once_param<_G> __p(_G(__decay_copy(_VSTD::forward<_Callable>(__func)),
|
__call_once_param<_Gp> __p(_Gp(__decay_copy(_VSTD::forward<_Callable>(__func)),
|
||||||
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
||||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
|
__call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
69
include/new
69
include/new
@@ -27,6 +27,18 @@ public:
|
|||||||
virtual const char* what() const noexcept;
|
virtual const char* what() const noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class bad_array_length : public bad_alloc // C++14
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bad_array_length() noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
class bad_array_new_length : public bad_alloc
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bad_array_new_length() noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
struct nothrow_t {};
|
struct nothrow_t {};
|
||||||
extern const nothrow_t nothrow;
|
extern const nothrow_t nothrow;
|
||||||
typedef void (*new_handler)();
|
typedef void (*new_handler)();
|
||||||
@@ -56,7 +68,9 @@ void operator delete[](void* ptr, void*) noexcept;
|
|||||||
#include <exception>
|
#include <exception>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
|
#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
|
||||||
{
|
{
|
||||||
@@ -79,37 +93,58 @@ public:
|
|||||||
virtual const char* what() const _NOEXCEPT;
|
virtual const char* what() const _NOEXCEPT;
|
||||||
};
|
};
|
||||||
|
|
||||||
void __throw_bad_alloc(); // not in C++ spec
|
#if defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
|
||||||
|
|
||||||
struct _LIBCPP_VISIBLE nothrow_t {};
|
class _LIBCPP_EXCEPTION_ABI bad_array_length
|
||||||
extern _LIBCPP_VISIBLE const nothrow_t nothrow;
|
: public bad_alloc
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bad_array_length() _NOEXCEPT;
|
||||||
|
virtual ~bad_array_length() _NOEXCEPT;
|
||||||
|
virtual const char* what() const _NOEXCEPT;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
|
||||||
|
|
||||||
|
#endif // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
|
||||||
|
|
||||||
|
_LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
|
||||||
|
|
||||||
|
struct _LIBCPP_TYPE_VIS nothrow_t {};
|
||||||
|
extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
|
||||||
typedef void (*new_handler)();
|
typedef void (*new_handler)();
|
||||||
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) _NOEXCEPT;
|
_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
|
||||||
_LIBCPP_VISIBLE new_handler get_new_handler() _NOEXCEPT;
|
_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
|
||||||
_LIBCPP_VISIBLE void* operator new(std::size_t __sz)
|
#if defined(_WIN32) && !defined(cxx_EXPORTS)
|
||||||
|
# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS_ONLY
|
||||||
|
#else
|
||||||
|
# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz)
|
||||||
#if !__has_feature(cxx_noexcept)
|
#if !__has_feature(cxx_noexcept)
|
||||||
throw(std::bad_alloc)
|
throw(std::bad_alloc)
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
_LIBCPP_VISIBLE void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
|
_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
|
||||||
_LIBCPP_VISIBLE void operator delete(void* __p) _NOEXCEPT;
|
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p) _NOEXCEPT;
|
||||||
_LIBCPP_VISIBLE void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
|
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz)
|
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz)
|
||||||
#if !__has_feature(cxx_noexcept)
|
#if !__has_feature(cxx_noexcept)
|
||||||
throw(std::bad_alloc)
|
throw(std::bad_alloc)
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
|
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
|
||||||
_LIBCPP_VISIBLE void operator delete[](void* __p) _NOEXCEPT;
|
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p) _NOEXCEPT;
|
||||||
_LIBCPP_VISIBLE void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
|
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
|
inline _LIBCPP_INLINE_VISIBILITY void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
|
||||||
_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
|
inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
|
||||||
_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) _NOEXCEPT {}
|
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
|
||||||
_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) _NOEXCEPT {}
|
inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {}
|
||||||
|
|
||||||
#endif // _LIBCPP_NEW
|
#endif // _LIBCPP_NEW
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ template <class ForwardIterator, class T>
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
@@ -155,7 +157,7 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
|
|||||||
{
|
{
|
||||||
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
|
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
|
||||||
*__result = __t2 - __t1;
|
*__result = __t2 - __t1;
|
||||||
__t1 = __t2;
|
__t1 = _VSTD::move(__t2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return __result;
|
return __result;
|
||||||
@@ -175,7 +177,7 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
|
|||||||
{
|
{
|
||||||
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
|
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
|
||||||
*__result = __binary_op(__t2, __t1);
|
*__result = __binary_op(__t2, __t1);
|
||||||
__t1 = __t2;
|
__t1 = _VSTD::move(__t2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return __result;
|
return __result;
|
||||||
@@ -184,10 +186,10 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
|
|||||||
template <class _ForwardIterator, class _Tp>
|
template <class _ForwardIterator, class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
|
iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
|
||||||
{
|
{
|
||||||
for (; __first != __last; ++__first, ++__value)
|
for (; __first != __last; ++__first, ++__value_)
|
||||||
*__first = __value;
|
*__first = __value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|||||||
158
include/ostream
158
include/ostream
@@ -32,6 +32,7 @@ public:
|
|||||||
virtual ~basic_ostream();
|
virtual ~basic_ostream();
|
||||||
|
|
||||||
// 27.7.2.3 Assign/swap
|
// 27.7.2.3 Assign/swap
|
||||||
|
basic_ostream& operator=(const basic_ostream& rhs) = delete; // C++14
|
||||||
basic_ostream& operator=(basic_ostream&& rhs);
|
basic_ostream& operator=(basic_ostream&& rhs);
|
||||||
void swap(basic_ostream& rhs);
|
void swap(basic_ostream& rhs);
|
||||||
|
|
||||||
@@ -133,12 +134,14 @@ template <class charT, class traits, class T>
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
||||||
|
#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_ostream
|
class _LIBCPP_TYPE_VIS_ONLY basic_ostream
|
||||||
: virtual public basic_ios<_CharT, _Traits>
|
: virtual public basic_ios<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -159,6 +162,9 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 27.7.2.3 Assign/swap
|
// 27.7.2.3 Assign/swap
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
basic_ostream& operator=(const basic_ostream&) = delete;
|
||||||
|
#endif
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_ostream& operator=(basic_ostream&& __rhs);
|
basic_ostream& operator=(basic_ostream&& __rhs);
|
||||||
@@ -167,7 +173,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
// 27.7.2.4 Prefix/suffix:
|
// 27.7.2.4 Prefix/suffix:
|
||||||
class sentry;
|
class _LIBCPP_TYPE_VIS_ONLY sentry;
|
||||||
|
|
||||||
// 27.7.2.6 Formatted output:
|
// 27.7.2.6 Formatted output:
|
||||||
basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&));
|
basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&));
|
||||||
@@ -205,7 +211,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
class _LIBCPP_VISIBLE basic_ostream<_CharT, _Traits>::sentry
|
class _LIBCPP_TYPE_VIS_ONLY basic_ostream<_CharT, _Traits>::sentry
|
||||||
{
|
{
|
||||||
bool __ok_;
|
bool __ok_;
|
||||||
basic_ostream<_CharT, _Traits>& __os_;
|
basic_ostream<_CharT, _Traits>& __os_;
|
||||||
@@ -218,7 +224,7 @@ public:
|
|||||||
~sentry();
|
~sentry();
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
// explicit
|
_LIBCPP_EXPLICIT
|
||||||
operator bool() const {return __ok_;}
|
operator bool() const {return __ok_;}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -340,11 +346,11 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||||
_I __i(__sb);
|
_Ip __i(__sb);
|
||||||
_I __eof;
|
_Ip __eof;
|
||||||
_O __o(*this);
|
_Op __o(*this);
|
||||||
size_t __c = 0;
|
size_t __c = 0;
|
||||||
for (; __i != __eof; ++__i, ++__o, ++__c)
|
for (; __i != __eof; ++__i, ++__o, ++__c)
|
||||||
{
|
{
|
||||||
@@ -386,8 +392,8 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||||
const _F& __f = use_facet<_F>(this->getloc());
|
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||||
}
|
}
|
||||||
@@ -413,8 +419,8 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
|
|||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
|
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
|
||||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||||
const _F& __f = use_facet<_F>(this->getloc());
|
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||||
if (__f.put(*this, *this, this->fill(),
|
if (__f.put(*this, *this, this->fill(),
|
||||||
__flags == ios_base::oct || __flags == ios_base::hex ?
|
__flags == ios_base::oct || __flags == ios_base::hex ?
|
||||||
static_cast<long>(static_cast<unsigned short>(__n)) :
|
static_cast<long>(static_cast<unsigned short>(__n)) :
|
||||||
@@ -442,8 +448,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||||
const _F& __f = use_facet<_F>(this->getloc());
|
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||||
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
|
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
|
||||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||||
}
|
}
|
||||||
@@ -469,8 +475,8 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
|
|||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
|
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
|
||||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||||
const _F& __f = use_facet<_F>(this->getloc());
|
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||||
if (__f.put(*this, *this, this->fill(),
|
if (__f.put(*this, *this, this->fill(),
|
||||||
__flags == ios_base::oct || __flags == ios_base::hex ?
|
__flags == ios_base::oct || __flags == ios_base::hex ?
|
||||||
static_cast<long>(static_cast<unsigned int>(__n)) :
|
static_cast<long>(static_cast<unsigned int>(__n)) :
|
||||||
@@ -498,8 +504,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||||
const _F& __f = use_facet<_F>(this->getloc());
|
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||||
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
|
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
|
||||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||||
}
|
}
|
||||||
@@ -524,8 +530,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||||
const _F& __f = use_facet<_F>(this->getloc());
|
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||||
}
|
}
|
||||||
@@ -550,8 +556,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||||
const _F& __f = use_facet<_F>(this->getloc());
|
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||||
}
|
}
|
||||||
@@ -576,8 +582,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||||
const _F& __f = use_facet<_F>(this->getloc());
|
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||||
}
|
}
|
||||||
@@ -602,8 +608,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||||
const _F& __f = use_facet<_F>(this->getloc());
|
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||||
}
|
}
|
||||||
@@ -628,8 +634,8 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||||
const _F& __f = use_facet<_F>(this->getloc());
|
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||||
if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
|
if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
|
||||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||||
}
|
}
|
||||||
@@ -654,8 +660,8 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||||
const _F& __f = use_facet<_F>(this->getloc());
|
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||||
}
|
}
|
||||||
@@ -680,8 +686,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||||
const _F& __f = use_facet<_F>(this->getloc());
|
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||||
}
|
}
|
||||||
@@ -706,8 +712,8 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||||
const _F& __f = use_facet<_F>(this->getloc());
|
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||||
}
|
}
|
||||||
@@ -732,8 +738,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
|
|||||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||||
if (__pad_and_output(_I(__os),
|
if (__pad_and_output(_Ip(__os),
|
||||||
&__c,
|
&__c,
|
||||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||||
&__c + 1 :
|
&__c + 1 :
|
||||||
@@ -765,8 +771,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
|
|||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
_CharT __c = __os.widen(__cn);
|
_CharT __c = __os.widen(__cn);
|
||||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||||
if (__pad_and_output(_I(__os),
|
if (__pad_and_output(_Ip(__os),
|
||||||
&__c,
|
&__c,
|
||||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||||
&__c + 1 :
|
&__c + 1 :
|
||||||
@@ -797,8 +803,8 @@ operator<<(basic_ostream<char, _Traits>& __os, char __c)
|
|||||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||||
if (__pad_and_output(_I(__os),
|
if (__pad_and_output(_Ip(__os),
|
||||||
&__c,
|
&__c,
|
||||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||||
&__c + 1 :
|
&__c + 1 :
|
||||||
@@ -829,8 +835,8 @@ operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
|
|||||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||||
if (__pad_and_output(_I(__os),
|
if (__pad_and_output(_Ip(__os),
|
||||||
(char*)&__c,
|
(char*)&__c,
|
||||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||||
(char*)&__c + 1 :
|
(char*)&__c + 1 :
|
||||||
@@ -861,8 +867,8 @@ operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
|
|||||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||||
if (__pad_and_output(_I(__os),
|
if (__pad_and_output(_Ip(__os),
|
||||||
(char*)&__c,
|
(char*)&__c,
|
||||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||||
(char*)&__c + 1 :
|
(char*)&__c + 1 :
|
||||||
@@ -893,9 +899,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
|
|||||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||||
size_t __len = _Traits::length(__str);
|
size_t __len = _Traits::length(__str);
|
||||||
if (__pad_and_output(_I(__os),
|
if (__pad_and_output(_Ip(__os),
|
||||||
__str,
|
__str,
|
||||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||||
__str + __len :
|
__str + __len :
|
||||||
@@ -926,7 +932,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
|
|||||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||||
size_t __len = char_traits<char>::length(__strn);
|
size_t __len = char_traits<char>::length(__strn);
|
||||||
const int __bs = 100;
|
const int __bs = 100;
|
||||||
_CharT __wbb[__bs];
|
_CharT __wbb[__bs];
|
||||||
@@ -941,7 +947,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
|
|||||||
}
|
}
|
||||||
for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
|
for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
|
||||||
*__p = __os.widen(*__strn);
|
*__p = __os.widen(*__strn);
|
||||||
if (__pad_and_output(_I(__os),
|
if (__pad_and_output(_Ip(__os),
|
||||||
__wb,
|
__wb,
|
||||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||||
__wb + __len :
|
__wb + __len :
|
||||||
@@ -972,9 +978,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
|
|||||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||||
size_t __len = _Traits::length(__str);
|
size_t __len = _Traits::length(__str);
|
||||||
if (__pad_and_output(_I(__os),
|
if (__pad_and_output(_Ip(__os),
|
||||||
__str,
|
__str,
|
||||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||||
__str + __len :
|
__str + __len :
|
||||||
@@ -1005,9 +1011,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
|
|||||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||||
size_t __len = _Traits::length((const char*)__str);
|
size_t __len = _Traits::length((const char*)__str);
|
||||||
if (__pad_and_output(_I(__os),
|
if (__pad_and_output(_Ip(__os),
|
||||||
(const char*)__str,
|
(const char*)__str,
|
||||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||||
(const char*)__str + __len :
|
(const char*)__str + __len :
|
||||||
@@ -1038,9 +1044,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
|
|||||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||||
size_t __len = _Traits::length((const char*)__str);
|
size_t __len = _Traits::length((const char*)__str);
|
||||||
if (__pad_and_output(_I(__os),
|
if (__pad_and_output(_Ip(__os),
|
||||||
(const char*)__str,
|
(const char*)__str,
|
||||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||||
(const char*)__str + __len :
|
(const char*)__str + __len :
|
||||||
@@ -1071,8 +1077,8 @@ basic_ostream<_CharT, _Traits>::put(char_type __c)
|
|||||||
sentry __s(*this);
|
sentry __s(*this);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||||
_O __o(*this);
|
_Op __o(*this);
|
||||||
*__o = __c;
|
*__o = __c;
|
||||||
if (__o.failed())
|
if (__o.failed())
|
||||||
this->setstate(ios_base::badbit);
|
this->setstate(ios_base::badbit);
|
||||||
@@ -1098,17 +1104,8 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
|
|||||||
sentry __sen(*this);
|
sentry __sen(*this);
|
||||||
if (__sen && __n)
|
if (__sen && __n)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
if (this->rdbuf()->sputn(__s, __n) != __n)
|
||||||
_O __o(*this);
|
|
||||||
for (; __n; --__n, ++__o, ++__s)
|
|
||||||
{
|
|
||||||
*__o = *__s;
|
|
||||||
if (__o.failed())
|
|
||||||
{
|
|
||||||
this->setstate(ios_base::badbit);
|
this->setstate(ios_base::badbit);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
}
|
}
|
||||||
@@ -1162,7 +1159,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
|||||||
basic_ostream<_CharT, _Traits>&
|
basic_ostream<_CharT, _Traits>&
|
||||||
basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
|
basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
|
||||||
{
|
{
|
||||||
if (!this->fail())
|
sentry __s(*this);
|
||||||
|
if (__s)
|
||||||
{
|
{
|
||||||
if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1))
|
if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1))
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
@@ -1175,8 +1173,12 @@ inline _LIBCPP_INLINE_VISIBILITY
|
|||||||
basic_ostream<_CharT, _Traits>&
|
basic_ostream<_CharT, _Traits>&
|
||||||
basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
|
basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
|
||||||
{
|
{
|
||||||
if (!this->fail())
|
sentry __s(*this);
|
||||||
this->rdbuf()->pubseekoff(__off, __dir, ios_base::out);
|
if (__s)
|
||||||
|
{
|
||||||
|
if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1))
|
||||||
|
this->setstate(ios_base::failbit);
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1216,12 +1218,12 @@ typename enable_if
|
|||||||
<
|
<
|
||||||
!is_lvalue_reference<_Stream>::value &&
|
!is_lvalue_reference<_Stream>::value &&
|
||||||
is_base_of<ios_base, _Stream>::value,
|
is_base_of<ios_base, _Stream>::value,
|
||||||
_Stream&
|
_Stream&&
|
||||||
>::type
|
>::type
|
||||||
operator<<(_Stream&& __os, const _Tp& __x)
|
operator<<(_Stream&& __os, const _Tp& __x)
|
||||||
{
|
{
|
||||||
__os << __x;
|
__os << __x;
|
||||||
return __os;
|
return _VSTD::move(__os);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
@@ -1238,9 +1240,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
|||||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||||
if (__s)
|
if (__s)
|
||||||
{
|
{
|
||||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||||
size_t __len = __str.size();
|
size_t __len = __str.size();
|
||||||
if (__pad_and_output(_I(__os),
|
if (__pad_and_output(_Ip(__os),
|
||||||
__str.data(),
|
__str.data(),
|
||||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||||
__str.data() + __len :
|
__str.data() + __len :
|
||||||
@@ -1268,10 +1270,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
|
|||||||
return __os << __ec.category().name() << ':' << __ec.value();
|
return __os << __ec.category().name() << ':' << __ec.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class _CharT, class _Traits, class _Y>
|
template<class _CharT, class _Traits, class _Yp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
basic_ostream<_CharT, _Traits>&
|
basic_ostream<_CharT, _Traits>&
|
||||||
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p)
|
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p)
|
||||||
{
|
{
|
||||||
return __os << __p.get();
|
return __os << __p.get();
|
||||||
}
|
}
|
||||||
@@ -1285,8 +1287,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
|
|||||||
use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
|
use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern template class basic_ostream<char>;
|
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<char>)
|
||||||
extern template class basic_ostream<wchar_t>;
|
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<wchar_t>)
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
|||||||
@@ -171,22 +171,26 @@ template <class T, class Container, class Compare>
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#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 _Container> class queue;
|
template <class _Tp, class _Container> class _LIBCPP_TYPE_VIS_ONLY queue;
|
||||||
|
|
||||||
template <class _Tp, class _Container>
|
template <class _Tp, class _Container>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
|
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
|
||||||
|
|
||||||
template <class _Tp, class _Container>
|
template <class _Tp, class _Container>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
|
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
|
||||||
|
|
||||||
template <class _Tp, class _Container = deque<_Tp> >
|
template <class _Tp, class _Container = deque<_Tp> >
|
||||||
class _LIBCPP_VISIBLE queue
|
class _LIBCPP_TYPE_VIS_ONLY queue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Container container_type;
|
typedef _Container container_type;
|
||||||
@@ -372,14 +376,14 @@ swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Container, class _Alloc>
|
template <class _Tp, class _Container, class _Alloc>
|
||||||
struct _LIBCPP_VISIBLE uses_allocator<queue<_Tp, _Container>, _Alloc>
|
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<queue<_Tp, _Container>, _Alloc>
|
||||||
: public uses_allocator<_Container, _Alloc>
|
: public uses_allocator<_Container, _Alloc>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _Container = vector<_Tp>,
|
template <class _Tp, class _Container = vector<_Tp>,
|
||||||
class _Compare = less<typename _Container::value_type> >
|
class _Compare = less<typename _Container::value_type> >
|
||||||
class _LIBCPP_VISIBLE priority_queue
|
class _LIBCPP_TYPE_VIS_ONLY priority_queue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Container container_type;
|
typedef _Container container_type;
|
||||||
@@ -703,7 +707,7 @@ swap(priority_queue<_Tp, _Container, _Compare>& __x,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Container, class _Compare, class _Alloc>
|
template <class _Tp, class _Container, class _Compare, class _Alloc>
|
||||||
struct _LIBCPP_VISIBLE uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
|
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
|
||||||
: public uses_allocator<_Container, _Alloc>
|
: public uses_allocator<_Container, _Alloc>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|||||||
1128
include/random
1128
include/random
File diff suppressed because it is too large
Load Diff
@@ -70,7 +70,11 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported
|
|||||||
#include <climits>
|
#include <climits>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
@@ -88,6 +92,12 @@ struct __static_gcd<_Xp, 0>
|
|||||||
static const intmax_t value = _Xp;
|
static const intmax_t value = _Xp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct __static_gcd<0, 0>
|
||||||
|
{
|
||||||
|
static const intmax_t value = 1;
|
||||||
|
};
|
||||||
|
|
||||||
// __static_lcm
|
// __static_lcm
|
||||||
|
|
||||||
template <intmax_t _Xp, intmax_t _Yp>
|
template <intmax_t _Xp, intmax_t _Yp>
|
||||||
@@ -221,7 +231,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <intmax_t _Num, intmax_t _Den = 1>
|
template <intmax_t _Num, intmax_t _Den = 1>
|
||||||
class _LIBCPP_VISIBLE ratio
|
class _LIBCPP_TYPE_VIS_ONLY ratio
|
||||||
{
|
{
|
||||||
static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
|
static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
|
||||||
static_assert(_Den != 0, "ratio divide by 0");
|
static_assert(_Den != 0, "ratio divide by 0");
|
||||||
@@ -282,7 +292,7 @@ template <class _R1, class _R2> using ratio_multiply
|
|||||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_multiply
|
struct _LIBCPP_TYPE_VIS_ONLY ratio_multiply
|
||||||
: public __ratio_multiply<_R1, _R2>::type {};
|
: public __ratio_multiply<_R1, _R2>::type {};
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
@@ -309,7 +319,7 @@ template <class _R1, class _R2> using ratio_divide
|
|||||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_divide
|
struct _LIBCPP_TYPE_VIS_ONLY ratio_divide
|
||||||
: public __ratio_divide<_R1, _R2>::type {};
|
: public __ratio_divide<_R1, _R2>::type {};
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
@@ -344,7 +354,7 @@ template <class _R1, class _R2> using ratio_add
|
|||||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_add
|
struct _LIBCPP_TYPE_VIS_ONLY ratio_add
|
||||||
: public __ratio_add<_R1, _R2>::type {};
|
: public __ratio_add<_R1, _R2>::type {};
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
@@ -379,7 +389,7 @@ template <class _R1, class _R2> using ratio_subtract
|
|||||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_subtract
|
struct _LIBCPP_TYPE_VIS_ONLY ratio_subtract
|
||||||
: public __ratio_subtract<_R1, _R2>::type {};
|
: public __ratio_subtract<_R1, _R2>::type {};
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
@@ -387,11 +397,11 @@ struct _LIBCPP_VISIBLE ratio_subtract
|
|||||||
// ratio_equal
|
// ratio_equal
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_equal
|
struct _LIBCPP_TYPE_VIS_ONLY ratio_equal
|
||||||
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
|
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_not_equal
|
struct _LIBCPP_TYPE_VIS_ONLY ratio_not_equal
|
||||||
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
|
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
|
||||||
|
|
||||||
// ratio_less
|
// ratio_less
|
||||||
@@ -404,27 +414,27 @@ struct __ratio_less1
|
|||||||
static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
|
static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R1, class _R2, bool _Odd, intmax_t _Q>
|
template <class _R1, class _R2, bool _Odd, intmax_t _Qp>
|
||||||
struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, 0>
|
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0>
|
||||||
{
|
{
|
||||||
static const bool value = false;
|
static const bool value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M2>
|
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M2>
|
||||||
struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, _M2>
|
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2>
|
||||||
{
|
{
|
||||||
static const bool value = !_Odd;
|
static const bool value = !_Odd;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M1>
|
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1>
|
||||||
struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, 0>
|
struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0>
|
||||||
{
|
{
|
||||||
static const bool value = _Odd;
|
static const bool value = _Odd;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M1,
|
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1,
|
||||||
intmax_t _M2>
|
intmax_t _M2>
|
||||||
struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, _M2>
|
struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2>
|
||||||
{
|
{
|
||||||
static const bool value = __ratio_less1<ratio<_R1::den, _M1>,
|
static const bool value = __ratio_less1<ratio<_R1::den, _M1>,
|
||||||
ratio<_R2::den, _M2>, !_Odd>::value;
|
ratio<_R2::den, _M2>, !_Odd>::value;
|
||||||
@@ -450,19 +460,19 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_less
|
struct _LIBCPP_TYPE_VIS_ONLY ratio_less
|
||||||
: public integral_constant<bool, __ratio_less<_R1, _R2>::value> {};
|
: public integral_constant<bool, __ratio_less<_R1, _R2>::value> {};
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_less_equal
|
struct _LIBCPP_TYPE_VIS_ONLY ratio_less_equal
|
||||||
: public integral_constant<bool, !ratio_less<_R2, _R1>::value> {};
|
: public integral_constant<bool, !ratio_less<_R2, _R1>::value> {};
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_greater
|
struct _LIBCPP_TYPE_VIS_ONLY ratio_greater
|
||||||
: public integral_constant<bool, ratio_less<_R2, _R1>::value> {};
|
: public integral_constant<bool, ratio_less<_R2, _R1>::value> {};
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_greater_equal
|
struct _LIBCPP_TYPE_VIS_ONLY ratio_greater_equal
|
||||||
: public integral_constant<bool, !ratio_less<_R1, _R2>::value> {};
|
: public integral_constant<bool, !ratio_less<_R1, _R2>::value> {};
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
|
|||||||
290
include/regex
290
include/regex
@@ -147,7 +147,7 @@ public:
|
|||||||
explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
|
explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
|
||||||
basic_regex(const charT* p, size_t len, flag_type f);
|
basic_regex(const charT* p, size_t len, flag_type f);
|
||||||
basic_regex(const basic_regex&);
|
basic_regex(const basic_regex&);
|
||||||
basic_regex(basic_regex&&);
|
basic_regex(basic_regex&&) noexcept;
|
||||||
template <class ST, class SA>
|
template <class ST, class SA>
|
||||||
explicit basic_regex(const basic_string<charT, ST, SA>& p,
|
explicit basic_regex(const basic_string<charT, ST, SA>& p,
|
||||||
flag_type f = regex_constants::ECMAScript);
|
flag_type f = regex_constants::ECMAScript);
|
||||||
@@ -159,7 +159,7 @@ public:
|
|||||||
~basic_regex();
|
~basic_regex();
|
||||||
|
|
||||||
basic_regex& operator=(const basic_regex&);
|
basic_regex& operator=(const basic_regex&);
|
||||||
basic_regex& operator=(basic_regex&&);
|
basic_regex& operator=(basic_regex&&) noexcept;
|
||||||
basic_regex& operator=(const charT* ptr);
|
basic_regex& operator=(const charT* ptr);
|
||||||
basic_regex& operator=(initializer_list<charT> il);
|
basic_regex& operator=(initializer_list<charT> il);
|
||||||
template <class ST, class SA>
|
template <class ST, class SA>
|
||||||
@@ -167,7 +167,7 @@ public:
|
|||||||
|
|
||||||
// assign:
|
// assign:
|
||||||
basic_regex& assign(const basic_regex& that);
|
basic_regex& assign(const basic_regex& that);
|
||||||
basic_regex& assign(basic_regex&& that);
|
basic_regex& assign(basic_regex&& that) noexcept;
|
||||||
basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
|
basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
|
||||||
basic_regex& assign(const charT* p, size_t len, flag_type f);
|
basic_regex& assign(const charT* p, size_t len, flag_type f);
|
||||||
template <class string_traits, class A>
|
template <class string_traits, class A>
|
||||||
@@ -449,7 +449,7 @@ public:
|
|||||||
// construct/copy/destroy:
|
// construct/copy/destroy:
|
||||||
explicit match_results(const Allocator& a = Allocator());
|
explicit match_results(const Allocator& a = Allocator());
|
||||||
match_results(const match_results& m);
|
match_results(const match_results& m);
|
||||||
match_results(match_results&& m);
|
match_results(match_results&& m) noexcept;
|
||||||
match_results& operator=(const match_results& m);
|
match_results& operator=(const match_results& m);
|
||||||
match_results& operator=(match_results&& m);
|
match_results& operator=(match_results&& m);
|
||||||
~match_results();
|
~match_results();
|
||||||
@@ -732,7 +732,11 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
@@ -756,15 +760,15 @@ enum syntax_option_type
|
|||||||
};
|
};
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
_LIBCPP_CONSTEXPR
|
||||||
syntax_option_type
|
syntax_option_type
|
||||||
operator~(syntax_option_type __x)
|
operator~(syntax_option_type __x)
|
||||||
{
|
{
|
||||||
return syntax_option_type(~int(__x));
|
return syntax_option_type(~int(__x) & 0x1FF);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
_LIBCPP_CONSTEXPR
|
||||||
syntax_option_type
|
syntax_option_type
|
||||||
operator&(syntax_option_type __x, syntax_option_type __y)
|
operator&(syntax_option_type __x, syntax_option_type __y)
|
||||||
{
|
{
|
||||||
@@ -772,7 +776,7 @@ operator&(syntax_option_type __x, syntax_option_type __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
_LIBCPP_CONSTEXPR
|
||||||
syntax_option_type
|
syntax_option_type
|
||||||
operator|(syntax_option_type __x, syntax_option_type __y)
|
operator|(syntax_option_type __x, syntax_option_type __y)
|
||||||
{
|
{
|
||||||
@@ -780,7 +784,7 @@ operator|(syntax_option_type __x, syntax_option_type __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
_LIBCPP_CONSTEXPR
|
||||||
syntax_option_type
|
syntax_option_type
|
||||||
operator^(syntax_option_type __x, syntax_option_type __y)
|
operator^(syntax_option_type __x, syntax_option_type __y)
|
||||||
{
|
{
|
||||||
@@ -788,7 +792,6 @@ operator^(syntax_option_type __x, syntax_option_type __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
|
||||||
syntax_option_type&
|
syntax_option_type&
|
||||||
operator&=(syntax_option_type& __x, syntax_option_type __y)
|
operator&=(syntax_option_type& __x, syntax_option_type __y)
|
||||||
{
|
{
|
||||||
@@ -797,7 +800,6 @@ operator&=(syntax_option_type& __x, syntax_option_type __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
|
||||||
syntax_option_type&
|
syntax_option_type&
|
||||||
operator|=(syntax_option_type& __x, syntax_option_type __y)
|
operator|=(syntax_option_type& __x, syntax_option_type __y)
|
||||||
{
|
{
|
||||||
@@ -806,7 +808,6 @@ operator|=(syntax_option_type& __x, syntax_option_type __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
|
||||||
syntax_option_type&
|
syntax_option_type&
|
||||||
operator^=(syntax_option_type& __x, syntax_option_type __y)
|
operator^=(syntax_option_type& __x, syntax_option_type __y)
|
||||||
{
|
{
|
||||||
@@ -835,15 +836,15 @@ enum match_flag_type
|
|||||||
};
|
};
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
_LIBCPP_CONSTEXPR
|
||||||
match_flag_type
|
match_flag_type
|
||||||
operator~(match_flag_type __x)
|
operator~(match_flag_type __x)
|
||||||
{
|
{
|
||||||
return match_flag_type(~int(__x));
|
return match_flag_type(~int(__x) & 0x0FFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
_LIBCPP_CONSTEXPR
|
||||||
match_flag_type
|
match_flag_type
|
||||||
operator&(match_flag_type __x, match_flag_type __y)
|
operator&(match_flag_type __x, match_flag_type __y)
|
||||||
{
|
{
|
||||||
@@ -851,7 +852,7 @@ operator&(match_flag_type __x, match_flag_type __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
_LIBCPP_CONSTEXPR
|
||||||
match_flag_type
|
match_flag_type
|
||||||
operator|(match_flag_type __x, match_flag_type __y)
|
operator|(match_flag_type __x, match_flag_type __y)
|
||||||
{
|
{
|
||||||
@@ -859,7 +860,7 @@ operator|(match_flag_type __x, match_flag_type __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
_LIBCPP_CONSTEXPR
|
||||||
match_flag_type
|
match_flag_type
|
||||||
operator^(match_flag_type __x, match_flag_type __y)
|
operator^(match_flag_type __x, match_flag_type __y)
|
||||||
{
|
{
|
||||||
@@ -867,7 +868,6 @@ operator^(match_flag_type __x, match_flag_type __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
|
||||||
match_flag_type&
|
match_flag_type&
|
||||||
operator&=(match_flag_type& __x, match_flag_type __y)
|
operator&=(match_flag_type& __x, match_flag_type __y)
|
||||||
{
|
{
|
||||||
@@ -876,7 +876,6 @@ operator&=(match_flag_type& __x, match_flag_type __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
|
||||||
match_flag_type&
|
match_flag_type&
|
||||||
operator|=(match_flag_type& __x, match_flag_type __y)
|
operator|=(match_flag_type& __x, match_flag_type __y)
|
||||||
{
|
{
|
||||||
@@ -885,7 +884,6 @@ operator|=(match_flag_type& __x, match_flag_type __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/
|
|
||||||
match_flag_type&
|
match_flag_type&
|
||||||
operator^=(match_flag_type& __x, match_flag_type __y)
|
operator^=(match_flag_type& __x, match_flag_type __y)
|
||||||
{
|
{
|
||||||
@@ -927,7 +925,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
struct _LIBCPP_VISIBLE regex_traits
|
struct _LIBCPP_TYPE_VIS_ONLY regex_traits
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _CharT char_type;
|
typedef _CharT char_type;
|
||||||
@@ -972,7 +970,7 @@ public:
|
|||||||
bool isctype(char_type __c, char_class_type __m) const;
|
bool isctype(char_type __c, char_class_type __m) const;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
int value(char_type __ch, int __radix) const
|
int value(char_type __ch, int __radix) const
|
||||||
{return __value(__ch, __radix);}
|
{return __regex_traits_value(__ch, __radix);}
|
||||||
locale_type imbue(locale_type __l);
|
locale_type imbue(locale_type __l);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
locale_type getloc()const {return __loc_;}
|
locale_type getloc()const {return __loc_;}
|
||||||
@@ -1003,13 +1001,17 @@ private:
|
|||||||
__lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
|
__lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
|
||||||
bool __icase, wchar_t) const;
|
bool __icase, wchar_t) const;
|
||||||
|
|
||||||
static int __value(unsigned char __ch, int __radix);
|
static int __regex_traits_value(unsigned char __ch, int __radix);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
int __value(char __ch, int __radix) const
|
int __regex_traits_value(char __ch, int __radix) const
|
||||||
{return __value(static_cast<unsigned char>(__ch), __radix);}
|
{return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);}
|
||||||
int __value(wchar_t __ch, int __radix) const;
|
int __regex_traits_value(wchar_t __ch, int __radix) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class _CharT>
|
||||||
|
const typename regex_traits<_CharT>::char_class_type
|
||||||
|
regex_traits<_CharT>::__regex_word;
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
regex_traits<_CharT>::regex_traits()
|
regex_traits<_CharT>::regex_traits()
|
||||||
{
|
{
|
||||||
@@ -1098,7 +1100,7 @@ regex_traits<_CharT>::__transform_primary(_ForwardIterator __f,
|
|||||||
|
|
||||||
// lookup_collatename is very FreeBSD-specific
|
// lookup_collatename is very FreeBSD-specific
|
||||||
|
|
||||||
string __get_collation_name(const char* __s);
|
_LIBCPP_FUNC_VIS string __get_collation_name(const char* __s);
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
template <class _ForwardIterator>
|
template <class _ForwardIterator>
|
||||||
@@ -1159,7 +1161,7 @@ regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
|
|||||||
|
|
||||||
// lookup_classname
|
// lookup_classname
|
||||||
|
|
||||||
ctype_base::mask __get_classname(const char* __s, bool __icase);
|
ctype_base::mask _LIBCPP_FUNC_VIS __get_classname(const char* __s, bool __icase);
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
template <class _ForwardIterator>
|
template <class _ForwardIterator>
|
||||||
@@ -1205,7 +1207,7 @@ regex_traits<_CharT>::isctype(char_type __c, char_class_type __m) const
|
|||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
int
|
int
|
||||||
regex_traits<_CharT>::__value(unsigned char __ch, int __radix)
|
regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix)
|
||||||
{
|
{
|
||||||
if ((__ch & 0xF8u) == 0x30) // '0' <= __ch && __ch <= '7'
|
if ((__ch & 0xF8u) == 0x30) // '0' <= __ch && __ch <= '7'
|
||||||
return __ch - '0';
|
return __ch - '0';
|
||||||
@@ -1226,18 +1228,18 @@ regex_traits<_CharT>::__value(unsigned char __ch, int __radix)
|
|||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
int
|
int
|
||||||
regex_traits<_CharT>::__value(wchar_t __ch, int __radix) const
|
regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const
|
||||||
{
|
{
|
||||||
return __value(static_cast<unsigned char>(__ct_->narrow(__ch, char_type())), __radix);
|
return __regex_traits_value(static_cast<unsigned char>(__ct_->narrow(__ch, char_type())), __radix);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT> class __node;
|
template <class _CharT> class __node;
|
||||||
|
|
||||||
template <class _BidirectionalIterator> class sub_match;
|
template <class _BidirectionalIterator> class _LIBCPP_TYPE_VIS_ONLY sub_match;
|
||||||
|
|
||||||
template <class _BidirectionalIterator,
|
template <class _BidirectionalIterator,
|
||||||
class _Allocator = allocator<sub_match<_BidirectionalIterator> > >
|
class _Allocator = allocator<sub_match<_BidirectionalIterator> > >
|
||||||
class match_results;
|
class _LIBCPP_TYPE_VIS_ONLY match_results;
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
struct __state
|
struct __state
|
||||||
@@ -2012,6 +2014,9 @@ public:
|
|||||||
virtual void __exec(__state&) const;
|
virtual void __exec(__state&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <> _LIBCPP_FUNC_VIS void __match_any_but_newline<char>::__exec(__state&) const;
|
||||||
|
template <> _LIBCPP_FUNC_VIS void __match_any_but_newline<wchar_t>::__exec(__state&) const;
|
||||||
|
|
||||||
// __match_char
|
// __match_char
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
@@ -2413,7 +2418,7 @@ __exit:
|
|||||||
template <class _CharT, class _Traits> class __lookahead;
|
template <class _CharT, class _Traits> class __lookahead;
|
||||||
|
|
||||||
template <class _CharT, class _Traits = regex_traits<_CharT> >
|
template <class _CharT, class _Traits = regex_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE basic_regex
|
class _LIBCPP_TYPE_VIS_ONLY basic_regex
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types:
|
// types:
|
||||||
@@ -2435,16 +2440,16 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// constants:
|
// constants:
|
||||||
static const/*expr*/ regex_constants::syntax_option_type icase = regex_constants::icase;
|
static const regex_constants::syntax_option_type icase = regex_constants::icase;
|
||||||
static const/*expr*/ regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
|
static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
|
||||||
static const/*expr*/ regex_constants::syntax_option_type optimize = regex_constants::optimize;
|
static const regex_constants::syntax_option_type optimize = regex_constants::optimize;
|
||||||
static const/*expr*/ regex_constants::syntax_option_type collate = regex_constants::collate;
|
static const regex_constants::syntax_option_type collate = regex_constants::collate;
|
||||||
static const/*expr*/ regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
|
static const regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
|
||||||
static const/*expr*/ regex_constants::syntax_option_type basic = regex_constants::basic;
|
static const regex_constants::syntax_option_type basic = regex_constants::basic;
|
||||||
static const/*expr*/ regex_constants::syntax_option_type extended = regex_constants::extended;
|
static const regex_constants::syntax_option_type extended = regex_constants::extended;
|
||||||
static const/*expr*/ regex_constants::syntax_option_type awk = regex_constants::awk;
|
static const regex_constants::syntax_option_type awk = regex_constants::awk;
|
||||||
static const/*expr*/ regex_constants::syntax_option_type grep = regex_constants::grep;
|
static const regex_constants::syntax_option_type grep = regex_constants::grep;
|
||||||
static const/*expr*/ regex_constants::syntax_option_type egrep = regex_constants::egrep;
|
static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
|
||||||
|
|
||||||
// construct/copy/destroy:
|
// construct/copy/destroy:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -2508,6 +2513,11 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_regex& assign(const basic_regex& __that)
|
basic_regex& assign(const basic_regex& __that)
|
||||||
{return *this = __that;}
|
{return *this = __that;}
|
||||||
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
basic_regex& assign(basic_regex&& __that) _NOEXCEPT
|
||||||
|
{return *this = _VSTD::move(__that);}
|
||||||
|
#endif
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
|
basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
|
||||||
{return assign(__p, __p + __traits_.length(__p), __f);}
|
{return assign(__p, __p + __traits_.length(__p), __f);}
|
||||||
@@ -2559,6 +2569,7 @@ public:
|
|||||||
{
|
{
|
||||||
__member_init(__f);
|
__member_init(__f);
|
||||||
__parse(__first, __last);
|
__parse(__first, __last);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||||
@@ -2761,7 +2772,7 @@ private:
|
|||||||
void __push_end_marked_subexpression(unsigned);
|
void __push_end_marked_subexpression(unsigned);
|
||||||
void __push_empty();
|
void __push_empty();
|
||||||
void __push_word_boundary(bool);
|
void __push_word_boundary(bool);
|
||||||
void __push_lookahead(const basic_regex&, bool);
|
void __push_lookahead(const basic_regex&, bool, unsigned);
|
||||||
|
|
||||||
template <class _Allocator>
|
template <class _Allocator>
|
||||||
bool
|
bool
|
||||||
@@ -2790,54 +2801,84 @@ private:
|
|||||||
match_results<const _CharT*, _Allocator>& __m,
|
match_results<const _CharT*, _Allocator>& __m,
|
||||||
regex_constants::match_flag_type __flags, bool) const;
|
regex_constants::match_flag_type __flags, bool) const;
|
||||||
|
|
||||||
template <class _B, class _A, class _C, class _T>
|
template <class _Bp, class _Ap, class _Cp, class _Tp>
|
||||||
friend
|
friend
|
||||||
bool
|
bool
|
||||||
regex_search(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&,
|
regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
|
||||||
regex_constants::match_flag_type);
|
regex_constants::match_flag_type);
|
||||||
|
|
||||||
template <class _A, class _C, class _T>
|
template <class _Ap, class _Cp, class _Tp>
|
||||||
friend
|
friend
|
||||||
bool
|
bool
|
||||||
regex_search(const _C*, const _C*, match_results<const _C*, _A>&,
|
regex_search(const _Cp*, const _Cp*, match_results<const _Cp*, _Ap>&,
|
||||||
const basic_regex<_C, _T>&, regex_constants::match_flag_type);
|
const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
|
||||||
|
|
||||||
template <class _B, class _C, class _T>
|
template <class _Bp, class _Cp, class _Tp>
|
||||||
friend
|
friend
|
||||||
bool
|
bool
|
||||||
regex_search(_B, _B, const basic_regex<_C, _T>&,
|
regex_search(_Bp, _Bp, const basic_regex<_Cp, _Tp>&,
|
||||||
regex_constants::match_flag_type);
|
regex_constants::match_flag_type);
|
||||||
|
|
||||||
template <class _C, class _T>
|
template <class _Cp, class _Tp>
|
||||||
friend
|
friend
|
||||||
bool
|
bool
|
||||||
regex_search(const _C*, const _C*,
|
regex_search(const _Cp*, const _Cp*,
|
||||||
const basic_regex<_C, _T>&, regex_constants::match_flag_type);
|
const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
|
||||||
|
|
||||||
template <class _C, class _A, class _T>
|
template <class _Cp, class _Ap, class _Tp>
|
||||||
friend
|
friend
|
||||||
bool
|
bool
|
||||||
regex_search(const _C*, match_results<const _C*, _A>&, const basic_regex<_C, _T>&,
|
regex_search(const _Cp*, match_results<const _Cp*, _Ap>&, const basic_regex<_Cp, _Tp>&,
|
||||||
regex_constants::match_flag_type);
|
regex_constants::match_flag_type);
|
||||||
|
|
||||||
template <class _ST, class _SA, class _C, class _T>
|
template <class _ST, class _SA, class _Cp, class _Tp>
|
||||||
friend
|
friend
|
||||||
bool
|
bool
|
||||||
regex_search(const basic_string<_C, _ST, _SA>& __s,
|
regex_search(const basic_string<_Cp, _ST, _SA>& __s,
|
||||||
const basic_regex<_C, _T>& __e,
|
const basic_regex<_Cp, _Tp>& __e,
|
||||||
regex_constants::match_flag_type __flags);
|
regex_constants::match_flag_type __flags);
|
||||||
|
|
||||||
template <class _ST, class _SA, class _A, class _C, class _T>
|
template <class _ST, class _SA, class _Ap, class _Cp, class _Tp>
|
||||||
friend
|
friend
|
||||||
bool
|
bool
|
||||||
regex_search(const basic_string<_C, _ST, _SA>& __s,
|
regex_search(const basic_string<_Cp, _ST, _SA>& __s,
|
||||||
match_results<typename basic_string<_C, _ST, _SA>::const_iterator, _A>&,
|
match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
|
||||||
const basic_regex<_C, _T>& __e,
|
const basic_regex<_Cp, _Tp>& __e,
|
||||||
|
regex_constants::match_flag_type __flags);
|
||||||
|
|
||||||
|
template <class _Iter, class _Ap, class _Cp, class _Tp>
|
||||||
|
friend
|
||||||
|
bool
|
||||||
|
regex_search(__wrap_iter<_Iter> __first,
|
||||||
|
__wrap_iter<_Iter> __last,
|
||||||
|
match_results<__wrap_iter<_Iter>, _Ap>& __m,
|
||||||
|
const basic_regex<_Cp, _Tp>& __e,
|
||||||
regex_constants::match_flag_type __flags);
|
regex_constants::match_flag_type __flags);
|
||||||
|
|
||||||
template <class, class> friend class __lookahead;
|
template <class, class> friend class __lookahead;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class _CharT, class _Traits>
|
||||||
|
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase;
|
||||||
|
template <class _CharT, class _Traits>
|
||||||
|
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::nosubs;
|
||||||
|
template <class _CharT, class _Traits>
|
||||||
|
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::optimize;
|
||||||
|
template <class _CharT, class _Traits>
|
||||||
|
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::collate;
|
||||||
|
template <class _CharT, class _Traits>
|
||||||
|
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::ECMAScript;
|
||||||
|
template <class _CharT, class _Traits>
|
||||||
|
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::basic;
|
||||||
|
template <class _CharT, class _Traits>
|
||||||
|
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::extended;
|
||||||
|
template <class _CharT, class _Traits>
|
||||||
|
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::awk;
|
||||||
|
template <class _CharT, class _Traits>
|
||||||
|
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::grep;
|
||||||
|
template <class _CharT, class _Traits>
|
||||||
|
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::egrep;
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
void
|
void
|
||||||
basic_regex<_CharT, _Traits>::swap(basic_regex& __r)
|
basic_regex<_CharT, _Traits>::swap(basic_regex& __r)
|
||||||
@@ -2869,6 +2910,7 @@ class __lookahead
|
|||||||
typedef __owns_one_state<_CharT> base;
|
typedef __owns_one_state<_CharT> base;
|
||||||
|
|
||||||
basic_regex<_CharT, _Traits> __exp_;
|
basic_regex<_CharT, _Traits> __exp_;
|
||||||
|
unsigned __mexp_;
|
||||||
bool __invert_;
|
bool __invert_;
|
||||||
|
|
||||||
__lookahead(const __lookahead&);
|
__lookahead(const __lookahead&);
|
||||||
@@ -2877,8 +2919,8 @@ public:
|
|||||||
typedef _VSTD::__state<_CharT> __state;
|
typedef _VSTD::__state<_CharT> __state;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s)
|
__lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
|
||||||
: base(__s), __exp_(__exp), __invert_(__invert) {}
|
: base(__s), __exp_(__exp), __invert_(__invert), __mexp_(__mexp) {}
|
||||||
|
|
||||||
virtual void __exec(__state&) const;
|
virtual void __exec(__state&) const;
|
||||||
};
|
};
|
||||||
@@ -2892,11 +2934,14 @@ __lookahead<_CharT, _Traits>::__exec(__state& __s) const
|
|||||||
bool __matched = __exp_.__match_at_start_ecma(__s.__current_, __s.__last_,
|
bool __matched = __exp_.__match_at_start_ecma(__s.__current_, __s.__last_,
|
||||||
__m,
|
__m,
|
||||||
__s.__flags_ | regex_constants::match_continuous,
|
__s.__flags_ | regex_constants::match_continuous,
|
||||||
true);
|
__s.__at_first_ && __s.__current_ == __s.__first_);
|
||||||
if (__matched != __invert_)
|
if (__matched != __invert_)
|
||||||
{
|
{
|
||||||
__s.__do_ = __state::__accept_but_not_consume;
|
__s.__do_ = __state::__accept_but_not_consume;
|
||||||
__s.__node_ = this->first();
|
__s.__node_ = this->first();
|
||||||
|
for (unsigned __i = 1; __i < __m.size(); ++__i) {
|
||||||
|
__s.__sub_matches_[__mexp_ + __i - 1] = __m.__matches_[__i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -3391,6 +3436,7 @@ basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first,
|
|||||||
case '+':
|
case '+':
|
||||||
case '?':
|
case '?':
|
||||||
case '{':
|
case '{':
|
||||||
|
case '}':
|
||||||
__push_char(*__temp);
|
__push_char(*__temp);
|
||||||
__first = ++__temp;
|
__first = ++__temp;
|
||||||
break;
|
break;
|
||||||
@@ -3739,7 +3785,7 @@ basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
|
|||||||
}
|
}
|
||||||
__ml->__add_range(_VSTD::move(__start_range), _VSTD::move(__end_range));
|
__ml->__add_range(_VSTD::move(__start_range), _VSTD::move(__end_range));
|
||||||
}
|
}
|
||||||
else
|
else if (!__start_range.empty())
|
||||||
{
|
{
|
||||||
if (__start_range.size() == 1)
|
if (__start_range.size() == 1)
|
||||||
__ml->__add_char(__start_range[0]);
|
__ml->__add_char(__start_range[0]);
|
||||||
@@ -3747,7 +3793,7 @@ basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
|
|||||||
__ml->__add_digraph(__start_range[0], __start_range[1]);
|
__ml->__add_digraph(__start_range[0], __start_range[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (!__start_range.empty())
|
||||||
{
|
{
|
||||||
if (__start_range.size() == 1)
|
if (__start_range.size() == 1)
|
||||||
__ml->__add_char(__start_range[0]);
|
__ml->__add_char(__start_range[0]);
|
||||||
@@ -3874,7 +3920,7 @@ basic_regex<_CharT, _Traits>::__parse_awk_escape(_ForwardIterator __first,
|
|||||||
{
|
{
|
||||||
__val = 8 * __val + *__first - '0';
|
__val = 8 * __val + *__first - '0';
|
||||||
if (++__first != __last && ('0' <= *__first && *__first <= '7'))
|
if (++__first != __last && ('0' <= *__first && *__first <= '7'))
|
||||||
__val = 8 * __val + *__first - '0';
|
__val = 8 * __val + *__first++ - '0';
|
||||||
}
|
}
|
||||||
if (__str)
|
if (__str)
|
||||||
*__str = _CharT(__val);
|
*__str = _CharT(__val);
|
||||||
@@ -4129,7 +4175,9 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
|
|||||||
basic_regex __exp;
|
basic_regex __exp;
|
||||||
__exp.__flags_ = __flags_;
|
__exp.__flags_ = __flags_;
|
||||||
__temp = __exp.__parse(++__temp, __last);
|
__temp = __exp.__parse(++__temp, __last);
|
||||||
__push_lookahead(_VSTD::move(__exp), false);
|
unsigned __mexp = __exp.__marked_count_;
|
||||||
|
__push_lookahead(_VSTD::move(__exp), false, __marked_count_);
|
||||||
|
__marked_count_ += __mexp;
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
if (__temp == __last || *__temp != ')')
|
if (__temp == __last || *__temp != ')')
|
||||||
throw regex_error(regex_constants::error_paren);
|
throw regex_error(regex_constants::error_paren);
|
||||||
@@ -4142,7 +4190,9 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
|
|||||||
basic_regex __exp;
|
basic_regex __exp;
|
||||||
__exp.__flags_ = __flags_;
|
__exp.__flags_ = __flags_;
|
||||||
__temp = __exp.__parse(++__temp, __last);
|
__temp = __exp.__parse(++__temp, __last);
|
||||||
__push_lookahead(_VSTD::move(__exp), true);
|
unsigned __mexp = __exp.__marked_count_;
|
||||||
|
__push_lookahead(_VSTD::move(__exp), true, __marked_count_);
|
||||||
|
__marked_count_ += __mexp;
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
if (__temp == __last || *__temp != ')')
|
if (__temp == __last || *__temp != ')')
|
||||||
throw regex_error(regex_constants::error_paren);
|
throw regex_error(regex_constants::error_paren);
|
||||||
@@ -4379,7 +4429,8 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
|
|||||||
case 'c':
|
case 'c':
|
||||||
if ((__t = _VSTD::next(__first)) != __last)
|
if ((__t = _VSTD::next(__first)) != __last)
|
||||||
{
|
{
|
||||||
if ('A' <= *__t <= 'Z' || 'a' <= *__t <= 'z')
|
if (('A' <= *__t && *__t <= 'Z') ||
|
||||||
|
('a' <= *__t && *__t <= 'z'))
|
||||||
{
|
{
|
||||||
if (__str)
|
if (__str)
|
||||||
*__str = _CharT(*__t % 32);
|
*__str = _CharT(*__t % 32);
|
||||||
@@ -4387,7 +4438,15 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
|
|||||||
__push_char(_CharT(*__t % 32));
|
__push_char(_CharT(*__t % 32));
|
||||||
__first = ++__t;
|
__first = ++__t;
|
||||||
}
|
}
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
else
|
||||||
|
throw regex_error(regex_constants::error_escape);
|
||||||
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
}
|
}
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
else
|
||||||
|
throw regex_error(regex_constants::error_escape);
|
||||||
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
++__first;
|
++__first;
|
||||||
@@ -4400,7 +4459,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
|
|||||||
if (__hd == -1)
|
if (__hd == -1)
|
||||||
throw regex_error(regex_constants::error_escape);
|
throw regex_error(regex_constants::error_escape);
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
__sum = 16 * __sum + __hd;
|
__sum = 16 * __sum + static_cast<unsigned>(__hd);
|
||||||
++__first;
|
++__first;
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
if (__first == __last)
|
if (__first == __last)
|
||||||
@@ -4411,7 +4470,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
|
|||||||
if (__hd == -1)
|
if (__hd == -1)
|
||||||
throw regex_error(regex_constants::error_escape);
|
throw regex_error(regex_constants::error_escape);
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
__sum = 16 * __sum + __hd;
|
__sum = 16 * __sum + static_cast<unsigned>(__hd);
|
||||||
// drop through
|
// drop through
|
||||||
case 'x':
|
case 'x':
|
||||||
++__first;
|
++__first;
|
||||||
@@ -4424,7 +4483,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
|
|||||||
if (__hd == -1)
|
if (__hd == -1)
|
||||||
throw regex_error(regex_constants::error_escape);
|
throw regex_error(regex_constants::error_escape);
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
__sum = 16 * __sum + __hd;
|
__sum = 16 * __sum + static_cast<unsigned>(__hd);
|
||||||
++__first;
|
++__first;
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
if (__first == __last)
|
if (__first == __last)
|
||||||
@@ -4435,7 +4494,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
|
|||||||
if (__hd == -1)
|
if (__hd == -1)
|
||||||
throw regex_error(regex_constants::error_escape);
|
throw regex_error(regex_constants::error_escape);
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
__sum = 16 * __sum + __hd;
|
__sum = 16 * __sum + static_cast<unsigned>(__hd);
|
||||||
if (__str)
|
if (__str)
|
||||||
*__str = _CharT(__sum);
|
*__str = _CharT(__sum);
|
||||||
else
|
else
|
||||||
@@ -4452,7 +4511,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
|
|||||||
++__first;
|
++__first;
|
||||||
}
|
}
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
else if (__str)
|
else
|
||||||
throw regex_error(regex_constants::error_escape);
|
throw regex_error(regex_constants::error_escape);
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
break;
|
break;
|
||||||
@@ -4711,10 +4770,11 @@ basic_regex<_CharT, _Traits>::__start_matching_list(bool __negate)
|
|||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
void
|
void
|
||||||
basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp,
|
basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp,
|
||||||
bool __invert)
|
bool __invert,
|
||||||
|
unsigned __mexp)
|
||||||
{
|
{
|
||||||
__end_->first() = new __lookahead<_CharT, _Traits>(__exp, __invert,
|
__end_->first() = new __lookahead<_CharT, _Traits>(__exp, __invert,
|
||||||
__end_->first());
|
__end_->first(), __mexp);
|
||||||
__end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
|
__end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4724,7 +4784,7 @@ typedef basic_regex<wchar_t> wregex;
|
|||||||
// sub_match
|
// sub_match
|
||||||
|
|
||||||
template <class _BidirectionalIterator>
|
template <class _BidirectionalIterator>
|
||||||
class _LIBCPP_VISIBLE sub_match
|
class _LIBCPP_TYPE_VIS_ONLY sub_match
|
||||||
: public pair<_BidirectionalIterator, _BidirectionalIterator>
|
: public pair<_BidirectionalIterator, _BidirectionalIterator>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -4736,7 +4796,7 @@ public:
|
|||||||
bool matched;
|
bool matched;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
/*constexpr*/ sub_match() : matched() {}
|
_LIBCPP_CONSTEXPR sub_match() : matched() {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
difference_type length() const
|
difference_type length() const
|
||||||
@@ -5147,7 +5207,7 @@ operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _BidirectionalIterator, class _Allocator>
|
template <class _BidirectionalIterator, class _Allocator>
|
||||||
class _LIBCPP_VISIBLE match_results
|
class _LIBCPP_TYPE_VIS_ONLY match_results
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Allocator allocator_type;
|
typedef _Allocator allocator_type;
|
||||||
@@ -5259,12 +5319,12 @@ public:
|
|||||||
// swap:
|
// swap:
|
||||||
void swap(match_results& __m);
|
void swap(match_results& __m);
|
||||||
|
|
||||||
template <class _B, class _A>
|
template <class _Bp, class _Ap>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __assign(_BidirectionalIterator __f, _BidirectionalIterator __l,
|
void __assign(_BidirectionalIterator __f, _BidirectionalIterator __l,
|
||||||
const match_results<_B, _A>& __m, bool __no_update_pos)
|
const match_results<_Bp, _Ap>& __m, bool __no_update_pos)
|
||||||
{
|
{
|
||||||
_B __mf = __m.prefix().first;
|
_Bp __mf = __m.prefix().first;
|
||||||
__matches_.resize(__m.size());
|
__matches_.resize(__m.size());
|
||||||
for (size_type __i = 0; __i < __matches_.size(); ++__i)
|
for (size_type __i = 0; __i < __matches_.size(); ++__i)
|
||||||
{
|
{
|
||||||
@@ -5293,16 +5353,16 @@ private:
|
|||||||
|
|
||||||
template <class, class> friend class basic_regex;
|
template <class, class> friend class basic_regex;
|
||||||
|
|
||||||
template <class _B, class _A, class _C, class _T>
|
template <class _Bp, class _Ap, class _Cp, class _Tp>
|
||||||
friend
|
friend
|
||||||
bool
|
bool
|
||||||
regex_match(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&,
|
regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
|
||||||
regex_constants::match_flag_type);
|
regex_constants::match_flag_type);
|
||||||
|
|
||||||
template <class _B, class _A>
|
template <class _Bp, class _Ap>
|
||||||
friend
|
friend
|
||||||
bool
|
bool
|
||||||
operator==(const match_results<_B, _A>&, const match_results<_B, _A>&);
|
operator==(const match_results<_Bp, _Ap>&, const match_results<_Bp, _Ap>&);
|
||||||
|
|
||||||
template <class, class> friend class __lookahead;
|
template <class, class> friend class __lookahead;
|
||||||
};
|
};
|
||||||
@@ -5492,8 +5552,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
|
|||||||
regex_constants::match_flag_type __flags, bool __at_first) const
|
regex_constants::match_flag_type __flags, bool __at_first) const
|
||||||
{
|
{
|
||||||
vector<__state> __states;
|
vector<__state> __states;
|
||||||
ptrdiff_t __j = 0;
|
|
||||||
ptrdiff_t _N = _VSTD::distance(__first, __last);
|
|
||||||
__node* __st = __start_.get();
|
__node* __st = __start_.get();
|
||||||
if (__st)
|
if (__st)
|
||||||
{
|
{
|
||||||
@@ -5507,7 +5565,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
|
|||||||
__states.back().__node_ = __st;
|
__states.back().__node_ = __st;
|
||||||
__states.back().__flags_ = __flags;
|
__states.back().__flags_ = __flags;
|
||||||
__states.back().__at_first_ = __at_first;
|
__states.back().__at_first_ = __at_first;
|
||||||
bool __matched = false;
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
__state& __s = __states.back();
|
__state& __s = __states.back();
|
||||||
@@ -5559,7 +5616,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
|
|||||||
{
|
{
|
||||||
deque<__state> __states;
|
deque<__state> __states;
|
||||||
ptrdiff_t __highest_j = 0;
|
ptrdiff_t __highest_j = 0;
|
||||||
ptrdiff_t _N = _VSTD::distance(__first, __last);
|
ptrdiff_t _Np = _VSTD::distance(__first, __last);
|
||||||
__node* __st = __start_.get();
|
__node* __st = __start_.get();
|
||||||
if (__st)
|
if (__st)
|
||||||
{
|
{
|
||||||
@@ -5584,7 +5641,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
|
|||||||
if (!__matched || __highest_j < __s.__current_ - __s.__first_)
|
if (!__matched || __highest_j < __s.__current_ - __s.__first_)
|
||||||
__highest_j = __s.__current_ - __s.__first_;
|
__highest_j = __s.__current_ - __s.__first_;
|
||||||
__matched = true;
|
__matched = true;
|
||||||
if (__highest_j == _N)
|
if (__highest_j == _Np)
|
||||||
__states.clear();
|
__states.clear();
|
||||||
else
|
else
|
||||||
__states.pop_back();
|
__states.pop_back();
|
||||||
@@ -5639,7 +5696,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
|
|||||||
__state __best_state;
|
__state __best_state;
|
||||||
ptrdiff_t __j = 0;
|
ptrdiff_t __j = 0;
|
||||||
ptrdiff_t __highest_j = 0;
|
ptrdiff_t __highest_j = 0;
|
||||||
ptrdiff_t _N = _VSTD::distance(__first, __last);
|
ptrdiff_t _Np = _VSTD::distance(__first, __last);
|
||||||
__node* __st = __start_.get();
|
__node* __st = __start_.get();
|
||||||
if (__st)
|
if (__st)
|
||||||
{
|
{
|
||||||
@@ -5669,7 +5726,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
|
|||||||
__best_state = __s;
|
__best_state = __s;
|
||||||
}
|
}
|
||||||
__matched = true;
|
__matched = true;
|
||||||
if (__highest_j == _N)
|
if (__highest_j == _Np)
|
||||||
__states.clear();
|
__states.clear();
|
||||||
else
|
else
|
||||||
__states.pop_back();
|
__states.pop_back();
|
||||||
@@ -5737,7 +5794,8 @@ basic_regex<_CharT, _Traits>::__search(
|
|||||||
{
|
{
|
||||||
__m.__init(1 + mark_count(), __first, __last,
|
__m.__init(1 + mark_count(), __first, __last,
|
||||||
__flags & regex_constants::__no_update_pos);
|
__flags & regex_constants::__no_update_pos);
|
||||||
if (__match_at_start(__first, __last, __m, __flags, true))
|
if (__match_at_start(__first, __last, __m, __flags,
|
||||||
|
!(__flags & regex_constants::__no_update_pos)))
|
||||||
{
|
{
|
||||||
__m.__prefix_.second = __m[0].first;
|
__m.__prefix_.second = __m[0].first;
|
||||||
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
|
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
|
||||||
@@ -5774,9 +5832,25 @@ regex_search(_BidirectionalIterator __first, _BidirectionalIterator __last,
|
|||||||
const basic_regex<_CharT, _Traits>& __e,
|
const basic_regex<_CharT, _Traits>& __e,
|
||||||
regex_constants::match_flag_type __flags = regex_constants::match_default)
|
regex_constants::match_flag_type __flags = regex_constants::match_default)
|
||||||
{
|
{
|
||||||
basic_string<_CharT> __s(__first, __last);
|
int __offset = (__flags & regex_constants::match_prev_avail) ? 1 : 0;
|
||||||
|
basic_string<_CharT> __s(_VSTD::prev(__first, __offset), __last);
|
||||||
match_results<const _CharT*> __mc;
|
match_results<const _CharT*> __mc;
|
||||||
bool __r = __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
|
bool __r = __e.__search(__s.data() + __offset, __s.data() + __s.size(), __mc, __flags);
|
||||||
|
__m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
|
||||||
|
return __r;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Iter, class _Allocator, class _CharT, class _Traits>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool
|
||||||
|
regex_search(__wrap_iter<_Iter> __first,
|
||||||
|
__wrap_iter<_Iter> __last,
|
||||||
|
match_results<__wrap_iter<_Iter>, _Allocator>& __m,
|
||||||
|
const basic_regex<_CharT, _Traits>& __e,
|
||||||
|
regex_constants::match_flag_type __flags = regex_constants::match_default)
|
||||||
|
{
|
||||||
|
match_results<const _CharT*> __mc;
|
||||||
|
bool __r = __e.__search(__first.base(), __last.base(), __mc, __flags);
|
||||||
__m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
|
__m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
|
||||||
return __r;
|
return __r;
|
||||||
}
|
}
|
||||||
@@ -5936,7 +6010,7 @@ regex_match(const basic_string<_CharT, _ST, _SA>& __s,
|
|||||||
template <class _BidirectionalIterator,
|
template <class _BidirectionalIterator,
|
||||||
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
|
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
|
||||||
class _Traits = regex_traits<_CharT> >
|
class _Traits = regex_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE regex_iterator
|
class _LIBCPP_TYPE_VIS_ONLY regex_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef basic_regex<_CharT, _Traits> regex_type;
|
typedef basic_regex<_CharT, _Traits> regex_type;
|
||||||
@@ -6018,7 +6092,7 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
|
|||||||
{
|
{
|
||||||
__flags_ |= regex_constants::__no_update_pos;
|
__flags_ |= regex_constants::__no_update_pos;
|
||||||
_BidirectionalIterator __start = __match_[0].second;
|
_BidirectionalIterator __start = __match_[0].second;
|
||||||
if (__match_.length() == 0)
|
if (__match_.empty())
|
||||||
{
|
{
|
||||||
if (__start == __end_)
|
if (__start == __end_)
|
||||||
{
|
{
|
||||||
@@ -6048,7 +6122,7 @@ typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
|
|||||||
template <class _BidirectionalIterator,
|
template <class _BidirectionalIterator,
|
||||||
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
|
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
|
||||||
class _Traits = regex_traits<_CharT> >
|
class _Traits = regex_traits<_CharT> >
|
||||||
class _LIBCPP_VISIBLE regex_token_iterator
|
class _LIBCPP_TYPE_VIS_ONLY regex_token_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef basic_regex<_CharT, _Traits> regex_type;
|
typedef basic_regex<_CharT, _Traits> regex_type;
|
||||||
@@ -6084,11 +6158,11 @@ public:
|
|||||||
regex_constants::match_flag_type __m =
|
regex_constants::match_flag_type __m =
|
||||||
regex_constants::match_default);
|
regex_constants::match_default);
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||||
template <size_t _N>
|
template <size_t _Np>
|
||||||
regex_token_iterator(_BidirectionalIterator __a,
|
regex_token_iterator(_BidirectionalIterator __a,
|
||||||
_BidirectionalIterator __b,
|
_BidirectionalIterator __b,
|
||||||
const regex_type& __re,
|
const regex_type& __re,
|
||||||
const int (&__submatches)[_N],
|
const int (&__submatches)[_Np],
|
||||||
regex_constants::match_flag_type __m =
|
regex_constants::match_flag_type __m =
|
||||||
regex_constants::match_default);
|
regex_constants::match_default);
|
||||||
regex_token_iterator(const regex_token_iterator&);
|
regex_token_iterator(const regex_token_iterator&);
|
||||||
@@ -6190,15 +6264,15 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
|
|||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||||
|
|
||||||
template <class _BidirectionalIterator, class _CharT, class _Traits>
|
template <class _BidirectionalIterator, class _CharT, class _Traits>
|
||||||
template <size_t _N>
|
template <size_t _Np>
|
||||||
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
|
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
|
||||||
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
|
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
|
||||||
const regex_type& __re,
|
const regex_type& __re,
|
||||||
const int (&__submatches)[_N],
|
const int (&__submatches)[_Np],
|
||||||
regex_constants::match_flag_type __m)
|
regex_constants::match_flag_type __m)
|
||||||
: __position_(__a, __b, __re, __m),
|
: __position_(__a, __b, __re, __m),
|
||||||
_N_(0),
|
_N_(0),
|
||||||
__subs_(__submatches, __submatches + _N)
|
__subs_(__submatches, __submatches + _Np)
|
||||||
{
|
{
|
||||||
__init(__a, __b);
|
__init(__a, __b);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,9 @@ template <class OuterA1, class OuterA2, class... InnerAllocs>
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
@@ -363,7 +365,7 @@ struct __outermost<_Alloc, true>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _OuterAlloc, class... _InnerAllocs>
|
template <class _OuterAlloc, class... _InnerAllocs>
|
||||||
class _LIBCPP_VISIBLE scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
|
class _LIBCPP_TYPE_VIS_ONLY scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
|
||||||
: public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
|
: public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
|
||||||
{
|
{
|
||||||
typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
|
typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
|
||||||
|
|||||||
170
include/set
170
include/set
@@ -66,6 +66,11 @@ public:
|
|||||||
set(initializer_list<value_type> il, const value_compare& comp = value_compare());
|
set(initializer_list<value_type> il, const value_compare& comp = value_compare());
|
||||||
set(initializer_list<value_type> il, const value_compare& comp,
|
set(initializer_list<value_type> il, const value_compare& comp,
|
||||||
const allocator_type& a);
|
const allocator_type& a);
|
||||||
|
template <class InputIterator>
|
||||||
|
set(InputIterator first, InputIterator last, const allocator_type& a)
|
||||||
|
: set(first, last, Compare(), a) {} // C++14
|
||||||
|
set(initializer_list<value_type> il, const allocator_type& a)
|
||||||
|
: set(il, Compare(), a) {} // C++14
|
||||||
~set();
|
~set();
|
||||||
|
|
||||||
set& operator=(const set& s);
|
set& operator=(const set& s);
|
||||||
@@ -129,13 +134,33 @@ public:
|
|||||||
// set operations:
|
// set operations:
|
||||||
iterator find(const key_type& k);
|
iterator find(const key_type& k);
|
||||||
const_iterator find(const key_type& k) const;
|
const_iterator find(const key_type& k) const;
|
||||||
|
template<typename K>
|
||||||
|
iterator find(const K& x);
|
||||||
|
template<typename K>
|
||||||
|
const_iterator find(const K& x) const; // C++14
|
||||||
|
template<typename K>
|
||||||
|
size_type count(const K& x) const; // C++14
|
||||||
|
|
||||||
size_type count(const key_type& k) const;
|
size_type count(const key_type& k) const;
|
||||||
iterator lower_bound(const key_type& k);
|
iterator lower_bound(const key_type& k);
|
||||||
const_iterator lower_bound(const key_type& k) const;
|
const_iterator lower_bound(const key_type& k) const;
|
||||||
|
template<typename K>
|
||||||
|
iterator lower_bound(const K& x); // C++14
|
||||||
|
template<typename K>
|
||||||
|
const_iterator lower_bound(const K& x) const; // C++14
|
||||||
|
|
||||||
iterator upper_bound(const key_type& k);
|
iterator upper_bound(const key_type& k);
|
||||||
const_iterator upper_bound(const key_type& k) const;
|
const_iterator upper_bound(const key_type& k) const;
|
||||||
|
template<typename K>
|
||||||
|
iterator upper_bound(const K& x); // C++14
|
||||||
|
template<typename K>
|
||||||
|
const_iterator upper_bound(const K& x) const; // C++14
|
||||||
pair<iterator,iterator> equal_range(const key_type& k);
|
pair<iterator,iterator> equal_range(const key_type& k);
|
||||||
pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
|
pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
|
||||||
|
template<typename K>
|
||||||
|
pair<iterator,iterator> equal_range(const K& x); // C++14
|
||||||
|
template<typename K>
|
||||||
|
pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Key, class Compare, class Allocator>
|
template <class Key, class Compare, class Allocator>
|
||||||
@@ -222,6 +247,11 @@ public:
|
|||||||
multiset(initializer_list<value_type> il, const value_compare& comp = value_compare());
|
multiset(initializer_list<value_type> il, const value_compare& comp = value_compare());
|
||||||
multiset(initializer_list<value_type> il, const value_compare& comp,
|
multiset(initializer_list<value_type> il, const value_compare& comp,
|
||||||
const allocator_type& a);
|
const allocator_type& a);
|
||||||
|
template <class InputIterator>
|
||||||
|
multiset(InputIterator first, InputIterator last, const allocator_type& a)
|
||||||
|
: set(first, last, Compare(), a) {} // C++14
|
||||||
|
multiset(initializer_list<value_type> il, const allocator_type& a)
|
||||||
|
: set(il, Compare(), a) {} // C++14
|
||||||
~multiset();
|
~multiset();
|
||||||
|
|
||||||
multiset& operator=(const multiset& s);
|
multiset& operator=(const multiset& s);
|
||||||
@@ -285,13 +315,32 @@ public:
|
|||||||
// set operations:
|
// set operations:
|
||||||
iterator find(const key_type& k);
|
iterator find(const key_type& k);
|
||||||
const_iterator find(const key_type& k) const;
|
const_iterator find(const key_type& k) const;
|
||||||
|
template<typename K>
|
||||||
|
iterator find(const K& x);
|
||||||
|
template<typename K>
|
||||||
|
const_iterator find(const K& x) const; // C++14
|
||||||
|
|
||||||
size_type count(const key_type& k) const;
|
size_type count(const key_type& k) const;
|
||||||
iterator lower_bound(const key_type& k);
|
iterator lower_bound(const key_type& k);
|
||||||
const_iterator lower_bound(const key_type& k) const;
|
const_iterator lower_bound(const key_type& k) const;
|
||||||
|
template<typename K>
|
||||||
|
iterator lower_bound(const K& x); // C++14
|
||||||
|
template<typename K>
|
||||||
|
const_iterator lower_bound(const K& x) const; // C++14
|
||||||
|
|
||||||
iterator upper_bound(const key_type& k);
|
iterator upper_bound(const key_type& k);
|
||||||
const_iterator upper_bound(const key_type& k) const;
|
const_iterator upper_bound(const key_type& k) const;
|
||||||
|
template<typename K>
|
||||||
|
iterator upper_bound(const K& x); // C++14
|
||||||
|
template<typename K>
|
||||||
|
const_iterator upper_bound(const K& x) const; // C++14
|
||||||
|
|
||||||
pair<iterator,iterator> equal_range(const key_type& k);
|
pair<iterator,iterator> equal_range(const key_type& k);
|
||||||
pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
|
pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
|
||||||
|
template<typename K>
|
||||||
|
pair<iterator,iterator> equal_range(const K& x); // C++14
|
||||||
|
template<typename K>
|
||||||
|
pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Key, class Compare, class Allocator>
|
template <class Key, class Compare, class Allocator>
|
||||||
@@ -338,13 +387,15 @@ swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
|
|||||||
#include <__tree>
|
#include <__tree>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
#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 _Key, class _Compare = less<_Key>,
|
template <class _Key, class _Compare = less<_Key>,
|
||||||
class _Allocator = allocator<_Key> >
|
class _Allocator = allocator<_Key> >
|
||||||
class _LIBCPP_VISIBLE set
|
class _LIBCPP_TYPE_VIS_ONLY set
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types:
|
// types:
|
||||||
@@ -401,6 +452,13 @@ public:
|
|||||||
insert(__f, __l);
|
insert(__f, __l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <class _InputIterator>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
|
||||||
|
: set(__f, __l, key_compare(), __a) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
set(const set& __s)
|
set(const set& __s)
|
||||||
: __tree_(__s.__tree_)
|
: __tree_(__s.__tree_)
|
||||||
@@ -453,6 +511,12 @@ public:
|
|||||||
insert(__il.begin(), __il.end());
|
insert(__il.begin(), __il.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
set(initializer_list<value_type> __il, const allocator_type& __a)
|
||||||
|
: set(__il, key_compare(), __a) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
set& operator=(initializer_list<value_type> __il)
|
set& operator=(initializer_list<value_type> __il)
|
||||||
{
|
{
|
||||||
@@ -577,6 +641,17 @@ public:
|
|||||||
iterator find(const key_type& __k) {return __tree_.find(__k);}
|
iterator find(const key_type& __k) {return __tree_.find(__k);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
|
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
|
||||||
|
find(const _K2& __k) {return __tree_.find(__k);}
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
|
||||||
|
find(const _K2& __k) const {return __tree_.find(__k);}
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type count(const key_type& __k) const
|
size_type count(const key_type& __k) const
|
||||||
{return __tree_.__count_unique(__k);}
|
{return __tree_.__count_unique(__k);}
|
||||||
@@ -586,18 +661,51 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_iterator lower_bound(const key_type& __k) const
|
const_iterator lower_bound(const key_type& __k) const
|
||||||
{return __tree_.lower_bound(__k);}
|
{return __tree_.lower_bound(__k);}
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
|
||||||
|
lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
|
||||||
|
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
|
||||||
|
lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
iterator upper_bound(const key_type& __k)
|
iterator upper_bound(const key_type& __k)
|
||||||
{return __tree_.upper_bound(__k);}
|
{return __tree_.upper_bound(__k);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_iterator upper_bound(const key_type& __k) const
|
const_iterator upper_bound(const key_type& __k) const
|
||||||
{return __tree_.upper_bound(__k);}
|
{return __tree_.upper_bound(__k);}
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
|
||||||
|
upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
|
||||||
|
upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
pair<iterator,iterator> equal_range(const key_type& __k)
|
pair<iterator,iterator> equal_range(const key_type& __k)
|
||||||
{return __tree_.__equal_range_unique(__k);}
|
{return __tree_.__equal_range_unique(__k);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
|
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
|
||||||
{return __tree_.__equal_range_unique(__k);}
|
{return __tree_.__equal_range_unique(__k);}
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
|
||||||
|
equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);}
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
|
||||||
|
equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
@@ -683,7 +791,7 @@ swap(set<_Key, _Compare, _Allocator>& __x,
|
|||||||
|
|
||||||
template <class _Key, class _Compare = less<_Key>,
|
template <class _Key, class _Compare = less<_Key>,
|
||||||
class _Allocator = allocator<_Key> >
|
class _Allocator = allocator<_Key> >
|
||||||
class _LIBCPP_VISIBLE multiset
|
class _LIBCPP_TYPE_VIS_ONLY multiset
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types:
|
// types:
|
||||||
@@ -732,6 +840,13 @@ public:
|
|||||||
insert(__f, __l);
|
insert(__f, __l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <class _InputIterator>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
|
||||||
|
: multiset(__f, __l, key_compare(), __a) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class _InputIterator>
|
template <class _InputIterator>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
multiset(_InputIterator __f, _InputIterator __l,
|
multiset(_InputIterator __f, _InputIterator __l,
|
||||||
@@ -791,6 +906,12 @@ public:
|
|||||||
insert(__il.begin(), __il.end());
|
insert(__il.begin(), __il.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
multiset(initializer_list<value_type> __il, const allocator_type& __a)
|
||||||
|
: multiset(__il, key_compare(), __a) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
multiset& operator=(initializer_list<value_type> __il)
|
multiset& operator=(initializer_list<value_type> __il)
|
||||||
{
|
{
|
||||||
@@ -915,27 +1036,72 @@ public:
|
|||||||
iterator find(const key_type& __k) {return __tree_.find(__k);}
|
iterator find(const key_type& __k) {return __tree_.find(__k);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
|
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
|
||||||
|
find(const _K2& __k) {return __tree_.find(__k);}
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
|
||||||
|
find(const _K2& __k) const {return __tree_.find(__k);}
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type count(const key_type& __k) const
|
size_type count(const key_type& __k) const
|
||||||
{return __tree_.__count_multi(__k);}
|
{return __tree_.__count_multi(__k);}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
iterator lower_bound(const key_type& __k)
|
iterator lower_bound(const key_type& __k)
|
||||||
{return __tree_.lower_bound(__k);}
|
{return __tree_.lower_bound(__k);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_iterator lower_bound(const key_type& __k) const
|
const_iterator lower_bound(const key_type& __k) const
|
||||||
{return __tree_.lower_bound(__k);}
|
{return __tree_.lower_bound(__k);}
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
|
||||||
|
lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
|
||||||
|
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
|
||||||
|
lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
iterator upper_bound(const key_type& __k)
|
iterator upper_bound(const key_type& __k)
|
||||||
{return __tree_.upper_bound(__k);}
|
{return __tree_.upper_bound(__k);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_iterator upper_bound(const key_type& __k) const
|
const_iterator upper_bound(const key_type& __k) const
|
||||||
{return __tree_.upper_bound(__k);}
|
{return __tree_.upper_bound(__k);}
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
|
||||||
|
upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
|
||||||
|
upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
pair<iterator,iterator> equal_range(const key_type& __k)
|
pair<iterator,iterator> equal_range(const key_type& __k)
|
||||||
{return __tree_.__equal_range_multi(__k);}
|
{return __tree_.__equal_range_multi(__k);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
|
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
|
||||||
{return __tree_.__equal_range_multi(__k);}
|
{return __tree_.__equal_range_multi(__k);}
|
||||||
|
#if _LIBCPP_STD_VER > 11
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
|
||||||
|
equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
|
||||||
|
template <typename _K2>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
|
||||||
|
equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|||||||
419
include/shared_mutex
Normal file
419
include/shared_mutex
Normal file
@@ -0,0 +1,419 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===------------------------ shared_mutex --------------------------------===//
|
||||||
|
//
|
||||||
|
// 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_SHARED_MUTEX
|
||||||
|
#define _LIBCPP_SHARED_MUTEX
|
||||||
|
|
||||||
|
/*
|
||||||
|
shared_mutex synopsis
|
||||||
|
|
||||||
|
// C++1y
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
|
||||||
|
class shared_mutex
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
shared_mutex();
|
||||||
|
~shared_mutex();
|
||||||
|
|
||||||
|
shared_mutex(const shared_mutex&) = delete;
|
||||||
|
shared_mutex& operator=(const shared_mutex&) = delete;
|
||||||
|
|
||||||
|
// Exclusive ownership
|
||||||
|
void lock(); // blocking
|
||||||
|
bool try_lock();
|
||||||
|
template <class Rep, class Period>
|
||||||
|
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
||||||
|
template <class Clock, class Duration>
|
||||||
|
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
||||||
|
void unlock();
|
||||||
|
|
||||||
|
// Shared ownership
|
||||||
|
void lock_shared(); // blocking
|
||||||
|
bool try_lock_shared();
|
||||||
|
template <class Rep, class Period>
|
||||||
|
bool
|
||||||
|
try_lock_shared_for(const chrono::duration<Rep, Period>& rel_time);
|
||||||
|
template <class Clock, class Duration>
|
||||||
|
bool
|
||||||
|
try_lock_shared_until(const chrono::time_point<Clock, Duration>& abs_time);
|
||||||
|
void unlock_shared();
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class Mutex>
|
||||||
|
class shared_lock
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef Mutex mutex_type;
|
||||||
|
|
||||||
|
// Shared locking
|
||||||
|
shared_lock() noexcept;
|
||||||
|
explicit shared_lock(mutex_type& m); // blocking
|
||||||
|
shared_lock(mutex_type& m, defer_lock_t) noexcept;
|
||||||
|
shared_lock(mutex_type& m, try_to_lock_t);
|
||||||
|
shared_lock(mutex_type& m, adopt_lock_t);
|
||||||
|
template <class Clock, class Duration>
|
||||||
|
shared_lock(mutex_type& m,
|
||||||
|
const chrono::time_point<Clock, Duration>& abs_time);
|
||||||
|
template <class Rep, class Period>
|
||||||
|
shared_lock(mutex_type& m,
|
||||||
|
const chrono::duration<Rep, Period>& rel_time);
|
||||||
|
~shared_lock();
|
||||||
|
|
||||||
|
shared_lock(shared_lock const&) = delete;
|
||||||
|
shared_lock& operator=(shared_lock const&) = delete;
|
||||||
|
|
||||||
|
shared_lock(shared_lock&& u) noexcept;
|
||||||
|
shared_lock& operator=(shared_lock&& u) noexcept;
|
||||||
|
|
||||||
|
void lock(); // blocking
|
||||||
|
bool try_lock();
|
||||||
|
template <class Rep, class Period>
|
||||||
|
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
||||||
|
template <class Clock, class Duration>
|
||||||
|
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
||||||
|
void unlock();
|
||||||
|
|
||||||
|
// Setters
|
||||||
|
void swap(shared_lock& u) noexcept;
|
||||||
|
mutex_type* release() noexcept;
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
bool owns_lock() const noexcept;
|
||||||
|
explicit operator bool () const noexcept;
|
||||||
|
mutex_type* mutex() const noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class Mutex>
|
||||||
|
void swap(shared_lock<Mutex>& x, shared_lock<Mutex>& y) noexcept;
|
||||||
|
|
||||||
|
} // std
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <__config>
|
||||||
|
|
||||||
|
#if _LIBCPP_STD_VER > 11 || defined(_LIBCPP_BUILDING_SHARED_MUTEX)
|
||||||
|
|
||||||
|
#include <__mutex_base>
|
||||||
|
|
||||||
|
#include <__undef_min_max>
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
class _LIBCPP_TYPE_VIS shared_mutex
|
||||||
|
{
|
||||||
|
mutex __mut_;
|
||||||
|
condition_variable __gate1_;
|
||||||
|
condition_variable __gate2_;
|
||||||
|
unsigned __state_;
|
||||||
|
|
||||||
|
static const unsigned __write_entered_ = 1U << (sizeof(unsigned)*__CHAR_BIT__ - 1);
|
||||||
|
static const unsigned __n_readers_ = ~__write_entered_;
|
||||||
|
public:
|
||||||
|
shared_mutex();
|
||||||
|
_LIBCPP_INLINE_VISIBILITY ~shared_mutex() = default;
|
||||||
|
|
||||||
|
shared_mutex(const shared_mutex&) = delete;
|
||||||
|
shared_mutex& operator=(const shared_mutex&) = delete;
|
||||||
|
|
||||||
|
// Exclusive ownership
|
||||||
|
void lock();
|
||||||
|
bool try_lock();
|
||||||
|
template <class _Rep, class _Period>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool
|
||||||
|
try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time)
|
||||||
|
{
|
||||||
|
return try_lock_until(chrono::steady_clock::now() + __rel_time);
|
||||||
|
}
|
||||||
|
template <class _Clock, class _Duration>
|
||||||
|
bool
|
||||||
|
try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
|
||||||
|
void unlock();
|
||||||
|
|
||||||
|
// Shared ownership
|
||||||
|
void lock_shared();
|
||||||
|
bool try_lock_shared();
|
||||||
|
template <class _Rep, class _Period>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool
|
||||||
|
try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rel_time)
|
||||||
|
{
|
||||||
|
return try_lock_shared_until(chrono::steady_clock::now() + __rel_time);
|
||||||
|
}
|
||||||
|
template <class _Clock, class _Duration>
|
||||||
|
bool
|
||||||
|
try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
|
||||||
|
void unlock_shared();
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _Clock, class _Duration>
|
||||||
|
bool
|
||||||
|
shared_mutex::try_lock_until(
|
||||||
|
const chrono::time_point<_Clock, _Duration>& __abs_time)
|
||||||
|
{
|
||||||
|
unique_lock<mutex> __lk(__mut_);
|
||||||
|
if (__state_ & __write_entered_)
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
cv_status __status = __gate1_.wait_until(__lk, __abs_time);
|
||||||
|
if ((__state_ & __write_entered_) == 0)
|
||||||
|
break;
|
||||||
|
if (__status == cv_status::timeout)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
__state_ |= __write_entered_;
|
||||||
|
if (__state_ & __n_readers_)
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
cv_status __status = __gate2_.wait_until(__lk, __abs_time);
|
||||||
|
if ((__state_ & __n_readers_) == 0)
|
||||||
|
break;
|
||||||
|
if (__status == cv_status::timeout)
|
||||||
|
{
|
||||||
|
__state_ &= ~__write_entered_;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Clock, class _Duration>
|
||||||
|
bool
|
||||||
|
shared_mutex::try_lock_shared_until(
|
||||||
|
const chrono::time_point<_Clock, _Duration>& __abs_time)
|
||||||
|
{
|
||||||
|
unique_lock<mutex> __lk(__mut_);
|
||||||
|
if ((__state_ & __write_entered_) || (__state_ & __n_readers_) == __n_readers_)
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
cv_status status = __gate1_.wait_until(__lk, __abs_time);
|
||||||
|
if ((__state_ & __write_entered_) == 0 &&
|
||||||
|
(__state_ & __n_readers_) < __n_readers_)
|
||||||
|
break;
|
||||||
|
if (status == cv_status::timeout)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unsigned __num_readers = (__state_ & __n_readers_) + 1;
|
||||||
|
__state_ &= ~__n_readers_;
|
||||||
|
__state_ |= __num_readers;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Mutex>
|
||||||
|
class shared_lock
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef _Mutex mutex_type;
|
||||||
|
|
||||||
|
private:
|
||||||
|
mutex_type* __m_;
|
||||||
|
bool __owns_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
shared_lock() noexcept
|
||||||
|
: __m_(nullptr),
|
||||||
|
__owns_(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
explicit shared_lock(mutex_type& __m)
|
||||||
|
: __m_(&__m),
|
||||||
|
__owns_(true)
|
||||||
|
{__m_->lock_shared();}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
shared_lock(mutex_type& __m, defer_lock_t) noexcept
|
||||||
|
: __m_(&__m),
|
||||||
|
__owns_(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
shared_lock(mutex_type& __m, try_to_lock_t)
|
||||||
|
: __m_(&__m),
|
||||||
|
__owns_(__m.try_lock_shared())
|
||||||
|
{}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
shared_lock(mutex_type& __m, adopt_lock_t)
|
||||||
|
: __m_(&__m),
|
||||||
|
__owns_(true)
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <class _Clock, class _Duration>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
shared_lock(mutex_type& __m,
|
||||||
|
const chrono::time_point<_Clock, _Duration>& __abs_time)
|
||||||
|
: __m_(&__m),
|
||||||
|
__owns_(__m.try_lock_shared_until(__abs_time))
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <class _Rep, class _Period>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
shared_lock(mutex_type& __m,
|
||||||
|
const chrono::duration<_Rep, _Period>& __rel_time)
|
||||||
|
: __m_(&__m),
|
||||||
|
__owns_(__m.try_lock_shared_for(__rel_time))
|
||||||
|
{}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
~shared_lock()
|
||||||
|
{
|
||||||
|
if (__owns_)
|
||||||
|
__m_->unlock_shared();
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_lock(shared_lock const&) = delete;
|
||||||
|
shared_lock& operator=(shared_lock const&) = delete;
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
shared_lock(shared_lock&& __u) noexcept
|
||||||
|
: __m_(__u.__m_),
|
||||||
|
__owns_(__u.__owns_)
|
||||||
|
{
|
||||||
|
__u.__m_ = nullptr;
|
||||||
|
__u.__owns_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
shared_lock& operator=(shared_lock&& __u) noexcept
|
||||||
|
{
|
||||||
|
if (__owns_)
|
||||||
|
__m_->unlock_shared();
|
||||||
|
__m_ = nullptr;
|
||||||
|
__owns_ = false;
|
||||||
|
__m_ = __u.__m_;
|
||||||
|
__owns_ = __u.__owns_;
|
||||||
|
__u.__m_ = nullptr;
|
||||||
|
__u.__owns_ = false;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lock();
|
||||||
|
bool try_lock();
|
||||||
|
template <class Rep, class Period>
|
||||||
|
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
||||||
|
template <class Clock, class Duration>
|
||||||
|
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
||||||
|
void unlock();
|
||||||
|
|
||||||
|
// Setters
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
void swap(shared_lock& __u) noexcept
|
||||||
|
{
|
||||||
|
_VSTD::swap(__m_, __u.__m_);
|
||||||
|
_VSTD::swap(__owns_, __u.__owns_);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
mutex_type* release() noexcept
|
||||||
|
{
|
||||||
|
mutex_type* __m = __m_;
|
||||||
|
__m_ = nullptr;
|
||||||
|
__owns_ = false;
|
||||||
|
return __m;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
bool owns_lock() const noexcept {return __owns_;}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
explicit operator bool () const noexcept {return __owns_;}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
mutex_type* mutex() const noexcept {return __m_;}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _Mutex>
|
||||||
|
void
|
||||||
|
shared_lock<_Mutex>::lock()
|
||||||
|
{
|
||||||
|
if (__m_ == nullptr)
|
||||||
|
__throw_system_error(EPERM, "shared_lock::lock: references null mutex");
|
||||||
|
if (__owns_)
|
||||||
|
__throw_system_error(EDEADLK, "shared_lock::lock: already locked");
|
||||||
|
__m_->lock_shared();
|
||||||
|
__owns_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Mutex>
|
||||||
|
bool
|
||||||
|
shared_lock<_Mutex>::try_lock()
|
||||||
|
{
|
||||||
|
if (__m_ == nullptr)
|
||||||
|
__throw_system_error(EPERM, "shared_lock::try_lock: references null mutex");
|
||||||
|
if (__owns_)
|
||||||
|
__throw_system_error(EDEADLK, "shared_lock::try_lock: already locked");
|
||||||
|
__owns_ = __m_->try_lock_shared();
|
||||||
|
return __owns_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Mutex>
|
||||||
|
template <class _Rep, class _Period>
|
||||||
|
bool
|
||||||
|
shared_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||||
|
{
|
||||||
|
if (__m_ == nullptr)
|
||||||
|
__throw_system_error(EPERM, "shared_lock::try_lock_for: references null mutex");
|
||||||
|
if (__owns_)
|
||||||
|
__throw_system_error(EDEADLK, "shared_lock::try_lock_for: already locked");
|
||||||
|
__owns_ = __m_->try_lock_shared_for(__d);
|
||||||
|
return __owns_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Mutex>
|
||||||
|
template <class _Clock, class _Duration>
|
||||||
|
bool
|
||||||
|
shared_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||||
|
{
|
||||||
|
if (__m_ == nullptr)
|
||||||
|
__throw_system_error(EPERM, "shared_lock::try_lock_until: references null mutex");
|
||||||
|
if (__owns_)
|
||||||
|
__throw_system_error(EDEADLK, "shared_lock::try_lock_until: already locked");
|
||||||
|
__owns_ = __m_->try_lock_shared_until(__t);
|
||||||
|
return __owns_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Mutex>
|
||||||
|
void
|
||||||
|
shared_lock<_Mutex>::unlock()
|
||||||
|
{
|
||||||
|
if (!__owns_)
|
||||||
|
__throw_system_error(EPERM, "shared_lock::unlock: not locked");
|
||||||
|
__m_->unlock_shared();
|
||||||
|
__owns_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class _Mutex>
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
void
|
||||||
|
swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) noexcept
|
||||||
|
{__x.swap(__y);}
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
#endif // _LIBCPP_STD_VER > 11
|
||||||
|
|
||||||
|
#endif // _LIBCPP_SHARED_MUTEX
|
||||||
168
include/sstream
168
include/sstream
@@ -175,14 +175,18 @@ typedef basic_stringstream<wchar_t> wstringstream;
|
|||||||
#include <istream>
|
#include <istream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
// basic_stringbuf
|
// basic_stringbuf
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
class _LIBCPP_VISIBLE basic_stringbuf
|
class _LIBCPP_TYPE_VIS_ONLY basic_stringbuf
|
||||||
: public basic_streambuf<_CharT, _Traits>
|
: public basic_streambuf<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -256,17 +260,36 @@ template <class _CharT, class _Traits, class _Allocator>
|
|||||||
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs)
|
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs)
|
||||||
: __mode_(__rhs.__mode_)
|
: __mode_(__rhs.__mode_)
|
||||||
{
|
{
|
||||||
ptrdiff_t __ninp = __rhs.gptr() - __rhs.eback();
|
char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
|
||||||
ptrdiff_t __einp = __rhs.egptr() - __rhs.eback();
|
ptrdiff_t __binp = -1;
|
||||||
ptrdiff_t __nout = __rhs.pptr() - __rhs.pbase();
|
ptrdiff_t __ninp = -1;
|
||||||
ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
|
ptrdiff_t __einp = -1;
|
||||||
ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
|
if (__rhs.eback() != nullptr)
|
||||||
|
{
|
||||||
|
__binp = __rhs.eback() - __p;
|
||||||
|
__ninp = __rhs.gptr() - __p;
|
||||||
|
__einp = __rhs.egptr() - __p;
|
||||||
|
}
|
||||||
|
ptrdiff_t __bout = -1;
|
||||||
|
ptrdiff_t __nout = -1;
|
||||||
|
ptrdiff_t __eout = -1;
|
||||||
|
if (__rhs.pbase() != nullptr)
|
||||||
|
{
|
||||||
|
__bout = __rhs.pbase() - __p;
|
||||||
|
__nout = __rhs.pptr() - __p;
|
||||||
|
__eout = __rhs.epptr() - __p;
|
||||||
|
}
|
||||||
|
ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
|
||||||
__str_ = _VSTD::move(__rhs.__str_);
|
__str_ = _VSTD::move(__rhs.__str_);
|
||||||
char_type* __p = const_cast<char_type*>(__str_.data());
|
__p = const_cast<char_type*>(__str_.data());
|
||||||
this->setg(__p, __p + __ninp, __p + __einp);
|
if (__binp != -1)
|
||||||
this->setp(__p, __p + __eout);
|
this->setg(__p + __binp, __p + __ninp, __p + __einp);
|
||||||
|
if (__bout != -1)
|
||||||
|
{
|
||||||
|
this->setp(__p + __bout, __p + __eout);
|
||||||
this->pbump(__nout);
|
this->pbump(__nout);
|
||||||
__hm_ = __p + __hm;
|
}
|
||||||
|
__hm_ = __hm == -1 ? nullptr : __p + __hm;
|
||||||
__p = const_cast<char_type*>(__rhs.__str_.data());
|
__p = const_cast<char_type*>(__rhs.__str_.data());
|
||||||
__rhs.setg(__p, __p, __p);
|
__rhs.setg(__p, __p, __p);
|
||||||
__rhs.setp(__p, __p);
|
__rhs.setp(__p, __p);
|
||||||
@@ -278,18 +301,37 @@ template <class _CharT, class _Traits, class _Allocator>
|
|||||||
basic_stringbuf<_CharT, _Traits, _Allocator>&
|
basic_stringbuf<_CharT, _Traits, _Allocator>&
|
||||||
basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
|
basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
|
||||||
{
|
{
|
||||||
ptrdiff_t __ninp = __rhs.gptr() - __rhs.eback();
|
char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
|
||||||
ptrdiff_t __einp = __rhs.egptr() - __rhs.eback();
|
ptrdiff_t __binp = -1;
|
||||||
ptrdiff_t __nout = __rhs.pptr() - __rhs.pbase();
|
ptrdiff_t __ninp = -1;
|
||||||
ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
|
ptrdiff_t __einp = -1;
|
||||||
ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
|
if (__rhs.eback() != nullptr)
|
||||||
__mode_ = __rhs.__mode_;
|
{
|
||||||
|
__binp = __rhs.eback() - __p;
|
||||||
|
__ninp = __rhs.gptr() - __p;
|
||||||
|
__einp = __rhs.egptr() - __p;
|
||||||
|
}
|
||||||
|
ptrdiff_t __bout = -1;
|
||||||
|
ptrdiff_t __nout = -1;
|
||||||
|
ptrdiff_t __eout = -1;
|
||||||
|
if (__rhs.pbase() != nullptr)
|
||||||
|
{
|
||||||
|
__bout = __rhs.pbase() - __p;
|
||||||
|
__nout = __rhs.pptr() - __p;
|
||||||
|
__eout = __rhs.epptr() - __p;
|
||||||
|
}
|
||||||
|
ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
|
||||||
__str_ = _VSTD::move(__rhs.__str_);
|
__str_ = _VSTD::move(__rhs.__str_);
|
||||||
char_type* __p = const_cast<char_type*>(__str_.data());
|
__p = const_cast<char_type*>(__str_.data());
|
||||||
this->setg(__p, __p + __ninp, __p + __einp);
|
if (__binp != -1)
|
||||||
this->setp(__p, __p + __eout);
|
this->setg(__p + __binp, __p + __ninp, __p + __einp);
|
||||||
|
if (__bout != -1)
|
||||||
|
{
|
||||||
|
this->setp(__p + __bout, __p + __eout);
|
||||||
this->pbump(__nout);
|
this->pbump(__nout);
|
||||||
__hm_ = __p + __hm;
|
}
|
||||||
|
__hm_ = __hm == -1 ? nullptr : __p + __hm;
|
||||||
|
__mode_ = __rhs.__mode_;
|
||||||
__p = const_cast<char_type*>(__rhs.__str_.data());
|
__p = const_cast<char_type*>(__rhs.__str_.data());
|
||||||
__rhs.setg(__p, __p, __p);
|
__rhs.setg(__p, __p, __p);
|
||||||
__rhs.setp(__p, __p);
|
__rhs.setp(__p, __p);
|
||||||
@@ -304,28 +346,74 @@ template <class _CharT, class _Traits, class _Allocator>
|
|||||||
void
|
void
|
||||||
basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
|
basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
|
||||||
{
|
{
|
||||||
ptrdiff_t __rninp = __rhs.gptr() - __rhs.eback();
|
char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
|
||||||
ptrdiff_t __reinp = __rhs.egptr() - __rhs.eback();
|
ptrdiff_t __rbinp = -1;
|
||||||
ptrdiff_t __rnout = __rhs.pptr() - __rhs.pbase();
|
ptrdiff_t __rninp = -1;
|
||||||
ptrdiff_t __reout = __rhs.epptr() - __rhs.pbase();
|
ptrdiff_t __reinp = -1;
|
||||||
ptrdiff_t __rhm = __rhs.__hm_ - __rhs.pbase();
|
if (__rhs.eback() != nullptr)
|
||||||
ptrdiff_t __lninp = this->gptr() - this->eback();
|
{
|
||||||
ptrdiff_t __leinp = this->egptr() - this->eback();
|
__rbinp = __rhs.eback() - __p;
|
||||||
ptrdiff_t __lnout = this->pptr() - this->pbase();
|
__rninp = __rhs.gptr() - __p;
|
||||||
ptrdiff_t __leout = this->epptr() - this->pbase();
|
__reinp = __rhs.egptr() - __p;
|
||||||
ptrdiff_t __lhm = this->__hm_ - this->pbase();
|
}
|
||||||
|
ptrdiff_t __rbout = -1;
|
||||||
|
ptrdiff_t __rnout = -1;
|
||||||
|
ptrdiff_t __reout = -1;
|
||||||
|
if (__rhs.pbase() != nullptr)
|
||||||
|
{
|
||||||
|
__rbout = __rhs.pbase() - __p;
|
||||||
|
__rnout = __rhs.pptr() - __p;
|
||||||
|
__reout = __rhs.epptr() - __p;
|
||||||
|
}
|
||||||
|
ptrdiff_t __rhm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
|
||||||
|
__p = const_cast<char_type*>(__str_.data());
|
||||||
|
ptrdiff_t __lbinp = -1;
|
||||||
|
ptrdiff_t __lninp = -1;
|
||||||
|
ptrdiff_t __leinp = -1;
|
||||||
|
if (this->eback() != nullptr)
|
||||||
|
{
|
||||||
|
__lbinp = this->eback() - __p;
|
||||||
|
__lninp = this->gptr() - __p;
|
||||||
|
__leinp = this->egptr() - __p;
|
||||||
|
}
|
||||||
|
ptrdiff_t __lbout = -1;
|
||||||
|
ptrdiff_t __lnout = -1;
|
||||||
|
ptrdiff_t __leout = -1;
|
||||||
|
if (this->pbase() != nullptr)
|
||||||
|
{
|
||||||
|
__lbout = this->pbase() - __p;
|
||||||
|
__lnout = this->pptr() - __p;
|
||||||
|
__leout = this->epptr() - __p;
|
||||||
|
}
|
||||||
|
ptrdiff_t __lhm = __hm_ == nullptr ? -1 : __hm_ - __p;
|
||||||
_VSTD::swap(__mode_, __rhs.__mode_);
|
_VSTD::swap(__mode_, __rhs.__mode_);
|
||||||
__str_.swap(__rhs.__str_);
|
__str_.swap(__rhs.__str_);
|
||||||
char_type* __p = const_cast<char_type*>(__str_.data());
|
__p = const_cast<char_type*>(__str_.data());
|
||||||
this->setg(__p, __p + __rninp, __p + __reinp);
|
if (__rbinp != -1)
|
||||||
this->setp(__p, __p + __reout);
|
this->setg(__p + __rbinp, __p + __rninp, __p + __reinp);
|
||||||
|
else
|
||||||
|
this->setg(nullptr, nullptr, nullptr);
|
||||||
|
if (__rbout != -1)
|
||||||
|
{
|
||||||
|
this->setp(__p + __rbout, __p + __reout);
|
||||||
this->pbump(__rnout);
|
this->pbump(__rnout);
|
||||||
__hm_ = __p + __rhm;
|
}
|
||||||
|
else
|
||||||
|
this->setp(nullptr, nullptr);
|
||||||
|
__hm_ = __rhm == -1 ? nullptr : __p + __rhm;
|
||||||
__p = const_cast<char_type*>(__rhs.__str_.data());
|
__p = const_cast<char_type*>(__rhs.__str_.data());
|
||||||
__rhs.setg(__p, __p + __lninp, __p + __leinp);
|
if (__lbinp != -1)
|
||||||
__rhs.setp(__p, __p + __leout);
|
__rhs.setg(__p + __lbinp, __p + __lninp, __p + __leinp);
|
||||||
|
else
|
||||||
|
__rhs.setg(nullptr, nullptr, nullptr);
|
||||||
|
if (__lbout != -1)
|
||||||
|
{
|
||||||
|
__rhs.setp(__p + __lbout, __p + __leout);
|
||||||
__rhs.pbump(__lnout);
|
__rhs.pbump(__lnout);
|
||||||
__rhs.__hm_ = __p + __lhm;
|
}
|
||||||
|
else
|
||||||
|
__rhs.setp(nullptr, nullptr);
|
||||||
|
__rhs.__hm_ = __lhm == -1 ? nullptr : __p + __lhm;
|
||||||
locale __tl = __rhs.getloc();
|
locale __tl = __rhs.getloc();
|
||||||
__rhs.pubimbue(this->getloc());
|
__rhs.pubimbue(this->getloc());
|
||||||
this->pubimbue(__tl);
|
this->pubimbue(__tl);
|
||||||
@@ -525,7 +613,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
|
|||||||
// basic_istringstream
|
// basic_istringstream
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
class _LIBCPP_VISIBLE basic_istringstream
|
class _LIBCPP_TYPE_VIS_ONLY basic_istringstream
|
||||||
: public basic_istream<_CharT, _Traits>
|
: public basic_istream<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -644,7 +732,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
|
|||||||
// basic_ostringstream
|
// basic_ostringstream
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
class _LIBCPP_VISIBLE basic_ostringstream
|
class _LIBCPP_TYPE_VIS_ONLY basic_ostringstream
|
||||||
: public basic_ostream<_CharT, _Traits>
|
: public basic_ostream<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -763,7 +851,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
|
|||||||
// basic_stringstream
|
// basic_stringstream
|
||||||
|
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
class _LIBCPP_VISIBLE basic_stringstream
|
class _LIBCPP_TYPE_VIS_ONLY basic_stringstream
|
||||||
: public basic_iostream<_CharT, _Traits>
|
: public basic_iostream<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -85,22 +85,26 @@ template <class T, class Container>
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
|
#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 _Container> class stack;
|
template <class _Tp, class _Container> class _LIBCPP_TYPE_VIS_ONLY stack;
|
||||||
|
|
||||||
template <class _Tp, class _Container>
|
template <class _Tp, class _Container>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
|
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
|
||||||
|
|
||||||
template <class _Tp, class _Container>
|
template <class _Tp, class _Container>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
|
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
|
||||||
|
|
||||||
template <class _Tp, class _Container = deque<_Tp> >
|
template <class _Tp, class _Container = deque<_Tp> >
|
||||||
class _LIBCPP_VISIBLE stack
|
class _LIBCPP_TYPE_VIS_ONLY stack
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Container container_type;
|
typedef _Container container_type;
|
||||||
@@ -278,7 +282,7 @@ swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Container, class _Alloc>
|
template <class _Tp, class _Container, class _Alloc>
|
||||||
struct _LIBCPP_VISIBLE uses_allocator<stack<_Tp, _Container>, _Alloc>
|
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<stack<_Tp, _Container>, _Alloc>
|
||||||
: public uses_allocator<_Container, _Alloc>
|
: public uses_allocator<_Container, _Alloc>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ public:
|
|||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iosfwd> // for string forward decl
|
#include <iosfwd> // for string forward decl
|
||||||
|
|
||||||
|
#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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -112,12 +112,14 @@ protected:
|
|||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <ios>
|
#include <ios>
|
||||||
|
|
||||||
|
#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_streambuf
|
class _LIBCPP_TYPE_VIS_ONLY basic_streambuf
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types:
|
// types:
|
||||||
@@ -459,15 +461,15 @@ basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize)
|
|||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
typename basic_streambuf<_CharT, _Traits>::pos_type
|
typename basic_streambuf<_CharT, _Traits>::pos_type
|
||||||
basic_streambuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir,
|
||||||
ios_base::openmode __which)
|
ios_base::openmode)
|
||||||
{
|
{
|
||||||
return pos_type(off_type(-1));
|
return pos_type(off_type(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
typename basic_streambuf<_CharT, _Traits>::pos_type
|
typename basic_streambuf<_CharT, _Traits>::pos_type
|
||||||
basic_streambuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode __which)
|
basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode)
|
||||||
{
|
{
|
||||||
return pos_type(off_type(-1));
|
return pos_type(off_type(-1));
|
||||||
}
|
}
|
||||||
@@ -538,7 +540,7 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
|
|||||||
{
|
{
|
||||||
if (__nout_ < __eout_)
|
if (__nout_ < __eout_)
|
||||||
*__nout_++ = *__s;
|
*__nout_++ = *__s;
|
||||||
else if (overflow(*__s) == __eof)
|
else if (overflow(traits_type::to_int_type(*__s)) == __eof)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return __i;
|
return __i;
|
||||||
@@ -546,16 +548,16 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
|
|||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
typename basic_streambuf<_CharT, _Traits>::int_type
|
typename basic_streambuf<_CharT, _Traits>::int_type
|
||||||
basic_streambuf<_CharT, _Traits>::overflow(int_type __c)
|
basic_streambuf<_CharT, _Traits>::overflow(int_type)
|
||||||
{
|
{
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern template class basic_streambuf<char>;
|
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_streambuf<char>)
|
||||||
extern template class basic_streambuf<wchar_t>;
|
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_streambuf<wchar_t>)
|
||||||
|
|
||||||
extern template class basic_ios<char>;
|
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ios<char>)
|
||||||
extern template class basic_ios<wchar_t>;
|
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ios<wchar_t>)
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
|||||||
1335
include/string
1335
include/string
File diff suppressed because it is too large
Load Diff
@@ -131,11 +131,13 @@ private:
|
|||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
|
|
||||||
|
#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 _LIBCPP_VISIBLE strstreambuf
|
class _LIBCPP_TYPE_VIS strstreambuf
|
||||||
: public streambuf
|
: public streambuf
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -226,7 +228,7 @@ strstreambuf::operator=(strstreambuf&& __rhs)
|
|||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE istrstream
|
class _LIBCPP_TYPE_VIS istrstream
|
||||||
: public istream
|
: public istream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -279,7 +281,7 @@ private:
|
|||||||
strstreambuf __sb_;
|
strstreambuf __sb_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE ostrstream
|
class _LIBCPP_TYPE_VIS ostrstream
|
||||||
: public ostream
|
: public ostream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -332,7 +334,7 @@ private:
|
|||||||
strstreambuf __sb_; // exposition only
|
strstreambuf __sb_; // exposition only
|
||||||
};
|
};
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE strstream
|
class _LIBCPP_TYPE_VIS strstream
|
||||||
: public iostream
|
: public iostream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
99
include/support/ibm/limits.h
Normal file
99
include/support/ibm/limits.h
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===--------------------- support/ibm/limits.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_SUPPORT_IBM_LIMITS_H
|
||||||
|
#define _LIBCPP_SUPPORT_IBM_LIMITS_H
|
||||||
|
|
||||||
|
#if !defined(_AIX) // Linux
|
||||||
|
#include <math.h> // for HUGE_VAL, HUGE_VALF, HUGE_VALL, and NAN
|
||||||
|
|
||||||
|
static const unsigned int _QNAN_F = 0x7fc00000;
|
||||||
|
#define NANF (*((float *)(&_QNAN_F)))
|
||||||
|
static const unsigned int _QNAN_LDBL128[4] = {0x7ff80000, 0x0, 0x0, 0x0};
|
||||||
|
#define NANL (*((long double *)(&_QNAN_LDBL128)))
|
||||||
|
static const unsigned int _SNAN_F= 0x7f855555;
|
||||||
|
#define NANSF (*((float *)(&_SNAN_F)))
|
||||||
|
static const unsigned int _SNAN_D[2] = {0x7ff55555, 0x55555555};
|
||||||
|
#define NANS (*((double *)(&_SNAN_D)))
|
||||||
|
static const unsigned int _SNAN_LDBL128[4] = {0x7ff55555, 0x55555555, 0x0, 0x0};
|
||||||
|
#define NANSL (*((long double *)(&_SNAN_LDBL128)))
|
||||||
|
|
||||||
|
#define __builtin_huge_val() HUGE_VAL
|
||||||
|
#define __builtin_huge_valf() HUGE_VALF
|
||||||
|
#define __builtin_huge_vall() HUGE_VALL
|
||||||
|
#define __builtin_nan(__dummy) NAN
|
||||||
|
#define __builtin_nanf(__dummy) NANF
|
||||||
|
#define __builtin_nanl(__dummy) NANL
|
||||||
|
#define __builtin_nans(__dummy) NANS
|
||||||
|
#define __builtin_nansf(__dummy) NANSF
|
||||||
|
#define __builtin_nansl(__dummy) NANSL
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <float.h> // limit constants
|
||||||
|
|
||||||
|
#define __builtin_huge_val() HUGE_VAL //0x7ff0000000000000
|
||||||
|
#define __builtin_huge_valf() HUGE_VALF //0x7f800000
|
||||||
|
#define __builtin_huge_vall() HUGE_VALL //0x7ff0000000000000
|
||||||
|
#define __builtin_nan(__dummy) nan(__dummy) //0x7ff8000000000000
|
||||||
|
#define __builtin_nanf(__dummy) nanf(__dummy) // 0x7ff80000
|
||||||
|
#define __builtin_nanl(__dummy) nanl(__dummy) //0x7ff8000000000000
|
||||||
|
#define __builtin_nans(__dummy) DBL_SNAN //0x7ff5555555555555
|
||||||
|
#define __builtin_nansf(__dummy) FLT_SNAN //0x7f855555
|
||||||
|
#define __builtin_nansl(__dummy) DBL_SNAN //0x7ff5555555555555
|
||||||
|
|
||||||
|
#define __FLT_MANT_DIG__ FLT_MANT_DIG
|
||||||
|
#define __FLT_DIG__ FLT_DIG
|
||||||
|
#define __FLT_RADIX__ FLT_RADIX
|
||||||
|
#define __FLT_MIN_EXP__ FLT_MIN_EXP
|
||||||
|
#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
|
||||||
|
#define __FLT_MAX_EXP__ FLT_MAX_EXP
|
||||||
|
#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
|
||||||
|
#define __FLT_MIN__ FLT_MIN
|
||||||
|
#define __FLT_MAX__ FLT_MAX
|
||||||
|
#define __FLT_EPSILON__ FLT_EPSILON
|
||||||
|
// predefined by XLC on LoP
|
||||||
|
#define __FLT_DENORM_MIN__ 1.40129846e-45F
|
||||||
|
|
||||||
|
#define __DBL_MANT_DIG__ DBL_MANT_DIG
|
||||||
|
#define __DBL_DIG__ DBL_DIG
|
||||||
|
#define __DBL_MIN_EXP__ DBL_MIN_EXP
|
||||||
|
#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
|
||||||
|
#define __DBL_MAX_EXP__ DBL_MAX_EXP
|
||||||
|
#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
|
||||||
|
#define __DBL_MIN__ DBL_MIN
|
||||||
|
#define __DBL_MAX__ DBL_MAX
|
||||||
|
#define __DBL_EPSILON__ DBL_EPSILON
|
||||||
|
// predefined by XLC on LoP
|
||||||
|
#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
|
||||||
|
|
||||||
|
#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
|
||||||
|
#define __LDBL_DIG__ LDBL_DIG
|
||||||
|
#define __LDBL_MIN_EXP__ LDBL_MIN_EXP
|
||||||
|
#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
|
||||||
|
#define __LDBL_MAX_EXP__ LDBL_MAX_EXP
|
||||||
|
#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
|
||||||
|
#define __LDBL_MIN__ LDBL_MIN
|
||||||
|
#define __LDBL_MAX__ LDBL_MAX
|
||||||
|
#define __LDBL_EPSILON__ LDBL_EPSILON
|
||||||
|
// predefined by XLC on LoP
|
||||||
|
#if __LONGDOUBLE128
|
||||||
|
#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L
|
||||||
|
#else
|
||||||
|
#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// predefined by XLC on LoP
|
||||||
|
#define __CHAR_BIT__ 8
|
||||||
|
|
||||||
|
#endif // _AIX
|
||||||
|
|
||||||
|
#endif // _LIBCPP_SUPPORT_IBM_LIMITS_H
|
||||||
54
include/support/ibm/support.h
Normal file
54
include/support/ibm/support.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===----------------------- support/ibm/support.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_SUPPORT_IBM_SUPPORT_H
|
||||||
|
#define _LIBCPP_SUPPORT_IBM_SUPPORT_H
|
||||||
|
|
||||||
|
extern "builtin" int __popcnt4(unsigned int);
|
||||||
|
extern "builtin" int __popcnt8(unsigned long long);
|
||||||
|
extern "builtin" unsigned int __cnttz4(unsigned int);
|
||||||
|
extern "builtin" unsigned int __cnttz8(unsigned long long);
|
||||||
|
extern "builtin" unsigned int __cntlz4(unsigned long long);
|
||||||
|
extern "builtin" unsigned int __cntlz8(unsigned long long);
|
||||||
|
|
||||||
|
// Builtin functions for counting population
|
||||||
|
#define __builtin_popcount(x) __popcnt4(x)
|
||||||
|
#define __builtin_popcountll(x) __popcnt8(x)
|
||||||
|
#if defined(__64BIT__)
|
||||||
|
#define __builtin_popcountl(x) __builtin_popcountll(x)
|
||||||
|
#else
|
||||||
|
#define __builtin_popcountl(x) __builtin_popcount(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Builtin functions for counting trailing zeros
|
||||||
|
#define __builtin_ctz(x) __cnttz4(x)
|
||||||
|
#define __builtin_ctzll(x) __cnttz8(x)
|
||||||
|
#if defined(__64BIT__)
|
||||||
|
#define __builtin_ctzl(x) __builtin_ctzll(x)
|
||||||
|
#else
|
||||||
|
#define __builtin_ctzl(x) __builtin_ctz(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Builtin functions for counting leading zeros
|
||||||
|
#define __builtin_clz(x) __cntlz4(x)
|
||||||
|
#define __builtin_clzll(x) __cntlz8(x)
|
||||||
|
#if defined(__64BIT__)
|
||||||
|
#define __builtin_clzl(x) __builtin_clzll(x)
|
||||||
|
#else
|
||||||
|
#define __builtin_clzl(x) __builtin_clz(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__64BIT__)
|
||||||
|
#define __SIZE_WIDTH__ 64
|
||||||
|
#else
|
||||||
|
#define __SIZE_WIDTH__ 32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _LIBCPP_SUPPORT_IBM_SUPPORT_H
|
||||||
326
include/support/ibm/xlocale.h
Normal file
326
include/support/ibm/xlocale.h
Normal file
@@ -0,0 +1,326 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//===--------------------- support/ibm/xlocale.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_SUPPORT_IBM_XLOCALE_H
|
||||||
|
#define _LIBCPP_SUPPORT_IBM_XLOCALE_H
|
||||||
|
|
||||||
|
#if defined(_AIX)
|
||||||
|
#include "cstdlib"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_AIX71)
|
||||||
|
// AIX 7.1 and higher has these definitions. Definitions and stubs
|
||||||
|
// are provied here as a temporary workaround on AIX 6.1.
|
||||||
|
|
||||||
|
#define LC_COLLATE_MASK 1
|
||||||
|
#define LC_CTYPE_MASK 2
|
||||||
|
#define LC_MESSAGES_MASK 4
|
||||||
|
#define LC_MONETARY_MASK 8
|
||||||
|
#define LC_NUMERIC_MASK 16
|
||||||
|
#define LC_TIME_MASK 32
|
||||||
|
#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | \
|
||||||
|
LC_MESSAGES_MASK | LC_MONETARY_MASK |\
|
||||||
|
LC_NUMERIC_MASK | LC_TIME_MASK)
|
||||||
|
|
||||||
|
typedef void* locale_t;
|
||||||
|
|
||||||
|
// The following are stubs. They are not supported on AIX 6.1.
|
||||||
|
static inline
|
||||||
|
locale_t newlocale(int category_mask, const char *locale, locale_t base)
|
||||||
|
{
|
||||||
|
_LC_locale_t *newloc, *loc;
|
||||||
|
if ((loc = (_LC_locale_t *)__xopen_locale(locale)) == NULL)
|
||||||
|
{
|
||||||
|
errno = EINVAL;
|
||||||
|
return (locale_t)0;
|
||||||
|
}
|
||||||
|
if ((newloc = (_LC_locale_t *)calloc(1, sizeof(_LC_locale_t))) == NULL)
|
||||||
|
{
|
||||||
|
errno = ENOMEM;
|
||||||
|
return (locale_t)0;
|
||||||
|
}
|
||||||
|
if (!base)
|
||||||
|
base = (_LC_locale_t *)__xopen_locale("C");
|
||||||
|
memcpy(newloc, base, sizeof (_LC_locale_t));
|
||||||
|
if (category_mask & LC_COLLATE_MASK)
|
||||||
|
newloc->lc_collate = loc->lc_collate;
|
||||||
|
if (category_mask & LC_CTYPE_MASK)
|
||||||
|
newloc->lc_ctype = loc->lc_ctype;
|
||||||
|
//if (category_mask & LC_MESSAGES_MASK)
|
||||||
|
// newloc->lc_messages = loc->lc_messages;
|
||||||
|
if (category_mask & LC_MONETARY_MASK)
|
||||||
|
newloc->lc_monetary = loc->lc_monetary;
|
||||||
|
if (category_mask & LC_TIME_MASK)
|
||||||
|
newloc->lc_time = loc->lc_time;
|
||||||
|
if (category_mask & LC_NUMERIC_MASK)
|
||||||
|
newloc->lc_numeric = loc->lc_numeric;
|
||||||
|
return (locale_t)newloc;
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
void freelocale(locale_t locobj)
|
||||||
|
{
|
||||||
|
free(locobj);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
locale_t uselocale(locale_t newloc)
|
||||||
|
{
|
||||||
|
return (locale_t)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int isalnum_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xisalnum(locale, c);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
int isalpha_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xisalpha(locale, c);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
int isblank_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xisblank(locale, c);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
int iscntrl_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiscntrl(locale, c);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
int isdigit_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xisdigit(locale, c);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
int isgraph_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xisgraph(locale, c);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
int islower_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xislower(locale, c);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
int isprint_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xisprint(locale, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int ispunct_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xispunct(locale, c);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
int isspace_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xisspace(locale, c);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
int isupper_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xisupper(locale, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int isxdigit_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xisxdigit(locale, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int iswalnum_l(wchar_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiswalnum(locale, wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int iswalpha_l(wchar_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiswalpha(locale, wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int iswblank_l(wchar_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiswblank(locale, wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int iswcntrl_l(wchar_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiswcntrl(locale, wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int iswdigit_l(wchar_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiswdigit(locale, wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int iswgraph_l(wchar_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiswgraph(locale, wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int iswlower_l(wchar_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiswlower(locale, wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int iswprint_l(wchar_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiswprint(locale, wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int iswpunct_l(wchar_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiswpunct(locale, wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int iswspace_l(wchar_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiswspace(locale, wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int iswupper_l(wchar_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiswupper(locale, wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int iswxdigit_l(wchar_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiswxdigit(locale, wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int iswctype_l(wint_t wc, wctype_t desc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xiswctype(locale, wc, desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int toupper_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xtoupper(locale, c);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
int tolower_l(int c, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xtolower(locale, c);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
wint_t towupper_l(wint_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xtowupper(locale, wc);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
wint_t towlower_l(wint_t wc, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xtowlower(locale, wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int strcoll_l(const char *__s1, const char *__s2, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xstrcoll(locale, __s1, __s2);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
int wcscoll_l(const wchar_t *__s1, const wchar_t *__s2, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xwcscoll(locale, __s1, __s2);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
size_t strxfrm_l(char *__s1, const char *__s2, size_t __n, locale_t locale)
|
||||||
|
{
|
||||||
|
return __xstrxfrm(locale, __s1, __s2, __n);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n,
|
||||||
|
locale_t locale)
|
||||||
|
{
|
||||||
|
return __xwcsxfrm(locale, __ws1, __ws2, __n);
|
||||||
|
}
|
||||||
|
#endif // !defined(_AIX71)
|
||||||
|
|
||||||
|
// strftime_l() is defined by POSIX. However, AIX 7.1 does not have it
|
||||||
|
// implemented yet.
|
||||||
|
static inline
|
||||||
|
size_t strftime_l(char *__s, size_t __size, const char *__fmt,
|
||||||
|
const struct tm *__tm, locale_t locale) {
|
||||||
|
return __xstrftime(locale, __s, __size, __fmt, __tm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The following are not POSIX routines. These are quick-and-dirty hacks
|
||||||
|
// to make things pretend to work
|
||||||
|
static inline
|
||||||
|
long long strtoll_l(const char *__nptr, char **__endptr,
|
||||||
|
int __base, locale_t locale) {
|
||||||
|
return strtoll(__nptr, __endptr, __base);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
long strtol_l(const char *__nptr, char **__endptr,
|
||||||
|
int __base, locale_t locale) {
|
||||||
|
return strtol(__nptr, __endptr, __base);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
long double strtold_l(const char *__nptr, char **__endptr,
|
||||||
|
locale_t locale) {
|
||||||
|
return strtold(__nptr, __endptr);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
unsigned long long strtoull_l(const char *__nptr, char **__endptr,
|
||||||
|
int __base, locale_t locale) {
|
||||||
|
return strtoull(__nptr, __endptr, __base);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
unsigned long strtoul_l(const char *__nptr, char **__endptr,
|
||||||
|
int __base, locale_t locale) {
|
||||||
|
return strtoul(__nptr, __endptr, __base);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int vasprintf(char **strp, const char *fmt, va_list ap)
|
||||||
|
{
|
||||||
|
const size_t buff_size = 256;
|
||||||
|
int str_size;
|
||||||
|
if ((*strp = (char *)malloc(buff_size)) == NULL)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if ((str_size = vsnprintf(*strp, buff_size, fmt, ap)) >= buff_size)
|
||||||
|
{
|
||||||
|
if ((*strp = (char *)realloc(*strp, str_size + 1)) == NULL)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
str_size = vsnprintf(*strp, str_size + 1, fmt, ap);
|
||||||
|
}
|
||||||
|
return str_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif // defined(_AIX)
|
||||||
|
#endif // _LIBCPP_SUPPORT_IBM_XLOCALE_H
|
||||||
5
include/support/solaris/floatingpoint.h
Normal file
5
include/support/solaris/floatingpoint.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#define atof sun_atof
|
||||||
|
#define strtod sun_strtod
|
||||||
|
#include_next "floatingpoint.h"
|
||||||
|
#undef atof
|
||||||
|
#undef strtod
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user