Compare commits
1208 Commits
svn-tags/l
...
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 | ||
|
|
2baccd81f1 | ||
|
|
11624459ef | ||
|
|
bc90e2a47d | ||
|
|
907732644c | ||
|
|
b97de44471 | ||
|
|
c6fe8cafc3 | ||
|
|
fdcbd1db25 | ||
|
|
e0a0e51248 | ||
|
|
9677458967 | ||
|
|
15e48f9239 | ||
|
|
c0d0cbad9e | ||
|
|
8452d21f41 | ||
|
|
f8800b12c5 | ||
|
|
2481cba8b7 | ||
|
|
14fa9f9d8f | ||
|
|
3c466fc631 | ||
|
|
866569b8c3 | ||
|
|
efbe4067f2 | ||
|
|
2ea1ca9bdd | ||
|
|
0cbb3a16e2 | ||
|
|
1c3ec6d480 | ||
|
|
6cd05eeb35 | ||
|
|
92a07003b2 | ||
|
|
59832523ac | ||
|
|
9e02b90405 | ||
|
|
2fb1a9d1e8 | ||
|
|
86698890db | ||
|
|
709c3d27f5 | ||
|
|
336f41ae0c | ||
|
|
db2e99f852 | ||
|
|
a824f53600 | ||
|
|
eb2c855c44 | ||
|
|
6b8ac3acda | ||
|
|
c512df1950 | ||
|
|
e2f2a15066 | ||
|
|
e6125bdeae | ||
|
|
be969d7c7d | ||
|
|
68ebc448f0 | ||
|
|
7608b4aac2 | ||
|
|
0442b12591 | ||
|
|
abe2628b43 | ||
|
|
7a563db09a | ||
|
|
8b3fae3cc7 | ||
|
|
9cbee430da | ||
|
|
6b171c557b | ||
|
|
92a836c03d | ||
|
|
5f255944ac | ||
|
|
2b56659c60 | ||
|
|
3fdbbd2a6f | ||
|
|
43edf2d1e1 | ||
|
|
e3e3291f3a | ||
|
|
8caf423916 | ||
|
|
8775816ba3 | ||
|
|
199d0aec1b | ||
|
|
9d7530935d | ||
|
|
a73da5d2ca | ||
|
|
8f0396e443 | ||
|
|
b59b929cc9 | ||
|
|
70bbcae9b5 | ||
|
|
d50c1c7429 | ||
|
|
110b8bf57e | ||
|
|
affd9e5d43 | ||
|
|
e36a196049 | ||
|
|
23369ee812 | ||
|
|
db86663223 | ||
|
|
9c59d38112 | ||
|
|
d36369d910 | ||
|
|
4f598034d2 | ||
|
|
fa06d75e8d | ||
|
|
2644a7b3da | ||
|
|
099084d52f | ||
|
|
b3296ae5bc | ||
|
|
bf6666f7a0 | ||
|
|
541cb301a1 | ||
|
|
13aaf422e4 | ||
|
|
e6440c6fa2 | ||
|
|
737a351850 | ||
|
|
2d81f3d1f3 | ||
|
|
464aa5cad3 | ||
|
|
bcbbd4d14f | ||
|
|
9a2078137f | ||
|
|
a78264f872 | ||
|
|
f3907e6cc0 | ||
|
|
912012e949 | ||
|
|
22ba71b8ef | ||
|
|
8d75632ad0 | ||
|
|
c97da3a590 | ||
|
|
0389c53f44 | ||
|
|
66f2641ac9 | ||
|
|
2bf1c08510 | ||
|
|
6f0342cf2e | ||
|
|
e59f724f79 | ||
|
|
62a6ac33a2 | ||
|
|
043fe1d931 | ||
|
|
cb05a0801a | ||
|
|
ac6de546bd | ||
|
|
12c3d374a5 | ||
|
|
9f66bffdbe | ||
|
|
3c8894b078 | ||
|
|
f03c3b4612 | ||
|
|
90d7785eba | ||
|
|
74248888ab | ||
|
|
61aa6013c3 | ||
|
|
0949eedbd6 | ||
|
|
d318d49e5c | ||
|
|
a2a08b43ee | ||
|
|
35d2fcfc8e | ||
|
|
f5d76a7afc | ||
|
|
7604fea08c | ||
|
|
d4b957820c | ||
|
|
2b1b2d40d7 | ||
|
|
8f5f2563aa | ||
|
|
c7c3891199 | ||
|
|
c28dbeee52 | ||
|
|
58cd8231d8 | ||
|
|
6a09441022 | ||
|
|
04dae1df22 | ||
|
|
5f2f14c5d2 | ||
|
|
8b53768dac | ||
|
|
b2e2a8f6f3 | ||
|
|
7686add61e | ||
|
|
d1d27a4afa | ||
|
|
53f7d4cc62 | ||
|
|
c560727d5e | ||
|
|
b965fed10b | ||
|
|
009b2c4583 | ||
|
|
93f2764b16 | ||
|
|
18884f4e9f | ||
|
|
0a612b0891 | ||
|
|
8790cabd86 | ||
|
|
a12beb35e5 | ||
|
|
aabf28721b | ||
|
|
d737382dfd | ||
|
|
083ba5f5ca | ||
|
|
f0562af9dd | ||
|
|
20eda8b563 | ||
|
|
c983454d30 | ||
|
|
c26fd8061e | ||
|
|
a6119a86c5 | ||
|
|
d5fed03778 | ||
|
|
ad1a5cc5f0 | ||
|
|
0687adca37 | ||
|
|
0667433587 | ||
|
|
756a1763d1 | ||
|
|
603d2c0989 | ||
|
|
1694d23e23 | ||
|
|
10f25d2739 | ||
|
|
a5e0121b8d | ||
|
|
e9b2c2d669 | ||
|
|
1e15fd1856 | ||
|
|
19ce6a4792 | ||
|
|
ed56921d6e | ||
|
|
4b7a43da34 | ||
|
|
8feadca3fa | ||
|
|
1122fec973 | ||
|
|
20542c0b94 | ||
|
|
ef54251a84 | ||
|
|
e003ce4899 | ||
|
|
bd89e4b0dd | ||
|
|
0148a838d0 | ||
|
|
57cff290a4 | ||
|
|
3dd965bdf9 | ||
|
|
932209b344 | ||
|
|
fead2e2de9 | ||
|
|
6b9826b2dc | ||
|
|
6cbf9f9b25 | ||
|
|
97ecd64913 | ||
|
|
ad935d583d | ||
|
|
656bdc3667 | ||
|
|
ed22f562e5 | ||
|
|
941138f8c9 | ||
|
|
496934a803 | ||
|
|
37c53b6221 | ||
|
|
5ec7f5a518 | ||
|
|
e06b9965ad | ||
|
|
f6cc833ae7 | ||
|
|
783b810cae | ||
|
|
a5a0ba86c8 | ||
|
|
e80c36e27b | ||
|
|
d515df2a50 | ||
|
|
f1151efcb1 | ||
|
|
2d01bf0665 | ||
|
|
0a111118a6 | ||
|
|
11a58a68e1 | ||
|
|
6063ec176d | ||
|
|
0cfa1f7cbd | ||
|
|
9e604b442c | ||
|
|
d5c2f255c5 | ||
|
|
7bbce3c0e7 | ||
|
|
6b41c6047b | ||
|
|
5d37fb32d2 | ||
|
|
3666695f0d | ||
|
|
d982028b92 | ||
|
|
ffadfd4c1e | ||
|
|
c6e08d6c44 | ||
|
|
469d419a17 | ||
|
|
7ac6af7027 | ||
|
|
e14ea5835e | ||
|
|
75f7695c62 | ||
|
|
ef3b2e2e34 | ||
|
|
9dbeff919b | ||
|
|
8c1aa2c24d | ||
|
|
506b36487c | ||
|
|
a02851e8a2 | ||
|
|
3e93e96dff | ||
|
|
b8a03c763a | ||
|
|
d615e47bea | ||
|
|
154002bb5d | ||
|
|
41fb6e1432 | ||
|
|
86e78d694c | ||
|
|
770a3c5116 | ||
|
|
d0a2fbfe60 | ||
|
|
f9b8998795 | ||
|
|
6e5e7e78ee | ||
|
|
5885da34ce | ||
|
|
80586729e4 | ||
|
|
8dcad976e0 | ||
|
|
542b0f0cf5 | ||
|
|
fddf722f4e | ||
|
|
171869e27c | ||
|
|
df85e57f4a | ||
|
|
e7c8da6f2d | ||
|
|
b2080c70d4 | ||
|
|
5a245dbf52 | ||
|
|
08774c5a22 | ||
|
|
6cf5d8c3aa | ||
|
|
c4cbb5b6b7 | ||
|
|
621ee222d9 | ||
|
|
31b8e617b6 | ||
|
|
47a7cce01e | ||
|
|
2529d02b5d | ||
|
|
211f0ee1be | ||
|
|
80f9180729 | ||
|
|
9ca45e21b8 | ||
|
|
65451f1549 | ||
|
|
30bbc93088 | ||
|
|
9a21a01946 | ||
|
|
99b2f7660d | ||
|
|
091c5ace78 | ||
|
|
497ac97247 | ||
|
|
aab015a929 | ||
|
|
9f193f202f | ||
|
|
5ea2e37c08 | ||
|
|
4ff9d3599c | ||
|
|
56a85ca8bf | ||
|
|
6c669943b3 | ||
|
|
f9e1c7e367 | ||
|
|
f83417b823 | ||
|
|
e76496ce46 | ||
|
|
5f5859c45b | ||
|
|
6fd4b669ca | ||
|
|
ac38bae75b | ||
|
|
52c4eb23e0 | ||
|
|
04240d90ef | ||
|
|
93c382bf45 | ||
|
|
2d72b1e393 | ||
|
|
e48e36623b | ||
|
|
0e1493ec5e | ||
|
|
eee7698bac | ||
|
|
626916fc25 | ||
|
|
b8f787b188 | ||
|
|
f190e97885 | ||
|
|
31aaf55f4c | ||
|
|
1b18a48e28 | ||
|
|
770d1c4ea7 | ||
|
|
c9f5d9fca6 | ||
|
|
d2f6afbfab | ||
|
|
57e5e87323 | ||
|
|
f02417b600 | ||
|
|
91e2f26fec | ||
|
|
4777bf2799 | ||
|
|
7a0248d2d7 | ||
|
|
d42c4beeff | ||
|
|
1f970ad73a | ||
|
|
55ddb21dd4 | ||
|
|
a445151f4a | ||
|
|
7de47902d0 | ||
|
|
ac417faebc | ||
|
|
d397d03651 | ||
|
|
c706565c88 | ||
|
|
6051e24e45 | ||
|
|
adaa6266fe | ||
|
|
8771430346 | ||
|
|
46ab5def62 | ||
|
|
fa5043d878 | ||
|
|
83b6979fa2 | ||
|
|
59a5ddbbd1 | ||
|
|
afff5aacd6 | ||
|
|
17c3a81048 | ||
|
|
5711e4daf0 | ||
|
|
6587dfe980 | ||
|
|
73d2f94f6b | ||
|
|
091f2ab44f | ||
|
|
6689564040 | ||
|
|
f8f852138f | ||
|
|
f048fe3a09 | ||
|
|
1468b668aa | ||
|
|
01feecb789 | ||
|
|
9835d76169 | ||
|
|
995676a98e | ||
|
|
9650b6cce3 | ||
|
|
2f6a627394 | ||
|
|
278bf2d289 | ||
|
|
47761071be | ||
|
|
34d6b19721 | ||
|
|
7b2cb48cc1 | ||
|
|
cd2254b454 | ||
|
|
86ed8aefb2 | ||
|
|
e32b5e2f23 | ||
|
|
b64f8b07c1 | ||
|
|
f38bc6efc5 | ||
|
|
662497edd2 | ||
|
|
28dbbe0596 | ||
|
|
726a76fb47 | ||
|
|
a8feecea67 | ||
|
|
e87ad178cc | ||
|
|
4e59948249 | ||
|
|
bce9c3132d | ||
|
|
f26262dde0 | ||
|
|
5bbe97ddaa | ||
|
|
e738501eb3 | ||
|
|
21ef47f436 | ||
|
|
be22ed405a | ||
|
|
f6fe084fd4 | ||
|
|
0d5dff1897 | ||
|
|
b742dcdd52 | ||
|
|
5306d68019 | ||
|
|
8177207f3c | ||
|
|
f9734c831f | ||
|
|
373a9d18d3 | ||
|
|
4d89249185 | ||
|
|
3c143ad882 | ||
|
|
08f2969220 | ||
|
|
ffb9a4e235 | ||
|
|
251aaa1064 | ||
|
|
77868b9d9a | ||
|
|
086b718734 | ||
|
|
e78d1f548b | ||
|
|
56f0d5be06 | ||
|
|
6cac2c2c9c | ||
|
|
b4ac745466 | ||
|
|
002f1d341b | ||
|
|
26994e383c | ||
|
|
611fdaf229 | ||
|
|
7c0c696afd | ||
|
|
364f5965da | ||
|
|
1348fba3e2 | ||
|
|
79101aec3a | ||
|
|
f701e25c49 | ||
|
|
767ae2b483 | ||
|
|
5b6af69387 | ||
|
|
c260b06366 | ||
|
|
ed760f40b7 | ||
|
|
0ce02245a9 | ||
|
|
d1176e29b0 | ||
|
|
8f73c63658 | ||
|
|
d05c6e646b | ||
|
|
e049cc5f75 | ||
|
|
ee6ccd0e32 | ||
|
|
8d7a9557b7 | ||
|
|
28c97e6ee1 | ||
|
|
aef07cbffd | ||
|
|
b9af2eae4a | ||
|
|
828948148d | ||
|
|
68a8e90b3d | ||
|
|
8c6cbb24e8 | ||
|
|
42a63a781f | ||
|
|
422a53fd7a | ||
|
|
333f50d30c | ||
|
|
b0be42b2ce | ||
|
|
99acc5008b | ||
|
|
c0de2e48ff | ||
|
|
3975ebd4f5 | ||
|
|
049734ed85 | ||
|
|
611581b853 | ||
|
|
26a43c25d7 | ||
|
|
7e0c57b203 | ||
|
|
f5eadcd8d5 | ||
|
|
45f5717812 | ||
|
|
d2a9251977 | ||
|
|
a0f1dc9f46 | ||
|
|
fdc5a0f321 | ||
|
|
c7e4d82bc0 | ||
|
|
36cdf027d2 | ||
|
|
cb2deb2652 | ||
|
|
e764f0b648 | ||
|
|
745d473ac1 | ||
|
|
27031115bf | ||
|
|
99ad765261 | ||
|
|
954b366317 | ||
|
|
aad0db393f | ||
|
|
87eea6d801 | ||
|
|
bb73d762b2 | ||
|
|
6fd2e09b36 | ||
|
|
2fd6d25bf1 | ||
|
|
1387038988 | ||
|
|
f6547cbf61 | ||
|
|
3991b553df | ||
|
|
a2ccccce89 | ||
|
|
9c2683d77c | ||
|
|
e3e488eb61 | ||
|
|
b02310e487 | ||
|
|
bfd5530c06 | ||
|
|
73d21a4f07 | ||
|
|
04acacadca | ||
|
|
171a9a7cc3 | ||
|
|
e6e4d01553 | ||
|
|
99be8237db | ||
|
|
ae153b9855 | ||
|
|
54da338f59 | ||
|
|
7158e5c38b | ||
|
|
f39daa8e5a | ||
|
|
47499b162a | ||
|
|
98ccdeca3b | ||
|
|
a652172d86 | ||
|
|
ef0036c5aa | ||
|
|
8e705bb5ad | ||
|
|
d510977c4d | ||
|
|
d2bb032075 | ||
|
|
c52f43e72d | ||
|
|
f11ea14460 | ||
|
|
6e0a1f458e | ||
|
|
bbd8086ee3 | ||
|
|
0e20cae1a5 | ||
|
|
22a74dcf50 | ||
|
|
cf6dcc35e1 | ||
|
|
712522cfd8 | ||
|
|
256813f4e7 | ||
|
|
74231bfbc0 | ||
|
|
aa20444a4f | ||
|
|
6046aced82 | ||
|
|
eb564e76cc | ||
|
|
16e6e1d72f | ||
|
|
324bb03bb9 | ||
|
|
92172b891f | ||
|
|
a785e4e469 | ||
|
|
7a2523b201 | ||
|
|
98e5d97400 | ||
|
|
725528086c | ||
|
|
e00e030f58 | ||
|
|
e3263b4dbe | ||
|
|
2794e6cca5 | ||
|
|
3c1ffbabc1 | ||
|
|
e92c3d74ce | ||
|
|
ba590bdc97 | ||
|
|
4a23e1e060 | ||
|
|
a8d7759708 | ||
|
|
262b779f1d | ||
|
|
a712c72499 | ||
|
|
aa78f9cdb3 | ||
|
|
27405f91a8 | ||
|
|
7026a17a48 | ||
|
|
878465043f | ||
|
|
0e353f2363 | ||
|
|
d444470d6c | ||
|
|
81e68580b2 | ||
|
|
3e13d4f9c4 | ||
|
|
b271eff4c6 | ||
|
|
0a68a4d739 | ||
|
|
60a0a8ef24 | ||
|
|
45783d2dfd | ||
|
|
3da2d48b03 | ||
|
|
d78b315935 | ||
|
|
f3dcca049b | ||
|
|
8daa733576 | ||
|
|
a0d045b787 | ||
|
|
588ea08124 | ||
|
|
15476f345d | ||
|
|
e9de5ff443 | ||
|
|
856846b66f | ||
|
|
ad2a7ab9a9 | ||
|
|
17615b040d | ||
|
|
ddff70e879 | ||
|
|
2ade7c27f8 | ||
|
|
1371b2e56e | ||
|
|
aa69808da9 | ||
|
|
639a668b4c | ||
|
|
22ce0b4a1c | ||
|
|
68025ed084 | ||
|
|
173968a5f2 | ||
|
|
e34f17d383 | ||
|
|
cba352d348 | ||
|
|
ac30386dfe | ||
|
|
37f9f9c587 | ||
|
|
e77aa5e7f4 | ||
|
|
f8ce459f8d | ||
|
|
43b4decac5 | ||
|
|
0dca5fc7ad | ||
|
|
9b80f2b044 | ||
|
|
7e9d84b746 | ||
|
|
cd85b9ee13 |
4
.arcconfig
Normal file
4
.arcconfig
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"project_id" : "libcxx",
|
||||
"conduit_uri" : "http://llvm-reviews.chandlerc.com/"
|
||||
}
|
||||
283
CMakeLists.txt
Normal file
283
CMakeLists.txt
Normal file
@@ -0,0 +1,283 @@
|
||||
# See www/CMake.html for instructions on how to build libcxx with CMake.
|
||||
|
||||
#===============================================================================
|
||||
# Setup Project
|
||||
#===============================================================================
|
||||
|
||||
project(libcxx CXX C)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION trunk-svn)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
|
||||
|
||||
# Add path for custom modules
|
||||
set(CMAKE_MODULE_PATH
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
|
||||
${CMAKE_MODULE_PATH}
|
||||
)
|
||||
|
||||
# Require out of source build.
|
||||
include(MacroEnsureOutOfSourceBuild)
|
||||
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
|
||||
"${PROJECT_NAME} requires an out of source build. Please create a separate
|
||||
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
|
||||
#===============================================================================
|
||||
|
||||
# Define options.
|
||||
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
|
||||
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
|
||||
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
||||
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
|
||||
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
||||
option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
|
||||
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
||||
option(LIBCXX_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
|
||||
#===============================================================================
|
||||
|
||||
# Get triples.
|
||||
include(GetTriple)
|
||||
get_host_triple(LIBCXX_HOST_TRIPLE
|
||||
LIBCXX_HOST_ARCH
|
||||
LIBCXX_HOST_VENDOR
|
||||
LIBCXX_HOST_OS
|
||||
)
|
||||
set(LIBCXX_HOST_TRIPLE ${LIBCXX_HOST_TRIPLE} CACHE STRING "Host triple.")
|
||||
get_target_triple(LIBCXX_TARGET_TRIPLE
|
||||
LIBCXX_TARGET_ARCH
|
||||
LIBCXX_TARGET_VENDOR
|
||||
LIBCXX_TARGET_OS
|
||||
)
|
||||
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.
|
||||
include(config-ix)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Compiler Flags
|
||||
#===============================================================================
|
||||
|
||||
# Get required flags.
|
||||
# On all systems the system c++ standard library headers need to be excluded.
|
||||
if (MSVC)
|
||||
# MSVC only has -X, which disables all default includes; including the crt.
|
||||
# Thus, we do nothing and hope we don't accidentally include any of the C++
|
||||
# headers.
|
||||
else()
|
||||
if (LIBCXX_HAS_NOSTDINCXX_FLAG)
|
||||
set(LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++)
|
||||
endif()
|
||||
if (LIBCXX_ENABLE_CXX0X AND LIBCXX_HAS_STDCXX0X_FLAG)
|
||||
list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -std=c++0x)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro(append_if list condition var)
|
||||
if (${condition})
|
||||
list(APPEND ${list} ${var})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Get warning flags
|
||||
if (NOT MSVC)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
|
||||
set(LIBCXX_CXX_REQUIRED_FLAGS, -Werror=return-type)
|
||||
endif()
|
||||
|
||||
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)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
|
||||
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()
|
||||
if (LIBCXX_ENABLE_PEDANTIC)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
|
||||
endif()
|
||||
|
||||
# Get feature flags.
|
||||
# Exceptions
|
||||
if (LIBCXX_ENABLE_EXCEPTIONS)
|
||||
# Catches C++ exceptions only and tells the compiler to assume that extern C
|
||||
# functions never throw a C++ exception.
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
|
||||
else()
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
|
||||
endif()
|
||||
# RTTI
|
||||
if (NOT LIBCXX_ENABLE_RTTI)
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_RTTI)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
|
||||
endif()
|
||||
# Assert
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
|
||||
if (LIBCXX_ENABLE_ASSERTIONS)
|
||||
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
||||
if (NOT MSVC)
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
|
||||
endif()
|
||||
# On Release builds cmake automatically defines NDEBUG, so we
|
||||
# explicitly undefine it:
|
||||
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -UNDEBUG)
|
||||
endif()
|
||||
else()
|
||||
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
|
||||
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.
|
||||
if (MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
add_definitions(
|
||||
${LIBCXX_CXX_REQUIRED_FLAGS}
|
||||
${LIBCXX_CXX_WARNING_FLAGS}
|
||||
${LIBCXX_CXX_FEATURE_FLAGS}
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Source Code
|
||||
#===============================================================================
|
||||
|
||||
include_directories(include)
|
||||
add_subdirectory(include)
|
||||
|
||||
# Add source code. This also contains all of the logic for deciding linker flags
|
||||
# soname, etc...
|
||||
add_subdirectory(lib)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Tests
|
||||
#===============================================================================
|
||||
|
||||
add_subdirectory(test)
|
||||
123
CREDITS.TXT
Normal file
123
CREDITS.TXT
Normal file
@@ -0,0 +1,123 @@
|
||||
This file is a partial list of people who have contributed to the LLVM/libc++
|
||||
project. If you have contributed a patch or made some other contribution to
|
||||
LLVM/libc++, please submit a patch to this file to add yourself, and it will be
|
||||
done!
|
||||
|
||||
The list is sorted by surname and formatted to allow easy grepping and
|
||||
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
|
||||
(S).
|
||||
|
||||
N: Saleem Abdulrasool
|
||||
E: compnerd@compnerd.org
|
||||
D: Minor patches and Linux fixes.
|
||||
|
||||
N: Dimitry Andric
|
||||
E: dimitry@andric.com
|
||||
D: Visibility fixes, minor FreeBSD portability patches.
|
||||
|
||||
N: Holger Arnold
|
||||
E: holgerar@gmail.com
|
||||
D: Minor fix.
|
||||
|
||||
N: Ruben Van Boxem
|
||||
E: vanboxem dot ruben at gmail dot com
|
||||
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
|
||||
E: aep at exys dot org
|
||||
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.
|
||||
45
LICENSE.TXT
45
LICENSE.TXT
@@ -1,10 +1,21 @@
|
||||
==============================================================================
|
||||
LLVM Release License
|
||||
libc++ License
|
||||
==============================================================================
|
||||
|
||||
The libc++ library is dual licensed under both the University of Illinois
|
||||
"BSD-Like" license and the MIT license. As a user of this code you may choose
|
||||
to use it under either license. As a contributor, you agree to allow your code
|
||||
to be used under both.
|
||||
|
||||
Full text of the relevant licenses is included below.
|
||||
|
||||
==============================================================================
|
||||
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2007-2010 University of Illinois at Urbana-Champaign.
|
||||
Copyright (c) 2009-2013 by the contributors listed in CREDITS.TXT
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
@@ -43,21 +54,23 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
The LLVM software contains code written by third parties. Such software will
|
||||
have its own individual LICENSE.TXT file in the directory in which it appears.
|
||||
This file will describe the copyrights, license, and restrictions which apply
|
||||
to that code.
|
||||
|
||||
The disclaimer of warranty in the University of Illinois Open Source License
|
||||
applies to all code in the LLVM Distribution, and nothing in any of the
|
||||
other licenses gives permission to use the names of the LLVM Team or the
|
||||
University of Illinois to endorse or promote products derived from this
|
||||
Software.
|
||||
Copyright (c) 2009-2013 by the contributors listed in CREDITS.TXT
|
||||
|
||||
The following pieces of software have additional or alternate copyrights,
|
||||
licenses, and/or restrictions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
Program Directory
|
||||
------- ---------
|
||||
<none yet>
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
50
Makefile
50
Makefile
@@ -1,5 +1,5 @@
|
||||
##
|
||||
# libcpp Makefile
|
||||
# libc++ Makefile
|
||||
##
|
||||
|
||||
SRCDIRS = .
|
||||
@@ -9,32 +9,46 @@ OBJROOT=.
|
||||
SYMROOT=.
|
||||
export TRIPLE=-apple-
|
||||
|
||||
ifeq (,$(RC_INDIGO))
|
||||
INSTALL_PREFIX=""
|
||||
else
|
||||
INSTALL_PREFIX="$(SDKROOT)"
|
||||
endif
|
||||
INSTALL_DIR=$(DSTROOT)/$(INSTALL_PREFIX)
|
||||
|
||||
.PHONY: help installsrc clean installheaders install
|
||||
|
||||
help::
|
||||
@echo "Use make install DSTROOT=<destination>"
|
||||
|
||||
installsrc:: $(SRCROOT)
|
||||
|
||||
ditto $(SRCDIRS)/include $(SRCROOT)/include
|
||||
ditto $(SRCDIRS)/lib/buildit $(SRCROOT)/lib/buildit
|
||||
ditto $(SRCDIRS)/lib $(SRCROOT)/lib
|
||||
ditto $(SRCDIRS)/src $(SRCROOT)/src
|
||||
ditto $(SRCDIRS)/Makefile $(SRCROOT)/Makefile
|
||||
|
||||
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)/usr/include/c++/v1/ext
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/usr/include/c++/v1/
|
||||
chown -R root:wheel $(DSTROOT)/usr/include
|
||||
chmod 755 $(DSTROOT)/usr/include/c++/v1
|
||||
chmod 644 $(DSTROOT)/usr/include/c++/v1/*
|
||||
chmod 755 $(DSTROOT)/usr/include/c++/v1/ext
|
||||
chmod 644 $(DSTROOT)/usr/include/c++/v1/ext/*
|
||||
|
||||
install:: installhdrs $(DESTDIR)
|
||||
install::
|
||||
|
||||
cd lib && ./buildit
|
||||
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
|
||||
mkdir -p $(DSTROOT)/usr/lib
|
||||
strip -S -o $(DSTROOT)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
cd $(DSTROOT)/usr/lib && ln -s libc++.1.dylib libc++.dylib
|
||||
|
||||
|
||||
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM \
|
||||
$(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
mkdir -p $(INSTALL_DIR)/usr/lib
|
||||
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
|
||||
|
||||
53
cmake/Modules/GetTriple.cmake
Normal file
53
cmake/Modules/GetTriple.cmake
Normal file
@@ -0,0 +1,53 @@
|
||||
# Define functions to get the host and target triple.
|
||||
|
||||
function(get_host_triple out out_arch out_vendor out_os)
|
||||
# Get the architecture.
|
||||
set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
||||
if (arch STREQUAL "x86")
|
||||
set(arch "i686")
|
||||
endif()
|
||||
# Get the vendor.
|
||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
set(vendor "apple")
|
||||
else()
|
||||
set(vendor "pc")
|
||||
endif()
|
||||
# Get os.
|
||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(os "win32")
|
||||
else()
|
||||
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} os)
|
||||
endif()
|
||||
set(triple "${arch}-${vendor}-${os}")
|
||||
set(${out} ${triple} PARENT_SCOPE)
|
||||
set(${out_arch} ${arch} PARENT_SCOPE)
|
||||
set(${out_vendor} ${vendor} PARENT_SCOPE)
|
||||
set(${out_os} ${os} PARENT_SCOPE)
|
||||
message(STATUS "Host triple: ${triple}")
|
||||
endfunction()
|
||||
|
||||
function(get_target_triple out out_arch out_vendor out_os)
|
||||
# Get the architecture.
|
||||
set(arch ${CMAKE_SYSTEM_PROCESSOR})
|
||||
if (arch STREQUAL "x86")
|
||||
set(arch "i686")
|
||||
endif()
|
||||
# Get the vendor.
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
set(vendor "apple")
|
||||
else()
|
||||
set(vendor "pc")
|
||||
endif()
|
||||
# Get os.
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(os "win32")
|
||||
else()
|
||||
string(TOLOWER ${CMAKE_SYSTEM_NAME} os)
|
||||
endif()
|
||||
set(triple "${arch}-${vendor}-${os}")
|
||||
set(${out} ${triple} PARENT_SCOPE)
|
||||
set(${out_arch} ${arch} PARENT_SCOPE)
|
||||
set(${out_vendor} ${vendor} PARENT_SCOPE)
|
||||
set(${out_os} ${os} PARENT_SCOPE)
|
||||
message(STATUS "Target triple: ${triple}")
|
||||
endfunction()
|
||||
18
cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
Normal file
18
cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
|
||||
|
||||
macro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage )
|
||||
|
||||
string( COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource )
|
||||
if( _insource )
|
||||
message( SEND_ERROR "${_errorMessage}" )
|
||||
message( FATAL_ERROR
|
||||
"In-source builds are not allowed.
|
||||
CMake would overwrite the makefiles distributed with Compiler-RT.
|
||||
Please create a directory and run cmake from there, passing the path
|
||||
to this source directory as the last argument.
|
||||
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
|
||||
Please delete them."
|
||||
)
|
||||
endif( _insource )
|
||||
|
||||
endmacro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD )
|
||||
40
cmake/config-ix.cmake
Normal file
40
cmake/config-ix.cmake
Normal file
@@ -0,0 +1,40 @@
|
||||
include(CheckLibraryExists)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
# Check compiler flags
|
||||
check_cxx_compiler_flag(-std=c++0x LIBCXX_HAS_STDCXX0X_FLAG)
|
||||
check_cxx_compiler_flag(-fPIC LIBCXX_HAS_FPIC_FLAG)
|
||||
check_cxx_compiler_flag(-nodefaultlibs LIBCXX_HAS_NODEFAULTLIBS_FLAG)
|
||||
check_cxx_compiler_flag(-nostdinc++ LIBCXX_HAS_NOSTDINCXX_FLAG)
|
||||
check_cxx_compiler_flag(-Wall LIBCXX_HAS_WALL_FLAG)
|
||||
check_cxx_compiler_flag(-W LIBCXX_HAS_W_FLAG)
|
||||
check_cxx_compiler_flag(-Wno-unused-parameter LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG)
|
||||
check_cxx_compiler_flag(-Wwrite-strings LIBCXX_HAS_WWRITE_STRINGS_FLAG)
|
||||
check_cxx_compiler_flag(-Wno-long-long LIBCXX_HAS_WNO_LONG_LONG_FLAG)
|
||||
check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG)
|
||||
check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG)
|
||||
check_cxx_compiler_flag(-Wno-error LIBCXX_HAS_WNO_ERROR_FLAG)
|
||||
check_cxx_compiler_flag(-fno-exceptions LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
|
||||
check_cxx_compiler_flag(-fno-rtti LIBCXX_HAS_FNO_RTTI_FLAG)
|
||||
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
|
||||
check_cxx_compiler_flag(/WX- LIBCXX_HAS_NO_WX_FLAG)
|
||||
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
|
||||
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
|
||||
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
|
||||
check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
|
||||
|
||||
# Check libraries
|
||||
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
|
||||
check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
|
||||
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
|
||||
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
|
||||
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
|
||||
|
||||
# Check C++0x features
|
||||
if (LIBCXX_ENABLE_CXX0X)
|
||||
if (LIBCXX_HAS_STDCXX0X_FLAG)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -std=c++0x)
|
||||
endif()
|
||||
else()
|
||||
set(LIBCXX_HAS_STDCXX0X_FLAG FALSE)
|
||||
endif()
|
||||
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/
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
579
include/__config
579
include/__config
@@ -3,17 +3,23 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_CONFIG
|
||||
#define _LIBCPP_CONFIG
|
||||
|
||||
#if !defined(_MSC_VER) || defined(__clang__)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_VERSION 1000
|
||||
#ifdef __GNUC__
|
||||
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_VERSION 1101
|
||||
|
||||
#define _LIBCPP_ABI_VERSION 1
|
||||
|
||||
@@ -26,15 +32,79 @@
|
||||
#if __LITTLE_ENDIAN__
|
||||
#define _LIBCPP_LITTLE_ENDIAN 1
|
||||
#define _LIBCPP_BIG_ENDIAN 0
|
||||
#endif
|
||||
#endif
|
||||
#endif // __LITTLE_ENDIAN__
|
||||
#endif // __LITTLE_ENDIAN__
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
#if __BIG_ENDIAN__
|
||||
#define _LIBCPP_LITTLE_ENDIAN 0
|
||||
#define _LIBCPP_BIG_ENDIAN 1
|
||||
#endif // __BIG_ENDIAN__
|
||||
#endif // __BIG_ENDIAN__
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
# 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
|
||||
# ifndef __LONG_LONG_SUPPORTED
|
||||
# define _LIBCPP_HAS_NO_LONG_LONG
|
||||
# endif // __LONG_LONG_SUPPORTED
|
||||
#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
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
// Compiler intrinsics (GCC or MSVC)
|
||||
# if defined(__clang__) \
|
||||
|| (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 // _WIN32
|
||||
|
||||
#ifdef __linux__
|
||||
# if defined(__GNUC__) && _GNUC_VER >= 403
|
||||
# define _LIBCPP_HAS_IS_BASE_OF
|
||||
# endif
|
||||
#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)
|
||||
# include <endian.h>
|
||||
@@ -44,21 +114,79 @@
|
||||
# elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# else
|
||||
# else // __BYTE_ORDER == __BIG_ENDIAN
|
||||
# error unable to determine endian
|
||||
# endif
|
||||
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
// 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
|
||||
|
||||
#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_VISIBILITY_TAG
|
||||
#define _LIBCPP_VISIBILITY_TAG 1
|
||||
#ifndef _LIBCPP_EXCEPTION_ABI
|
||||
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_VISIBILITY_TAG
|
||||
#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_VISIBLE __attribute__ ((__visibility__("default")))
|
||||
#else
|
||||
#define _LIBCPP_HIDDEN
|
||||
#define _LIBCPP_VISIBLE
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_FUNC_VIS
|
||||
#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
|
||||
#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
|
||||
@@ -66,46 +194,219 @@
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXCEPTION_ABI
|
||||
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
|
||||
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
|
||||
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
|
||||
|
||||
#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
|
||||
#define _LIBCPP_MOVE
|
||||
#endif
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#endif
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#ifndef _LIBCPP_ALWAYS_INLINE
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
#define _LIBCPP_HAS_NO_STRONG_USING
|
||||
|
||||
#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)
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#endif
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
#ifdef __linux__
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#else
|
||||
typedef __char16_t char16_t;
|
||||
typedef __char32_t char32_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_exceptions))
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_rtti))
|
||||
#define _LIBCPP_NO_RTTI
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_strong_enums))
|
||||
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_decltype))
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_attributes)
|
||||
# define _LIBCPP_NORETURN [[noreturn]]
|
||||
#else
|
||||
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_defaulted_functions))
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#endif // !(__has_feature(cxx_defaulted_functions))
|
||||
|
||||
#if !(__has_feature(cxx_deleted_functions))
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#endif // !(__has_feature(cxx_deleted_functions))
|
||||
|
||||
#if !(__has_feature(cxx_lambdas))
|
||||
#define _LIBCPP_HAS_NO_LAMBDAS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_nullptr))
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_rvalue_references))
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_static_assert))
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_auto_type))
|
||||
#define _LIBCPP_HAS_NO_AUTO_TYPE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_variadic_templates))
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_trailing_return))
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_generalized_initializers))
|
||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif
|
||||
|
||||
#if __has_feature(is_base_of)
|
||||
# define _LIBCPP_HAS_IS_BASE_OF
|
||||
#endif
|
||||
|
||||
// Objective-C++ features (opt-in)
|
||||
#if __has_feature(objc_arc)
|
||||
#define _LIBCPP_HAS_OBJC_ARC
|
||||
#endif
|
||||
|
||||
#if __has_feature(objc_arc_weak)
|
||||
#define _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_constexpr))
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#endif
|
||||
|
||||
#if __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))
|
||||
# define _NOEXCEPT noexcept
|
||||
# define _NOEXCEPT_(x) noexcept(x)
|
||||
#else
|
||||
# define _NOEXCEPT throw()
|
||||
# define _NOEXCEPT_(x)
|
||||
#endif
|
||||
|
||||
#if __has_feature(underlying_type)
|
||||
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
|
||||
#endif
|
||||
|
||||
// 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__)
|
||||
|
||||
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
||||
|
||||
#define _LIBCPP_NORETURN __attribute__((noreturn))
|
||||
|
||||
#if !__EXCEPTIONS
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
|
||||
#define _NOEXCEPT throw()
|
||||
#define _NOEXCEPT_(x)
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
|
||||
#else // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
|
||||
#if _GNUC_VER < 403
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if _GNUC_VER < 403
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#if _GNUC_VER < 404
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif // _GNUC_VER < 404
|
||||
|
||||
#if _GNUC_VER < 406
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STRONG_USING
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
|
||||
#define _LIBCPP_END_NAMESPACE_STD }
|
||||
#define _STD std
|
||||
#else
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
namespace _LIBCPP_NAMESPACE {
|
||||
@@ -113,13 +414,68 @@ namespace _LIBCPP_NAMESPACE {
|
||||
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||
}
|
||||
|
||||
#define _STD std::_LIBCPP_NAMESPACE
|
||||
#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
|
||||
typedef unsigned short char16_t;
|
||||
typedef unsigned int char32_t;
|
||||
#endif
|
||||
typedef unsigned short char16_t;
|
||||
typedef unsigned int char32_t;
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
|
||||
@@ -130,16 +486,135 @@ template <unsigned> struct __static_assert_check {};
|
||||
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
|
||||
_LIBCPP_CONCAT(__t, __LINE__)
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_DECLTYPE
|
||||
|
||||
#define decltype(x) __typeof__(x)
|
||||
|
||||
#endif
|
||||
|
||||
#if !__EXCEPTIONS
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#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
|
||||
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(__x) 0
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_explicit_conversions)
|
||||
# define _LIBCPP_EXPLICIT explicit
|
||||
#else
|
||||
# define _LIBCPP_EXPLICIT
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
|
||||
__lx __v_; \
|
||||
_LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
|
||||
_LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
|
||||
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
|
||||
};
|
||||
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
|
||||
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
# if _LIBCPP_DEBUG == 0
|
||||
# define _LIBCPP_DEBUG_LEVEL 1
|
||||
# elif _LIBCPP_DEBUG == 1
|
||||
# define _LIBCPP_DEBUG_LEVEL 2
|
||||
# else
|
||||
# error Supported values for _LIBCPP_DEBUG are 0 and 1
|
||||
# endif
|
||||
# define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
#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
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
|
||||
#define _LIBCPP_WCTYPE_IS_MASK
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
||||
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 0
|
||||
#endif
|
||||
#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
|
||||
# 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
|
||||
|
||||
#ifndef _LIBCPP_WEAK
|
||||
# define _LIBCPP_WEAK __attribute__((__weak__))
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
||||
|
||||
218
include/__debug
Normal file
218
include/__debug
Normal file
@@ -0,0 +1,218 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- __debug ----------------------------------===//
|
||||
//
|
||||
// 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_DEBUG_H
|
||||
#define _LIBCPP_DEBUG_H
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 1
|
||||
|
||||
# include <cstdlib>
|
||||
# include <cstdio>
|
||||
# include <cstddef>
|
||||
# ifndef _LIBCPP_ASSERT
|
||||
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
struct _LIBCPP_TYPE_VIS __c_node;
|
||||
|
||||
struct _LIBCPP_TYPE_VIS __i_node
|
||||
{
|
||||
void* __i_;
|
||||
__i_node* __next_;
|
||||
__c_node* __c_;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
__i_node(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
|
||||
__i_node(void* __i, __i_node* __next, __c_node* __c)
|
||||
: __i_(__i), __next_(__next), __c_(__c) {}
|
||||
~__i_node();
|
||||
};
|
||||
|
||||
struct _LIBCPP_TYPE_VIS __c_node
|
||||
{
|
||||
void* __c_;
|
||||
__c_node* __next_;
|
||||
__i_node** beg_;
|
||||
__i_node** end_;
|
||||
__i_node** cap_;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
__c_node(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
|
||||
__c_node(void* __c, __c_node* __next)
|
||||
: __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
|
||||
virtual ~__c_node();
|
||||
|
||||
virtual bool __dereferenceable(const void*) const = 0;
|
||||
virtual bool __decrementable(const void*) const = 0;
|
||||
virtual bool __addable(const void*, ptrdiff_t) const = 0;
|
||||
virtual bool __subscriptable(const void*, ptrdiff_t) const = 0;
|
||||
|
||||
void __add(__i_node* __i);
|
||||
_LIBCPP_HIDDEN void __remove(__i_node* __i);
|
||||
};
|
||||
|
||||
template <class _Cont>
|
||||
struct _C_node
|
||||
: public __c_node
|
||||
{
|
||||
_C_node(void* __c, __c_node* __n)
|
||||
: __c_node(__c, __n) {}
|
||||
|
||||
virtual bool __dereferenceable(const void*) const;
|
||||
virtual bool __decrementable(const void*) const;
|
||||
virtual bool __addable(const void*, ptrdiff_t) const;
|
||||
virtual bool __subscriptable(const void*, ptrdiff_t) const;
|
||||
};
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__dereferenceable(const void* __i) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__dereferenceable(__j);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__decrementable(const void* __i) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__decrementable(__j);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__addable(__j, __n);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
bool
|
||||
_C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__subscriptable(__j, __n);
|
||||
}
|
||||
|
||||
class _LIBCPP_TYPE_VIS __libcpp_db
|
||||
{
|
||||
__c_node** __cbeg_;
|
||||
__c_node** __cend_;
|
||||
size_t __csz_;
|
||||
__i_node** __ibeg_;
|
||||
__i_node** __iend_;
|
||||
size_t __isz_;
|
||||
|
||||
__libcpp_db();
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
__libcpp_db(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();
|
||||
|
||||
class __db_c_iterator;
|
||||
class __db_c_const_iterator;
|
||||
class __db_i_iterator;
|
||||
class __db_i_const_iterator;
|
||||
|
||||
__db_c_const_iterator __c_end() const;
|
||||
__db_i_const_iterator __i_end() const;
|
||||
|
||||
template <class _Cont>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __insert_c(_Cont* __c)
|
||||
{
|
||||
__c_node* __n = __insert_c(static_cast<void*>(__c));
|
||||
::new(__n) _C_node<_Cont>(__n->__c_, __n->__next_);
|
||||
}
|
||||
|
||||
void __insert_i(void* __i);
|
||||
__c_node* __insert_c(void* __c);
|
||||
void __erase_c(void* __c);
|
||||
|
||||
void __insert_ic(void* __i, const void* __c);
|
||||
void __iterator_copy(void* __i, const void* __i0);
|
||||
void __erase_i(void* __i);
|
||||
|
||||
void* __find_c_from_i(void* __i) const;
|
||||
void __invalidate_all(void* __c);
|
||||
__c_node* __find_c_and_lock(void* __c) const;
|
||||
__c_node* __find_c(void* __c) const;
|
||||
void unlock() const;
|
||||
|
||||
void swap(void* __c1, void* __c2);
|
||||
|
||||
|
||||
bool __dereferenceable(const void* __i) const;
|
||||
bool __decrementable(const void* __i) const;
|
||||
bool __addable(const void* __i, ptrdiff_t __n) const;
|
||||
bool __subscriptable(const void* __i, ptrdiff_t __n) const;
|
||||
bool __less_than_comparable(const void* __i, const void* __j) const;
|
||||
private:
|
||||
_LIBCPP_HIDDEN
|
||||
__i_node* __insert_iterator(void* __i);
|
||||
_LIBCPP_HIDDEN
|
||||
__i_node* __find_iterator(const void* __i) const;
|
||||
|
||||
friend _LIBCPP_FUNC_VIS __libcpp_db* __get_db();
|
||||
};
|
||||
|
||||
_LIBCPP_FUNC_VIS __libcpp_db* __get_db();
|
||||
_LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_DEBUG_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -15,39 +15,116 @@
|
||||
#include <type_traits>
|
||||
#include <typeinfo>
|
||||
#include <exception>
|
||||
#include <new>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
struct unary_function
|
||||
struct _LIBCPP_TYPE_VIS_ONLY unary_function
|
||||
{
|
||||
typedef _Arg argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
struct binary_function
|
||||
struct _LIBCPP_TYPE_VIS_ONLY binary_function
|
||||
{
|
||||
typedef _Arg1 first_argument_type;
|
||||
typedef _Arg2 second_argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
template <class _Tp> struct hash;
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash;
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_result_type
|
||||
{
|
||||
private:
|
||||
struct __two {char _; char __;};
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename _Up::result_type* = 0);
|
||||
public:
|
||||
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
|
||||
|
||||
#include <__functional_base_03>
|
||||
@@ -60,11 +137,11 @@ template <class _Tp>
|
||||
struct __derives_from_unary_function
|
||||
{
|
||||
private:
|
||||
struct __two {char _; char __;};
|
||||
struct __two {char __lx; char __lxx;};
|
||||
static __two __test(...);
|
||||
template <class _A, class _R>
|
||||
static unary_function<_A, _R>
|
||||
__test(const volatile unary_function<_A, _R>*);
|
||||
template <class _Ap, class _Rp>
|
||||
static unary_function<_Ap, _Rp>
|
||||
__test(const volatile unary_function<_Ap, _Rp>*);
|
||||
public:
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
@@ -74,11 +151,11 @@ template <class _Tp>
|
||||
struct __derives_from_binary_function
|
||||
{
|
||||
private:
|
||||
struct __two {char _; char __;};
|
||||
struct __two {char __lx; char __lxx;};
|
||||
static __two __test(...);
|
||||
template <class _A1, class _A2, class _R>
|
||||
static binary_function<_A1, _A2, _R>
|
||||
__test(const volatile binary_function<_A1, _A2, _R>*);
|
||||
template <class _A1, class _A2, class _Rp>
|
||||
static binary_function<_A1, _A2, _Rp>
|
||||
__test(const volatile binary_function<_A1, _A2, _Rp>*);
|
||||
public:
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
@@ -129,323 +206,221 @@ struct __weak_result_type
|
||||
|
||||
// 0 argument case
|
||||
|
||||
template <class _R>
|
||||
struct __weak_result_type<_R ()>
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp ()>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _R>
|
||||
struct __weak_result_type<_R (&)()>
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp (&)()>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _R>
|
||||
struct __weak_result_type<_R (*)()>
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp (*)()>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
// 1 argument case
|
||||
|
||||
template <class _R, class _A1>
|
||||
struct __weak_result_type<_R (_A1)>
|
||||
: public unary_function<_A1, _R>
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (_A1)>
|
||||
: public unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _A1>
|
||||
struct __weak_result_type<_R (&)(_A1)>
|
||||
: public unary_function<_A1, _R>
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (&)(_A1)>
|
||||
: public unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _A1>
|
||||
struct __weak_result_type<_R (*)(_A1)>
|
||||
: public unary_function<_A1, _R>
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (*)(_A1)>
|
||||
: public unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C>
|
||||
struct __weak_result_type<_R (_C::*)()>
|
||||
: public unary_function<_C*, _R>
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)()>
|
||||
: public unary_function<_Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C>
|
||||
struct __weak_result_type<_R (_C::*)() const>
|
||||
: public unary_function<const _C*, _R>
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const>
|
||||
: public unary_function<const _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C>
|
||||
struct __weak_result_type<_R (_C::*)() volatile>
|
||||
: public unary_function<volatile _C*, _R>
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() volatile>
|
||||
: public unary_function<volatile _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C>
|
||||
struct __weak_result_type<_R (_C::*)() const volatile>
|
||||
: public unary_function<const volatile _C*, _R>
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const volatile>
|
||||
: public unary_function<const volatile _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
// 2 argument case
|
||||
|
||||
template <class _R, class _A1, class _A2>
|
||||
struct __weak_result_type<_R (_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _R>
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _A1, class _A2>
|
||||
struct __weak_result_type<_R (*)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _R>
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (*)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _A1, class _A2>
|
||||
struct __weak_result_type<_R (&)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _R>
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (&)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1>
|
||||
struct __weak_result_type<_R (_C::*)(_A1)>
|
||||
: public binary_function<_C*, _A1, _R>
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1)>
|
||||
: public binary_function<_Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1>
|
||||
struct __weak_result_type<_R (_C::*)(_A1) const>
|
||||
: public binary_function<const _C*, _A1, _R>
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
|
||||
: public binary_function<const _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1>
|
||||
struct __weak_result_type<_R (_C::*)(_A1) volatile>
|
||||
: public binary_function<volatile _C*, _A1, _R>
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
|
||||
: public binary_function<volatile _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1>
|
||||
struct __weak_result_type<_R (_C::*)(_A1) const volatile>
|
||||
: public binary_function<const volatile _C*, _A1, _R>
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
|
||||
: public binary_function<const volatile _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
// 3 or more arguments
|
||||
|
||||
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_R (_A1, _A2, _A3, _A4...)>
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._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>
|
||||
struct __weak_result_type<_R (&)(_A1, _A2, _A3, _A4...)>
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._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>
|
||||
struct __weak_result_type<_R (*)(_A1, _A2, _A3, _A4...)>
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._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>
|
||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...)>
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._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>
|
||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const>
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
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>
|
||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) volatile>
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
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>
|
||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
// __invoke
|
||||
|
||||
// first bullet
|
||||
// bullets 1 and 2
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
template <class _Fp, class _A0, class ..._Args,
|
||||
class>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
|
||||
auto
|
||||
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
template <class _Fp, class _A0, class ..._Args,
|
||||
class>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
|
||||
auto
|
||||
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
// bullets 3 and 4
|
||||
|
||||
template <class _Fp, class _A0,
|
||||
class>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
|
||||
auto
|
||||
__invoke(_Fp&& __f, _A0&& __a0)
|
||||
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
|
||||
{
|
||||
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
return _VSTD::forward<_A0>(__a0).*__f;
|
||||
}
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
template <class _Fp, class _A0,
|
||||
class>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
|
||||
auto
|
||||
__invoke(_Fp&& __f, _A0&& __a0)
|
||||
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
|
||||
{
|
||||
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
return (*_VSTD::forward<_A0>(__a0)).*__f;
|
||||
}
|
||||
|
||||
// second bullet
|
||||
// bullet 5
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
template <class _Fp, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
|
||||
auto
|
||||
__invoke(_Fp&& __f, _Args&& ...__args)
|
||||
-> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
}
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
|
||||
{
|
||||
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
}
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
|
||||
{
|
||||
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
}
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
|
||||
{
|
||||
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
}
|
||||
|
||||
// third bullet
|
||||
|
||||
template <class _R, class _T, class _T1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
typename __apply_cv<_T1, _R>::type&&
|
||||
>::type
|
||||
__invoke(_R _T::* __f, _T1&& __t1)
|
||||
{
|
||||
return _STD::forward<_T1>(__t1).*__f;
|
||||
}
|
||||
|
||||
// forth bullet
|
||||
|
||||
template <class _T1, class _R, bool>
|
||||
struct __4th_helper
|
||||
{
|
||||
};
|
||||
|
||||
template <class _T1, class _R>
|
||||
struct __4th_helper<_T1, _R, true>
|
||||
{
|
||||
typedef typename __apply_cv<decltype(*_STD::declval<_T1>()), _R>::type type;
|
||||
};
|
||||
|
||||
template <class _R, class _T, class _T1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __4th_helper<_T1, _R,
|
||||
!is_base_of<_T,
|
||||
typename remove_reference<_T1>::type
|
||||
>::value
|
||||
>::type&&
|
||||
__invoke(_R _T::* __f, _T1&& __t1)
|
||||
{
|
||||
return (*_STD::forward<_T1>(__t1)).*__f;
|
||||
}
|
||||
|
||||
// fifth bullet
|
||||
|
||||
template <class _F, class ..._T>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename result_of<_F(_T...)>::type
|
||||
__invoke(_F&& __f, _T&& ...__t)
|
||||
{
|
||||
return _STD::forward<_F>(__f)(_STD::forward<_T>(__t)...);
|
||||
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _Tp, class ..._Args>
|
||||
struct __invoke_return
|
||||
{
|
||||
typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_Args>()...)) type;
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class reference_wrapper
|
||||
class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
|
||||
: public __weak_result_type<_Tp>
|
||||
{
|
||||
public:
|
||||
@@ -456,21 +431,23 @@ private:
|
||||
|
||||
public:
|
||||
// construct/copy/destroy
|
||||
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) : __f_(&__f) {}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT
|
||||
: __f_(_VSTD::addressof(__f)) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
|
||||
#endif
|
||||
|
||||
// access
|
||||
_LIBCPP_INLINE_VISIBILITY operator type& () const {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY type& get() const {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
|
||||
|
||||
// invoke
|
||||
template <class... _ArgTypes>
|
||||
typename __invoke_return<type&, _ArgTypes...>::type
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_of<type&, _ArgTypes...>::type
|
||||
operator() (_ArgTypes&&... __args) const
|
||||
{
|
||||
return __invoke(get(), _STD::forward<_ArgTypes>(__args)...);
|
||||
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -482,7 +459,7 @@ template <class _Tp> struct __is_reference_wrapper
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<_Tp>
|
||||
ref(_Tp& __t)
|
||||
ref(_Tp& __t) _NOEXCEPT
|
||||
{
|
||||
return reference_wrapper<_Tp>(__t);
|
||||
}
|
||||
@@ -490,7 +467,7 @@ ref(_Tp& __t)
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<_Tp>
|
||||
ref(reference_wrapper<_Tp> __t)
|
||||
ref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
return ref(__t.get());
|
||||
}
|
||||
@@ -498,7 +475,7 @@ ref(reference_wrapper<_Tp> __t)
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<const _Tp>
|
||||
cref(const _Tp& __t)
|
||||
cref(const _Tp& __t) _NOEXCEPT
|
||||
{
|
||||
return reference_wrapper<const _Tp>(__t);
|
||||
}
|
||||
@@ -506,16 +483,131 @@ cref(const _Tp& __t)
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<const _Tp>
|
||||
cref(reference_wrapper<_Tp> __t)
|
||||
cref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
return cref(__t.get());
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
template <class _Tp> void ref(const _Tp&& __t);// = delete; // LWG 688
|
||||
template <class _Tp> void cref(const _Tp&& __t);// = delete; // LWG 688
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
template <class _Tp> void ref(const _Tp&&) = delete;
|
||||
template <class _Tp> void cref(const _Tp&&) = delete;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
template <class _Tp> void ref(const _Tp&&);// = delete;
|
||||
template <class _Tp> void cref(const _Tp&&);// = delete;
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1258
include/__hash_table
1258
include/__hash_table
File diff suppressed because it is too large
Load Diff
304
include/__locale
304
include/__locale
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -19,23 +19,38 @@
|
||||
#include <cstdint>
|
||||
#include <cctype>
|
||||
#include <locale.h>
|
||||
#include <xlocale.h>
|
||||
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||
# include <support/win32/locale_win32.h>
|
||||
#elif _AIX
|
||||
# include <support/ibm/xlocale.h>
|
||||
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)
|
||||
# include <xlocale.h>
|
||||
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class locale;
|
||||
class _LIBCPP_TYPE_VIS locale;
|
||||
|
||||
template <class _Facet> bool has_facet(const locale&) throw();
|
||||
template <class _Facet> const _Facet& use_facet(const locale&);
|
||||
template <class _Facet>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
has_facet(const locale&) _NOEXCEPT;
|
||||
|
||||
class locale
|
||||
template <class _Facet>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _Facet&
|
||||
use_facet(const locale&);
|
||||
|
||||
class _LIBCPP_TYPE_VIS locale
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
class facet;
|
||||
class id;
|
||||
class _LIBCPP_TYPE_VIS facet;
|
||||
class _LIBCPP_TYPE_VIS id;
|
||||
|
||||
typedef int category;
|
||||
static const category // values assigned here are for exposition only
|
||||
@@ -49,18 +64,19 @@ public:
|
||||
all = collate | ctype | monetary | numeric | time | messages;
|
||||
|
||||
// construct/copy/destroy:
|
||||
locale() throw();
|
||||
locale(const locale&) throw();
|
||||
locale() _NOEXCEPT;
|
||||
locale(const locale&) _NOEXCEPT;
|
||||
explicit locale(const char*);
|
||||
explicit locale(const string&);
|
||||
locale(const locale&, const char*, category);
|
||||
locale(const locale&, const string&, category);
|
||||
template <class _Facet> locale(const locale&, _Facet*);
|
||||
template <class _Facet>
|
||||
_LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*);
|
||||
locale(const locale&, const locale&, category);
|
||||
|
||||
~locale() throw();
|
||||
~locale();
|
||||
|
||||
const locale& operator=(const locale&) throw();
|
||||
const locale& operator=(const locale&) _NOEXCEPT;
|
||||
|
||||
template <class _Facet> locale combine(const locale&) const;
|
||||
|
||||
@@ -85,14 +101,15 @@ private:
|
||||
bool has_facet(id&) const;
|
||||
const facet* use_facet(id&) const;
|
||||
|
||||
template <class _Facet> friend bool has_facet(const locale&) throw();
|
||||
template <class _Facet> friend bool has_facet(const locale&) _NOEXCEPT;
|
||||
template <class _Facet> friend const _Facet& use_facet(const locale&);
|
||||
};
|
||||
|
||||
class locale::facet
|
||||
class _LIBCPP_TYPE_VIS locale::facet
|
||||
: public __shared_count
|
||||
{
|
||||
protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit facet(size_t __refs = 0)
|
||||
: __shared_count(static_cast<long>(__refs)-1) {}
|
||||
|
||||
@@ -101,17 +118,17 @@ protected:
|
||||
// facet(const facet&) = delete; // effectively done in __shared_count
|
||||
// void operator=(const facet&) = delete;
|
||||
private:
|
||||
virtual void __on_zero_shared();
|
||||
virtual void __on_zero_shared() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class locale::id
|
||||
class _LIBCPP_TYPE_VIS locale::id
|
||||
{
|
||||
once_flag __flag_;
|
||||
int32_t __id_;
|
||||
|
||||
|
||||
static int32_t __next_id;
|
||||
public:
|
||||
id() {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {}
|
||||
private:
|
||||
void __init();
|
||||
void operator=(const id&); // = delete;
|
||||
@@ -134,15 +151,17 @@ template <class _Facet>
|
||||
locale
|
||||
locale::combine(const locale& __other) const
|
||||
{
|
||||
if (!_STD::has_facet<_Facet>(__other))
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (!_VSTD::has_facet<_Facet>(__other))
|
||||
throw runtime_error("locale::combine: locale missing facet");
|
||||
return locale(*this, &const_cast<_Facet&>(_STD::use_facet<_Facet>(__other)));
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return locale(*this, &const_cast<_Facet&>(_VSTD::use_facet<_Facet>(__other)));
|
||||
}
|
||||
|
||||
template <class _Facet>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
has_facet(const locale& __l) throw()
|
||||
has_facet(const locale& __l) _NOEXCEPT
|
||||
{
|
||||
return __l.has_facet(_Facet::id);
|
||||
}
|
||||
@@ -158,27 +177,31 @@ use_facet(const locale& __l)
|
||||
// template <class _CharT> class collate;
|
||||
|
||||
template <class _CharT>
|
||||
class collate
|
||||
class _LIBCPP_TYPE_VIS_ONLY collate
|
||||
: public locale::facet
|
||||
{
|
||||
public:
|
||||
typedef _CharT char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit collate(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int compare(const char_type* __lo1, const char_type* __hi1,
|
||||
const char_type* __lo2, const char_type* __hi2) const
|
||||
{
|
||||
return do_compare(__lo1, __hi1, __lo2, __hi2);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
string_type transform(const char_type* __lo, const char_type* __hi) const
|
||||
{
|
||||
return do_transform(__lo, __hi);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
long hash(const char_type* __lo, const char_type* __hi) const
|
||||
{
|
||||
return do_hash(__lo, __hi);
|
||||
@@ -219,29 +242,29 @@ collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
|
||||
|
||||
template <class _CharT>
|
||||
long
|
||||
collate<_CharT>::do_hash(const char_type* lo, const char_type* hi) const
|
||||
collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
|
||||
{
|
||||
size_t h = 0;
|
||||
const size_t sr = __CHAR_BIT__ * sizeof(size_t) - 8;
|
||||
const size_t mask = size_t(0xF) << (sr + 4);
|
||||
for(const char_type* p = lo; p != hi; ++p)
|
||||
size_t __h = 0;
|
||||
const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
|
||||
const size_t __mask = size_t(0xF) << (__sr + 4);
|
||||
for(const char_type* __p = __lo; __p != __hi; ++__p)
|
||||
{
|
||||
h = (h << 4) + *p;
|
||||
size_t g = h & mask;
|
||||
h ^= g | (g >> sr);
|
||||
__h = (__h << 4) + static_cast<size_t>(*__p);
|
||||
size_t __g = __h & __mask;
|
||||
__h ^= __g | (__g >> __sr);
|
||||
}
|
||||
return static_cast<long>(h);
|
||||
return static_cast<long>(__h);
|
||||
}
|
||||
|
||||
extern template class collate<char>;
|
||||
extern template class collate<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<char>)
|
||||
_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_TYPE_VIS_ONLY collate_byname;
|
||||
|
||||
template <>
|
||||
class collate_byname<char>
|
||||
class _LIBCPP_TYPE_VIS collate_byname<char>
|
||||
: public collate<char>
|
||||
{
|
||||
locale_t __l;
|
||||
@@ -260,7 +283,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class collate_byname<wchar_t>
|
||||
class _LIBCPP_TYPE_VIS collate_byname<wchar_t>
|
||||
: public collate<wchar_t>
|
||||
{
|
||||
locale_t __l;
|
||||
@@ -284,29 +307,18 @@ bool
|
||||
locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
|
||||
const basic_string<_CharT, _Traits, _Allocator>& __y) const
|
||||
{
|
||||
return _STD::use_facet<_STD::collate<_CharT> >(*this).compare(
|
||||
return _VSTD::use_facet<_VSTD::collate<_CharT> >(*this).compare(
|
||||
__x.data(), __x.data() + __x.size(),
|
||||
__y.data(), __y.data() + __y.size()) < 0;
|
||||
}
|
||||
|
||||
// template <class charT> class ctype
|
||||
|
||||
class ctype_base {
|
||||
class _LIBCPP_TYPE_VIS ctype_base
|
||||
{
|
||||
public:
|
||||
typedef __uint32_t mask;
|
||||
|
||||
#if __APPLE__
|
||||
static const mask space = _CTYPE_S;
|
||||
static const mask print = _CTYPE_R;
|
||||
static const mask cntrl = _CTYPE_C;
|
||||
static const mask upper = _CTYPE_U;
|
||||
static const mask lower = _CTYPE_L;
|
||||
static const mask alpha = _CTYPE_A;
|
||||
static const mask digit = _CTYPE_D;
|
||||
static const mask punct = _CTYPE_P;
|
||||
static const mask xdigit = _CTYPE_X;
|
||||
static const mask blank = _CTYPE_B;
|
||||
#else /* !__APPLE__ */
|
||||
#ifdef __GLIBC__
|
||||
typedef unsigned short mask;
|
||||
static const mask space = _ISspace;
|
||||
static const mask print = _ISprint;
|
||||
static const mask cntrl = _IScntrl;
|
||||
@@ -317,23 +329,81 @@ public:
|
||||
static const mask punct = _ISpunct;
|
||||
static const mask xdigit = _ISxdigit;
|
||||
static const mask blank = _ISblank;
|
||||
#endif /* __APPLE__ */
|
||||
#elif defined(_WIN32)
|
||||
typedef unsigned short mask;
|
||||
static const mask space = _SPACE;
|
||||
static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
|
||||
static const mask cntrl = _CONTROL;
|
||||
static const mask upper = _UPPER;
|
||||
static const mask lower = _LOWER;
|
||||
static const mask alpha = _ALPHA;
|
||||
static const mask digit = _DIGIT;
|
||||
static const mask punct = _PUNCT;
|
||||
static const mask xdigit = _HEX;
|
||||
static const mask blank = _BLANK;
|
||||
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
|
||||
#ifdef __APPLE__
|
||||
typedef __uint32_t mask;
|
||||
#elif defined(__FreeBSD__)
|
||||
typedef unsigned long mask;
|
||||
#elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
|
||||
typedef unsigned short mask;
|
||||
#endif
|
||||
static const mask space = _CTYPE_S;
|
||||
static const mask print = _CTYPE_R;
|
||||
static const mask cntrl = _CTYPE_C;
|
||||
static const mask upper = _CTYPE_U;
|
||||
static const mask lower = _CTYPE_L;
|
||||
static const mask alpha = _CTYPE_A;
|
||||
static const mask digit = _CTYPE_D;
|
||||
static const mask punct = _CTYPE_P;
|
||||
static const mask xdigit = _CTYPE_X;
|
||||
# if defined(__NetBSD__)
|
||||
static const mask blank = _CTYPE_BL;
|
||||
# else
|
||||
static const mask blank = _CTYPE_B;
|
||||
# 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;
|
||||
static const mask space = 1<<0;
|
||||
static const mask print = 1<<1;
|
||||
static const mask cntrl = 1<<2;
|
||||
static const mask upper = 1<<3;
|
||||
static const mask lower = 1<<4;
|
||||
static const mask alpha = 1<<5;
|
||||
static const mask digit = 1<<6;
|
||||
static const mask punct = 1<<7;
|
||||
static const mask xdigit = 1<<8;
|
||||
static const mask blank = 1<<9;
|
||||
#endif // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
|
||||
static const mask alnum = alpha | digit;
|
||||
static const mask graph = alnum | punct;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE ctype_base() {}
|
||||
};
|
||||
|
||||
template <class _CharT> class ctype;
|
||||
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype;
|
||||
|
||||
template <>
|
||||
class ctype<wchar_t>
|
||||
class _LIBCPP_TYPE_VIS ctype<wchar_t>
|
||||
: public locale::facet,
|
||||
public ctype_base
|
||||
{
|
||||
public:
|
||||
typedef wchar_t char_type;
|
||||
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit ctype(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
@@ -429,7 +499,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class ctype<char>
|
||||
class _LIBCPP_TYPE_VIS ctype<char>
|
||||
: public locale::facet, public ctype_base
|
||||
{
|
||||
const mask* __tab_;
|
||||
@@ -442,14 +512,14 @@ public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
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
|
||||
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
|
||||
{
|
||||
for (; __low != __high; ++__low, ++__vec)
|
||||
*__vec = isascii(*__low) ? __tab_[*__low] : 0;
|
||||
*__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
|
||||
return __low;
|
||||
}
|
||||
|
||||
@@ -457,7 +527,7 @@ public:
|
||||
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
|
||||
{
|
||||
for (; __low != __high; ++__low)
|
||||
if (isascii(*__low) && (__tab_[*__low] & __m))
|
||||
if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
|
||||
break;
|
||||
return __low;
|
||||
}
|
||||
@@ -466,7 +536,7 @@ public:
|
||||
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
|
||||
{
|
||||
for (; __low != __high; ++__low)
|
||||
if (!(isascii(*__low) && (__tab_[*__low] & __m)))
|
||||
if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
|
||||
break;
|
||||
return __low;
|
||||
}
|
||||
@@ -526,8 +596,16 @@ public:
|
||||
#else
|
||||
static const size_t table_size = 256; // FIXME: Don't hardcode this.
|
||||
#endif
|
||||
const mask* table() const throw() {return __tab_;}
|
||||
static const mask* classic_table() throw();
|
||||
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
|
||||
static const mask* classic_table() _NOEXCEPT;
|
||||
#if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
|
||||
static const int* __classic_upper_table() _NOEXCEPT;
|
||||
static const int* __classic_lower_table() _NOEXCEPT;
|
||||
#endif
|
||||
#if defined(__NetBSD__)
|
||||
static const short* __classic_upper_table() _NOEXCEPT;
|
||||
static const short* __classic_lower_table() _NOEXCEPT;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
~ctype();
|
||||
@@ -543,10 +621,10 @@ protected:
|
||||
|
||||
// template <class CharT> class ctype_byname;
|
||||
|
||||
template <class _CharT> class ctype_byname;
|
||||
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype_byname;
|
||||
|
||||
template <>
|
||||
class ctype_byname<char>
|
||||
class _LIBCPP_TYPE_VIS ctype_byname<char>
|
||||
: public ctype<char>
|
||||
{
|
||||
locale_t __l;
|
||||
@@ -564,7 +642,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class ctype_byname<wchar_t>
|
||||
class _LIBCPP_TYPE_VIS ctype_byname<wchar_t>
|
||||
: public ctype<wchar_t>
|
||||
{
|
||||
locale_t __l;
|
||||
@@ -695,7 +773,7 @@ tolower(_CharT __c, const locale& __loc)
|
||||
|
||||
// codecvt_base
|
||||
|
||||
class codecvt_base
|
||||
class _LIBCPP_TYPE_VIS codecvt_base
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE codecvt_base() {}
|
||||
@@ -704,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_TYPE_VIS_ONLY codecvt;
|
||||
|
||||
// template <> class codecvt<char, char, mbstate_t>
|
||||
|
||||
template <>
|
||||
class codecvt<char, char, mbstate_t>
|
||||
class _LIBCPP_TYPE_VIS codecvt<char, char, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
@@ -746,13 +824,13 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int encoding() const throw()
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool always_noconv() const throw()
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
@@ -764,7 +842,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int max_length() const throw()
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
@@ -786,16 +864,16 @@ protected:
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_encoding() const _NOEXCEPT;
|
||||
virtual bool do_always_noconv() const _NOEXCEPT;
|
||||
virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
// template <> class codecvt<wchar_t, char, mbstate_t>
|
||||
|
||||
template <>
|
||||
class codecvt<wchar_t, char, mbstate_t>
|
||||
class _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
@@ -831,13 +909,13 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int encoding() const throw()
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool always_noconv() const throw()
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
@@ -849,7 +927,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int max_length() const throw()
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
@@ -869,16 +947,16 @@ protected:
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_encoding() const _NOEXCEPT;
|
||||
virtual bool do_always_noconv() const _NOEXCEPT;
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
||||
|
||||
template <>
|
||||
class codecvt<char16_t, char, mbstate_t>
|
||||
class _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
@@ -915,13 +993,13 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int encoding() const throw()
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool always_noconv() const throw()
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
@@ -933,7 +1011,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int max_length() const throw()
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
@@ -955,16 +1033,16 @@ protected:
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_encoding() const _NOEXCEPT;
|
||||
virtual bool do_always_noconv() const _NOEXCEPT;
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
||||
|
||||
template <>
|
||||
class codecvt<char32_t, char, mbstate_t>
|
||||
class _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
@@ -1001,13 +1079,13 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int encoding() const throw()
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool always_noconv() const throw()
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
@@ -1019,7 +1097,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int max_length() const throw()
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
@@ -1041,21 +1119,23 @@ protected:
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_encoding() const _NOEXCEPT;
|
||||
virtual bool do_always_noconv() const _NOEXCEPT;
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
|
||||
|
||||
template <class _InternT, class _ExternT, class _StateT>
|
||||
class codecvt_byname
|
||||
class _LIBCPP_TYPE_VIS_ONLY codecvt_byname
|
||||
: public codecvt<_InternT, _ExternT, _StateT>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit codecvt_byname(const char* __nm, size_t __refs = 0)
|
||||
: codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit codecvt_byname(const string& __nm, size_t __refs = 0)
|
||||
: codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
|
||||
protected:
|
||||
@@ -1067,14 +1147,14 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
|
||||
{
|
||||
}
|
||||
|
||||
extern template class codecvt_byname<char, char, mbstate_t>;
|
||||
extern template class codecvt_byname<wchar_t, char, mbstate_t>;
|
||||
extern template class 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<char, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
|
||||
|
||||
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
|
||||
{
|
||||
template <class _OutputIterator, class _CharT>
|
||||
@@ -1164,7 +1244,7 @@ struct __narrow_to_utf8<32>
|
||||
}
|
||||
};
|
||||
|
||||
template <size_t _N>
|
||||
template <size_t _Np>
|
||||
struct __widen_from_utf8
|
||||
{
|
||||
template <class _OutputIterator>
|
||||
@@ -1256,10 +1336,10 @@ struct __widen_from_utf8<32>
|
||||
|
||||
// template <class charT> class numpunct
|
||||
|
||||
template <class _CharT> class numpunct;
|
||||
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct;
|
||||
|
||||
template <>
|
||||
class numpunct<char>
|
||||
class _LIBCPP_TYPE_VIS numpunct<char>
|
||||
: public locale::facet
|
||||
{
|
||||
public:
|
||||
@@ -1290,7 +1370,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class numpunct<wchar_t>
|
||||
class _LIBCPP_TYPE_VIS numpunct<wchar_t>
|
||||
: public locale::facet
|
||||
{
|
||||
public:
|
||||
@@ -1322,10 +1402,10 @@ protected:
|
||||
|
||||
// template <class charT> class numpunct_byname
|
||||
|
||||
template <class charT> class numpunct_byname;
|
||||
template <class charT> class _LIBCPP_TYPE_VIS_ONLY numpunct_byname;
|
||||
|
||||
template <>
|
||||
class numpunct_byname<char>
|
||||
class _LIBCPP_TYPE_VIS numpunct_byname<char>
|
||||
: public numpunct<char>
|
||||
{
|
||||
public:
|
||||
@@ -1343,7 +1423,7 @@ private:
|
||||
};
|
||||
|
||||
template <>
|
||||
class numpunct_byname<wchar_t>
|
||||
class _LIBCPP_TYPE_VIS numpunct_byname<wchar_t>
|
||||
: public numpunct<wchar_t>
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -16,16 +16,23 @@
|
||||
#include <system_error>
|
||||
#include <pthread.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class mutex
|
||||
class _LIBCPP_TYPE_VIS mutex
|
||||
{
|
||||
pthread_mutex_t __m_;
|
||||
|
||||
public:
|
||||
mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}
|
||||
#else
|
||||
mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
|
||||
#endif
|
||||
~mutex();
|
||||
|
||||
private:
|
||||
@@ -34,31 +41,33 @@ private:
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
bool try_lock() _NOEXCEPT;
|
||||
void unlock() _NOEXCEPT;
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
native_handle_type native_handle() {return &__m_;}
|
||||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
|
||||
};
|
||||
|
||||
struct defer_lock_t {};
|
||||
struct try_to_lock_t {};
|
||||
struct adopt_lock_t {};
|
||||
struct _LIBCPP_TYPE_VIS defer_lock_t {};
|
||||
struct _LIBCPP_TYPE_VIS try_to_lock_t {};
|
||||
struct _LIBCPP_TYPE_VIS adopt_lock_t {};
|
||||
|
||||
//constexpr
|
||||
extern const
|
||||
defer_lock_t defer_lock;
|
||||
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX)
|
||||
|
||||
//constexpr
|
||||
extern const
|
||||
try_to_lock_t try_to_lock;
|
||||
extern const defer_lock_t defer_lock;
|
||||
extern const try_to_lock_t try_to_lock;
|
||||
extern const adopt_lock_t adopt_lock;
|
||||
|
||||
//constexpr
|
||||
extern const
|
||||
adopt_lock_t adopt_lock;
|
||||
#else
|
||||
|
||||
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>
|
||||
class lock_guard
|
||||
class _LIBCPP_TYPE_VIS_ONLY lock_guard
|
||||
{
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
@@ -67,10 +76,13 @@ private:
|
||||
mutex_type& __m_;
|
||||
public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit lock_guard(mutex_type& __m)
|
||||
: __m_(__m) {__m_.lock();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
lock_guard(mutex_type& __m, adopt_lock_t)
|
||||
: __m_(__m) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~lock_guard() {__m_.unlock();}
|
||||
|
||||
private:
|
||||
@@ -79,7 +91,7 @@ private:
|
||||
};
|
||||
|
||||
template <class _Mutex>
|
||||
class unique_lock
|
||||
class _LIBCPP_TYPE_VIS_ONLY unique_lock
|
||||
{
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
@@ -89,21 +101,29 @@ private:
|
||||
bool __owns_;
|
||||
|
||||
public:
|
||||
unique_lock() : __m_(nullptr), __owns_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit unique_lock(mutex_type& __m)
|
||||
: __m_(&__m), __owns_(true) {__m_->lock();}
|
||||
unique_lock(mutex_type& __m, defer_lock_t)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT
|
||||
: __m_(&__m), __owns_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, try_to_lock_t)
|
||||
: __m_(&__m), __owns_(__m.try_lock()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, adopt_lock_t)
|
||||
: __m_(&__m), __owns_(true) {}
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t)
|
||||
: __m_(&__m), __owns_(__m.try_lock_until(__t)) {}
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d)
|
||||
: __m_(&__m), __owns_(__m.try_lock_for(__d)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~unique_lock()
|
||||
{
|
||||
if (__owns_)
|
||||
@@ -115,11 +135,13 @@ private:
|
||||
unique_lock& operator=(unique_lock const&); // = delete;
|
||||
|
||||
public:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
unique_lock(unique_lock&& __u)
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(unique_lock&& __u) _NOEXCEPT
|
||||
: __m_(__u.__m_), __owns_(__u.__owns_)
|
||||
{__u.__m_ = nullptr; __u.__owns_ = false;}
|
||||
unique_lock& operator=(unique_lock&& __u)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock& operator=(unique_lock&& __u) _NOEXCEPT
|
||||
{
|
||||
if (__owns_)
|
||||
__m_->unlock();
|
||||
@@ -129,7 +151,8 @@ public:
|
||||
__u.__owns_ = false;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
@@ -141,12 +164,14 @@ public:
|
||||
|
||||
void unlock();
|
||||
|
||||
void swap(unique_lock& __u)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(unique_lock& __u) _NOEXCEPT
|
||||
{
|
||||
_STD::swap(__m_, __u.__m_);
|
||||
_STD::swap(__owns_, __u.__owns_);
|
||||
_VSTD::swap(__m_, __u.__m_);
|
||||
_VSTD::swap(__owns_, __u.__owns_);
|
||||
}
|
||||
mutex_type* release()
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex_type* release() _NOEXCEPT
|
||||
{
|
||||
mutex_type* __m = __m_;
|
||||
__m_ = nullptr;
|
||||
@@ -154,10 +179,13 @@ public:
|
||||
return __m;
|
||||
}
|
||||
|
||||
bool owns_lock() const {return __owns_;}
|
||||
// explicit
|
||||
operator bool () const {return __owns_;}
|
||||
mutex_type* mutex() const {return __m_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool owns_lock() const _NOEXCEPT {return __owns_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool () const _NOEXCEPT {return __owns_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex_type* mutex() const _NOEXCEPT {return __m_;}
|
||||
};
|
||||
|
||||
template <class _Mutex>
|
||||
@@ -221,29 +249,35 @@ unique_lock<_Mutex>::unlock()
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
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 cv_status
|
||||
struct _LIBCPP_TYPE_VIS cv_status
|
||||
{
|
||||
enum _ {
|
||||
enum __lx {
|
||||
no_timeout,
|
||||
timeout
|
||||
};
|
||||
|
||||
_ __v_;
|
||||
__lx __v_;
|
||||
|
||||
cv_status(_ __v) : __v_(__v) {}
|
||||
operator int() const {return __v_;}
|
||||
_LIBCPP_INLINE_VISIBILITY cv_status(__lx __v) : __v_(__v) {}
|
||||
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
|
||||
|
||||
};
|
||||
|
||||
class condition_variable
|
||||
class _LIBCPP_TYPE_VIS condition_variable
|
||||
{
|
||||
pthread_cond_t __cv_;
|
||||
public:
|
||||
_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;}
|
||||
#endif
|
||||
~condition_variable();
|
||||
|
||||
private:
|
||||
@@ -251,18 +285,13 @@ private:
|
||||
condition_variable& operator=(const condition_variable&); // = delete;
|
||||
|
||||
public:
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
void notify_one() _NOEXCEPT;
|
||||
void notify_all() _NOEXCEPT;
|
||||
|
||||
void wait(unique_lock<mutex>& __lk);
|
||||
template <class _Predicate>
|
||||
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>
|
||||
cv_status
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
@@ -286,7 +315,7 @@ public:
|
||||
_Predicate __pred);
|
||||
|
||||
typedef pthread_cond_t* native_handle_type;
|
||||
native_handle_type native_handle() {return &__cv_;}
|
||||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;}
|
||||
|
||||
private:
|
||||
void __do_timed_wait(unique_lock<mutex>& __lk,
|
||||
@@ -294,7 +323,7 @@ private:
|
||||
};
|
||||
|
||||
template <class _To, class _Rep, class _Period>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
chrono::__is_duration<_To>::value,
|
||||
@@ -317,28 +346,13 @@ condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
|
||||
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>
|
||||
cv_status
|
||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
system_clock::time_point __s_now = system_clock::now();
|
||||
typename _Clock::time_point __c_now = _Clock::now();
|
||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__t - __c_now));
|
||||
wait_for(__lk, __t - _Clock::now());
|
||||
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
|
||||
}
|
||||
|
||||
@@ -362,22 +376,30 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
using namespace chrono;
|
||||
system_clock::time_point __s_now = system_clock::now();
|
||||
monotonic_clock::time_point __c_now = monotonic_clock::now();
|
||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
|
||||
return monotonic_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
||||
cv_status::timeout;
|
||||
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();
|
||||
steady_clock::time_point __c_now = steady_clock::now();
|
||||
if (_Max - __d > __s_now)
|
||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
|
||||
else
|
||||
__do_timed_wait(__lk, __sys_tpi::max());
|
||||
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
||||
cv_status::timeout;
|
||||
}
|
||||
|
||||
template <class _Rep, class _Period, class _Predicate>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lk, chrono::monotonic_clock::now() + __d,
|
||||
_STD::move(__pred));
|
||||
return wait_until(__lk, chrono::steady_clock::now() + __d,
|
||||
_VSTD::move(__pred));
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
#include <type_traits>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -18,7 +22,7 @@ protected:
|
||||
void __throw_out_of_range() const;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class _Tp, class _Allocator = allocator<_Tp> >
|
||||
struct __split_buffer
|
||||
: private __split_buffer_common<true>
|
||||
{
|
||||
@@ -26,7 +30,7 @@ private:
|
||||
__split_buffer(const __split_buffer&);
|
||||
__split_buffer& operator=(const __split_buffer&);
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
typedef _Tp value_type;
|
||||
typedef _Allocator allocator_type;
|
||||
typedef typename remove_reference<allocator_type>::type __alloc_rr;
|
||||
typedef allocator_traits<__alloc_rr> __alloc_traits;
|
||||
@@ -47,29 +51,36 @@ public:
|
||||
typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref;
|
||||
typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() {return __end_cap_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const {return __end_cap_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
|
||||
|
||||
__split_buffer();
|
||||
__split_buffer()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
||||
explicit __split_buffer(__alloc_rr& __a);
|
||||
explicit __split_buffer(const __alloc_rr& __a);
|
||||
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
|
||||
~__split_buffer();
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
__split_buffer(__split_buffer&& __c);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__split_buffer(__split_buffer&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
|
||||
__split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
|
||||
__split_buffer& operator=(__split_buffer&& __c);
|
||||
#endif
|
||||
__split_buffer& operator=(__split_buffer&& __c)
|
||||
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value) ||
|
||||
!__alloc_traits::propagate_on_container_move_assignment::value);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator end() {return __end_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator end() const {return __end_;}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return __end_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return __end_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void clear() {__destruct_at_end(__begin_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT
|
||||
{__destruct_at_end(__begin_);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);}
|
||||
_LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);}
|
||||
@@ -82,25 +93,23 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);}
|
||||
|
||||
void reserve(size_type __n);
|
||||
void shrink_to_fit();
|
||||
void shrink_to_fit() _NOEXCEPT;
|
||||
void push_front(const_reference __x);
|
||||
void push_back(const_reference __x);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
void push_front(value_type&& __x);
|
||||
void push_back(value_type&& __x);
|
||||
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
template <class... _Args>
|
||||
void emplace_back(_Args&&... __args);
|
||||
#endif
|
||||
#endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
|
||||
|
||||
void __construct_at_end(size_type __n);
|
||||
void __construct_at_end(size_type __n, false_type);
|
||||
void __construct_at_end(size_type __n, true_type);
|
||||
void __construct_at_end(size_type __n, const_reference __x);
|
||||
void __construct_at_end(size_type __n, const_reference __x, false_type);
|
||||
void __construct_at_end(size_type __n, const_reference __x, true_type);
|
||||
template <class _InputIter>
|
||||
typename enable_if
|
||||
<
|
||||
@@ -118,38 +127,53 @@ public:
|
||||
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
|
||||
{__destruct_at_begin(__new_begin, has_trivial_destructor<value_type>());}
|
||||
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
|
||||
void __destruct_at_begin(pointer __new_begin, false_type);
|
||||
void __destruct_at_begin(pointer __new_begin, true_type);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last)
|
||||
{__destruct_at_end(__new_last, has_trivial_destructor<value_type>());}
|
||||
void __destruct_at_end(pointer __new_last, false_type);
|
||||
void __destruct_at_end(pointer __new_last, true_type);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __destruct_at_end(pointer __new_last) _NOEXCEPT
|
||||
{__destruct_at_end(__new_last, false_type());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
|
||||
|
||||
void swap(__split_buffer& __x);
|
||||
void swap(__split_buffer& __x)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value);
|
||||
|
||||
bool __invariants() const;
|
||||
|
||||
private:
|
||||
void __move_assign_alloc(const __split_buffer& __c, true_type)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__split_buffer& __c, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
|
||||
{
|
||||
__alloc() = _STD::move(__c.__alloc());
|
||||
__alloc() = _VSTD::move(__c.__alloc());
|
||||
}
|
||||
|
||||
void __move_assign_alloc(const __split_buffer& __c, false_type)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||
__alloc_traits::propagate_on_container_swap::value>());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type)
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -184,35 +208,18 @@ __split_buffer<_Tp, _Allocator>::__invariants() const
|
||||
// Precondition: size() + __n <= capacity()
|
||||
// Postcondition: size() == size() + __n
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
|
||||
{
|
||||
__construct_at_end(__n, __is_zero_default_constructible<value_type>());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
do
|
||||
{
|
||||
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), value_type());
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
|
||||
++this->__end_;
|
||||
--__n;
|
||||
} while (__n > 0);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
|
||||
{
|
||||
_STD::memset(this->__end_, 0, __n*sizeof(value_type));
|
||||
this->__end_ += __n;
|
||||
}
|
||||
|
||||
// Copy constructs __n objects starting at __end_ from __x
|
||||
// throws if construction throws
|
||||
// Precondition: __n > 0
|
||||
@@ -220,36 +227,18 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
|
||||
// Postcondition: size() == old size() + __n
|
||||
// Postcondition: [i] == __x for all i in [size() - __n, __n)
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
|
||||
{
|
||||
__construct_at_end(__n, __x, integral_constant<bool, has_trivial_copy_constructor<value_type>::value &&
|
||||
has_trivial_copy_assign<value_type>::value>());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, false_type)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
do
|
||||
{
|
||||
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), __x);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
|
||||
++this->__end_;
|
||||
--__n;
|
||||
} while (__n > 0);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, true_type)
|
||||
{
|
||||
_STD::fill_n(this->__end_, __n, __x);
|
||||
this->__end_ += __n;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class _InputIter>
|
||||
typename enable_if
|
||||
@@ -266,14 +255,14 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIt
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
size_type __old_cap = __end_cap() - __first_;
|
||||
size_type __new_cap = _STD::max<size_type>(2 * __old_cap, 8);
|
||||
size_type __new_cap = _VSTD::max<size_type>(2 * __old_cap, 8);
|
||||
__split_buffer __buf(__new_cap, 0, __a);
|
||||
for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
|
||||
__alloc_traits::construct(__buf.__alloc(),
|
||||
_STD::__to_raw_pointer(__buf.__end_), _STD::move(*__p));
|
||||
_VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p));
|
||||
swap(__buf);
|
||||
}
|
||||
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), *__first);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
|
||||
++this->__end_;
|
||||
}
|
||||
}
|
||||
@@ -290,22 +279,22 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _F
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
for (; __first != __last; ++__first)
|
||||
{
|
||||
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), *__first);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
|
||||
++this->__end_;
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
|
||||
{
|
||||
while (__begin_ < __new_begin)
|
||||
__alloc_traits::destroy(__alloc(), __begin_++);
|
||||
while (__begin_ != __new_begin)
|
||||
__alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
|
||||
{
|
||||
@@ -313,25 +302,25 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_t
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type)
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
|
||||
{
|
||||
while (__new_last < __end_)
|
||||
__alloc_traits::destroy(__alloc(), --__end_);
|
||||
while (__new_last != __end_)
|
||||
__alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type)
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
|
||||
{
|
||||
__end_ = __new_last;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__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;
|
||||
__begin_ = __end_ = __first_ + __start;
|
||||
@@ -339,23 +328,24 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer()
|
||||
: __first_(0), __begin_(0), __end_(0), __end_cap_(0)
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__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>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__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)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -367,14 +357,15 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer()
|
||||
__alloc_traits::deallocate(__alloc(), __first_, capacity());
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
|
||||
: __first_(_STD::move(__c.__first_)),
|
||||
__begin_(_STD::move(__c.__begin_)),
|
||||
__end_(_STD::move(__c.__end_)),
|
||||
__end_cap_(_STD::move(__c.__end_cap_))
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
: __first_(_VSTD::move(__c.__first_)),
|
||||
__begin_(_VSTD::move(__c.__begin_)),
|
||||
__end_(_VSTD::move(__c.__end_)),
|
||||
__end_cap_(_VSTD::move(__c.__end_cap_))
|
||||
{
|
||||
__c.__first_ = nullptr;
|
||||
__c.__begin_ = nullptr;
|
||||
@@ -403,14 +394,17 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al
|
||||
__first_ = __alloc_traits::allocate(__alloc(), __cap);
|
||||
__begin_ = __end_ = __first_;
|
||||
__end_cap() = __first_ + __cap;
|
||||
typedef move_iterator<iterator> _I;
|
||||
__construct_at_end(_I(__c.begin()), _I(__c.end()));
|
||||
typedef move_iterator<iterator> _Ip;
|
||||
__construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>&
|
||||
__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
|
||||
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value) ||
|
||||
!__alloc_traits::propagate_on_container_move_assignment::value)
|
||||
{
|
||||
clear();
|
||||
shrink_to_fit();
|
||||
@@ -425,16 +419,18 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{
|
||||
_STD::swap(__first_, __x.__first_);
|
||||
_STD::swap(__begin_, __x.__begin_);
|
||||
_STD::swap(__end_, __x.__end_);
|
||||
_STD::swap(__end_cap(), __x.__end_cap());
|
||||
_VSTD::swap(__first_, __x.__first_);
|
||||
_VSTD::swap(__begin_, __x.__begin_);
|
||||
_VSTD::swap(__end_, __x.__end_);
|
||||
_VSTD::swap(__end_cap(), __x.__end_cap());
|
||||
__swap_alloc(__alloc(), __x.__alloc());
|
||||
}
|
||||
|
||||
@@ -447,37 +443,37 @@ __split_buffer<_Tp, _Allocator>::reserve(size_type __n)
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::shrink_to_fit()
|
||||
__split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
|
||||
{
|
||||
if (capacity() > size())
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
__t.__end_ = __t.__begin_ + (__end_ - __begin_);
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,26 +487,26 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
||||
{
|
||||
difference_type __d = __end_cap() - __end_;
|
||||
__d = (__d + 1) / 2;
|
||||
__begin_ = _STD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__end_ += __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 2) / 4, __alloc());
|
||||
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());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__begin_-1), __x);
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __x);
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
@@ -522,30 +518,30 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
||||
{
|
||||
difference_type __d = __end_cap() - __end_;
|
||||
__d = (__d + 1) / 2;
|
||||
__begin_ = _STD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__end_ += __d;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 2) / 4, __alloc());
|
||||
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());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__begin_-1),
|
||||
_STD::move(__x));
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1),
|
||||
_VSTD::move(__x));
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
||||
{
|
||||
@@ -555,26 +551,26 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _STD::move(__begin_, __end_, __begin_ - __d);
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
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());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_), __x);
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __x);
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
@@ -586,26 +582,28 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _STD::move(__begin_, __end_, __begin_ - __d);
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
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());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_),
|
||||
_STD::move(__x));
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
|
||||
_VSTD::move(__x));
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
void
|
||||
@@ -617,27 +615,39 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _STD::move(__begin_, __end_, __begin_ - __d);
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
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());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -15,24 +15,26 @@
|
||||
#include <type_traits>
|
||||
#include <new>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_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>
|
||||
class _LIBCPP_HIDDEN __sso_allocator<void, _N>
|
||||
template <size_t _Np>
|
||||
class _LIBCPP_HIDDEN __sso_allocator<void, _Np>
|
||||
{
|
||||
public:
|
||||
typedef const void* const_pointer;
|
||||
typedef void value_type;
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _N>
|
||||
template <class _Tp, size_t _Np>
|
||||
class _LIBCPP_HIDDEN __sso_allocator
|
||||
{
|
||||
typename aligned_storage<sizeof(_Tp) * _N>::type buf_;
|
||||
typename aligned_storage<sizeof(_Tp) * _Np>::type buf_;
|
||||
bool __allocated_;
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
@@ -41,14 +43,14 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __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) {}
|
||||
private:
|
||||
__sso_allocator& operator=(const __sso_allocator&);
|
||||
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;
|
||||
return (pointer)&buf_;
|
||||
@@ -64,7 +66,9 @@ public:
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(__sso_allocator& __a) const {return &buf_ == &__a.buf_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(__sso_allocator& __a) const {return &buf_ != &__a.buf_;}
|
||||
};
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -17,11 +17,15 @@
|
||||
#include <__locale>
|
||||
#include <cstdio>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
static const unsigned __limit = 8;
|
||||
static const int __limit = 8;
|
||||
|
||||
// __stdinbuf
|
||||
|
||||
@@ -37,7 +41,7 @@ public:
|
||||
typedef typename traits_type::off_type off_type;
|
||||
typedef typename traits_type::state_type state_type;
|
||||
|
||||
explicit __stdinbuf(FILE* __fp);
|
||||
__stdinbuf(FILE* __fp, state_type* __st);
|
||||
|
||||
protected:
|
||||
virtual int_type underflow();
|
||||
@@ -49,8 +53,10 @@ private:
|
||||
|
||||
FILE* __file_;
|
||||
const codecvt<char_type, char, state_type>* __cv_;
|
||||
state_type __st_;
|
||||
state_type* __st_;
|
||||
int __encoding_;
|
||||
int_type __last_consumed_;
|
||||
bool __last_consumed_is_next_;
|
||||
bool __always_noconv_;
|
||||
|
||||
__stdinbuf(const __stdinbuf&);
|
||||
@@ -60,9 +66,11 @@ private:
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp)
|
||||
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp, state_type* __st)
|
||||
: __file_(__fp),
|
||||
__st_()
|
||||
__st_(__st),
|
||||
__last_consumed_(traits_type::eof()),
|
||||
__last_consumed_is_next_(false)
|
||||
{
|
||||
imbue(this->getloc());
|
||||
}
|
||||
@@ -96,11 +104,21 @@ template <class _CharT>
|
||||
typename __stdinbuf<_CharT>::int_type
|
||||
__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];
|
||||
int __nread = max(1, __encoding_);
|
||||
int __nread = _VSTD::max(1, __encoding_);
|
||||
for (int __i = 0; __i < __nread; ++__i)
|
||||
{
|
||||
char __c = getc(__file_);
|
||||
int __c = getc(__file_);
|
||||
if (__c == EOF)
|
||||
return traits_type::eof();
|
||||
__extbuf[__i] = static_cast<char>(__c);
|
||||
@@ -115,19 +133,19 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
|
||||
codecvt_base::result __r;
|
||||
do
|
||||
{
|
||||
state_type __sv_st = __st_;
|
||||
__r = __cv_->in(__st_, __extbuf, __extbuf + __nread, __enxt,
|
||||
state_type __sv_st = *__st_;
|
||||
__r = __cv_->in(*__st_, __extbuf, __extbuf + __nread, __enxt,
|
||||
&__1buf, &__1buf + 1, __inxt);
|
||||
switch (__r)
|
||||
{
|
||||
case _STD::codecvt_base::ok:
|
||||
case _VSTD::codecvt_base::ok:
|
||||
break;
|
||||
case codecvt_base::partial:
|
||||
__st_ = __sv_st;
|
||||
*__st_ = __sv_st;
|
||||
if (__nread == sizeof(__extbuf))
|
||||
return traits_type::eof();
|
||||
{
|
||||
char __c = getc(__file_);
|
||||
int __c = getc(__file_);
|
||||
if (__c == EOF)
|
||||
return traits_type::eof();
|
||||
__extbuf[__nread] = static_cast<char>(__c);
|
||||
@@ -136,20 +154,22 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
|
||||
break;
|
||||
case codecvt_base::error:
|
||||
return traits_type::eof();
|
||||
case _STD::codecvt_base::noconv:
|
||||
case _VSTD::codecvt_base::noconv:
|
||||
__1buf = static_cast<char_type>(__extbuf[0]);
|
||||
break;
|
||||
}
|
||||
} while (__r == _STD::codecvt_base::partial);
|
||||
} while (__r == _VSTD::codecvt_base::partial);
|
||||
}
|
||||
if (!__consume)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
else
|
||||
__last_consumed_ = traits_type::to_int_type(__1buf);
|
||||
return traits_type::to_int_type(__1buf);
|
||||
}
|
||||
|
||||
@@ -158,28 +178,41 @@ typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::pbackfail(int_type __c)
|
||||
{
|
||||
if (traits_type::eq_int_type(__c, traits_type::eof()))
|
||||
return __c;
|
||||
char __extbuf[__limit];
|
||||
char* __enxt;
|
||||
const char_type __ci = traits_type::to_char_type(__c);
|
||||
const char_type* __inxt;
|
||||
switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt,
|
||||
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
|
||||
{
|
||||
case _STD::codecvt_base::ok:
|
||||
break;
|
||||
case _STD::codecvt_base::noconv:
|
||||
__extbuf[0] = static_cast<char>(__c);
|
||||
__enxt = __extbuf + 1;
|
||||
break;
|
||||
case codecvt_base::partial:
|
||||
case codecvt_base::error:
|
||||
return 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;
|
||||
}
|
||||
while (__enxt > __extbuf)
|
||||
if (ungetc(*--__enxt, __file_) == EOF)
|
||||
if (__last_consumed_is_next_)
|
||||
{
|
||||
char __extbuf[__limit];
|
||||
char* __enxt;
|
||||
const char_type __ci = traits_type::to_char_type(__last_consumed_);
|
||||
const char_type* __inxt;
|
||||
switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt,
|
||||
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
|
||||
{
|
||||
case _VSTD::codecvt_base::ok:
|
||||
break;
|
||||
case _VSTD::codecvt_base::noconv:
|
||||
__extbuf[0] = static_cast<char>(__last_consumed_);
|
||||
__enxt = __extbuf + 1;
|
||||
break;
|
||||
case codecvt_base::partial:
|
||||
case codecvt_base::error:
|
||||
return traits_type::eof();
|
||||
return traits_type::not_eof(__c);
|
||||
}
|
||||
while (__enxt > __extbuf)
|
||||
if (ungetc(*--__enxt, __file_) == EOF)
|
||||
return traits_type::eof();
|
||||
}
|
||||
__last_consumed_ = __c;
|
||||
__last_consumed_is_next_ = true;
|
||||
return __c;
|
||||
}
|
||||
|
||||
// __stdoutbuf
|
||||
@@ -196,17 +229,18 @@ public:
|
||||
typedef typename traits_type::off_type off_type;
|
||||
typedef typename traits_type::state_type state_type;
|
||||
|
||||
explicit __stdoutbuf(FILE* __fp);
|
||||
__stdoutbuf(FILE* __fp, state_type* __st);
|
||||
|
||||
protected:
|
||||
virtual int_type overflow (int_type __c = traits_type::eof());
|
||||
virtual streamsize xsputn(const char_type* __s, streamsize __n);
|
||||
virtual int sync();
|
||||
virtual void imbue(const locale& __loc);
|
||||
|
||||
private:
|
||||
FILE* __file_;
|
||||
const codecvt<char_type, char, state_type>* __cv_;
|
||||
state_type __st_;
|
||||
state_type* __st_;
|
||||
bool __always_noconv_;
|
||||
|
||||
__stdoutbuf(const __stdoutbuf&);
|
||||
@@ -214,10 +248,10 @@ private:
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp)
|
||||
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp, state_type* __st)
|
||||
: __file_(__fp),
|
||||
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
|
||||
__st_(),
|
||||
__st_(__st),
|
||||
__always_noconv_(__cv_->always_noconv())
|
||||
{
|
||||
}
|
||||
@@ -230,30 +264,31 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
|
||||
char_type __1buf;
|
||||
if (!traits_type::eq_int_type(__c, traits_type::eof()))
|
||||
{
|
||||
this->setp(&__1buf, &__1buf+1);
|
||||
*this->pptr() = traits_type::to_char_type(__c);
|
||||
this->pbump(1);
|
||||
__1buf = traits_type::to_char_type(__c);
|
||||
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();
|
||||
}
|
||||
else
|
||||
{
|
||||
char* __extbe = __extbuf;
|
||||
codecvt_base::result __r;
|
||||
char_type* pbase = &__1buf;
|
||||
char_type* pptr = pbase + 1;
|
||||
char_type* epptr = pptr;
|
||||
do
|
||||
{
|
||||
const char_type* __e;
|
||||
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
|
||||
__r = __cv_->out(*__st_, pbase, pptr, __e,
|
||||
__extbuf,
|
||||
__extbuf + sizeof(__extbuf),
|
||||
__extbe);
|
||||
if (__e == this->pbase())
|
||||
if (__e == pbase)
|
||||
return traits_type::eof();
|
||||
if (__r == codecvt_base::noconv)
|
||||
{
|
||||
if (fwrite(this->pbase(), 1, 1, __file_) != 1)
|
||||
if (fwrite(pbase, 1, 1, __file_) != 1)
|
||||
return traits_type::eof();
|
||||
}
|
||||
else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
|
||||
@@ -263,19 +298,30 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
|
||||
return traits_type::eof();
|
||||
if (__r == codecvt_base::partial)
|
||||
{
|
||||
this->setp((char_type*)__e, this->pptr());
|
||||
this->pbump(this->epptr() - this->pbase());
|
||||
pbase = (char_type*)__e;
|
||||
}
|
||||
}
|
||||
else
|
||||
return traits_type::eof();
|
||||
} while (__r == codecvt_base::partial);
|
||||
}
|
||||
this->setp(0, 0);
|
||||
}
|
||||
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>
|
||||
int
|
||||
__stdoutbuf<_CharT>::sync()
|
||||
@@ -285,7 +331,7 @@ __stdoutbuf<_CharT>::sync()
|
||||
do
|
||||
{
|
||||
char* __extbe;
|
||||
__r = __cv_->unshift(__st_, __extbuf,
|
||||
__r = __cv_->unshift(*__st_, __extbuf,
|
||||
__extbuf + sizeof(__extbuf),
|
||||
__extbe);
|
||||
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
|
||||
|
||||
659
include/__tree
659
include/__tree
File diff suppressed because it is too large
Load Diff
196
include/__tuple
196
include/__tuple
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -15,56 +15,113 @@
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#include <__tuple_03>
|
||||
|
||||
#else
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp> class tuple_size;
|
||||
template <size_t _Ip, class _Tp> class tuple_element;
|
||||
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_size;
|
||||
|
||||
template <class ..._Tp> class tuple;
|
||||
template <class _T1, class _T2> class pair;
|
||||
template <class _Tp, size_t _Size> struct array;
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<volatile _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const volatile _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_element;
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const _Tp>
|
||||
{
|
||||
public:
|
||||
typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, volatile _Tp>
|
||||
{
|
||||
public:
|
||||
typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const volatile _Tp>
|
||||
{
|
||||
public:
|
||||
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <class ..._Tp> class _LIBCPP_TYPE_VIS_ONLY tuple;
|
||||
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY pair;
|
||||
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<tuple<_Tp...>> : true_type {};
|
||||
template <class... _Tp> struct __tuple_like<const tuple<_Tp...>> : true_type {};
|
||||
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
|
||||
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
|
||||
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
|
||||
|
||||
template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
|
||||
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
|
||||
template <class _T1, class _T2> struct __tuple_like<const 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<const array<_Tp, _Size> > : true_type {};
|
||||
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
typename tuple_element<_Ip, tuple<_Tp...>>::type&
|
||||
get(tuple<_Tp...>&);
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(tuple<_Tp...>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
const typename tuple_element<_Ip, tuple<_Tp...>>::type&
|
||||
get(const tuple<_Tp...>&);
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(const tuple<_Tp...>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
||||
get(tuple<_Tp...>&&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(pair<_T1, _T2>&);
|
||||
get(pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(const pair<_T1, _T2>&);
|
||||
get(const pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||
get(pair<_T1, _T2>&&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp&
|
||||
get(array<_Tp, _Size>&);
|
||||
get(array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const _Tp&
|
||||
get(const array<_Tp, _Size>&);
|
||||
get(const array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&&) _NOEXCEPT;
|
||||
|
||||
// __make_tuple_indices
|
||||
|
||||
@@ -97,7 +154,7 @@ struct __make_tuple_indices
|
||||
template <class ..._Tp> struct __tuple_types {};
|
||||
|
||||
template <size_t _Ip>
|
||||
class tuple_element<_Ip, __tuple_types<>>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<> >
|
||||
{
|
||||
public:
|
||||
static_assert(_Ip == 0, "tuple_element index out of range");
|
||||
@@ -105,29 +162,34 @@ public:
|
||||
};
|
||||
|
||||
template <class _Hp, class ..._Tp>
|
||||
class tuple_element<0, __tuple_types<_Hp, _Tp...>>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<0, __tuple_types<_Hp, _Tp...> >
|
||||
{
|
||||
public:
|
||||
typedef _Hp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Hp, class ..._Tp>
|
||||
class tuple_element<_Ip, __tuple_types<_Hp, _Tp...>>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
|
||||
{
|
||||
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>
|
||||
class tuple_size<__tuple_types<_Tp...>>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<__tuple_types<_Tp...> >
|
||||
: public integral_constant<size_t, sizeof...(_Tp)>
|
||||
{
|
||||
};
|
||||
|
||||
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...>> : true_type {};
|
||||
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {};
|
||||
|
||||
// __make_tuple_types
|
||||
|
||||
// __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a
|
||||
// __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep).
|
||||
// _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a
|
||||
// lvalue_reference type, then __tuple_types<_Types&...> is the result.
|
||||
|
||||
template <class _TupleTypes, class _Tp, size_t _Sp, size_t _Ep>
|
||||
struct __make_tuple_types_imp;
|
||||
|
||||
@@ -136,7 +198,7 @@ struct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
|
||||
{
|
||||
typedef typename remove_reference<_Tp>::type _Tpr;
|
||||
typedef typename __make_tuple_types_imp<__tuple_types<_Types...,
|
||||
typename conditional<is_reference<_Tp>::value,
|
||||
typename conditional<is_lvalue_reference<_Tp>::value,
|
||||
typename tuple_element<_Sp, _Tpr>::type&,
|
||||
typename tuple_element<_Sp, _Tpr>::type>::type>,
|
||||
_Tp, _Sp+1, _Ep>::type type;
|
||||
@@ -155,45 +217,19 @@ struct __make_tuple_types
|
||||
typedef typename __make_tuple_types_imp<__tuple_types<>, _Tp, _Sp, _Ep>::type type;
|
||||
};
|
||||
|
||||
// __make_assignable_types
|
||||
|
||||
template <class _Tuple, class _Tp, size_t _Sp, size_t _Ep>
|
||||
struct __make_assignable_types_imp;
|
||||
|
||||
template <class ..._Types, class _Tp, size_t _Sp, size_t _Ep>
|
||||
struct __make_assignable_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
|
||||
{
|
||||
typedef typename __make_assignable_types_imp<__tuple_types<_Types...,
|
||||
typename remove_reference<typename tuple_element<_Sp, _Tp>::type>::type>,
|
||||
_Tp, _Sp+1, _Ep>::type type;
|
||||
};
|
||||
|
||||
template <class ..._Types, class _Tp, size_t _Ep>
|
||||
struct __make_assignable_types_imp<__tuple_types<_Types...>, _Tp, _Ep, _Ep>
|
||||
{
|
||||
typedef __tuple_types<_Types...> type;
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, size_t _Sp = 0>
|
||||
struct __make_assignable_types
|
||||
{
|
||||
static_assert(_Sp <= _Ep, "__make_assignable_types input error");
|
||||
typedef typename __make_assignable_types_imp<__tuple_types<>, typename remove_reference<_Tp>::type, _Sp, _Ep>::type type;
|
||||
};
|
||||
|
||||
// __tuple_convertible
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
struct __tuple_convertible_imp : public false_type {};
|
||||
|
||||
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,
|
||||
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 <>
|
||||
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<>>
|
||||
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<> >
|
||||
: public true_type {};
|
||||
|
||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||
@@ -208,8 +244,48 @@ struct __tuple_convertible<_Tp, _Up, true, true>
|
||||
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
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
struct __tuple_assignable_imp : public false_type {};
|
||||
|
||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||
struct __tuple_assignable_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
: public integral_constant<bool,
|
||||
is_assignable<_Up0&, _Tp0>::value &&
|
||||
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_assignable_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_assignable
|
||||
@@ -217,9 +293,9 @@ struct __tuple_assignable
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_assignable<_Tp, _Up, true, true>
|
||||
: public __tuple_convertible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_assignable_types<_Up>::type>
|
||||
: public __tuple_assignable_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>
|
||||
{};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -13,13 +13,15 @@
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp> class tuple_size;
|
||||
template <size_t _Ip, class _Tp> class tuple_element;
|
||||
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_size;
|
||||
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_element;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP___TUPLE_03
|
||||
|
||||
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
|
||||
1507
include/algorithm
1507
include/algorithm
File diff suppressed because it is too large
Load Diff
306
include/array
306
include/array
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -16,84 +16,85 @@
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <class T, size_t N >
|
||||
template <class T, size_t N >
|
||||
struct array
|
||||
{
|
||||
// types:
|
||||
typedef T & reference;
|
||||
typedef const T & const_reference;
|
||||
typedef implementation defined iterator;
|
||||
typedef implementation defined const_iterator;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
{
|
||||
// types:
|
||||
typedef T & reference;
|
||||
typedef const T & const_reference;
|
||||
typedef implementation defined iterator;
|
||||
typedef implementation defined const_iterator;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
void fill(const T& u);
|
||||
void swap(array& a);
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
void fill(const T& u);
|
||||
void swap(array& a) noexcept(noexcept(swap(declval<T&>(), declval<T&>())));
|
||||
|
||||
// iterators:
|
||||
iterator begin();
|
||||
const_iterator begin() const;
|
||||
iterator end();
|
||||
const_iterator end() const;
|
||||
// iterators:
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
reverse_iterator rbegin();
|
||||
const_reverse_iterator rbegin() const;
|
||||
reverse_iterator rend();
|
||||
const_reverse_iterator rend() const;
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
|
||||
const_iterator cbegin() const;
|
||||
const_iterator cend() const;
|
||||
const_reverse_iterator crbegin() const;
|
||||
const_reverse_iterator crend() const;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
// capacity:
|
||||
constexpr size_type size() const;
|
||||
constexpr size_type max_size() const;
|
||||
bool empty() const;
|
||||
// capacity:
|
||||
constexpr size_type size() const noexcept;
|
||||
constexpr size_type max_size() const noexcept;
|
||||
constexpr bool empty() const noexcept;
|
||||
|
||||
// element access:
|
||||
reference operator[](size_type n);
|
||||
const_reference operator[](size_type n) const;
|
||||
const_reference at(size_type n) const;
|
||||
reference at(size_type n);
|
||||
// element access:
|
||||
reference operator[](size_type n);
|
||||
const_reference operator[](size_type n) const; // constexpr in C++14
|
||||
const_reference at(size_type n) const; // constexpr in C++14
|
||||
reference at(size_type n);
|
||||
|
||||
reference front();
|
||||
const_reference front() const;
|
||||
reference back();
|
||||
const_reference back() const;
|
||||
reference front();
|
||||
const_reference front() const; // constexpr in C++14
|
||||
reference back();
|
||||
const_reference back() const; // constexpr in C++14
|
||||
|
||||
T* data();
|
||||
const T* data() const;
|
||||
T* data() noexcept;
|
||||
const T* data() const noexcept;
|
||||
};
|
||||
|
||||
template <class T, size_t N>
|
||||
bool operator==(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator!=(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator<(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator>(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator<=(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator>=(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator==(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator!=(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator<(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator>(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator<=(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
bool operator>=(const array<T,N>& x, const array<T,N>& y);
|
||||
|
||||
template <class T, size_t N >
|
||||
void swap(array<T,N>& x, array<T,N>& y);
|
||||
template <class T, size_t N >
|
||||
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class T> class tuple_size;
|
||||
template <int I, class T> class tuple_element;
|
||||
template <class T> class tuple_size;
|
||||
template <int I, class T> class tuple_element;
|
||||
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> T& get(array<T, N>&);
|
||||
template <int I, class T, size_t N> const T& get(const 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; // constexpr in C++14
|
||||
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; // constexpr in C++14
|
||||
|
||||
} // std
|
||||
|
||||
@@ -110,70 +111,92 @@ template <int I, class T, size_t N> const T& get(const array<T, N>&);
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
struct array
|
||||
template <class _Tp, size_t _Size>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY array
|
||||
{
|
||||
// types:
|
||||
typedef array __self;
|
||||
typedef _Tp value_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
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;
|
||||
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;
|
||||
|
||||
value_type __elems_[_Size > 0 ? _Size : 1];
|
||||
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) {_STD::fill_n(__elems_, _Size, __u);}
|
||||
_LIBCPP_INLINE_VISIBILITY void swap(array& __a) {_STD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
|
||||
{_VSTD::fill_n(__elems_, _Size, __u);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||
{_VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
|
||||
|
||||
// iterators:
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return const_iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__elems_ + _Size);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator end() const {return const_iterator(__elems_ + _Size);}
|
||||
// iterators:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT {return iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() {return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY reverse_iterator rend() {return reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const {return begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator cend() const {return end();}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const {return rbegin();}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const {return rend();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const _NOEXCEPT {return begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const _NOEXCEPT {return end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
|
||||
|
||||
// capacity:
|
||||
_LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type size() const {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type max_size() const {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY bool empty() const {return _Size == 0;}
|
||||
// capacity:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_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 const_reference operator[](size_type __n) const {return __elems_[__n];}
|
||||
reference at(size_type __n);
|
||||
const_reference at(size_type __n) const;
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type __n) const {return __elems_[__n];}
|
||||
reference at(size_type __n);
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
|
||||
|
||||
_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 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 value_type* data() {return __elems_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const value_type* data() const {return __elems_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type* data() _NOEXCEPT {return __elems_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const value_type* data() const _NOEXCEPT {return __elems_;}
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
template <class _Tp, size_t _Size>
|
||||
typename array<_Tp, _Size>::reference
|
||||
array<_Tp, _Size>::at(size_type __n)
|
||||
{
|
||||
@@ -186,7 +209,8 @@ array<_Tp, _Size>::at(size_type __n)
|
||||
return __elems_[__n];
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename array<_Tp, _Size>::const_reference
|
||||
array<_Tp, _Size>::at(size_type __n) const
|
||||
{
|
||||
@@ -199,98 +223,120 @@ array<_Tp, _Size>::at(size_type __n) const
|
||||
return __elems_[__n];
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return _STD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
|
||||
return _VSTD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return _STD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
|
||||
return _VSTD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return __y < __x;
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return !(__y < __x);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
__is_swappable<_Tp>::value,
|
||||
void
|
||||
>::type
|
||||
swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
class tuple_size<array<_Tp, _Size> > : public integral_constant<size_t, _Size> {};
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<array<_Tp, _Size> >
|
||||
: public integral_constant<size_t, _Size> {};
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
class tuple_size<const array<_Tp, _Size> > : public integral_constant<size_t, _Size> {};
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const array<_Tp, _Size> >
|
||||
: public integral_constant<size_t, _Size> {};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
class tuple_element<_Ip, array<_Tp, _Size> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, array<_Tp, _Size> >
|
||||
{
|
||||
public:
|
||||
typedef _Tp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
class tuple_element<_Ip, const array<_Tp, _Size> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const array<_Tp, _Size> >
|
||||
{
|
||||
public:
|
||||
typedef const _Tp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp&
|
||||
get(array<_Tp, _Size>& __a)
|
||||
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>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const _Tp&
|
||||
get(const array<_Tp, _Size>& __a)
|
||||
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
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&& __a) _NOEXCEPT
|
||||
{
|
||||
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
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_ARRAY
|
||||
|
||||
1531
include/atomic
Normal file
1531
include/atomic
Normal file
File diff suppressed because it is too large
Load Diff
481
include/bitset
481
include/bitset
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -27,20 +27,23 @@ public:
|
||||
class reference
|
||||
{
|
||||
friend class bitset;
|
||||
reference();
|
||||
reference() noexcept;
|
||||
public:
|
||||
~reference();
|
||||
reference& operator=(bool x); // for b[i] = x;
|
||||
reference& operator=(const reference&); // for b[i] = b[j];
|
||||
bool operator~() const; // flips the bit
|
||||
operator bool() const; // for x = b[i];
|
||||
reference& flip(); // for b[i].flip();
|
||||
~reference() noexcept;
|
||||
reference& operator=(bool x) noexcept; // for b[i] = x;
|
||||
reference& operator=(const reference&) noexcept; // for b[i] = b[j];
|
||||
bool operator~() const noexcept; // flips the bit
|
||||
operator bool() const noexcept; // for x = b[i];
|
||||
reference& flip() noexcept; // for b[i].flip();
|
||||
};
|
||||
|
||||
// 23.3.5.1 constructors:
|
||||
constexpr bitset();
|
||||
constexpr bitset(unsigned long long val);
|
||||
explicit bitset( const char* str );
|
||||
constexpr bitset() noexcept;
|
||||
constexpr bitset(unsigned long long val) noexcept;
|
||||
template <class charT>
|
||||
explicit bitset(const charT* str,
|
||||
typename basic_string<charT>::size_type n = basic_string<charT>::npos,
|
||||
charT zero = charT('0'), charT one = charT('1'));
|
||||
template<class charT, class traits, class Allocator>
|
||||
explicit bitset(const basic_string<charT,traits,Allocator>& str,
|
||||
typename basic_string<charT,traits,Allocator>::size_type pos = 0,
|
||||
@@ -49,17 +52,17 @@ public:
|
||||
charT zero = charT('0'), charT one = charT('1'));
|
||||
|
||||
// 23.3.5.2 bitset operations:
|
||||
bitset& operator&=(const bitset& rhs);
|
||||
bitset& operator|=(const bitset& rhs);
|
||||
bitset& operator^=(const bitset& rhs);
|
||||
bitset& operator<<=(size_t pos);
|
||||
bitset& operator>>=(size_t pos);
|
||||
bitset& set();
|
||||
bitset& operator&=(const bitset& rhs) noexcept;
|
||||
bitset& operator|=(const bitset& rhs) noexcept;
|
||||
bitset& operator^=(const bitset& rhs) noexcept;
|
||||
bitset& operator<<=(size_t pos) noexcept;
|
||||
bitset& operator>>=(size_t pos) noexcept;
|
||||
bitset& set() noexcept;
|
||||
bitset& set(size_t pos, bool val = true);
|
||||
bitset& reset();
|
||||
bitset& reset() noexcept;
|
||||
bitset& reset(size_t pos);
|
||||
bitset operator~() const;
|
||||
bitset& flip();
|
||||
bitset operator~() const noexcept;
|
||||
bitset& flip() noexcept;
|
||||
bitset& flip(size_t pos);
|
||||
|
||||
// element access:
|
||||
@@ -74,27 +77,27 @@ public:
|
||||
template <class charT>
|
||||
basic_string<charT, char_traits<charT>, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const;
|
||||
basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const;
|
||||
size_t count() const;
|
||||
constexpr size_t size() const;
|
||||
bool operator==(const bitset& rhs) const;
|
||||
bool operator!=(const bitset& rhs) const;
|
||||
size_t count() const noexcept;
|
||||
constexpr size_t size() const noexcept;
|
||||
bool operator==(const bitset& rhs) const noexcept;
|
||||
bool operator!=(const bitset& rhs) const noexcept;
|
||||
bool test(size_t pos) const;
|
||||
bool all() const;
|
||||
bool any() const;
|
||||
bool none() const;
|
||||
bitset operator<<(size_t pos) const;
|
||||
bitset operator>>(size_t pos) const;
|
||||
bool all() const noexcept;
|
||||
bool any() const noexcept;
|
||||
bool none() const noexcept;
|
||||
bitset operator<<(size_t pos) const noexcept;
|
||||
bitset operator>>(size_t pos) const noexcept;
|
||||
};
|
||||
|
||||
// 23.3.5.3 bitset operators:
|
||||
template <size_t N>
|
||||
bitset<N> operator&(const bitset<N>&, const bitset<N>&);
|
||||
bitset<N> operator&(const bitset<N>&, const bitset<N>&) noexcept;
|
||||
|
||||
template <size_t N>
|
||||
bitset<N> operator|(const bitset<N>&, const bitset<N>&);
|
||||
bitset<N> operator|(const bitset<N>&, const bitset<N>&) noexcept;
|
||||
|
||||
template <size_t N>
|
||||
bitset<N> operator^(const bitset<N>&, const bitset<N>&);
|
||||
bitset<N> operator^(const bitset<N>&, const bitset<N>&) noexcept;
|
||||
|
||||
template <class charT, class traits, size_t N>
|
||||
basic_istream<charT, traits>&
|
||||
@@ -110,7 +113,9 @@ template <size_t N> struct hash<std::bitset<N>>;
|
||||
|
||||
*/
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <__config>
|
||||
#include <__bit_reference>
|
||||
@@ -124,17 +129,28 @@ template <size_t N> struct hash<std::bitset<N>>;
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
class __bitset;
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
struct __has_storage_type<__bitset<_N_words, _Size> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
class __bitset
|
||||
{
|
||||
public:
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef size_t size_type;
|
||||
typedef size_type __storage_type;
|
||||
protected:
|
||||
typedef __bitset __self;
|
||||
typedef size_type __storage_type;
|
||||
typedef __storage_type* __storage_pointer;
|
||||
typedef const __storage_type* __const_storage_pointer;
|
||||
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
||||
@@ -143,7 +159,7 @@ protected:
|
||||
friend class __bit_const_reference<__bitset>;
|
||||
friend class __bit_iterator<__bitset, false>;
|
||||
friend class __bit_iterator<__bitset, true>;
|
||||
friend class __bit_array<__bitset>;
|
||||
friend struct __bit_array<__bitset>;
|
||||
|
||||
__storage_type __first_[_N_words];
|
||||
|
||||
@@ -152,34 +168,36 @@ protected:
|
||||
typedef __bit_iterator<__bitset, false> iterator;
|
||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||
|
||||
__bitset();
|
||||
explicit __bitset(unsigned long long __v);
|
||||
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
|
||||
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos)
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
|
||||
{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
|
||||
_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);}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
||||
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
||||
{return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||
|
||||
void operator&=(const __bitset& __v);
|
||||
void operator|=(const __bitset& __v);
|
||||
void operator^=(const __bitset& __v);
|
||||
void operator&=(const __bitset& __v) _NOEXCEPT;
|
||||
void operator|=(const __bitset& __v) _NOEXCEPT;
|
||||
void operator^=(const __bitset& __v) _NOEXCEPT;
|
||||
|
||||
void flip();
|
||||
void flip() _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const
|
||||
{return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());}
|
||||
_LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const
|
||||
{return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());}
|
||||
|
||||
bool all() const;
|
||||
bool any() const;
|
||||
size_t __hash_code() const;
|
||||
bool all() const _NOEXCEPT;
|
||||
bool any() const _NOEXCEPT;
|
||||
size_t __hash_code() const _NOEXCEPT;
|
||||
private:
|
||||
void __init(unsigned long long __v, false_type);
|
||||
void __init(unsigned long long __v, true_type);
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
void __init(unsigned long long __v, false_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(true_type) const;
|
||||
unsigned long long to_ullong(false_type) const;
|
||||
@@ -190,43 +208,65 @@ private:
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bitset<_N_words, _Size>::__bitset()
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
: __first_{0}
|
||||
#endif
|
||||
{
|
||||
_STD::fill_n(__first_, _N_words, __storage_type(0));
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
_VSTD::fill_n(__first_, _N_words, __storage_type(0));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
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)];
|
||||
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
|
||||
__t[__i] = static_cast<__storage_type>(__v);
|
||||
_STD::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_);
|
||||
_STD::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]),
|
||||
_VSTD::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_);
|
||||
_VSTD::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]),
|
||||
__storage_type(0));
|
||||
}
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
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;
|
||||
_STD::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>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bitset<_N_words, _Size>::__bitset(unsigned long long __v)
|
||||
_LIBCPP_CONSTEXPR
|
||||
__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)>());
|
||||
#endif
|
||||
}
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<_N_words, _Size>::operator&=(const __bitset& __v)
|
||||
__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
||||
{
|
||||
for (size_type __i = 0; __i < _N_words; ++__i)
|
||||
__first_[__i] &= __v.__first_[__i];
|
||||
@@ -235,7 +275,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v)
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<_N_words, _Size>::operator|=(const __bitset& __v)
|
||||
__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
||||
{
|
||||
for (size_type __i = 0; __i < _N_words; ++__i)
|
||||
__first_[__i] |= __v.__first_[__i];
|
||||
@@ -244,7 +284,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v)
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<_N_words, _Size>::operator^=(const __bitset& __v)
|
||||
__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
||||
{
|
||||
for (size_type __i = 0; __i < _N_words; ++__i)
|
||||
__first_[__i] ^= __v.__first_[__i];
|
||||
@@ -252,7 +292,7 @@ __bitset<_N_words, _Size>::operator^=(const __bitset& __v)
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
void
|
||||
__bitset<_N_words, _Size>::flip()
|
||||
__bitset<_N_words, _Size>::flip() _NOEXCEPT
|
||||
{
|
||||
// do middle whole words
|
||||
size_type __n = _Size;
|
||||
@@ -274,7 +314,7 @@ unsigned long
|
||||
__bitset<_N_words, _Size>::to_ulong(false_type) const
|
||||
{
|
||||
const_iterator __e = __make_iter(_Size);
|
||||
const_iterator __i = _STD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
|
||||
const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
|
||||
if (__i != __e)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw overflow_error("bitset to_ulong overflow error");
|
||||
@@ -297,7 +337,7 @@ unsigned long long
|
||||
__bitset<_N_words, _Size>::to_ullong(false_type) const
|
||||
{
|
||||
const_iterator __e = __make_iter(_Size);
|
||||
const_iterator __i = _STD::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
|
||||
const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
|
||||
if (__i != __e)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw overflow_error("bitset to_ullong overflow error");
|
||||
@@ -335,7 +375,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
bool
|
||||
__bitset<_N_words, _Size>::all() const
|
||||
__bitset<_N_words, _Size>::all() const _NOEXCEPT
|
||||
{
|
||||
// do middle whole words
|
||||
size_type __n = _Size;
|
||||
@@ -355,7 +395,7 @@ __bitset<_N_words, _Size>::all() const
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
bool
|
||||
__bitset<_N_words, _Size>::any() const
|
||||
__bitset<_N_words, _Size>::any() const _NOEXCEPT
|
||||
{
|
||||
// do middle whole words
|
||||
size_type __n = _Size;
|
||||
@@ -376,7 +416,7 @@ __bitset<_N_words, _Size>::any() const
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t
|
||||
__bitset<_N_words, _Size>::__hash_code() const
|
||||
__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
|
||||
{
|
||||
size_t __h = 0;
|
||||
for (size_type __i = 0; __i < _N_words; ++__i)
|
||||
@@ -390,9 +430,9 @@ class __bitset<1, _Size>
|
||||
public:
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef size_t size_type;
|
||||
typedef size_type __storage_type;
|
||||
protected:
|
||||
typedef __bitset __self;
|
||||
typedef size_type __storage_type;
|
||||
typedef __storage_type* __storage_pointer;
|
||||
typedef const __storage_type* __const_storage_pointer;
|
||||
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
||||
@@ -401,7 +441,7 @@ protected:
|
||||
friend class __bit_const_reference<__bitset>;
|
||||
friend class __bit_iterator<__bitset, false>;
|
||||
friend class __bit_iterator<__bitset, true>;
|
||||
friend class __bit_array<__bitset>;
|
||||
friend struct __bit_array<__bitset>;
|
||||
|
||||
__storage_type __first_;
|
||||
|
||||
@@ -410,43 +450,45 @@ protected:
|
||||
typedef __bit_iterator<__bitset, false> iterator;
|
||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||
|
||||
__bitset();
|
||||
explicit __bitset(unsigned long long __v);
|
||||
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
|
||||
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos)
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
|
||||
{return reference(&__first_, __storage_type(1) << __pos);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
|
||||
{return const_reference(&__first_, __storage_type(1) << __pos);}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
||||
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
||||
{return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||
|
||||
void operator&=(const __bitset& __v);
|
||||
void operator|=(const __bitset& __v);
|
||||
void operator^=(const __bitset& __v);
|
||||
void operator&=(const __bitset& __v) _NOEXCEPT;
|
||||
void operator|=(const __bitset& __v) _NOEXCEPT;
|
||||
void operator^=(const __bitset& __v) _NOEXCEPT;
|
||||
|
||||
void flip();
|
||||
void flip() _NOEXCEPT;
|
||||
|
||||
unsigned long to_ulong() const;
|
||||
unsigned long long to_ullong() const;
|
||||
|
||||
bool all() const;
|
||||
bool any() const;
|
||||
bool all() const _NOEXCEPT;
|
||||
bool any() const _NOEXCEPT;
|
||||
|
||||
size_t __hash_code() const;
|
||||
size_t __hash_code() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bitset<1, _Size>::__bitset()
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<1, _Size>::__bitset() _NOEXCEPT
|
||||
: __first_(0)
|
||||
{
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bitset<1, _Size>::__bitset(unsigned long long __v)
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
||||
: __first_(static_cast<__storage_type>(__v))
|
||||
{
|
||||
}
|
||||
@@ -454,7 +496,7 @@ __bitset<1, _Size>::__bitset(unsigned long long __v)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<1, _Size>::operator&=(const __bitset& __v)
|
||||
__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
||||
{
|
||||
__first_ &= __v.__first_;
|
||||
}
|
||||
@@ -462,7 +504,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<1, _Size>::operator|=(const __bitset& __v)
|
||||
__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
||||
{
|
||||
__first_ |= __v.__first_;
|
||||
}
|
||||
@@ -470,7 +512,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<1, _Size>::operator^=(const __bitset& __v)
|
||||
__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
||||
{
|
||||
__first_ ^= __v.__first_;
|
||||
}
|
||||
@@ -478,7 +520,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<1, _Size>::flip()
|
||||
__bitset<1, _Size>::flip() _NOEXCEPT
|
||||
{
|
||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
|
||||
__first_ = ~__first_;
|
||||
@@ -504,7 +546,7 @@ __bitset<1, _Size>::to_ullong() const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__bitset<1, _Size>::all() const
|
||||
__bitset<1, _Size>::all() const _NOEXCEPT
|
||||
{
|
||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
|
||||
return !(~__first_ & __m);
|
||||
@@ -513,7 +555,7 @@ __bitset<1, _Size>::all() const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__bitset<1, _Size>::any() const
|
||||
__bitset<1, _Size>::any() const _NOEXCEPT
|
||||
{
|
||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
|
||||
return __first_ & __m;
|
||||
@@ -522,7 +564,7 @@ __bitset<1, _Size>::any() const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t
|
||||
__bitset<1, _Size>::__hash_code() const
|
||||
__bitset<1, _Size>::__hash_code() const _NOEXCEPT
|
||||
{
|
||||
return __first_;
|
||||
}
|
||||
@@ -533,9 +575,9 @@ class __bitset<0, 0>
|
||||
public:
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef size_t size_type;
|
||||
typedef size_type __storage_type;
|
||||
protected:
|
||||
typedef __bitset __self;
|
||||
typedef size_type __storage_type;
|
||||
typedef __storage_type* __storage_pointer;
|
||||
typedef const __storage_type* __const_storage_pointer;
|
||||
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
||||
@@ -544,155 +586,163 @@ protected:
|
||||
friend class __bit_const_reference<__bitset>;
|
||||
friend class __bit_iterator<__bitset, false>;
|
||||
friend class __bit_iterator<__bitset, true>;
|
||||
friend class __bit_array<__bitset>;
|
||||
friend struct __bit_array<__bitset>;
|
||||
|
||||
typedef __bit_reference<__bitset> reference;
|
||||
typedef __bit_const_reference<__bitset> const_reference;
|
||||
typedef __bit_iterator<__bitset, false> iterator;
|
||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||
|
||||
__bitset();
|
||||
explicit __bitset(unsigned long long);
|
||||
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
|
||||
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t)
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
|
||||
{return reference(0, 1);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
|
||||
{return const_reference(0, 1);}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
|
||||
{return iterator(0, 0);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT
|
||||
{return const_iterator(0, 0);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) {}
|
||||
_LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) {}
|
||||
_LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) {}
|
||||
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void flip() {}
|
||||
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const {return 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const {return 0;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY bool all() const {return true;}
|
||||
_LIBCPP_INLINE_VISIBILITY bool any() const {return false;}
|
||||
_LIBCPP_INLINE_VISIBILITY bool all() const _NOEXCEPT {return true;}
|
||||
_LIBCPP_INLINE_VISIBILITY bool any() const _NOEXCEPT {return false;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const {return 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bitset<0, 0>::__bitset()
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<0, 0>::__bitset() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bitset<0, 0>::__bitset(unsigned long long)
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
template <size_t _Size> class bitset;
|
||||
template <size_t _Size> struct hash<bitset<_Size> >;
|
||||
template <size_t _Size> class _LIBCPP_TYPE_VIS_ONLY bitset;
|
||||
template <size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY hash<bitset<_Size> >;
|
||||
|
||||
template <size_t _Size>
|
||||
class bitset
|
||||
class _LIBCPP_TYPE_VIS_ONLY bitset
|
||||
: 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;
|
||||
typedef __bitset<__n_words, _Size> base;
|
||||
|
||||
public:
|
||||
public:
|
||||
typedef typename base::reference reference;
|
||||
typedef typename base::const_reference const_reference;
|
||||
|
||||
// 23.3.5.1 constructors:
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() {}
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) : base(__v) {}
|
||||
explicit bitset(const char* __str);
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
||||
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0,
|
||||
typename basic_string<_CharT,_Traits,_Allocator>::size_type __n =
|
||||
// 23.3.5.1 constructors:
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
|
||||
template<class _CharT>
|
||||
explicit bitset(const _CharT* __str,
|
||||
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
|
||||
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
||||
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0,
|
||||
typename basic_string<_CharT,_Traits,_Allocator>::size_type __n =
|
||||
(basic_string<_CharT,_Traits,_Allocator>::npos),
|
||||
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
|
||||
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
|
||||
|
||||
// 23.3.5.2 bitset operations:
|
||||
bitset& operator&=(const bitset& __rhs);
|
||||
bitset& operator|=(const bitset& __rhs);
|
||||
bitset& operator^=(const bitset& __rhs);
|
||||
bitset& operator<<=(size_t __pos);
|
||||
bitset& operator>>=(size_t __pos);
|
||||
bitset& set();
|
||||
bitset& set(size_t __pos, bool __val = true);
|
||||
bitset& reset();
|
||||
bitset& reset(size_t __pos);
|
||||
bitset operator~() const;
|
||||
bitset& flip();
|
||||
bitset& flip(size_t __pos);
|
||||
// 23.3.5.2 bitset operations:
|
||||
bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
|
||||
bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
|
||||
bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
|
||||
bitset& operator<<=(size_t __pos) _NOEXCEPT;
|
||||
bitset& operator>>=(size_t __pos) _NOEXCEPT;
|
||||
bitset& set() _NOEXCEPT;
|
||||
bitset& set(size_t __pos, bool __val = true);
|
||||
bitset& reset() _NOEXCEPT;
|
||||
bitset& reset(size_t __pos);
|
||||
bitset operator~() const _NOEXCEPT;
|
||||
bitset& flip() _NOEXCEPT;
|
||||
bitset& flip(size_t __pos);
|
||||
|
||||
// element access:
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
|
||||
// element access:
|
||||
_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);}
|
||||
unsigned long to_ulong() const;
|
||||
unsigned long long to_ullong() const;
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
unsigned long to_ulong() const;
|
||||
unsigned long long to_ullong() const;
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
|
||||
_CharT __one = _CharT('1')) const;
|
||||
template <class _CharT, class _Traits>
|
||||
_CharT __one = _CharT('1')) const;
|
||||
template <class _CharT, class _Traits>
|
||||
basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
|
||||
_CharT __one = _CharT('1')) const;
|
||||
template <class _CharT>
|
||||
_CharT __one = _CharT('1')) const;
|
||||
template <class _CharT>
|
||||
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
|
||||
_CharT __one = _CharT('1')) const;
|
||||
_CharT __one = _CharT('1')) const;
|
||||
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
|
||||
char __one = '1') const;
|
||||
size_t count() const;
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const {return _Size;}
|
||||
bool operator==(const bitset& __rhs) const;
|
||||
bool operator!=(const bitset& __rhs) const;
|
||||
bool test(size_t __pos) const;
|
||||
bool all() const;
|
||||
bool any() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool none() const {return !any();}
|
||||
bitset operator<<(size_t __pos) const;
|
||||
bitset operator>>(size_t __pos) const;
|
||||
char __one = '1') const;
|
||||
size_t count() const _NOEXCEPT;
|
||||
_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 test(size_t __pos) const;
|
||||
bool all() const _NOEXCEPT;
|
||||
bool any() const _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();}
|
||||
bitset operator<<(size_t __pos) const _NOEXCEPT;
|
||||
bitset operator>>(size_t __pos) const _NOEXCEPT;
|
||||
|
||||
private:
|
||||
|
||||
size_t __hash_code() const {return base::__hash_code();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t __hash_code() const _NOEXCEPT {return base::__hash_code();}
|
||||
|
||||
friend struct hash<bitset>;
|
||||
};
|
||||
|
||||
template <size_t _Size>
|
||||
bitset<_Size>::bitset(const char* __str)
|
||||
template<class _CharT>
|
||||
bitset<_Size>::bitset(const _CharT* __str,
|
||||
typename basic_string<_CharT>::size_type __n,
|
||||
_CharT __zero, _CharT __one)
|
||||
{
|
||||
size_t __rlen = strlen(__str);
|
||||
size_t __rlen = _VSTD::min(__n, char_traits<_CharT>::length(__str));
|
||||
for (size_t __i = 0; __i < __rlen; ++__i)
|
||||
if (__str[__i] != '0' && __str[__i] != '1')
|
||||
if (__str[__i] != __zero && __str[__i] != __one)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw invalid_argument("bitset string ctor has invalid argument");
|
||||
#else
|
||||
assert(!"bitset string ctor has invalid argument");
|
||||
#endif
|
||||
size_t _M = _STD::min(__rlen, _Size);
|
||||
size_t _Mp = _VSTD::min(__rlen, _Size);
|
||||
size_t __i = 0;
|
||||
for (; __i < _M; ++__i)
|
||||
for (; __i < _Mp; ++__i)
|
||||
{
|
||||
switch (__str[_M - 1 - __i])
|
||||
{
|
||||
case '0':
|
||||
_CharT __c = __str[_Mp - 1 - __i];
|
||||
if (__c == __zero)
|
||||
(*this)[__i] = false;
|
||||
break;
|
||||
case '1':
|
||||
else
|
||||
(*this)[__i] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
|
||||
_VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
||||
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos,
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
||||
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos,
|
||||
typename basic_string<_CharT,_Traits,_Allocator>::size_type __n,
|
||||
_CharT __zero, _CharT __one)
|
||||
{
|
||||
@@ -702,7 +752,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
||||
#else
|
||||
assert(!"bitset string pos out of range");
|
||||
#endif
|
||||
size_t __rlen = _STD::min(__n, __str.size() - __pos);
|
||||
size_t __rlen = _VSTD::min(__n, __str.size() - __pos);
|
||||
for (size_t __i = __pos; __i < __pos + __rlen; ++__i)
|
||||
if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -710,23 +760,23 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
||||
#else
|
||||
assert(!"bitset string ctor has invalid argument");
|
||||
#endif
|
||||
size_t _M = _STD::min(__rlen, _Size);
|
||||
size_t _Mp = _VSTD::min(__rlen, _Size);
|
||||
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))
|
||||
(*this)[__i] = false;
|
||||
else
|
||||
(*this)[__i] = true;
|
||||
}
|
||||
_STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
|
||||
_VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::operator&=(const bitset& __rhs)
|
||||
bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
|
||||
{
|
||||
base::operator&=(__rhs);
|
||||
return *this;
|
||||
@@ -735,7 +785,7 @@ bitset<_Size>::operator&=(const bitset& __rhs)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::operator|=(const bitset& __rhs)
|
||||
bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
|
||||
{
|
||||
base::operator|=(__rhs);
|
||||
return *this;
|
||||
@@ -744,7 +794,7 @@ bitset<_Size>::operator|=(const bitset& __rhs)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::operator^=(const bitset& __rhs)
|
||||
bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
|
||||
{
|
||||
base::operator^=(__rhs);
|
||||
return *this;
|
||||
@@ -752,30 +802,30 @@ bitset<_Size>::operator^=(const bitset& __rhs)
|
||||
|
||||
template <size_t _Size>
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::operator<<=(size_t __pos)
|
||||
bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT
|
||||
{
|
||||
__pos = _STD::min(__pos, _Size);
|
||||
_STD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
|
||||
_STD::fill_n(base::__make_iter(0), __pos, false);
|
||||
__pos = _VSTD::min(__pos, _Size);
|
||||
_VSTD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
|
||||
_VSTD::fill_n(base::__make_iter(0), __pos, false);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::operator>>=(size_t __pos)
|
||||
bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
|
||||
{
|
||||
__pos = _STD::min(__pos, _Size);
|
||||
_STD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
|
||||
_STD::fill_n(base::__make_iter(_Size - __pos), __pos, false);
|
||||
__pos = _VSTD::min(__pos, _Size);
|
||||
_VSTD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
|
||||
_VSTD::fill_n(base::__make_iter(_Size - __pos), __pos, false);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::set()
|
||||
bitset<_Size>::set() _NOEXCEPT
|
||||
{
|
||||
_STD::fill_n(base::__make_iter(0), _Size, true);
|
||||
_VSTD::fill_n(base::__make_iter(0), _Size, true);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -796,9 +846,9 @@ bitset<_Size>::set(size_t __pos, bool __val)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::reset()
|
||||
bitset<_Size>::reset() _NOEXCEPT
|
||||
{
|
||||
_STD::fill_n(base::__make_iter(0), _Size, false);
|
||||
_VSTD::fill_n(base::__make_iter(0), _Size, false);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -819,7 +869,7 @@ bitset<_Size>::reset(size_t __pos)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>
|
||||
bitset<_Size>::operator~() const
|
||||
bitset<_Size>::operator~() const _NOEXCEPT
|
||||
{
|
||||
bitset __x(*this);
|
||||
__x.flip();
|
||||
@@ -829,7 +879,7 @@ bitset<_Size>::operator~() const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::flip()
|
||||
bitset<_Size>::flip() _NOEXCEPT
|
||||
{
|
||||
base::flip();
|
||||
return *this;
|
||||
@@ -867,7 +917,7 @@ bitset<_Size>::to_ullong() const
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>
|
||||
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
||||
{
|
||||
@@ -881,7 +931,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
template <class _CharT, class _Traits>
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, allocator<_CharT> >
|
||||
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
||||
@@ -890,7 +940,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
template <class _CharT>
|
||||
template <class _CharT>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
|
||||
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
||||
@@ -909,23 +959,23 @@ bitset<_Size>::to_string(char __zero, char __one) const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t
|
||||
bitset<_Size>::count() const
|
||||
bitset<_Size>::count() const _NOEXCEPT
|
||||
{
|
||||
return static_cast<size_t>(_STD::count(base::__make_iter(0), base::__make_iter(_Size), true));
|
||||
return static_cast<size_t>(_VSTD::count(base::__make_iter(0), base::__make_iter(_Size), true));
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
bitset<_Size>::operator==(const bitset& __rhs) const
|
||||
bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
|
||||
{
|
||||
return _STD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
|
||||
return _VSTD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
bitset<_Size>::operator!=(const bitset& __rhs) const
|
||||
bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
|
||||
{
|
||||
return !(*this == __rhs);
|
||||
}
|
||||
@@ -946,7 +996,7 @@ bitset<_Size>::test(size_t __pos) const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
bitset<_Size>::all() const
|
||||
bitset<_Size>::all() const _NOEXCEPT
|
||||
{
|
||||
return base::all();
|
||||
}
|
||||
@@ -954,7 +1004,7 @@ bitset<_Size>::all() const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
bitset<_Size>::any() const
|
||||
bitset<_Size>::any() const _NOEXCEPT
|
||||
{
|
||||
return base::any();
|
||||
}
|
||||
@@ -962,7 +1012,7 @@ bitset<_Size>::any() const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>
|
||||
bitset<_Size>::operator<<(size_t __pos) const
|
||||
bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
|
||||
{
|
||||
bitset __r = *this;
|
||||
__r <<= __pos;
|
||||
@@ -972,7 +1022,7 @@ bitset<_Size>::operator<<(size_t __pos) const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>
|
||||
bitset<_Size>::operator>>(size_t __pos) const
|
||||
bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
|
||||
{
|
||||
bitset __r = *this;
|
||||
__r >>= __pos;
|
||||
@@ -982,7 +1032,7 @@ bitset<_Size>::operator>>(size_t __pos) const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>
|
||||
operator&(const bitset<_Size>& __x, const bitset<_Size>& __y)
|
||||
operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
|
||||
{
|
||||
bitset<_Size> __r = __x;
|
||||
__r &= __y;
|
||||
@@ -992,7 +1042,7 @@ operator&(const bitset<_Size>& __x, const bitset<_Size>& __y)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>
|
||||
operator|(const bitset<_Size>& __x, const bitset<_Size>& __y)
|
||||
operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
|
||||
{
|
||||
bitset<_Size> __r = __x;
|
||||
__r |= __y;
|
||||
@@ -1002,7 +1052,7 @@ operator|(const bitset<_Size>& __x, const bitset<_Size>& __y)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>
|
||||
operator^(const bitset<_Size>& __x, const bitset<_Size>& __y)
|
||||
operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
|
||||
{
|
||||
bitset<_Size> __r = __x;
|
||||
__r ^= __y;
|
||||
@@ -1010,13 +1060,22 @@ operator^(const bitset<_Size>& __x, const bitset<_Size>& __y)
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
struct hash<bitset<_Size> >
|
||||
struct _LIBCPP_TYPE_VIS_ONLY hash<bitset<_Size> >
|
||||
: public unary_function<bitset<_Size>, size_t>
|
||||
{
|
||||
size_t operator()(const bitset<_Size>& __bs) const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT
|
||||
{return __bs.__hash_code();}
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, size_t _Size>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x);
|
||||
|
||||
template <class _CharT, class _Traits, size_t _Size>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x);
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_BITSET
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -20,4 +20,6 @@ Macros:
|
||||
#include <__config>
|
||||
#include <assert.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
|
||||
#include <complex>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
// hh 080623 Created
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -37,8 +37,13 @@ int toupper(int c);
|
||||
|
||||
#include <__config>
|
||||
#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
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
||||
346
include/cerrno
346
include/cerrno
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -26,32 +26,368 @@ Macros:
|
||||
#include <__config>
|
||||
#include <errno.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||
|
||||
#ifdef ELAST
|
||||
|
||||
const int __elast1 = ELAST+1;
|
||||
const int __elast2 = ELAST+2;
|
||||
#undef ELAST
|
||||
|
||||
#else
|
||||
|
||||
const int __elast1 = 104;
|
||||
const int __elast2 = 105;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENOTRECOVERABLE
|
||||
|
||||
#define EOWNERDEAD __elast1
|
||||
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST EOWNERDEAD
|
||||
#endif
|
||||
|
||||
#elif defined(EOWNERDEAD)
|
||||
|
||||
#define ENOTRECOVERABLE __elast1
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST ENOTRECOVERABLE
|
||||
#endif
|
||||
|
||||
#else
|
||||
#else // defined(EOWNERDEAD)
|
||||
|
||||
#define EOWNERDEAD __elast1
|
||||
#define ENOTRECOVERABLE __elast2
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST ENOTRECOVERABLE
|
||||
|
||||
#endif
|
||||
|
||||
#endif // defined(EOWNERDEAD)
|
||||
|
||||
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||
|
||||
// supply errno values likely to be missing, particularly on Windows
|
||||
|
||||
#ifndef EAFNOSUPPORT
|
||||
#define EAFNOSUPPORT 9901
|
||||
#endif
|
||||
|
||||
#ifndef EADDRINUSE
|
||||
#define EADDRINUSE 9902
|
||||
#endif
|
||||
|
||||
#ifndef EADDRNOTAVAIL
|
||||
#define EADDRNOTAVAIL 9903
|
||||
#endif
|
||||
|
||||
#ifndef EISCONN
|
||||
#define EISCONN 9904
|
||||
#endif
|
||||
|
||||
#ifndef EBADMSG
|
||||
#define EBADMSG 9905
|
||||
#endif
|
||||
|
||||
#ifndef ECONNABORTED
|
||||
#define ECONNABORTED 9906
|
||||
#endif
|
||||
|
||||
#ifndef EALREADY
|
||||
#define EALREADY 9907
|
||||
#endif
|
||||
|
||||
#ifndef ECONNREFUSED
|
||||
#define ECONNREFUSED 9908
|
||||
#endif
|
||||
|
||||
#ifndef ECONNRESET
|
||||
#define ECONNRESET 9909
|
||||
#endif
|
||||
|
||||
#ifndef EDESTADDRREQ
|
||||
#define EDESTADDRREQ 9910
|
||||
#endif
|
||||
|
||||
#ifndef EHOSTUNREACH
|
||||
#define EHOSTUNREACH 9911
|
||||
#endif
|
||||
|
||||
#ifndef EIDRM
|
||||
#define EIDRM 9912
|
||||
#endif
|
||||
|
||||
#ifndef EMSGSIZE
|
||||
#define EMSGSIZE 9913
|
||||
#endif
|
||||
|
||||
#ifndef ENETDOWN
|
||||
#define ENETDOWN 9914
|
||||
#endif
|
||||
|
||||
#ifndef ENETRESET
|
||||
#define ENETRESET 9915
|
||||
#endif
|
||||
|
||||
#ifndef ENETUNREACH
|
||||
#define ENETUNREACH 9916
|
||||
#endif
|
||||
|
||||
#ifndef ENOBUFS
|
||||
#define ENOBUFS 9917
|
||||
#endif
|
||||
|
||||
#ifndef ENOLINK
|
||||
#define ENOLINK 9918
|
||||
#endif
|
||||
|
||||
#ifndef ENODATA
|
||||
#define ENODATA 9919
|
||||
#endif
|
||||
|
||||
#ifndef ENOMSG
|
||||
#define ENOMSG 9920
|
||||
#endif
|
||||
|
||||
#ifndef ENOPROTOOPT
|
||||
#define ENOPROTOOPT 9921
|
||||
#endif
|
||||
|
||||
#ifndef ENOSR
|
||||
#define ENOSR 9922
|
||||
#endif
|
||||
|
||||
#ifndef ENOTSOCK
|
||||
#define ENOTSOCK 9923
|
||||
#endif
|
||||
|
||||
#ifndef ENOSTR
|
||||
#define ENOSTR 9924
|
||||
#endif
|
||||
|
||||
#ifndef ENOTCONN
|
||||
#define ENOTCONN 9925
|
||||
#endif
|
||||
|
||||
#ifndef ENOTSUP
|
||||
#define ENOTSUP 9926
|
||||
#endif
|
||||
|
||||
#ifndef ECANCELED
|
||||
#define ECANCELED 9927
|
||||
#endif
|
||||
|
||||
#ifndef EINPROGRESS
|
||||
#define EINPROGRESS 9928
|
||||
#endif
|
||||
|
||||
#ifndef EOPNOTSUPP
|
||||
#define EOPNOTSUPP 9929
|
||||
#endif
|
||||
|
||||
#ifndef EWOULDBLOCK
|
||||
#define EWOULDBLOCK 9930
|
||||
#endif
|
||||
|
||||
#ifndef EOWNERDEAD
|
||||
#define EOWNERDEAD 9931
|
||||
#endif
|
||||
|
||||
#ifndef EPROTO
|
||||
#define EPROTO 9932
|
||||
#endif
|
||||
|
||||
#ifndef EPROTONOSUPPORT
|
||||
#define EPROTONOSUPPORT 9933
|
||||
#endif
|
||||
|
||||
#ifndef ENOTRECOVERABLE
|
||||
#define ENOTRECOVERABLE 9934
|
||||
#endif
|
||||
|
||||
#ifndef ETIME
|
||||
#define ETIME 9935
|
||||
#endif
|
||||
|
||||
#ifndef ETXTBSY
|
||||
#define ETXTBSY 9936
|
||||
#endif
|
||||
|
||||
#ifndef ETIMEDOUT
|
||||
#define ETIMEDOUT 9938
|
||||
#endif
|
||||
|
||||
#ifndef ELOOP
|
||||
#define ELOOP 9939
|
||||
#endif
|
||||
|
||||
#ifndef EOVERFLOW
|
||||
#define EOVERFLOW 9940
|
||||
#endif
|
||||
|
||||
#ifndef EPROTOTYPE
|
||||
#define EPROTOTYPE 9941
|
||||
#endif
|
||||
|
||||
#ifndef ENOSYS
|
||||
#define ENOSYS 9942
|
||||
#endif
|
||||
|
||||
#ifndef EINVAL
|
||||
#define EINVAL 9943
|
||||
#endif
|
||||
|
||||
#ifndef ERANGE
|
||||
#define ERANGE 9944
|
||||
#endif
|
||||
|
||||
#ifndef EILSEQ
|
||||
#define EILSEQ 9945
|
||||
#endif
|
||||
|
||||
// Windows Mobile doesn't appear to define these:
|
||||
|
||||
#ifndef E2BIG
|
||||
#define E2BIG 9946
|
||||
#endif
|
||||
|
||||
#ifndef EDOM
|
||||
#define EDOM 9947
|
||||
#endif
|
||||
|
||||
#ifndef EFAULT
|
||||
#define EFAULT 9948
|
||||
#endif
|
||||
|
||||
#ifndef EBADF
|
||||
#define EBADF 9949
|
||||
#endif
|
||||
|
||||
#ifndef EPIPE
|
||||
#define EPIPE 9950
|
||||
#endif
|
||||
|
||||
#ifndef EXDEV
|
||||
#define EXDEV 9951
|
||||
#endif
|
||||
|
||||
#ifndef EBUSY
|
||||
#define EBUSY 9952
|
||||
#endif
|
||||
|
||||
#ifndef ENOTEMPTY
|
||||
#define ENOTEMPTY 9953
|
||||
#endif
|
||||
|
||||
#ifndef ENOEXEC
|
||||
#define ENOEXEC 9954
|
||||
#endif
|
||||
|
||||
#ifndef EEXIST
|
||||
#define EEXIST 9955
|
||||
#endif
|
||||
|
||||
#ifndef EFBIG
|
||||
#define EFBIG 9956
|
||||
#endif
|
||||
|
||||
#ifndef ENAMETOOLONG
|
||||
#define ENAMETOOLONG 9957
|
||||
#endif
|
||||
|
||||
#ifndef ENOTTY
|
||||
#define ENOTTY 9958
|
||||
#endif
|
||||
|
||||
#ifndef EINTR
|
||||
#define EINTR 9959
|
||||
#endif
|
||||
|
||||
#ifndef ESPIPE
|
||||
#define ESPIPE 9960
|
||||
#endif
|
||||
|
||||
#ifndef EIO
|
||||
#define EIO 9961
|
||||
#endif
|
||||
|
||||
#ifndef EISDIR
|
||||
#define EISDIR 9962
|
||||
#endif
|
||||
|
||||
#ifndef ECHILD
|
||||
#define ECHILD 9963
|
||||
#endif
|
||||
|
||||
#ifndef ENOLCK
|
||||
#define ENOLCK 9964
|
||||
#endif
|
||||
|
||||
#ifndef ENOSPC
|
||||
#define ENOSPC 9965
|
||||
#endif
|
||||
|
||||
#ifndef ENXIO
|
||||
#define ENXIO 9966
|
||||
#endif
|
||||
|
||||
#ifndef ENODEV
|
||||
#define ENODEV 9967
|
||||
#endif
|
||||
|
||||
#ifndef ENOENT
|
||||
#define ENOENT 9968
|
||||
#endif
|
||||
|
||||
#ifndef ESRCH
|
||||
#define ESRCH 9969
|
||||
#endif
|
||||
|
||||
#ifndef ENOTDIR
|
||||
#define ENOTDIR 9970
|
||||
#endif
|
||||
|
||||
#ifndef ENOMEM
|
||||
#define ENOMEM 9971
|
||||
#endif
|
||||
|
||||
#ifndef EPERM
|
||||
#define EPERM 9972
|
||||
#endif
|
||||
|
||||
#ifndef EACCES
|
||||
#define EACCES 9973
|
||||
#endif
|
||||
|
||||
#ifndef EROFS
|
||||
#define EROFS 9974
|
||||
#endif
|
||||
|
||||
#ifndef EDEADLK
|
||||
#define EDEADLK 9975
|
||||
#endif
|
||||
|
||||
#ifndef EAGAIN
|
||||
#define EAGAIN 9976
|
||||
#endif
|
||||
|
||||
#ifndef ENFILE
|
||||
#define ENFILE 9977
|
||||
#endif
|
||||
|
||||
#ifndef EMFILE
|
||||
#define EMFILE 9978
|
||||
#endif
|
||||
|
||||
#ifndef EMLINK
|
||||
#define EMLINK 9979
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CERRNO
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -56,7 +56,9 @@ int feupdateenv(const fenv_t* envp);
|
||||
#include <__config>
|
||||
#include <fenv.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -63,7 +63,9 @@ Macros:
|
||||
#include <__config>
|
||||
#include <float.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef FLT_EVAL_METHOD
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
|
||||
389
include/chrono
389
include/chrono
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace chrono
|
||||
{
|
||||
|
||||
template <class ToDuration, class Rep, class Period>
|
||||
constexpr
|
||||
ToDuration
|
||||
duration_cast(const duration<Rep, Period>& fd);
|
||||
|
||||
@@ -29,9 +30,9 @@ template <class Rep>
|
||||
struct duration_values
|
||||
{
|
||||
public:
|
||||
static Rep zero();
|
||||
static Rep max();
|
||||
static Rep min();
|
||||
static constexpr Rep zero();
|
||||
static constexpr Rep max();
|
||||
static constexpr Rep min();
|
||||
};
|
||||
|
||||
// duration
|
||||
@@ -46,9 +47,9 @@ public:
|
||||
typedef Rep rep;
|
||||
typedef Period period;
|
||||
|
||||
duration() = default;
|
||||
constexpr duration() = default;
|
||||
template <class Rep2>
|
||||
explicit duration(const Rep2& r,
|
||||
constexpr explicit duration(const Rep2& r,
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<Rep2, rep>::value &&
|
||||
@@ -58,7 +59,7 @@ public:
|
||||
|
||||
// conversions
|
||||
template <class Rep2, class Period2>
|
||||
duration(const duration<Rep2, Period2>& d,
|
||||
constexpr duration(const duration<Rep2, Period2>& d,
|
||||
typename enable_if
|
||||
<
|
||||
treat_as_floating_point<rep>::value ||
|
||||
@@ -67,12 +68,12 @@ public:
|
||||
|
||||
// observer
|
||||
|
||||
rep count() const;
|
||||
constexpr rep count() const;
|
||||
|
||||
// arithmetic
|
||||
|
||||
duration operator+() const;
|
||||
duration operator-() const;
|
||||
constexpr duration operator+() const;
|
||||
constexpr duration operator-() const;
|
||||
duration& operator++();
|
||||
duration operator++(int);
|
||||
duration& operator--();
|
||||
@@ -86,9 +87,9 @@ public:
|
||||
|
||||
// special values
|
||||
|
||||
static duration zero();
|
||||
static duration min();
|
||||
static duration max();
|
||||
static constexpr duration zero();
|
||||
static constexpr duration min();
|
||||
static constexpr duration max();
|
||||
};
|
||||
|
||||
typedef duration<long long, nano> nanoseconds;
|
||||
@@ -110,16 +111,16 @@ private:
|
||||
duration d_; // exposition only
|
||||
|
||||
public:
|
||||
time_point(); // has value "epoch"
|
||||
explicit time_point(const duration& d); // same as time_point() + d
|
||||
time_point(); // has value "epoch" // constexpr in C++14
|
||||
explicit time_point(const duration& d); // same as time_point() + d // constexpr in C++14
|
||||
|
||||
// conversions
|
||||
template <class Duration2>
|
||||
time_point(const time_point<clock, Duration2>& t);
|
||||
time_point(const time_point<clock, Duration2>& t); // constexpr in C++14
|
||||
|
||||
// observer
|
||||
|
||||
duration time_since_epoch() const;
|
||||
duration time_since_epoch() const; // constexpr in C++14
|
||||
|
||||
// arithmetic
|
||||
|
||||
@@ -145,43 +146,55 @@ namespace chrono {
|
||||
|
||||
// duration arithmetic
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
||||
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
||||
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period, class Rep2>
|
||||
constexpr
|
||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||
operator*(const duration<Rep1, Period>& d, const Rep2& s);
|
||||
template <class Rep1, class Period, class Rep2>
|
||||
constexpr
|
||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||
operator*(const Rep1& s, const duration<Rep2, Period>& d);
|
||||
template <class Rep1, class Period, class Rep2>
|
||||
constexpr
|
||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||
operator/(const duration<Rep1, Period>& d, const Rep2& s);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
typename common_type<Rep1, Rep2>::type
|
||||
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
|
||||
// duration comparisons
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
|
||||
// duration_cast
|
||||
template <class ToDuration, class Rep, class Period>
|
||||
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>
|
||||
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
|
||||
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
|
||||
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>
|
||||
bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||
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>
|
||||
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>
|
||||
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
|
||||
@@ -223,29 +236,42 @@ public:
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<system_clock> time_point;
|
||||
static const bool is_monotonic = false;
|
||||
static const bool is_steady = false; // constexpr in C++14
|
||||
|
||||
static time_point now();
|
||||
static time_t to_time_t (const time_point& __t);
|
||||
static time_point from_time_t(time_t __t);
|
||||
static time_point now() noexcept;
|
||||
static time_t to_time_t (const time_point& __t) noexcept;
|
||||
static time_point from_time_t(time_t __t) noexcept;
|
||||
};
|
||||
|
||||
class monotonic_clock
|
||||
class steady_clock
|
||||
{
|
||||
public:
|
||||
typedef nanoseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<monotonic_clock, duration> time_point;
|
||||
static const bool is_monotonic = true;
|
||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||
static const bool is_steady = true; // constexpr in C++14
|
||||
|
||||
static time_point now();
|
||||
static time_point now() noexcept;
|
||||
};
|
||||
|
||||
typedef monotonic_clock high_resolution_clock;
|
||||
typedef steady_clock high_resolution_clock;
|
||||
|
||||
} // 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
|
||||
*/
|
||||
|
||||
@@ -255,14 +281,18 @@ typedef monotonic_clock high_resolution_clock;
|
||||
#include <ratio>
|
||||
#include <limits>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
namespace chrono
|
||||
{
|
||||
|
||||
template <class _Rep, class _Period = ratio<1> > class duration;
|
||||
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_TYPE_VIS_ONLY duration;
|
||||
|
||||
template <class _Tp>
|
||||
struct __is_duration : false_type {};
|
||||
@@ -282,7 +312,8 @@ struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
|
||||
} // chrono
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
struct common_type<chrono::duration<_Rep1, _Period1>, chrono::duration<_Rep2, _Period2> >
|
||||
struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::duration<_Rep1, _Period1>,
|
||||
chrono::duration<_Rep2, _Period2> >
|
||||
{
|
||||
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
|
||||
typename __ratio_gcd<_Period1, _Period2>::type> type;
|
||||
@@ -301,7 +332,7 @@ struct __duration_cast;
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
|
||||
@@ -311,7 +342,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||
@@ -323,7 +354,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||
@@ -335,7 +366,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||
@@ -347,6 +378,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
|
||||
|
||||
template <class _ToDuration, class _Rep, class _Period>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename enable_if
|
||||
<
|
||||
__is_duration<_ToDuration>::value,
|
||||
@@ -357,25 +389,57 @@ duration_cast(const duration<_Rep, _Period>& __fd)
|
||||
return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
|
||||
}
|
||||
|
||||
template <class _Rep> struct treat_as_floating_point : is_floating_point<_Rep> {};
|
||||
template <class _Rep>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY treat_as_floating_point : is_floating_point<_Rep> {};
|
||||
|
||||
template <class _Rep>
|
||||
struct duration_values
|
||||
struct _LIBCPP_TYPE_VIS_ONLY duration_values
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _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 zero() {return _Rep(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep max() {return numeric_limits<_Rep>::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();}
|
||||
};
|
||||
|
||||
// duration
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
class duration
|
||||
class _LIBCPP_TYPE_VIS_ONLY 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(_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:
|
||||
typedef _Rep rep;
|
||||
typedef _Period period;
|
||||
@@ -383,9 +447,15 @@ private:
|
||||
rep __rep_;
|
||||
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>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
explicit duration(const _Rep2& __r,
|
||||
typename enable_if
|
||||
<
|
||||
@@ -397,24 +467,25 @@ public:
|
||||
|
||||
// conversions
|
||||
template <class _Rep2, class _Period2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
duration(const duration<_Rep2, _Period2>& __d,
|
||||
typename enable_if
|
||||
<
|
||||
__no_overflow<_Period2, period>::value && (
|
||||
treat_as_floating_point<rep>::value ||
|
||||
(ratio_divide<_Period2, period>::type::den == 1 &&
|
||||
!treat_as_floating_point<_Rep2>::value)
|
||||
(__no_overflow<_Period2, period>::type::den == 1 &&
|
||||
!treat_as_floating_point<_Rep2>::value))
|
||||
>::type* = 0)
|
||||
: __rep_(_STD::chrono::duration_cast<duration>(__d).count()) {}
|
||||
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
|
||||
|
||||
// observer
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR rep count() const {return __rep_;}
|
||||
|
||||
// arithmetic
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator+() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator-() const {return duration(-__rep_);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
|
||||
@@ -430,9 +501,9 @@ public:
|
||||
|
||||
// special values
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY static duration zero() {return duration(duration_values<rep>::zero());}
|
||||
_LIBCPP_INLINE_VISIBILITY static 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 zero() {return duration(duration_values<rep>::zero());}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration min() {return duration(duration_values<rep>::min());}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration max() {return duration(duration_values<rep>::max());}
|
||||
};
|
||||
|
||||
typedef duration<long long, nano> nanoseconds;
|
||||
@@ -447,8 +518,8 @@ typedef duration< long, ratio<3600> > hours;
|
||||
template <class _LhsDuration, class _RhsDuration>
|
||||
struct __duration_eq
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
|
||||
{
|
||||
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
||||
return _Ct(__lhs).count() == _Ct(__rhs).count();
|
||||
@@ -458,13 +529,14 @@ struct __duration_eq
|
||||
template <class _LhsDuration>
|
||||
struct __duration_eq<_LhsDuration, _LhsDuration>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
|
||||
{return __lhs.count() == __rhs.count();}
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
bool
|
||||
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -475,6 +547,7 @@ operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
bool
|
||||
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -486,8 +559,8 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
||||
template <class _LhsDuration, class _RhsDuration>
|
||||
struct __duration_lt
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
|
||||
{
|
||||
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
||||
return _Ct(__lhs).count() < _Ct(__rhs).count();
|
||||
@@ -497,13 +570,14 @@ struct __duration_lt
|
||||
template <class _LhsDuration>
|
||||
struct __duration_lt<_LhsDuration, _LhsDuration>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
|
||||
{return __lhs.count() < __rhs.count();}
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
bool
|
||||
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -514,6 +588,7 @@ operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
bool
|
||||
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -524,6 +599,7 @@ operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
bool
|
||||
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -534,6 +610,7 @@ operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
bool
|
||||
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -544,30 +621,31 @@ operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||
__r += __rhs;
|
||||
return __r;
|
||||
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
|
||||
return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
|
||||
}
|
||||
|
||||
// Duration -
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||
__r -= __rhs;
|
||||
return __r;
|
||||
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
|
||||
return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
|
||||
}
|
||||
|
||||
// Duration *
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
|
||||
@@ -576,13 +654,13 @@ typename enable_if
|
||||
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||
{
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
duration<_Cr, _Period> __r = __d;
|
||||
__r *= static_cast<_Cr>(__s);
|
||||
return __r;
|
||||
typedef duration<_Cr, _Period> _Cd;
|
||||
return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
|
||||
}
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
|
||||
@@ -621,17 +699,18 @@ struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
||||
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||
{
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
duration<_Cr, _Period> __r = __d;
|
||||
__r /= static_cast<_Cr>(__s);
|
||||
return __r;
|
||||
typedef duration<_Cr, _Period> _Cd;
|
||||
return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
|
||||
}
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename common_type<_Rep1, _Rep2>::type
|
||||
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -643,23 +722,24 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
||||
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||
{
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
duration<_Cr, _Period> __r = __d;
|
||||
__r %= static_cast<_Cr>(__s);
|
||||
return __r;
|
||||
typedef duration<_Cr, _Period> _Cd;
|
||||
return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
|
||||
}
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||
__r %= __rhs;
|
||||
return __r;
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
|
||||
return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
@@ -667,7 +747,7 @@ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
template <class _Clock, class _Duration = typename _Clock::duration>
|
||||
class time_point
|
||||
class _LIBCPP_TYPE_VIS_ONLY time_point
|
||||
{
|
||||
static_assert(__is_duration<_Duration>::value,
|
||||
"Second template parameter of time_point must be a std::chrono::duration");
|
||||
@@ -680,12 +760,12 @@ private:
|
||||
duration __d_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY time_point() : __d_(duration::zero()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit time_point(const duration& __d) : __d_(__d) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 time_point() : __d_(duration::zero()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit time_point(const duration& __d) : __d_(__d) {}
|
||||
|
||||
// conversions
|
||||
template <class _Duration2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
time_point(const time_point<clock, _Duration2>& t,
|
||||
typename enable_if
|
||||
<
|
||||
@@ -695,23 +775,24 @@ public:
|
||||
|
||||
// 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
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d;}
|
||||
_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; return *this;}
|
||||
|
||||
// special values
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY static 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 min() {return time_point(duration::min());}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() {return time_point(duration::max());}
|
||||
};
|
||||
|
||||
} // chrono
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
struct common_type<chrono::time_point<_Clock, _Duration1>, chrono::time_point<_Clock, _Duration2> >
|
||||
struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::time_point<_Clock, _Duration1>,
|
||||
chrono::time_point<_Clock, _Duration2> >
|
||||
{
|
||||
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
|
||||
};
|
||||
@@ -719,17 +800,17 @@ struct common_type<chrono::time_point<_Clock, _Duration1>, chrono::time_point<_C
|
||||
namespace chrono {
|
||||
|
||||
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_cast(const time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
return time_point<_Clock, _ToDuration>(_STD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
|
||||
return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
|
||||
}
|
||||
|
||||
// time_point ==
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool
|
||||
operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
@@ -739,7 +820,7 @@ operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
||||
// time_point !=
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool
|
||||
operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
@@ -749,7 +830,7 @@ operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
||||
// time_point <
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool
|
||||
operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
@@ -759,7 +840,7 @@ operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
||||
// time_point >
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool
|
||||
operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
@@ -769,7 +850,7 @@ operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
||||
// time_point <=
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool
|
||||
operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
@@ -779,7 +860,7 @@ operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
||||
// time_point >=
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool
|
||||
operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
@@ -789,20 +870,18 @@ operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
||||
// time_point operator+(time_point x, duration y);
|
||||
|
||||
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>
|
||||
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;
|
||||
_Tr __r(__lhs.time_since_epoch());
|
||||
__r += __rhs;
|
||||
return __r;
|
||||
return _Tr (__lhs.time_since_epoch() + __rhs);
|
||||
}
|
||||
|
||||
// time_point operator+(duration x, time_point y);
|
||||
|
||||
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>
|
||||
operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
@@ -812,7 +891,7 @@ operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Dura
|
||||
// time_point operator-(time_point x, duration y);
|
||||
|
||||
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>
|
||||
operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -822,7 +901,7 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Pe
|
||||
// duration operator-(time_point x, time_point y);
|
||||
|
||||
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
|
||||
operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||
{
|
||||
@@ -833,36 +912,116 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
||||
/////////////////////// clocks ///////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
class system_clock
|
||||
class _LIBCPP_TYPE_VIS system_clock
|
||||
{
|
||||
public:
|
||||
typedef microseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<system_clock> time_point;
|
||||
static const bool is_monotonic = false;
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
|
||||
|
||||
static time_point now();
|
||||
static time_t to_time_t (const time_point& __t);
|
||||
static time_point from_time_t(time_t __t);
|
||||
static time_point now() _NOEXCEPT;
|
||||
static time_t to_time_t (const time_point& __t) _NOEXCEPT;
|
||||
static time_point from_time_t(time_t __t) _NOEXCEPT;
|
||||
};
|
||||
|
||||
class monotonic_clock
|
||||
class _LIBCPP_TYPE_VIS steady_clock
|
||||
{
|
||||
public:
|
||||
typedef nanoseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<monotonic_clock, duration> time_point;
|
||||
static const bool is_monotonic = true;
|
||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = true;
|
||||
|
||||
static time_point now();
|
||||
static time_point now() _NOEXCEPT;
|
||||
};
|
||||
|
||||
typedef monotonic_clock high_resolution_clock;
|
||||
typedef steady_clock high_resolution_clock;
|
||||
|
||||
} // 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
|
||||
|
||||
#endif // _LIBCPP_CHRONO
|
||||
|
||||
@@ -239,7 +239,9 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
|
||||
#include <cstdint>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CISO646
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -41,6 +41,8 @@ Macros:
|
||||
#include <__config>
|
||||
#include <limits.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CLIMITS
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -38,7 +38,9 @@ lconv* localeconv();
|
||||
#include <__config>
|
||||
#include <locale.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
||||
1332
include/cmath
1332
include/cmath
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -29,7 +29,8 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
class codecvt_utf8
|
||||
: public codecvt<Elem, char, mbstate_t>
|
||||
{
|
||||
// unspecified
|
||||
explicit codecvt_utf8(size_t refs = 0);
|
||||
~codecvt_utf8();
|
||||
};
|
||||
|
||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
@@ -37,7 +38,8 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
class codecvt_utf16
|
||||
: public codecvt<Elem, char, mbstate_t>
|
||||
{
|
||||
// unspecified
|
||||
explicit codecvt_utf16(size_t refs = 0);
|
||||
~codecvt_utf16();
|
||||
};
|
||||
|
||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
@@ -45,7 +47,8 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||
class codecvt_utf8_utf16
|
||||
: public codecvt<Elem, char, mbstate_t>
|
||||
{
|
||||
// unspecified
|
||||
explicit codecvt_utf8_utf16(size_t refs = 0);
|
||||
~codecvt_utf8_utf16();
|
||||
};
|
||||
|
||||
} // std
|
||||
@@ -55,7 +58,9 @@ class codecvt_utf8_utf16
|
||||
#include <__config>
|
||||
#include <__locale>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -71,7 +76,7 @@ enum codecvt_mode
|
||||
template <class _Elem> class __codecvt_utf8;
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8<wchar_t>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
@@ -106,7 +111,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8<char16_t>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
@@ -141,7 +146,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8<char32_t>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
@@ -177,7 +182,7 @@ protected:
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class codecvt_utf8
|
||||
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8
|
||||
: public __codecvt_utf8<_Elem>
|
||||
{
|
||||
public:
|
||||
@@ -185,6 +190,7 @@ public:
|
||||
explicit codecvt_utf8(size_t __refs = 0)
|
||||
: __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf8() {}
|
||||
};
|
||||
|
||||
@@ -193,7 +199,7 @@ public:
|
||||
template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<wchar_t, false>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
@@ -228,7 +234,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<wchar_t, true>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, true>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
@@ -263,7 +269,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<char16_t, false>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
@@ -298,7 +304,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<char16_t, true>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
@@ -333,7 +339,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<char32_t, false>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
@@ -368,7 +374,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf16<char32_t, true>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
@@ -404,7 +410,7 @@ protected:
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class codecvt_utf16
|
||||
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf16
|
||||
: public __codecvt_utf16<_Elem, _Mode & little_endian>
|
||||
{
|
||||
public:
|
||||
@@ -412,6 +418,7 @@ public:
|
||||
explicit codecvt_utf16(size_t __refs = 0)
|
||||
: __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf16() {}
|
||||
};
|
||||
|
||||
@@ -420,7 +427,7 @@ public:
|
||||
template <class _Elem> class __codecvt_utf8_utf16;
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8_utf16<wchar_t>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
@@ -455,7 +462,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8_utf16<char32_t>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
@@ -490,7 +497,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class __codecvt_utf8_utf16<char16_t>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
unsigned long _Maxcode_;
|
||||
@@ -526,7 +533,7 @@ protected:
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class codecvt_utf8_utf16
|
||||
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8_utf16
|
||||
: public __codecvt_utf8_utf16<_Elem>
|
||||
{
|
||||
public:
|
||||
@@ -534,6 +541,7 @@ public:
|
||||
explicit codecvt_utf8_utf16(size_t __refs = 0)
|
||||
: __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf8_utf16() {}
|
||||
};
|
||||
|
||||
|
||||
429
include/complex
429
include/complex
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -23,12 +23,12 @@ class complex
|
||||
public:
|
||||
typedef T value_type;
|
||||
|
||||
complex(const T& re = T(), const T& im = T());
|
||||
complex(const complex&);
|
||||
template<class X> complex(const complex<X>&);
|
||||
complex(const T& re = T(), const T& im = T()); // constexpr in C++14
|
||||
complex(const complex&); // constexpr in C++14
|
||||
template<class X> complex(const complex<X>&); // constexpr in C++14
|
||||
|
||||
T real() const;
|
||||
T imag() const;
|
||||
T real() const; // constexpr in C++14
|
||||
T imag() const; // constexpr in C++14
|
||||
|
||||
void real(T);
|
||||
void imag(T);
|
||||
@@ -49,89 +49,89 @@ public:
|
||||
|
||||
template<>
|
||||
class complex<float>
|
||||
{
|
||||
public:
|
||||
typedef float value_type;
|
||||
{
|
||||
public:
|
||||
typedef float value_type;
|
||||
|
||||
constexpr complex(float re = 0.0f, float im = 0.0f);
|
||||
explicit constexpr complex(const complex<double>&);
|
||||
explicit constexpr complex(const complex<long double>&);
|
||||
constexpr complex(float re = 0.0f, float im = 0.0f);
|
||||
explicit constexpr complex(const complex<double>&);
|
||||
explicit constexpr complex(const complex<long double>&);
|
||||
|
||||
constexpr float real() const;
|
||||
constexpr float real() const;
|
||||
void real(float);
|
||||
constexpr float imag() const;
|
||||
constexpr float imag() const;
|
||||
void imag(float);
|
||||
|
||||
complex<float>& operator= (float);
|
||||
complex<float>& operator+=(float);
|
||||
complex<float>& operator-=(float);
|
||||
complex<float>& operator*=(float);
|
||||
complex<float>& operator/=(float);
|
||||
complex<float>& operator= (float);
|
||||
complex<float>& operator+=(float);
|
||||
complex<float>& operator-=(float);
|
||||
complex<float>& operator*=(float);
|
||||
complex<float>& operator/=(float);
|
||||
|
||||
complex<float>& operator=(const complex<float>&);
|
||||
template<class X> complex<float>& operator= (const complex<X>&);
|
||||
template<class X> complex<float>& operator+=(const complex<X>&);
|
||||
template<class X> complex<float>& operator-=(const complex<X>&);
|
||||
template<class X> complex<float>& operator*=(const complex<X>&);
|
||||
template<class X> complex<float>& operator/=(const complex<X>&);
|
||||
complex<float>& operator=(const complex<float>&);
|
||||
template<class X> complex<float>& operator= (const complex<X>&);
|
||||
template<class X> complex<float>& operator+=(const complex<X>&);
|
||||
template<class X> complex<float>& operator-=(const complex<X>&);
|
||||
template<class X> complex<float>& operator*=(const complex<X>&);
|
||||
template<class X> complex<float>& operator/=(const complex<X>&);
|
||||
};
|
||||
|
||||
template<>
|
||||
class complex<double>
|
||||
{
|
||||
public:
|
||||
typedef double value_type;
|
||||
{
|
||||
public:
|
||||
typedef double value_type;
|
||||
|
||||
constexpr complex(double re = 0.0, double im = 0.0);
|
||||
constexpr complex(const complex<float>&);
|
||||
explicit constexpr complex(const complex<long double>&);
|
||||
constexpr complex(double re = 0.0, double im = 0.0);
|
||||
constexpr complex(const complex<float>&);
|
||||
explicit constexpr complex(const complex<long double>&);
|
||||
|
||||
constexpr double real() const;
|
||||
constexpr double real() const;
|
||||
void real(double);
|
||||
constexpr double imag() const;
|
||||
constexpr double imag() const;
|
||||
void imag(double);
|
||||
|
||||
complex<double>& operator= (double);
|
||||
complex<double>& operator+=(double);
|
||||
complex<double>& operator-=(double);
|
||||
complex<double>& operator*=(double);
|
||||
complex<double>& operator/=(double);
|
||||
complex<double>& operator=(const complex<double>&);
|
||||
complex<double>& operator= (double);
|
||||
complex<double>& operator+=(double);
|
||||
complex<double>& operator-=(double);
|
||||
complex<double>& operator*=(double);
|
||||
complex<double>& operator/=(double);
|
||||
complex<double>& operator=(const complex<double>&);
|
||||
|
||||
template<class X> complex<double>& operator= (const complex<X>&);
|
||||
template<class X> complex<double>& operator+=(const complex<X>&);
|
||||
template<class X> complex<double>& operator-=(const complex<X>&);
|
||||
template<class X> complex<double>& operator*=(const complex<X>&);
|
||||
template<class X> complex<double>& operator/=(const complex<X>&);
|
||||
};
|
||||
template<class X> complex<double>& operator= (const complex<X>&);
|
||||
template<class X> complex<double>& operator+=(const complex<X>&);
|
||||
template<class X> complex<double>& operator-=(const complex<X>&);
|
||||
template<class X> complex<double>& operator*=(const complex<X>&);
|
||||
template<class X> complex<double>& operator/=(const complex<X>&);
|
||||
};
|
||||
|
||||
template<>
|
||||
class complex<long double>
|
||||
{
|
||||
public:
|
||||
typedef long double value_type;
|
||||
{
|
||||
public:
|
||||
typedef long double value_type;
|
||||
|
||||
constexpr complex(long double re = 0.0L, long double im = 0.0L);
|
||||
constexpr complex(const complex<float>&);
|
||||
constexpr complex(const complex<double>&);
|
||||
constexpr complex(long double re = 0.0L, long double im = 0.0L);
|
||||
constexpr complex(const complex<float>&);
|
||||
constexpr complex(const complex<double>&);
|
||||
|
||||
constexpr long double real() const;
|
||||
constexpr long double real() const;
|
||||
void real(long double);
|
||||
constexpr long double imag() const;
|
||||
constexpr long double imag() const;
|
||||
void imag(long double);
|
||||
|
||||
complex<long double>& operator=(const complex<long double>&);
|
||||
complex<long double>& operator= (long double);
|
||||
complex<long double>& operator+=(long double);
|
||||
complex<long double>& operator-=(long double);
|
||||
complex<long double>& operator*=(long double);
|
||||
complex<long double>& operator/=(long double);
|
||||
complex<long double>& operator=(const complex<long double>&);
|
||||
complex<long double>& operator= (long double);
|
||||
complex<long double>& operator+=(long double);
|
||||
complex<long double>& operator-=(long double);
|
||||
complex<long double>& operator*=(long double);
|
||||
complex<long double>& operator/=(long double);
|
||||
|
||||
template<class X> complex<long double>& operator= (const complex<X>&);
|
||||
template<class X> complex<long double>& operator+=(const complex<X>&);
|
||||
template<class X> complex<long double>& operator-=(const complex<X>&);
|
||||
template<class X> complex<long double>& operator*=(const complex<X>&);
|
||||
template<class X> complex<long double>& operator/=(const complex<X>&);
|
||||
template<class X> complex<long double>& operator= (const complex<X>&);
|
||||
template<class X> complex<long double>& operator+=(const complex<X>&);
|
||||
template<class X> complex<long double>& operator-=(const complex<X>&);
|
||||
template<class X> complex<long double>& operator*=(const complex<X>&);
|
||||
template<class X> complex<long double>& operator/=(const complex<X>&);
|
||||
};
|
||||
|
||||
// 26.3.6 operators:
|
||||
@@ -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 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 T&);
|
||||
template<class T> bool operator==(const T&, const complex<T>&);
|
||||
template<class T> bool operator!=(const complex<T>&, const complex<T>&);
|
||||
template<class T> bool operator!=(const complex<T>&, const T&);
|
||||
template<class T> bool operator!=(const 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&); // constexpr in C++14
|
||||
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>&); // constexpr in C++14
|
||||
template<class T> bool operator!=(const complex<T>&, const T&); // constexpr in C++14
|
||||
template<class T> bool operator!=(const T&, const complex<T>&); // constexpr in C++14
|
||||
|
||||
template<class T, class charT, class traits>
|
||||
basic_istream<charT, traits>&
|
||||
@@ -165,17 +165,17 @@ template<class T, class charT, class traits>
|
||||
|
||||
// 26.3.7 values:
|
||||
|
||||
template<class T> T real(const complex<T>&);
|
||||
long double real(long double);
|
||||
double real(double);
|
||||
template<Integral T> double real(T);
|
||||
float real(float);
|
||||
template<class T> T real(const complex<T>&); // constexpr in C++14
|
||||
long double real(long double); // constexpr in C++14
|
||||
double real(double); // constexpr in C++14
|
||||
template<Integral T> double real(T); // constexpr in C++14
|
||||
float real(float); // constexpr in C++14
|
||||
|
||||
template<class T> T imag(const complex<T>&);
|
||||
long double imag(long double);
|
||||
double imag(double);
|
||||
template<Integral T> double imag(T);
|
||||
float imag(float);
|
||||
template<class T> T imag(const complex<T>&); // constexpr in C++14
|
||||
long double imag(long double); // constexpr in C++14
|
||||
double imag(double); // constexpr in C++14
|
||||
template<Integral T> double imag(T); // constexpr in C++14
|
||||
float imag(float); // constexpr in C++14
|
||||
|
||||
template<class T> T abs(const complex<T>&);
|
||||
|
||||
@@ -191,17 +191,17 @@ template<class T> T norm(const complex<T>&);
|
||||
template<Integral T> double norm(T);
|
||||
float norm(float);
|
||||
|
||||
template<class T> complex<T> conj(const complex<T>&);
|
||||
long double conj(long double);
|
||||
double conj(double);
|
||||
template<Integral T> double conj(T);
|
||||
float conj(float);
|
||||
template<class T> complex<T> conj(const complex<T>&);
|
||||
complex<long double> conj(long double);
|
||||
complex<double> conj(double);
|
||||
template<Integral T> complex<double> conj(T);
|
||||
complex<float> conj(float);
|
||||
|
||||
template<class T> complex<T> proj(const complex<T>&);
|
||||
long double proj(long double);
|
||||
double proj(double);
|
||||
template<Integral T> double proj(T);
|
||||
float proj(float);
|
||||
template<class T> complex<T> proj(const complex<T>&);
|
||||
complex<long double> proj(long double);
|
||||
complex<double> proj(double);
|
||||
template<Integral T> complex<double> proj(T);
|
||||
complex<float> proj(float);
|
||||
|
||||
template<class T> complex<T> polar(const T&, const T& = 0);
|
||||
|
||||
@@ -249,17 +249,19 @@ template<class T, class charT, class traits>
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template<class _Tp> class 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>& __x, const complex<_Tp>& __y);
|
||||
|
||||
template<class _Tp>
|
||||
class complex
|
||||
class _LIBCPP_TYPE_VIS_ONLY complex
|
||||
{
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
@@ -267,20 +269,21 @@ private:
|
||||
value_type __re_;
|
||||
value_type __im_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
complex(const value_type& __re = value_type(), const value_type& __im = value_type())
|
||||
: __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)
|
||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY value_type real() const {return __re_;}
|
||||
_LIBCPP_INLINE_VISIBILITY value_type imag() const {return __im_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type real() const {return __re_;}
|
||||
_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 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; __im_ *= __re; return *this;}
|
||||
@@ -306,39 +309,40 @@ public:
|
||||
}
|
||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
||||
{
|
||||
*this = *this * __c;
|
||||
*this = *this * complex(__c.real(), __c.imag());
|
||||
return *this;
|
||||
}
|
||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
||||
{
|
||||
*this = *this / __c;
|
||||
*this = *this / complex(__c.real(), __c.imag());
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
template<> class complex<double>;
|
||||
template<> class complex<long double>;
|
||||
template<> class _LIBCPP_TYPE_VIS_ONLY complex<double>;
|
||||
template<> class _LIBCPP_TYPE_VIS_ONLY complex<long double>;
|
||||
|
||||
template<>
|
||||
class complex<float>
|
||||
{
|
||||
class _LIBCPP_TYPE_VIS_ONLY complex<float>
|
||||
{
|
||||
float __re_;
|
||||
float __im_;
|
||||
public:
|
||||
typedef float value_type;
|
||||
public:
|
||||
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) {}
|
||||
explicit /*constexpr*/ complex(const complex<double>& __c);
|
||||
explicit /*constexpr*/ complex(const complex<long double>& __c);
|
||||
explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
|
||||
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
|
||||
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float real() const {return __re_;}
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float imag() const {return __im_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||
_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; __im_ *= __re; return *this;}
|
||||
@@ -364,36 +368,37 @@ public:
|
||||
}
|
||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
||||
{
|
||||
*this = *this * __c;
|
||||
*this = *this * complex(__c.real(), __c.imag());
|
||||
return *this;
|
||||
}
|
||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
||||
{
|
||||
*this = *this / __c;
|
||||
*this = *this / complex(__c.real(), __c.imag());
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class complex<double>
|
||||
{
|
||||
class _LIBCPP_TYPE_VIS_ONLY complex<double>
|
||||
{
|
||||
double __re_;
|
||||
double __im_;
|
||||
public:
|
||||
typedef double value_type;
|
||||
public:
|
||||
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) {}
|
||||
/*constexpr*/ complex(const complex<float>& __c);
|
||||
explicit /*constexpr*/ complex(const complex<long double>& __c);
|
||||
_LIBCPP_CONSTEXPR complex(const complex<float>& __c);
|
||||
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
|
||||
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double real() const {return __re_;}
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double imag() const {return __im_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||
_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; __im_ *= __re; return *this;}
|
||||
@@ -419,36 +424,37 @@ public:
|
||||
}
|
||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
||||
{
|
||||
*this = *this * __c;
|
||||
*this = *this * complex(__c.real(), __c.imag());
|
||||
return *this;
|
||||
}
|
||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
||||
{
|
||||
*this = *this / __c;
|
||||
*this = *this / complex(__c.real(), __c.imag());
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
class complex<long double>
|
||||
{
|
||||
class _LIBCPP_TYPE_VIS_ONLY complex<long double>
|
||||
{
|
||||
long double __re_;
|
||||
long double __im_;
|
||||
public:
|
||||
typedef long double value_type;
|
||||
public:
|
||||
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) {}
|
||||
/*constexpr*/ complex(const complex<float>& __c);
|
||||
/*constexpr*/ complex(const complex<double>& __c);
|
||||
_LIBCPP_CONSTEXPR complex(const complex<float>& __c);
|
||||
_LIBCPP_CONSTEXPR complex(const complex<double>& __c);
|
||||
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double real() const {return __re_;}
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double imag() const {return __im_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;}
|
||||
_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 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; __im_ *= __re; return *this;}
|
||||
@@ -474,43 +480,43 @@ public:
|
||||
}
|
||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
||||
{
|
||||
*this = *this * __c;
|
||||
*this = *this * complex(__c.real(), __c.imag());
|
||||
return *this;
|
||||
}
|
||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
||||
{
|
||||
*this = *this / __c;
|
||||
*this = *this / complex(__c.real(), __c.imag());
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
//constexpr
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
complex<float>::complex(const complex<double>& __c)
|
||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||
|
||||
//constexpr
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
complex<float>::complex(const complex<long double>& __c)
|
||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||
|
||||
//constexpr
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
complex<double>::complex(const complex<float>& __c)
|
||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||
|
||||
//constexpr
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
complex<double>::complex(const complex<long double>& __c)
|
||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||
|
||||
//constexpr
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
complex<long double>::complex(const complex<float>& __c)
|
||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||
|
||||
//constexpr
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
complex<long double>::complex(const complex<double>& __c)
|
||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||
|
||||
@@ -734,7 +740,7 @@ operator-(const complex<_Tp>& __x)
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool
|
||||
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>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool
|
||||
operator==(const complex<_Tp>& __x, const _Tp& __y)
|
||||
{
|
||||
@@ -750,7 +756,7 @@ operator==(const complex<_Tp>& __x, const _Tp& __y)
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool
|
||||
operator==(const _Tp& __x, const complex<_Tp>& __y)
|
||||
{
|
||||
@@ -758,7 +764,7 @@ operator==(const _Tp& __x, const complex<_Tp>& __y)
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool
|
||||
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>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool
|
||||
operator!=(const complex<_Tp>& __x, const _Tp& __y)
|
||||
{
|
||||
@@ -774,47 +780,33 @@ operator!=(const complex<_Tp>& __x, const _Tp& __y)
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool
|
||||
operator!=(const _Tp& __x, const complex<_Tp>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
/*
|
||||
Move to <istream>
|
||||
|
||||
template<class T, class charT, class traits>
|
||||
basic_istream<charT, traits>&
|
||||
operator>>(basic_istream<charT, traits>&, complex<T>&);
|
||||
|
||||
Move to <ostream>
|
||||
|
||||
template<class T, class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>&, const complex<T>&);
|
||||
*/
|
||||
|
||||
// 26.3.7 values:
|
||||
|
||||
// real
|
||||
|
||||
template<class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp
|
||||
real(const complex<_Tp>& __c)
|
||||
{
|
||||
return __c.real();
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
long double
|
||||
real(long double __re)
|
||||
{
|
||||
return __re;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
double
|
||||
real(double __re)
|
||||
{
|
||||
@@ -822,7 +814,7 @@ real(double __re)
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value,
|
||||
@@ -833,7 +825,7 @@ real(_Tp __re)
|
||||
return __re;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
float
|
||||
real(float __re)
|
||||
{
|
||||
@@ -843,21 +835,21 @@ real(float __re)
|
||||
// imag
|
||||
|
||||
template<class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp
|
||||
imag(const complex<_Tp>& __c)
|
||||
{
|
||||
return __c.imag();
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
long double
|
||||
imag(long double __re)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
double
|
||||
imag(double __re)
|
||||
{
|
||||
@@ -865,7 +857,7 @@ imag(double __re)
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value,
|
||||
@@ -876,7 +868,7 @@ imag(_Tp __re)
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
float
|
||||
imag(float __re)
|
||||
{
|
||||
@@ -994,17 +986,17 @@ conj(const complex<_Tp>& __c)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
long double
|
||||
complex<long double>
|
||||
conj(long double __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<long double>(__re);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
double
|
||||
complex<double>
|
||||
conj(double __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<double>(__re);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
@@ -1012,18 +1004,18 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value,
|
||||
double
|
||||
complex<double>
|
||||
>::type
|
||||
conj(_Tp __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<double>(__re);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
float
|
||||
complex<float>
|
||||
conj(float __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<float>(__re);
|
||||
}
|
||||
|
||||
// proj
|
||||
@@ -1040,21 +1032,21 @@ proj(const complex<_Tp>& __c)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
long double
|
||||
complex<long double>
|
||||
proj(long double __re)
|
||||
{
|
||||
if (isinf(__re))
|
||||
__re = abs(__re);
|
||||
return __re;
|
||||
return complex<long double>(__re);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
double
|
||||
complex<double>
|
||||
proj(double __re)
|
||||
{
|
||||
if (isinf(__re))
|
||||
__re = abs(__re);
|
||||
return __re;
|
||||
return complex<double>(__re);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
@@ -1062,20 +1054,20 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value,
|
||||
double
|
||||
complex<double>
|
||||
>::type
|
||||
proj(_Tp __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<double>(__re);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
float
|
||||
complex<float>
|
||||
proj(float __re)
|
||||
{
|
||||
if (isinf(__re))
|
||||
__re = abs(__re);
|
||||
return __re;
|
||||
return complex<float>(__re);
|
||||
}
|
||||
|
||||
// polar
|
||||
@@ -1187,7 +1179,7 @@ complex<typename __promote<_Tp, _Up>::type>
|
||||
pow(const complex<_Tp>& __x, const complex<_Up>& __y)
|
||||
{
|
||||
typedef complex<typename __promote<_Tp, _Up>::type> result_type;
|
||||
return _STD::pow(result_type(__x), result_type(__y));
|
||||
return _VSTD::pow(result_type(__x), result_type(__y));
|
||||
}
|
||||
|
||||
template<class _Tp, class _Up>
|
||||
@@ -1200,7 +1192,7 @@ typename enable_if
|
||||
pow(const complex<_Tp>& __x, const _Up& __y)
|
||||
{
|
||||
typedef complex<typename __promote<_Tp, _Up>::type> result_type;
|
||||
return _STD::pow(result_type(__x), result_type(__y));
|
||||
return _VSTD::pow(result_type(__x), result_type(__y));
|
||||
}
|
||||
|
||||
template<class _Tp, class _Up>
|
||||
@@ -1213,7 +1205,7 @@ typename enable_if
|
||||
pow(const _Tp& __x, const complex<_Up>& __y)
|
||||
{
|
||||
typedef complex<typename __promote<_Tp, _Up>::type> result_type;
|
||||
return _STD::pow(result_type(__x), result_type(__y));
|
||||
return _VSTD::pow(result_type(__x), result_type(__y));
|
||||
}
|
||||
|
||||
// asinh
|
||||
@@ -1257,10 +1249,12 @@ acosh(const complex<_Tp>& __x)
|
||||
if (isnan(__x.imag()))
|
||||
return complex<_Tp>(abs(__x.real()), __x.imag());
|
||||
if (isinf(__x.imag()))
|
||||
{
|
||||
if (__x.real() > 0)
|
||||
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
|
||||
else
|
||||
return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
|
||||
}
|
||||
if (__x.real() < 0)
|
||||
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
|
||||
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
||||
@@ -1359,7 +1353,11 @@ tanh(const complex<_Tp>& __x)
|
||||
_Tp __2r(_Tp(2) * __x.real());
|
||||
_Tp __2i(_Tp(2) * __x.imag());
|
||||
_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
|
||||
@@ -1523,6 +1521,47 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
|
||||
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
|
||||
|
||||
#endif // _LIBCPP_COMPLEX
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -18,8 +18,18 @@
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <ccomplex>
|
||||
|
||||
#else // __cplusplus
|
||||
|
||||
#include_next <complex.h>
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_COMPLEX_H
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -28,8 +28,8 @@ public:
|
||||
condition_variable(const condition_variable&) = delete;
|
||||
condition_variable& operator=(const condition_variable&) = delete;
|
||||
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
void notify_one() noexcept;
|
||||
void notify_all() noexcept;
|
||||
|
||||
void wait(unique_lock<mutex>& lock);
|
||||
template <class Predicate>
|
||||
@@ -61,6 +61,8 @@ public:
|
||||
native_handle_type native_handle();
|
||||
};
|
||||
|
||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
|
||||
class condition_variable_any
|
||||
{
|
||||
public:
|
||||
@@ -70,8 +72,8 @@ public:
|
||||
condition_variable_any(const condition_variable_any&) = delete;
|
||||
condition_variable_any& operator=(const condition_variable_any&) = delete;
|
||||
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
void notify_one() noexcept;
|
||||
void notify_all() noexcept;
|
||||
|
||||
template <class Lock>
|
||||
void wait(Lock& lock);
|
||||
@@ -109,19 +111,21 @@ public:
|
||||
#include <__mutex_base>
|
||||
#include <memory>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class condition_variable_any
|
||||
class _LIBCPP_TYPE_VIS condition_variable_any
|
||||
{
|
||||
condition_variable __cv_;
|
||||
shared_ptr<mutex> __mut_;
|
||||
public:
|
||||
condition_variable_any();
|
||||
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
void notify_one() _NOEXCEPT;
|
||||
void notify_all() _NOEXCEPT;
|
||||
|
||||
template <class _Lock>
|
||||
void wait(_Lock& __lock);
|
||||
@@ -151,23 +155,23 @@ public:
|
||||
_Predicate __pred);
|
||||
};
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
condition_variable_any::condition_variable_any()
|
||||
: __mut_(make_shared<mutex>()) {}
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::notify_one()
|
||||
condition_variable_any::notify_one() _NOEXCEPT
|
||||
{
|
||||
{lock_guard<mutex> _(*__mut_);}
|
||||
{lock_guard<mutex> __lx(*__mut_);}
|
||||
__cv_.notify_one();
|
||||
}
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::notify_all()
|
||||
condition_variable_any::notify_all() _NOEXCEPT
|
||||
{
|
||||
{lock_guard<mutex> _(*__mut_);}
|
||||
{lock_guard<mutex> __lx(*__mut_);}
|
||||
__cv_.notify_all();
|
||||
}
|
||||
|
||||
@@ -184,13 +188,13 @@ condition_variable_any::wait(_Lock& __lock)
|
||||
shared_ptr<mutex> __mut = __mut_;
|
||||
unique_lock<mutex> __lk(*__mut);
|
||||
__lock.unlock();
|
||||
unique_ptr<_Lock, __lock_external> __(&__lock);
|
||||
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
|
||||
unique_ptr<_Lock, __lock_external> __lxx(&__lock);
|
||||
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
|
||||
__cv_.wait(__lk);
|
||||
} // __mut_.unlock(), __lock.lock()
|
||||
|
||||
template <class _Lock, class _Predicate>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
|
||||
{
|
||||
@@ -206,13 +210,13 @@ condition_variable_any::wait_until(_Lock& __lock,
|
||||
shared_ptr<mutex> __mut = __mut_;
|
||||
unique_lock<mutex> __lk(*__mut);
|
||||
__lock.unlock();
|
||||
unique_ptr<_Lock, __lock_external> __(&__lock);
|
||||
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
|
||||
unique_ptr<_Lock, __lock_external> __lxx(&__lock);
|
||||
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
|
||||
return __cv_.wait_until(__lk, __t);
|
||||
} // __mut_.unlock(), __lock.lock()
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable_any::wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
@@ -225,25 +229,28 @@ condition_variable_any::wait_until(_Lock& __lock,
|
||||
}
|
||||
|
||||
template <class _Lock, class _Rep, class _Period>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
cv_status
|
||||
condition_variable_any::wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
return wait_until(__lock, chrono::monotonic_clock::now() + __d);
|
||||
return wait_until(__lock, chrono::steady_clock::now() + __d);
|
||||
}
|
||||
|
||||
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable_any::wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lock, chrono::monotonic_clock::now() + __d,
|
||||
_STD::move(__pred));
|
||||
return wait_until(__lock, chrono::steady_clock::now() + __d,
|
||||
_VSTD::move(__pred));
|
||||
}
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CONDITION_VARIABLE
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -34,7 +34,9 @@ void longjmp(jmp_buf env, int val);
|
||||
#include <__config>
|
||||
#include <setjmp.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef setjmp
|
||||
#define setjmp(env) setjmp(env)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -25,7 +25,7 @@ Macros:
|
||||
SIGINT
|
||||
SIGSEGV
|
||||
SIGTERM
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
@@ -43,7 +43,9 @@ int raise(int sig);
|
||||
#include <__config>
|
||||
#include <signal.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -20,7 +20,7 @@ Macros:
|
||||
void va_copy(va_list dest, va_list src); // C99
|
||||
void va_end(va_list ap);
|
||||
void va_start(va_list ap, parmN);
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
@@ -35,7 +35,9 @@ Types:
|
||||
#include <__config>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -22,7 +22,9 @@ Macros:
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#undef __bool_true_false_are_defined
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -18,7 +18,7 @@ Macros:
|
||||
|
||||
offsetof(type,member-designator)
|
||||
NULL
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
@@ -39,11 +39,13 @@ Types:
|
||||
#define __need_NULL
|
||||
#define __need_ptrdiff_t
|
||||
#define __need_size_t
|
||||
#endif
|
||||
#endif // __GLIBC__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -54,42 +56,48 @@ typedef long double max_align_t;
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
struct nullptr_t
|
||||
struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
|
||||
{
|
||||
void* _;
|
||||
void* __lx;
|
||||
|
||||
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>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
|
||||
operator _Tp* () const {return 0;}
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
operator _Tp _Up::* () const {return 0;}
|
||||
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
|
||||
};
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE 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 _STD::__get_nullptr_t()
|
||||
#define nullptr _VSTD::__get_nullptr_t()
|
||||
|
||||
#else
|
||||
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
namespace std
|
||||
{
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
#endif // _LIBCPP_CSTDDEF
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -144,7 +144,9 @@ Types:
|
||||
#include <__config>
|
||||
#include <stdint.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -74,7 +74,7 @@ int fputc(int c, FILE* stream);
|
||||
int fputs(const char* restrict s, FILE* restrict stream);
|
||||
int getc(FILE* stream);
|
||||
int getchar(void);
|
||||
char* gets(char* s);
|
||||
char* gets(char* s); // removed in C++14
|
||||
int putc(int c, FILE* stream);
|
||||
int putchar(int c);
|
||||
int puts(const char* s);
|
||||
@@ -99,7 +99,26 @@ void perror(const char* s);
|
||||
#include <__config>
|
||||
#include <stdio.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_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
|
||||
|
||||
@@ -124,20 +143,24 @@ using ::scanf;
|
||||
using ::snprintf;
|
||||
using ::sprintf;
|
||||
using ::sscanf;
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::vfprintf;
|
||||
using ::vfscanf;
|
||||
using ::vprintf;
|
||||
using ::vscanf;
|
||||
using ::vsscanf;
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
using ::vprintf;
|
||||
using ::vsnprintf;
|
||||
using ::vsprintf;
|
||||
using ::vsscanf;
|
||||
using ::fgetc;
|
||||
using ::fgets;
|
||||
using ::fputc;
|
||||
using ::fputs;
|
||||
using ::getc;
|
||||
using ::getchar;
|
||||
#if _LIBCPP_STD_VER <= 11
|
||||
using ::gets;
|
||||
#endif
|
||||
using ::putc;
|
||||
using ::putchar;
|
||||
using ::puts;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -21,7 +21,7 @@ Macros:
|
||||
MB_CUR_MAX
|
||||
NULL
|
||||
RAND_MAX
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ long labs( long j);
|
||||
long long llabs(long long j); // C99
|
||||
div_t div( int numer, int denom);
|
||||
ldiv_t div( long numer, long denom);
|
||||
lldiv_t div(long long numer, long long denom); // C++0X
|
||||
lldiv_t div(long long numer, long long denom); // C++0X
|
||||
ldiv_t ldiv( long numer, long denom);
|
||||
lldiv_t lldiv(long long numer, long long denom); // C99
|
||||
int mblen(const char* s, size_t n);
|
||||
@@ -74,6 +74,9 @@ int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
|
||||
int wctomb(char* s, wchar_t wchar);
|
||||
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);
|
||||
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
|
||||
|
||||
@@ -81,26 +84,39 @@ size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
|
||||
|
||||
#include <__config>
|
||||
#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
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::size_t;
|
||||
using ::div_t;
|
||||
using ::ldiv_t;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::lldiv_t;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::atof;
|
||||
using ::atoi;
|
||||
using ::atol;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::atoll;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::strtod;
|
||||
using ::strtof;
|
||||
using ::strtold;
|
||||
using ::strtol;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::strtoll;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::strtoul;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::strtoull;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::rand;
|
||||
using ::srand;
|
||||
using ::calloc;
|
||||
@@ -117,21 +133,39 @@ using ::bsearch;
|
||||
using ::qsort;
|
||||
using ::abs;
|
||||
using ::labs;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::llabs;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::div;
|
||||
using ::ldiv;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::lldiv;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::mblen;
|
||||
using ::mbtowc;
|
||||
using ::wctomb;
|
||||
using ::mbstowcs;
|
||||
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);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
|
||||
// MSVCRT already has the correct prototype in <stdlib.h> #ifdef __cplusplus
|
||||
#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 lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__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
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
Macros:
|
||||
|
||||
NULL
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
@@ -60,7 +60,9 @@ size_t strlen(const char* s);
|
||||
#include <__config>
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -77,24 +79,28 @@ using ::strncmp;
|
||||
using ::strcoll;
|
||||
using ::strxfrm;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const void* memchr(const void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
|
||||
using ::memchr;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const char* strchr(const char* __s, int __c) {return ::strchr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
|
||||
using ::strchr;
|
||||
|
||||
using ::strcspn;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const char* strpbrk(const char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
|
||||
using ::strpbrk;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const char* strrchr(const char* __s, int __c) {return ::strrchr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
|
||||
using ::strrchr;
|
||||
|
||||
using ::strspn;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY const char* strstr(const char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
|
||||
using ::strstr;
|
||||
|
||||
// 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* 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 void* memchr( void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strstr( char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
|
||||
#endif
|
||||
|
||||
using ::strtok;
|
||||
using ::memset;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include <ccomplex>
|
||||
#include <cmath>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CTGMATH
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -18,7 +18,7 @@ Macros:
|
||||
|
||||
NULL
|
||||
CLOCKS_PER_SEC
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
@@ -47,7 +47,9 @@ size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
|
||||
#include <__config>
|
||||
#include <time.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -20,7 +20,7 @@ Macros:
|
||||
WCHAR_MAX
|
||||
WCHAR_MIN
|
||||
WEOF
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ wint_t fputwc(wchar_t c, FILE* stream);
|
||||
int fputws(const wchar_t* restrict s, FILE* restrict stream);
|
||||
int fwide(FILE* stream, int mode);
|
||||
wint_t getwc(FILE* stream);
|
||||
wint_t getwchar();
|
||||
wint_t getwchar();
|
||||
wint_t putwc(wchar_t c, FILE* stream);
|
||||
wint_t putwchar(wchar_t c);
|
||||
wint_t ungetwc(wint_t c, FILE* stream);
|
||||
@@ -92,10 +92,10 @@ wint_t btowc(int c);
|
||||
int wctob(wint_t c);
|
||||
int mbsinit(const mbstate_t* ps);
|
||||
size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
|
||||
size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
|
||||
size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
|
||||
size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
|
||||
size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
|
||||
mbstate_t* restrict ps);
|
||||
mbstate_t* restrict ps);
|
||||
size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
|
||||
mbstate_t* restrict ps);
|
||||
|
||||
@@ -106,8 +106,13 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
|
||||
#include <__config>
|
||||
#include <cwctype>
|
||||
#include <wchar.h>
|
||||
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||
#include <support/win32/support.h> // pull in *swprintf defines
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -119,13 +124,15 @@ using ::FILE;
|
||||
using ::fwprintf;
|
||||
using ::fwscanf;
|
||||
using ::swprintf;
|
||||
using ::swscanf;
|
||||
using ::vfwprintf;
|
||||
using ::vfwscanf;
|
||||
using ::vswprintf;
|
||||
using ::vswscanf;
|
||||
using ::vwprintf;
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::swscanf;
|
||||
using ::vfwscanf;
|
||||
using ::vswscanf;
|
||||
using ::vwscanf;
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
using ::wprintf;
|
||||
using ::wscanf;
|
||||
using ::fgetwc;
|
||||
@@ -139,12 +146,18 @@ using ::putwc;
|
||||
using ::putwchar;
|
||||
using ::ungetwc;
|
||||
using ::wcstod;
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::wcstof;
|
||||
using ::wcstold;
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
using ::wcstol;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::wcstoll;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::wcstoul;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::wcstoull;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
using ::wcscpy;
|
||||
using ::wcsncpy;
|
||||
using ::wcscat;
|
||||
@@ -154,28 +167,37 @@ using ::wcscoll;
|
||||
using ::wcsncmp;
|
||||
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 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 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 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 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 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 ::wmemcpy;
|
||||
using ::wmemmove;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
Macros:
|
||||
|
||||
WEOF
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
@@ -54,7 +54,9 @@ wctrans_t wctrans(const char* property);
|
||||
#include <cctype>
|
||||
#include <wctype.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -66,7 +68,7 @@ using ::wctype_t;
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalnum(wint_t __wc) {return iswalnum(__wc);}
|
||||
#undef iswalnum
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswalnum(wint_t __wc) {return __libcpp_iswalnum(__wc);}
|
||||
#else
|
||||
#else // iswalnum
|
||||
using ::iswalnum;
|
||||
#endif
|
||||
|
||||
@@ -74,7 +76,7 @@ using ::iswalnum;
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalpha(wint_t __wc) {return iswalpha(__wc);}
|
||||
#undef iswalpha
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswalpha(wint_t __wc) {return __libcpp_iswalpha(__wc);}
|
||||
#else
|
||||
#else // iswalpha
|
||||
using ::iswalpha;
|
||||
#endif
|
||||
|
||||
@@ -82,7 +84,7 @@ using ::iswalpha;
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswblank(wint_t __wc) {return iswblank(__wc);}
|
||||
#undef iswblank
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswblank(wint_t __wc) {return __libcpp_iswblank(__wc);}
|
||||
#else
|
||||
#else // iswblank
|
||||
using ::iswblank;
|
||||
#endif
|
||||
|
||||
@@ -90,7 +92,7 @@ using ::iswblank;
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswcntrl(wint_t __wc) {return iswcntrl(__wc);}
|
||||
#undef iswcntrl
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswcntrl(wint_t __wc) {return __libcpp_iswcntrl(__wc);}
|
||||
#else
|
||||
#else // iswcntrl
|
||||
using ::iswcntrl;
|
||||
#endif
|
||||
|
||||
@@ -98,7 +100,7 @@ using ::iswcntrl;
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswdigit(wint_t __wc) {return iswdigit(__wc);}
|
||||
#undef iswdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswdigit(wint_t __wc) {return __libcpp_iswdigit(__wc);}
|
||||
#else
|
||||
#else // iswdigit
|
||||
using ::iswdigit;
|
||||
#endif
|
||||
|
||||
@@ -106,7 +108,7 @@ using ::iswdigit;
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswgraph(wint_t __wc) {return iswgraph(__wc);}
|
||||
#undef iswgraph
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswgraph(wint_t __wc) {return __libcpp_iswgraph(__wc);}
|
||||
#else
|
||||
#else // iswgraph
|
||||
using ::iswgraph;
|
||||
#endif
|
||||
|
||||
@@ -114,7 +116,7 @@ using ::iswgraph;
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswlower(wint_t __wc) {return iswlower(__wc);}
|
||||
#undef iswlower
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswlower(wint_t __wc) {return __libcpp_iswlower(__wc);}
|
||||
#else
|
||||
#else // iswlower
|
||||
using ::iswlower;
|
||||
#endif
|
||||
|
||||
@@ -122,7 +124,7 @@ using ::iswlower;
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswprint(wint_t __wc) {return iswprint(__wc);}
|
||||
#undef iswprint
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswprint(wint_t __wc) {return __libcpp_iswprint(__wc);}
|
||||
#else
|
||||
#else // iswprint
|
||||
using ::iswprint;
|
||||
#endif
|
||||
|
||||
@@ -130,7 +132,7 @@ using ::iswprint;
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswpunct(wint_t __wc) {return iswpunct(__wc);}
|
||||
#undef iswpunct
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswpunct(wint_t __wc) {return __libcpp_iswpunct(__wc);}
|
||||
#else
|
||||
#else // iswpunct
|
||||
using ::iswpunct;
|
||||
#endif
|
||||
|
||||
@@ -138,7 +140,7 @@ using ::iswpunct;
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswspace(wint_t __wc) {return iswspace(__wc);}
|
||||
#undef iswspace
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswspace(wint_t __wc) {return __libcpp_iswspace(__wc);}
|
||||
#else
|
||||
#else // iswspace
|
||||
using ::iswspace;
|
||||
#endif
|
||||
|
||||
@@ -146,7 +148,7 @@ using ::iswspace;
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswupper(wint_t __wc) {return iswupper(__wc);}
|
||||
#undef iswupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswupper(wint_t __wc) {return __libcpp_iswupper(__wc);}
|
||||
#else
|
||||
#else // iswupper
|
||||
using ::iswupper;
|
||||
#endif
|
||||
|
||||
@@ -154,7 +156,7 @@ using ::iswupper;
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswxdigit(wint_t __wc) {return iswxdigit(__wc);}
|
||||
#undef iswxdigit
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswxdigit(wint_t __wc) {return __libcpp_iswxdigit(__wc);}
|
||||
#else
|
||||
#else // iswxdigit
|
||||
using ::iswxdigit;
|
||||
#endif
|
||||
|
||||
@@ -162,7 +164,7 @@ using ::iswxdigit;
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswctype(wint_t __w, wctype_t __d) {return iswctype(__w, __d);}
|
||||
#undef iswctype
|
||||
inline _LIBCPP_INLINE_VISIBILITY int iswctype(wint_t __w, wctype_t __d) {return __libcpp_iswctype(__w, __d);}
|
||||
#else
|
||||
#else // iswctype
|
||||
using ::iswctype;
|
||||
#endif
|
||||
|
||||
@@ -170,7 +172,7 @@ using ::iswctype;
|
||||
inline _LIBCPP_INLINE_VISIBILITY wctype_t __libcpp_wctype(const char* __p) {return wctype(__p);}
|
||||
#undef wctype
|
||||
inline _LIBCPP_INLINE_VISIBILITY wctype_t wctype(const char* __p) {return __libcpp_wctype(__p);}
|
||||
#else
|
||||
#else // wctype
|
||||
using ::wctype;
|
||||
#endif
|
||||
|
||||
@@ -178,7 +180,7 @@ using ::wctype;
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towlower(wint_t __wc) {return towlower(__wc);}
|
||||
#undef towlower
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t towlower(wint_t __wc) {return __libcpp_towlower(__wc);}
|
||||
#else
|
||||
#else // towlower
|
||||
using ::towlower;
|
||||
#endif
|
||||
|
||||
@@ -186,7 +188,7 @@ using ::towlower;
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towupper(wint_t __wc) {return towupper(__wc);}
|
||||
#undef towupper
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t towupper(wint_t __wc) {return __libcpp_towupper(__wc);}
|
||||
#else
|
||||
#else // towupper
|
||||
using ::towupper;
|
||||
#endif
|
||||
|
||||
@@ -194,7 +196,7 @@ using ::towupper;
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towctrans(wint_t __wc, wctype_t __d) {return towctrans(__wc, __d);}
|
||||
#undef towctrans
|
||||
inline _LIBCPP_INLINE_VISIBILITY wint_t towctrans(wint_t __wc, wctype_t __d) {return __libcpp_towctrans(__wc, __d);}
|
||||
#else
|
||||
#else // towctrans
|
||||
using ::towctrans;
|
||||
#endif
|
||||
|
||||
@@ -202,7 +204,7 @@ using ::towctrans;
|
||||
inline _LIBCPP_INLINE_VISIBILITY wctrans_t __libcpp_wctrans(const char* __p) {return wctrans(__p);}
|
||||
#undef wctrans
|
||||
inline _LIBCPP_INLINE_VISIBILITY wctrans_t wctrans(const char* __p) {return __libcpp_wctrans(__p);}
|
||||
#else
|
||||
#else // wctrans
|
||||
using ::wctrans;
|
||||
#endif
|
||||
|
||||
|
||||
683
include/deque
683
include/deque
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -20,54 +20,56 @@ namespace std
|
||||
class exception
|
||||
{
|
||||
public:
|
||||
exception() throw();
|
||||
exception(const exception&) throw();
|
||||
exception& operator=(const exception&) throw();
|
||||
virtual ~exception() throw();
|
||||
virtual const char* what() const throw();
|
||||
exception() noexcept;
|
||||
exception(const exception&) noexcept;
|
||||
exception& operator=(const exception&) noexcept;
|
||||
virtual ~exception() noexcept;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
class bad_exception
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_exception() throw();
|
||||
bad_exception(const bad_exception&) throw();
|
||||
bad_exception& operator=(const bad_exception&) throw();
|
||||
virtual ~bad_exception() throw();
|
||||
virtual const char* what() const throw();
|
||||
bad_exception() noexcept;
|
||||
bad_exception(const bad_exception&) noexcept;
|
||||
bad_exception& operator=(const bad_exception&) noexcept;
|
||||
virtual ~bad_exception() noexcept;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
typedef void (*unexpected_handler)();
|
||||
unexpected_handler set_unexpected(unexpected_handler f ) throw();
|
||||
void unexpected [[noreturn]] ();
|
||||
unexpected_handler set_unexpected(unexpected_handler f ) noexcept;
|
||||
unexpected_handler get_unexpected() noexcept;
|
||||
[[noreturn]] void unexpected();
|
||||
|
||||
typedef void (*terminate_handler)();
|
||||
terminate_handler set_terminate(terminate_handler f ) throw();
|
||||
void terminate [[noreturn]] ();
|
||||
terminate_handler set_terminate(terminate_handler f ) noexcept;
|
||||
terminate_handler get_terminate() noexcept;
|
||||
[[noreturn]] void terminate() noexcept;
|
||||
|
||||
bool uncaught_exception() throw();
|
||||
bool uncaught_exception() noexcept;
|
||||
|
||||
typedef unspecified exception_ptr;
|
||||
|
||||
exception_ptr current_exception();
|
||||
exception_ptr current_exception() noexcept;
|
||||
void rethrow_exception [[noreturn]] (exception_ptr p);
|
||||
template<class E> exception_ptr make_exception_ptr(E e);
|
||||
template<class E> exception_ptr make_exception_ptr(E e) noexcept;
|
||||
|
||||
class nested_exception
|
||||
{
|
||||
public:
|
||||
nested_exception() throw();
|
||||
nested_exception(const nested_exception&) throw() = default;
|
||||
nested_exception& operator=(const nested_exception&) throw() = default;
|
||||
nested_exception() noexcept;
|
||||
nested_exception(const nested_exception&) noexcept = default;
|
||||
nested_exception& operator=(const nested_exception&) noexcept = default;
|
||||
virtual ~nested_exception() = default;
|
||||
|
||||
// access functions
|
||||
void rethrow_nested [[noreturn]] () const;
|
||||
exception_ptr nested_ptr() const;
|
||||
[[noreturn]] void rethrow_nested() const;
|
||||
exception_ptr nested_ptr() const noexcept;
|
||||
};
|
||||
|
||||
template <class T> void throw_with_nested [[noreturn]] (T&& t);
|
||||
template <class T> [[noreturn]] void throw_with_nested(T&& t);
|
||||
template <class E> void rethrow_if_nested(const E& e);
|
||||
|
||||
} // std
|
||||
@@ -78,7 +80,9 @@ template <class E> void rethrow_if_nested(const E& e);
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
@@ -86,61 +90,67 @@ namespace std // purposefully not using versioning namespace
|
||||
class _LIBCPP_EXCEPTION_ABI exception
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY exception() throw() {}
|
||||
virtual ~exception() throw();
|
||||
virtual const char* what() const throw();
|
||||
_LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {}
|
||||
virtual ~exception() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_exception
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY bad_exception() throw() {}
|
||||
virtual ~bad_exception() throw();
|
||||
virtual const char* what() const throw();
|
||||
_LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {}
|
||||
virtual ~bad_exception() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
typedef void (*unexpected_handler)();
|
||||
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) throw();
|
||||
_LIBCPP_VISIBLE void unexpected();
|
||||
_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected();
|
||||
|
||||
typedef void (*terminate_handler)();
|
||||
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) throw();
|
||||
_LIBCPP_VISIBLE void terminate() __attribute__((__noreturn__));
|
||||
_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_VISIBLE bool uncaught_exception() throw();
|
||||
_LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT;
|
||||
|
||||
class exception_ptr;
|
||||
class _LIBCPP_TYPE_VIS exception_ptr;
|
||||
|
||||
exception_ptr current_exception();
|
||||
void rethrow_exception(exception_ptr); // noreturn
|
||||
_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
|
||||
|
||||
class exception_ptr
|
||||
class _LIBCPP_TYPE_VIS exception_ptr
|
||||
{
|
||||
void* __ptr_;
|
||||
public:
|
||||
exception_ptr() : __ptr_() {}
|
||||
exception_ptr(nullptr_t) : __ptr_() {}
|
||||
exception_ptr(const exception_ptr&);
|
||||
exception_ptr& operator=(const exception_ptr&);
|
||||
~exception_ptr();
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
|
||||
exception_ptr(const exception_ptr&) _NOEXCEPT;
|
||||
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
|
||||
~exception_ptr() _NOEXCEPT;
|
||||
|
||||
// explicit
|
||||
operator bool() const {return __ptr_ != nullptr;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
|
||||
|
||||
friend bool operator==(const exception_ptr& __x, const exception_ptr& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||
{return __x.__ptr_ == __y.__ptr_;}
|
||||
friend bool operator!=(const exception_ptr& __x, const exception_ptr& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||
{return !(__x == __y);}
|
||||
|
||||
friend exception_ptr current_exception();
|
||||
friend void rethrow_exception(exception_ptr); // noreturn
|
||||
friend _LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
|
||||
friend _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
|
||||
};
|
||||
|
||||
template<class _E>
|
||||
template<class _Ep>
|
||||
exception_ptr
|
||||
make_exception_ptr(_E __e)
|
||||
make_exception_ptr(_Ep __e) _NOEXCEPT
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
throw __e;
|
||||
@@ -149,6 +159,7 @@ make_exception_ptr(_E __e)
|
||||
{
|
||||
return current_exception();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
|
||||
// nested_exception
|
||||
@@ -157,14 +168,14 @@ class _LIBCPP_EXCEPTION_ABI nested_exception
|
||||
{
|
||||
exception_ptr __ptr_;
|
||||
public:
|
||||
nested_exception();
|
||||
// nested_exception(const nested_exception&) throw() = default;
|
||||
// nested_exception& operator=(const nested_exception&) throw() = default;
|
||||
virtual ~nested_exception();
|
||||
nested_exception() _NOEXCEPT;
|
||||
// nested_exception(const nested_exception&) noexcept = default;
|
||||
// nested_exception& operator=(const nested_exception&) noexcept = default;
|
||||
virtual ~nested_exception() _NOEXCEPT;
|
||||
|
||||
// access functions
|
||||
void rethrow_nested /*[[noreturn]]*/ () const;
|
||||
exception_ptr nested_ptr() const {return __ptr_;}
|
||||
_LIBCPP_NORETURN void rethrow_nested() const;
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
@@ -172,46 +183,52 @@ struct __nested
|
||||
: public _Tp,
|
||||
public nested_exception
|
||||
{
|
||||
explicit __nested(const _Tp& __t) : _Tp(__t) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
void
|
||||
#ifdef _LIBCPP_MOVE
|
||||
throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if<
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
is_class<typename remove_reference<_Tp>::type>::value &&
|
||||
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
is_class<_Tp>::value && !is_base_of<nested_exception, _Tp>::value
|
||||
>::type* = 0)
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
throw __nested<typename remove_reference<_Tp>::type>(_STD::forward<_Tp>(__t));
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw __nested<typename remove_reference<_Tp>::type>(_VSTD::forward<_Tp>(__t));
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
void
|
||||
#ifdef _LIBCPP_MOVE
|
||||
throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if<
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
!is_class<typename remove_reference<_Tp>::type>::value ||
|
||||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
!is_class<_Tp>::value || is_base_of<nested_exception, _Tp>::value
|
||||
>::type* = 0)
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
throw _STD::forward<_Tp>(__t);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw _VSTD::forward<_Tp>(__t);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _E>
|
||||
inline
|
||||
template <class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _E& __e, typename enable_if<
|
||||
is_polymorphic<_E>::value
|
||||
rethrow_if_nested(const _Ep& __e, typename enable_if<
|
||||
is_polymorphic<_Ep>::value
|
||||
>::type* = 0)
|
||||
{
|
||||
const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
|
||||
@@ -219,11 +236,11 @@ rethrow_if_nested(const _E& __e, typename enable_if<
|
||||
__nep->rethrow_nested();
|
||||
}
|
||||
|
||||
template <class _E>
|
||||
inline
|
||||
template <class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _E& __e, typename enable_if<
|
||||
!is_polymorphic<_E>::value
|
||||
rethrow_if_nested(const _Ep&, typename enable_if<
|
||||
!is_polymorphic<_Ep>::value
|
||||
>::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
|
||||
46
include/ext/__hash
Normal file
46
include/ext/__hash
Normal file
@@ -0,0 +1,46 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------------- hash_set ------------------------------------===//
|
||||
//
|
||||
// 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_EXT_HASH
|
||||
#define _LIBCPP_EXT_HASH
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
namespace __gnu_cxx {
|
||||
using namespace std;
|
||||
|
||||
template <typename _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash : public std::hash<_Tp>
|
||||
{ };
|
||||
|
||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<const char*>
|
||||
: public unary_function<const char*, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const char *__c) const _NOEXCEPT
|
||||
{
|
||||
return __do_string_hash(__c, __c + strlen(__c));
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<char *>
|
||||
: public unary_function<char*, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char *__c) const _NOEXCEPT
|
||||
{
|
||||
return __do_string_hash<const char *>(__c, __c + strlen(__c));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_EXT_HASH
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -203,8 +203,15 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
#include <__hash_table>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
#include <ext/__hash>
|
||||
|
||||
#warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
|
||||
#if __DEPRECATED
|
||||
#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
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
@@ -212,16 +219,22 @@ namespace __gnu_cxx {
|
||||
|
||||
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
|
||||
: private _Hash
|
||||
{
|
||||
public:
|
||||
__hash_map_hasher() : _Hash() {}
|
||||
__hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
|
||||
const _Hash& hash_function() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : _Hash() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _Tp& __x) const
|
||||
{return static_cast<const _Hash&>(*this)(__x.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const typename _Tp::first_type& __x) const
|
||||
{return static_cast<const _Hash&>(*this)(__x);}
|
||||
};
|
||||
@@ -231,30 +244,40 @@ class __hash_map_hasher<_Tp, _Hash, false>
|
||||
{
|
||||
_Hash __hash_;
|
||||
public:
|
||||
__hash_map_hasher() : __hash_() {}
|
||||
__hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
|
||||
const _Hash& hash_function() const {return __hash_;}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : __hash_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return __hash_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _Tp& __x) const
|
||||
{return __hash_(__x.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const typename _Tp::first_type& __x) const
|
||||
{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
|
||||
: private _Pred
|
||||
{
|
||||
public:
|
||||
__hash_map_equal() : _Pred() {}
|
||||
__hash_map_equal(const _Pred& __p) : _Pred(__p) {}
|
||||
const _Pred& key_eq() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_equal() : _Pred() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : _Pred(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const _Tp& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x.first, __y);}
|
||||
bool operator()(const typename _Tp::first_type& __x,
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Tp::first_type& __x,
|
||||
const typename _Tp::first_type& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x, __y);}
|
||||
};
|
||||
@@ -264,15 +287,19 @@ class __hash_map_equal<_Tp, _Pred, false>
|
||||
{
|
||||
_Pred __pred_;
|
||||
public:
|
||||
__hash_map_equal() : __pred_() {}
|
||||
__hash_map_equal(const _Pred& __p) : __pred_(__p) {}
|
||||
const _Pred& key_eq() const {return __pred_;}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_equal() : __pred_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : __pred_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return __pred_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const _Tp& __y) const
|
||||
{return __pred_(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
|
||||
{return __pred_(__x, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
|
||||
{return __pred_(__x.first, __y);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Tp::first_type& __x,
|
||||
const typename _Tp::first_type& __y) const
|
||||
{return __pred_(__x, __y);}
|
||||
@@ -298,13 +325,15 @@ public:
|
||||
bool __first_constructed;
|
||||
bool __second_constructed;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __hash_map_node_destructor(allocator_type& __na)
|
||||
: __na_(__na),
|
||||
__first_constructed(false),
|
||||
__second_constructed(false)
|
||||
{}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
|
||||
: __na_(__x.__na_),
|
||||
__first_constructed(__x.__value_constructed),
|
||||
@@ -312,7 +341,8 @@ public:
|
||||
{
|
||||
__x.__value_constructed = false;
|
||||
}
|
||||
#else
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
|
||||
: __na_(__x.__na_),
|
||||
__first_constructed(__x.__value_constructed),
|
||||
@@ -320,21 +350,22 @@ public:
|
||||
{
|
||||
const_cast<bool&>(__x.__value_constructed) = false;
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()(pointer __p)
|
||||
{
|
||||
if (__second_constructed)
|
||||
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
|
||||
if (__first_constructed)
|
||||
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first));
|
||||
if (__p)
|
||||
__alloc_traits::deallocate(__na_, __p, 1);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _HashIterator>
|
||||
class __hash_map_iterator
|
||||
class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator
|
||||
{
|
||||
_HashIterator __i_;
|
||||
|
||||
@@ -354,14 +385,15 @@ public:
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
__hash_map_iterator() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {}
|
||||
|
||||
__hash_map_iterator(_HashIterator __i) : __i_(__i) {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator(_HashIterator __i) : __i_(__i) {}
|
||||
|
||||
reference operator*() const {return *operator->();}
|
||||
pointer operator->() const {return (pointer)__i_.operator->();}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *operator->();}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return (pointer)__i_.operator->();}
|
||||
|
||||
__hash_map_iterator& operator++() {++__i_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator& operator++() {++__i_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_iterator operator++(int)
|
||||
{
|
||||
__hash_map_iterator __t(*this);
|
||||
@@ -369,20 +401,22 @@ public:
|
||||
return __t;
|
||||
}
|
||||
|
||||
friend bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
||||
{return __x.__i_ == __y.__i_;}
|
||||
friend bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
||||
{return __x.__i_ != __y.__i_;}
|
||||
|
||||
template <class, class, class, class, class> friend class hash_map;
|
||||
template <class, class, class, class, class> friend class hash_multimap;
|
||||
template <class> friend class __hash_const_iterator;
|
||||
template <class> friend class __hash_const_local_iterator;
|
||||
template <class> friend class __hash_map_const_iterator;
|
||||
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_map;
|
||||
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_multimap;
|
||||
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
|
||||
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
|
||||
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
|
||||
};
|
||||
|
||||
template <class _HashIterator>
|
||||
class __hash_map_const_iterator
|
||||
class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator
|
||||
{
|
||||
_HashIterator __i_;
|
||||
|
||||
@@ -402,17 +436,23 @@ public:
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
__hash_map_const_iterator() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator(
|
||||
__hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
|
||||
: __i_(__i.__i_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return *operator->();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const {return (pointer)__i_.operator->();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator& operator++() {++__i_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator operator++(int)
|
||||
{
|
||||
__hash_map_const_iterator __t(*this);
|
||||
@@ -420,25 +460,28 @@ public:
|
||||
return __t;
|
||||
}
|
||||
|
||||
friend bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
||||
{return __x.__i_ == __y.__i_;}
|
||||
friend bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
||||
{return __x.__i_ != __y.__i_;}
|
||||
|
||||
template <class, class, class, class, class> friend class hash_map;
|
||||
template <class, class, class, class, class> friend class hash_multimap;
|
||||
template <class> friend class __hash_const_iterator;
|
||||
template <class> friend class __hash_const_local_iterator;
|
||||
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_map;
|
||||
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_multimap;
|
||||
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_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>,
|
||||
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
||||
class hash_map
|
||||
class _LIBCPP_TYPE_VIS_ONLY hash_map
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef _Key key_type;
|
||||
typedef _Tp mapped_type;
|
||||
typedef _Tp data_type;
|
||||
typedef _Hash hasher;
|
||||
typedef _Pred key_equal;
|
||||
typedef _Alloc allocator_type;
|
||||
@@ -468,8 +511,8 @@ private:
|
||||
typedef typename __table::__node_traits __node_traits;
|
||||
typedef typename __table::__node_allocator __node_allocator;
|
||||
typedef typename __table::__node __node;
|
||||
typedef __hash_map_node_destructor<__node_allocator> _D;
|
||||
typedef unique_ptr<__node, _D> __node_holder;
|
||||
typedef __hash_map_node_destructor<__node_allocator> _Dp;
|
||||
typedef unique_ptr<__node, _Dp> __node_holder;
|
||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||
public:
|
||||
typedef typename __alloc_traits::pointer pointer;
|
||||
@@ -480,7 +523,7 @@ public:
|
||||
typedef __hash_map_iterator<typename __table::iterator> iterator;
|
||||
typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
|
||||
|
||||
hash_map() {__table_.rehash(193);}
|
||||
_LIBCPP_INLINE_VISIBILITY hash_map() {__table_.rehash(193);}
|
||||
explicit hash_map(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
hash_map(size_type __n, const hasher& __hf,
|
||||
@@ -499,52 +542,79 @@ public:
|
||||
const allocator_type& __a);
|
||||
hash_map(const hash_map& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(const value_type& __x)
|
||||
{return __table_.__insert_unique(__x);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first.__i_, __last.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_map& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const
|
||||
{return __table_.hash_function().hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const
|
||||
{return __table_.key_eq().key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
|
||||
mapped_type& operator[](const key_type& __k);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const
|
||||
{return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
|
||||
private:
|
||||
@@ -613,17 +683,17 @@ typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
|
||||
{
|
||||
__node_allocator& __na = __table_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_.first), __k);
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, addressof(__h->__value_.second));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return _STD::move(__h);
|
||||
return _VSTD::move(__h); // explicitly moved for C++03
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
@@ -646,7 +716,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
@@ -674,7 +744,7 @@ operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
@@ -684,12 +754,13 @@ operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
|
||||
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
|
||||
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
||||
class hash_multimap
|
||||
class _LIBCPP_TYPE_VIS_ONLY hash_multimap
|
||||
{
|
||||
public:
|
||||
// types
|
||||
typedef _Key key_type;
|
||||
typedef _Tp mapped_type;
|
||||
typedef _Tp data_type;
|
||||
typedef _Hash hasher;
|
||||
typedef _Pred key_equal;
|
||||
typedef _Alloc allocator_type;
|
||||
@@ -717,8 +788,8 @@ private:
|
||||
typedef typename __table::__node_traits __node_traits;
|
||||
typedef typename __table::__node_allocator __node_allocator;
|
||||
typedef typename __table::__node __node;
|
||||
typedef __hash_map_node_destructor<__node_allocator> _D;
|
||||
typedef unique_ptr<__node, _D> __node_holder;
|
||||
typedef __hash_map_node_destructor<__node_allocator> _Dp;
|
||||
typedef unique_ptr<__node, _Dp> __node_holder;
|
||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||
public:
|
||||
typedef typename __alloc_traits::pointer pointer;
|
||||
@@ -729,6 +800,7 @@ public:
|
||||
typedef __hash_map_iterator<typename __table::iterator> iterator;
|
||||
typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hash_multimap() {__table_.rehash(193);}
|
||||
explicit hash_multimap(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
@@ -748,49 +820,76 @@ public:
|
||||
const allocator_type& __a);
|
||||
hash_multimap(const hash_multimap& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first.__i_, __last.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_multimap& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const
|
||||
{return __table_.hash_function().hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const
|
||||
{return __table_.key_eq().key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const
|
||||
{return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
};
|
||||
|
||||
@@ -853,7 +952,7 @@ hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
@@ -863,7 +962,7 @@ hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
@@ -885,9 +984,9 @@ operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
{
|
||||
_EqRng __xeq = __x.equal_range(__i->first);
|
||||
_EqRng __yeq = __y.equal_range(__i->first);
|
||||
if (_STD::distance(__xeq.first, __xeq.second) !=
|
||||
_STD::distance(__yeq.first, __yeq.second) ||
|
||||
!_STD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
if (_VSTD::distance(__xeq.first, __xeq.second) !=
|
||||
_VSTD::distance(__yeq.first, __yeq.second) ||
|
||||
!_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
return false;
|
||||
__i = __xeq.second;
|
||||
}
|
||||
@@ -895,7 +994,7 @@ operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -196,16 +196,23 @@ template <class Value, class Hash, class Pred, class Alloc>
|
||||
#include <__config>
|
||||
#include <__hash_table>
|
||||
#include <functional>
|
||||
#include <ext/__hash>
|
||||
|
||||
#warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
|
||||
#if __DEPRECATED
|
||||
#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
|
||||
|
||||
namespace __gnu_cxx {
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <class _Value, class _Hash = std::hash<_Value>, class _Pred = equal_to<_Value>,
|
||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
||||
class _Alloc = allocator<_Value> >
|
||||
class hash_set
|
||||
class _LIBCPP_TYPE_VIS_ONLY hash_set
|
||||
{
|
||||
public:
|
||||
// types
|
||||
@@ -231,6 +238,7 @@ public:
|
||||
typedef typename __table::const_iterator iterator;
|
||||
typedef typename __table::const_iterator const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hash_set() {__table_.rehash(193);}
|
||||
explicit hash_set(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
@@ -248,47 +256,74 @@ public:
|
||||
const allocator_type& __a);
|
||||
hash_set(const hash_set& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(const value_type& __x)
|
||||
{return __table_.__insert_unique(__x);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first, __last);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_set& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const {return __table_.hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const {return __table_.key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
};
|
||||
|
||||
@@ -350,7 +385,7 @@ hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
@@ -360,7 +395,7 @@ hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
@@ -388,7 +423,7 @@ operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
@@ -398,7 +433,7 @@ operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
|
||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
||||
class _Alloc = allocator<_Value> >
|
||||
class hash_multiset
|
||||
class _LIBCPP_TYPE_VIS_ONLY hash_multiset
|
||||
{
|
||||
public:
|
||||
// types
|
||||
@@ -424,6 +459,7 @@ public:
|
||||
typedef typename __table::const_iterator iterator;
|
||||
typedef typename __table::const_iterator const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hash_multiset() {__table_.rehash(193);}
|
||||
explicit hash_multiset(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
@@ -441,46 +477,73 @@ public:
|
||||
const key_equal& __eql, const allocator_type& __a);
|
||||
hash_multiset(const hash_multiset& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first, __last);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_multiset& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const {return __table_.hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const {return __table_.key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
};
|
||||
|
||||
@@ -543,7 +606,7 @@ hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
@@ -553,7 +616,7 @@ hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
@@ -575,9 +638,9 @@ operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
{
|
||||
_EqRng __xeq = __x.equal_range(*__i);
|
||||
_EqRng __yeq = __y.equal_range(*__i);
|
||||
if (_STD::distance(__xeq.first, __xeq.second) !=
|
||||
_STD::distance(__yeq.first, __yeq.second) ||
|
||||
!_STD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
if (_VSTD::distance(__xeq.first, __xeq.second) !=
|
||||
_VSTD::distance(__yeq.first, __yeq.second) ||
|
||||
!_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
return false;
|
||||
__i = __xeq.second;
|
||||
}
|
||||
@@ -585,7 +648,7 @@ operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
203
include/fstream
203
include/fstream
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
void close();
|
||||
};
|
||||
|
||||
template <class charT, class traits>
|
||||
template <class charT, class traits>
|
||||
void
|
||||
swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
|
||||
|
||||
@@ -171,12 +171,16 @@ typedef basic_fstream<wchar_t> wfstream;
|
||||
#include <__locale>
|
||||
#include <cstdio>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_filebuf
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_filebuf
|
||||
: public basic_streambuf<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -189,13 +193,13 @@ public:
|
||||
|
||||
// 27.9.1.2 Constructors/destructor:
|
||||
basic_filebuf();
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_filebuf(basic_filebuf&& __rhs);
|
||||
#endif
|
||||
virtual ~basic_filebuf();
|
||||
|
||||
// 27.9.1.3 Assign/swap:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_filebuf& operator=(basic_filebuf&& __rhs);
|
||||
#endif
|
||||
void swap(basic_filebuf& __rhs);
|
||||
@@ -230,6 +234,7 @@ private:
|
||||
FILE* __file_;
|
||||
const codecvt<char_type, char, state_type>* __cv_;
|
||||
state_type __st_;
|
||||
state_type __st_last_;
|
||||
ios_base::openmode __om_;
|
||||
ios_base::openmode __cm_;
|
||||
bool __owns_eb_;
|
||||
@@ -249,18 +254,24 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
|
||||
__intbuf_(0),
|
||||
__ibs_(0),
|
||||
__file_(0),
|
||||
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
|
||||
__cv_(nullptr),
|
||||
__st_(),
|
||||
__st_last_(),
|
||||
__om_(0),
|
||||
__cm_(0),
|
||||
__owns_eb_(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);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
|
||||
@@ -284,6 +295,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
|
||||
__file_ = __rhs.__file_;
|
||||
__cv_ = __rhs.__cv_;
|
||||
__st_ = __rhs.__st_;
|
||||
__st_last_ = __rhs.__st_last_;
|
||||
__om_ = __rhs.__om_;
|
||||
__cm_ = __rhs.__cm_;
|
||||
__owns_eb_ = __rhs.__owns_eb_;
|
||||
@@ -316,6 +328,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
|
||||
__rhs.__ibs_ = 0;
|
||||
__rhs.__file_ = 0;
|
||||
__rhs.__st_ = state_type();
|
||||
__rhs.__st_last_ = state_type();
|
||||
__rhs.__om_ = 0;
|
||||
__rhs.__cm_ = 0;
|
||||
__rhs.__owns_eb_ = false;
|
||||
@@ -331,9 +344,10 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
|
||||
{
|
||||
close();
|
||||
swap(__rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>::~basic_filebuf()
|
||||
@@ -341,14 +355,14 @@ basic_filebuf<_CharT, _Traits>::~basic_filebuf()
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
close();
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
if (__owns_eb_)
|
||||
delete [] __extbuf_;
|
||||
if (__owns_ib_)
|
||||
@@ -362,9 +376,9 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
|
||||
basic_streambuf<char_type, traits_type>::swap(__rhs);
|
||||
if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_)
|
||||
{
|
||||
_STD::swap(__extbuf_, __rhs.__extbuf_);
|
||||
_STD::swap(__extbufnext_, __rhs.__extbufnext_);
|
||||
_STD::swap(__extbufend_, __rhs.__extbufend_);
|
||||
_VSTD::swap(__extbuf_, __rhs.__extbuf_);
|
||||
_VSTD::swap(__extbufnext_, __rhs.__extbufnext_);
|
||||
_VSTD::swap(__extbufend_, __rhs.__extbufend_);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -387,17 +401,18 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
|
||||
__rhs.__extbufnext_ = __rhs.__extbuf_ + __ln;
|
||||
__rhs.__extbufend_ = __rhs.__extbuf_ + __le;
|
||||
}
|
||||
_STD::swap(__ebs_, __rhs.__ebs_);
|
||||
_STD::swap(__intbuf_, __rhs.__intbuf_);
|
||||
_STD::swap(__ibs_, __rhs.__ibs_);
|
||||
_STD::swap(__file_, __rhs.__file_);
|
||||
_STD::swap(__cv_, __rhs.__cv_);
|
||||
_STD::swap(__st_, __rhs.__st_);
|
||||
_STD::swap(__om_, __rhs.__om_);
|
||||
_STD::swap(__cm_, __rhs.__cm_);
|
||||
_STD::swap(__owns_eb_, __rhs.__owns_eb_);
|
||||
_STD::swap(__owns_ib_, __rhs.__owns_ib_);
|
||||
_STD::swap(__always_noconv_, __rhs.__always_noconv_);
|
||||
_VSTD::swap(__ebs_, __rhs.__ebs_);
|
||||
_VSTD::swap(__intbuf_, __rhs.__intbuf_);
|
||||
_VSTD::swap(__ibs_, __rhs.__ibs_);
|
||||
_VSTD::swap(__file_, __rhs.__file_);
|
||||
_VSTD::swap(__cv_, __rhs.__cv_);
|
||||
_VSTD::swap(__st_, __rhs.__st_);
|
||||
_VSTD::swap(__st_last_, __rhs.__st_last_);
|
||||
_VSTD::swap(__om_, __rhs.__om_);
|
||||
_VSTD::swap(__cm_, __rhs.__cm_);
|
||||
_VSTD::swap(__owns_eb_, __rhs.__owns_eb_);
|
||||
_VSTD::swap(__owns_ib_, __rhs.__owns_ib_);
|
||||
_VSTD::swap(__always_noconv_, __rhs.__always_noconv_);
|
||||
if (this->eback() == (char_type*)__rhs.__extbuf_min_)
|
||||
{
|
||||
ptrdiff_t __n = this->gptr() - this->eback();
|
||||
@@ -545,7 +560,7 @@ basic_filebuf<_CharT, _Traits>::close()
|
||||
{
|
||||
__rt = this;
|
||||
unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
|
||||
if ((__cm_ & ios_base::out) && sync())
|
||||
if (sync())
|
||||
__rt = 0;
|
||||
if (fclose(__h.release()) == 0)
|
||||
__file_ = 0;
|
||||
@@ -579,7 +594,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
|
||||
this->setg(this->eback(),
|
||||
this->eback() + __unget_sz,
|
||||
this->eback() + __unget_sz + __nmemb);
|
||||
__c = *this->gptr();
|
||||
__c = traits_type::to_int_type(*this->gptr());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -587,33 +602,37 @@ basic_filebuf<_CharT, _Traits>::underflow()
|
||||
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
||||
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
|
||||
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
|
||||
size_t __nmemb = 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_));
|
||||
codecvt_base::result __r;
|
||||
state_type __svs = __st_;
|
||||
__st_last_ = __st_;
|
||||
size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
|
||||
if (__nr != 0)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (!__cv_)
|
||||
throw bad_cast();
|
||||
#endif
|
||||
__extbufend_ = __extbufnext_ + __nr;
|
||||
char_type* __inext;
|
||||
__r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
|
||||
this->eback() + __unget_sz,
|
||||
this->egptr(), __inext);
|
||||
this->eback() + __ibs_, __inext);
|
||||
if (__r == codecvt_base::noconv)
|
||||
{
|
||||
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
|
||||
__c = *this->gptr();
|
||||
__c = traits_type::to_int_type(*this->gptr());
|
||||
}
|
||||
else if (__inext != this->eback() + __unget_sz)
|
||||
{
|
||||
this->setg(this->eback(), this->eback() + __unget_sz, __inext);
|
||||
__c = *this->gptr();
|
||||
__c = traits_type::to_int_type(*this->gptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
__c = *this->gptr();
|
||||
__c = traits_type::to_int_type(*this->gptr());
|
||||
if (this->eback() == &__1buf)
|
||||
this->setg(0, 0, 0);
|
||||
return __c;
|
||||
@@ -672,6 +691,10 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
|
||||
codecvt_base::result __r;
|
||||
do
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (!__cv_)
|
||||
throw bad_cast();
|
||||
#endif
|
||||
const char_type* __e;
|
||||
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
|
||||
__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,
|
||||
ios_base::openmode)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (!__cv_)
|
||||
throw bad_cast();
|
||||
#endif
|
||||
int __width = __cv_->encoding();
|
||||
if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
|
||||
return pos_type(off_type(-1));
|
||||
@@ -780,21 +807,33 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
||||
default:
|
||||
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))
|
||||
return pos_type(off_type(-1));
|
||||
pos_type __r = ftello(__file_);
|
||||
#endif
|
||||
__r.state(__st_);
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
typename basic_filebuf<_CharT, _Traits>::pos_type
|
||||
basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode __wch)
|
||||
basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
|
||||
{
|
||||
if (__file_ == 0 || sync())
|
||||
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))
|
||||
return pos_type(off_type(-1));
|
||||
#endif
|
||||
__st_ = __sp.state();
|
||||
return __sp;
|
||||
}
|
||||
|
||||
@@ -804,6 +843,10 @@ basic_filebuf<_CharT, _Traits>::sync()
|
||||
{
|
||||
if (__file_ == 0)
|
||||
return 0;
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (!__cv_)
|
||||
throw bad_cast();
|
||||
#endif
|
||||
if (__cm_ & ios_base::out)
|
||||
{
|
||||
if (this->pptr() != this->pbase())
|
||||
@@ -826,6 +869,8 @@ basic_filebuf<_CharT, _Traits>::sync()
|
||||
else if (__cm_ & ios_base::in)
|
||||
{
|
||||
off_type __c;
|
||||
state_type __state = __st_last_;
|
||||
bool __update_st = false;
|
||||
if (__always_noconv_)
|
||||
__c = this->egptr() - this->gptr();
|
||||
else
|
||||
@@ -838,32 +883,24 @@ basic_filebuf<_CharT, _Traits>::sync()
|
||||
{
|
||||
if (this->gptr() != this->egptr())
|
||||
{
|
||||
reverse(this->gptr(), this->egptr());
|
||||
codecvt_base::result __r;
|
||||
const char_type* __e = this->gptr();
|
||||
char* __extbe;
|
||||
do
|
||||
{
|
||||
__r = __cv_->out(__st_, __e, this->egptr(), __e,
|
||||
__extbuf_, __extbuf_ + __ebs_, __extbe);
|
||||
switch (__r)
|
||||
{
|
||||
case codecvt_base::noconv:
|
||||
__c += this->egptr() - this->gptr();
|
||||
break;
|
||||
case codecvt_base::ok:
|
||||
case codecvt_base::partial:
|
||||
__c += __extbe - __extbuf_;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
} while (__r == codecvt_base::partial);
|
||||
const int __off = __cv_->length(__state, __extbuf_,
|
||||
__extbufnext_,
|
||||
this->gptr() - this->eback());
|
||||
__c += __extbufnext_ - __extbuf_ - __off;
|
||||
__update_st = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if _WIN32
|
||||
if (fseek(__file_, -__c, SEEK_CUR))
|
||||
return -1;
|
||||
#else
|
||||
if (fseeko(__file_, -__c, SEEK_CUR))
|
||||
return -1;
|
||||
#endif
|
||||
if (__update_st)
|
||||
__st_ = __state;
|
||||
__extbufnext_ = __extbufend_ = __extbuf_;
|
||||
this->setg(0, 0, 0);
|
||||
__cm_ = 0;
|
||||
}
|
||||
@@ -957,7 +994,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
|
||||
// basic_ifstream
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_ifstream
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ifstream
|
||||
: public basic_istream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -970,11 +1007,11 @@ public:
|
||||
basic_ifstream();
|
||||
explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
|
||||
explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_ifstream(basic_ifstream&& __rhs);
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_ifstream& operator=(basic_ifstream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_ifstream& __rhs);
|
||||
@@ -1014,13 +1051,13 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs)
|
||||
: basic_istream<char_type, traits_type>(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: basic_istream<char_type, traits_type>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
this->set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -1030,12 +1067,12 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ifstream<_CharT, _Traits>&
|
||||
basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
|
||||
{
|
||||
basic_istream<char_type, traits_type>::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1102,7 +1139,7 @@ basic_ifstream<_CharT, _Traits>::close()
|
||||
// basic_ofstream
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_ofstream
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ofstream
|
||||
: public basic_ostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -1115,11 +1152,11 @@ public:
|
||||
basic_ofstream();
|
||||
explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
|
||||
explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_ofstream(basic_ofstream&& __rhs);
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_ofstream& operator=(basic_ofstream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_ofstream& __rhs);
|
||||
@@ -1159,13 +1196,13 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs)
|
||||
: basic_ostream<char_type, traits_type>(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: basic_ostream<char_type, traits_type>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
this->set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -1175,12 +1212,12 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ofstream<_CharT, _Traits>&
|
||||
basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
|
||||
{
|
||||
basic_ostream<char_type, traits_type>::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1247,7 +1284,7 @@ basic_ofstream<_CharT, _Traits>::close()
|
||||
// basic_fstream
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_fstream
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_fstream
|
||||
: public basic_iostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -1260,11 +1297,11 @@ public:
|
||||
basic_fstream();
|
||||
explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_fstream(basic_fstream&& __rhs);
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_fstream& operator=(basic_fstream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_fstream& __rhs);
|
||||
@@ -1304,13 +1341,13 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs)
|
||||
: basic_iostream<char_type, traits_type>(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: basic_iostream<char_type, traits_type>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
this->set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -1320,12 +1357,12 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_fstream<_CharT, _Traits>&
|
||||
basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
|
||||
{
|
||||
basic_iostream<char_type, traits_type>::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
||||
1759
include/functional
1759
include/functional
File diff suppressed because it is too large
Load Diff
2447
include/future
2447
include/future
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -29,15 +29,15 @@ public:
|
||||
typedef const E* iterator;
|
||||
typedef const E* const_iterator;
|
||||
|
||||
initializer_list();
|
||||
initializer_list() noexcept; // constexpr in C++14
|
||||
|
||||
size_t size() const;
|
||||
const E* begin() const;
|
||||
const E* end() const;
|
||||
size_t size() const noexcept; // constexpr in C++14
|
||||
const E* begin() const noexcept; // constexpr in C++14
|
||||
const E* end() const noexcept; // constexpr in C++14
|
||||
};
|
||||
|
||||
template<class E> const E* begin(initializer_list<E> il);
|
||||
template<class E> const E* end(initializer_list<E> il);
|
||||
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; // constexpr in C++14
|
||||
|
||||
} // std
|
||||
|
||||
@@ -46,54 +46,73 @@ template<class E> const E* end(initializer_list<E> il);
|
||||
#include <__config>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not versioned
|
||||
{
|
||||
|
||||
template<class _E>
|
||||
class initializer_list
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template<class _Ep>
|
||||
class _LIBCPP_TYPE_VIS_ONLY initializer_list
|
||||
{
|
||||
const _E* __begin_;
|
||||
const _Ep* __begin_;
|
||||
size_t __size_;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
initializer_list(const _E* __b, size_t __s)
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
|
||||
: __begin_(__b),
|
||||
__size_(__s)
|
||||
{}
|
||||
public:
|
||||
typedef _E value_type;
|
||||
typedef const _E& reference;
|
||||
typedef const _E& const_reference;
|
||||
typedef _Ep value_type;
|
||||
typedef const _Ep& reference;
|
||||
typedef const _Ep& const_reference;
|
||||
typedef size_t size_type;
|
||||
|
||||
typedef const _E* iterator;
|
||||
typedef const _E* const_iterator;
|
||||
typedef const _Ep* iterator;
|
||||
typedef const _Ep* const_iterator;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE initializer_list() : __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 {return __size_;}
|
||||
_LIBCPP_ALWAYS_INLINE const _E* begin() const {return __begin_;}
|
||||
_LIBCPP_ALWAYS_INLINE const _E* end() const {return __begin_ + __size_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
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
|
||||
const _E*
|
||||
begin(initializer_list<_E> __il)
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const _Ep*
|
||||
begin(initializer_list<_Ep> __il) _NOEXCEPT
|
||||
{
|
||||
return __il.begin();
|
||||
}
|
||||
|
||||
template<class _E>
|
||||
template<class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
const _E*
|
||||
end(initializer_list<_E> __il)
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const _Ep*
|
||||
end(initializer_list<_Ep> __il) _NOEXCEPT
|
||||
{
|
||||
return __il.end();
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
} // std
|
||||
|
||||
#endif // _LIBCPP_INITIALIZER_LIST
|
||||
|
||||
244
include/iomanip
244
include/iomanip
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
/*
|
||||
iomanip synopsis
|
||||
|
||||
namespace std {
|
||||
|
||||
// types T1, T2, ... are unspecified implementation types
|
||||
T1 resetiosflags(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> 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
|
||||
|
||||
*/
|
||||
@@ -33,7 +46,9 @@ template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
|
||||
#include <__config>
|
||||
#include <istream>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -43,10 +58,12 @@ class __iom_t1
|
||||
{
|
||||
ios_base::fmtflags __mask_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x)
|
||||
{
|
||||
@@ -56,6 +73,7 @@ public:
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x)
|
||||
{
|
||||
@@ -77,10 +95,12 @@ class __iom_t2
|
||||
{
|
||||
ios_base::fmtflags __mask_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x)
|
||||
{
|
||||
@@ -90,6 +110,7 @@ public:
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x)
|
||||
{
|
||||
@@ -111,10 +132,12 @@ class __iom_t3
|
||||
{
|
||||
int __base_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t3(int __b) : __base_(__b) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x)
|
||||
{
|
||||
@@ -127,6 +150,7 @@ public:
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x)
|
||||
{
|
||||
@@ -152,10 +176,12 @@ class __iom_t4
|
||||
{
|
||||
_CharT __fill_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t4(_CharT __c) : __fill_(__c) {}
|
||||
|
||||
template <class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x)
|
||||
{
|
||||
@@ -178,10 +204,12 @@ class __iom_t5
|
||||
{
|
||||
int __n_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t5(int __n) : __n_(__n) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x)
|
||||
{
|
||||
@@ -191,6 +219,7 @@ public:
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x)
|
||||
{
|
||||
@@ -212,10 +241,12 @@ class __iom_t6
|
||||
{
|
||||
int __n_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t6(int __n) : __n_(__n) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x)
|
||||
{
|
||||
@@ -225,6 +256,7 @@ public:
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x)
|
||||
{
|
||||
@@ -254,13 +286,14 @@ class __iom_t7
|
||||
_MoneyT& __mon_;
|
||||
bool __intl_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t7(_MoneyT& __mon, bool __intl)
|
||||
: __mon_(__mon), __intl_(__intl) {}
|
||||
|
||||
template <class _CharT, class _Traits, class _M>
|
||||
template <class _CharT, class _Traits, class _Mp>
|
||||
friend
|
||||
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>
|
||||
@@ -270,15 +303,15 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef money_get<_CharT, _I> _F;
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
typedef money_get<_CharT, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
const _F& __mf = use_facet<_F>(__is.getloc());
|
||||
__mf.get(_I(__is), _I(), __x.__intl_, __is, __err, __x.__mon_);
|
||||
const _Fp& __mf = use_facet<_Fp>(__is.getloc());
|
||||
__mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
|
||||
__is.setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -287,7 +320,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
|
||||
{
|
||||
__is.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __is;
|
||||
}
|
||||
|
||||
@@ -313,13 +346,14 @@ class __iom_t8
|
||||
const _MoneyT& __mon_;
|
||||
bool __intl_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t8(const _MoneyT& __mon, bool __intl)
|
||||
: __mon_(__mon), __intl_(__intl) {}
|
||||
|
||||
template <class _CharT, class _Traits, class _M>
|
||||
template <class _CharT, class _Traits, class _Mp>
|
||||
friend
|
||||
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>
|
||||
@@ -329,14 +363,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
||||
typedef money_put<_CharT, _O> _F;
|
||||
const _F& __mf = use_facet<_F>(__os.getloc());
|
||||
if (__mf.put(_O(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||
typedef money_put<_CharT, _Op> _Fp;
|
||||
const _Fp& __mf = use_facet<_Fp>(__os.getloc());
|
||||
if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
|
||||
__os.setstate(ios_base::badbit);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -345,7 +379,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
@@ -371,13 +405,14 @@ class __iom_t9
|
||||
tm* __tm_;
|
||||
const _CharT* __fmt_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t9(tm* __tm, const _CharT* __fmt)
|
||||
: __tm_(__tm), __fmt_(__fmt) {}
|
||||
|
||||
template <class _C, class _Traits>
|
||||
template <class _Cp, class _Traits>
|
||||
friend
|
||||
basic_istream<_C, _Traits>&
|
||||
operator>>(basic_istream<_C, _Traits>& __is, const __iom_t9<_C>& __x);
|
||||
basic_istream<_Cp, _Traits>&
|
||||
operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@@ -387,15 +422,15 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef time_get<_CharT, _I> _F;
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
typedef time_get<_CharT, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
const _F& __tf = use_facet<_F>(__is.getloc());
|
||||
__tf.get(_I(__is), _I(), __is, __err, __x.__tm_,
|
||||
const _Fp& __tf = use_facet<_Fp>(__is.getloc());
|
||||
__tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_,
|
||||
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
|
||||
__is.setstate(__err);
|
||||
}
|
||||
@@ -405,7 +440,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
|
||||
{
|
||||
__is.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __is;
|
||||
}
|
||||
|
||||
@@ -431,13 +466,14 @@ class __iom_t10
|
||||
const tm* __tm_;
|
||||
const _CharT* __fmt_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t10(const tm* __tm, const _CharT* __fmt)
|
||||
: __tm_(__tm), __fmt_(__fmt) {}
|
||||
|
||||
template <class _C, class _Traits>
|
||||
template <class _Cp, class _Traits>
|
||||
friend
|
||||
basic_ostream<_C, _Traits>&
|
||||
operator<<(basic_ostream<_C, _Traits>& __os, const __iom_t10<_C>& __x);
|
||||
basic_ostream<_Cp, _Traits>&
|
||||
operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@@ -447,14 +483,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
||||
typedef time_put<_CharT, _O> _F;
|
||||
const _F& __tf = use_facet<_F>(__os.getloc());
|
||||
if (__tf.put(_O(__os), __os, __os.fill(), __x.__tm_,
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||
typedef time_put<_CharT, _Op> _Fp;
|
||||
const _Fp& __tf = use_facet<_Fp>(__os.getloc());
|
||||
if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_,
|
||||
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
|
||||
__os.setstate(ios_base::badbit);
|
||||
}
|
||||
@@ -464,7 +500,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
@@ -476,6 +512,142 @@ put_time(const tm* __tm, const _CharT* __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
|
||||
|
||||
#endif // _LIBCPP_IOMANIP
|
||||
|
||||
242
include/ios
242
include/ios
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -29,43 +29,43 @@ public:
|
||||
class failure;
|
||||
|
||||
typedef T1 fmtflags;
|
||||
static const fmtflags boolalpha;
|
||||
static const fmtflags dec;
|
||||
static const fmtflags fixed;
|
||||
static const fmtflags hex;
|
||||
static const fmtflags internal;
|
||||
static const fmtflags left;
|
||||
static const fmtflags oct;
|
||||
static const fmtflags right;
|
||||
static const fmtflags scientific;
|
||||
static const fmtflags showbase;
|
||||
static const fmtflags showpoint;
|
||||
static const fmtflags showpos;
|
||||
static const fmtflags skipws;
|
||||
static const fmtflags unitbuf;
|
||||
static const fmtflags uppercase;
|
||||
static const fmtflags adjustfield;
|
||||
static const fmtflags basefield;
|
||||
static const fmtflags floatfield;
|
||||
static constexpr fmtflags boolalpha;
|
||||
static constexpr fmtflags dec;
|
||||
static constexpr fmtflags fixed;
|
||||
static constexpr fmtflags hex;
|
||||
static constexpr fmtflags internal;
|
||||
static constexpr fmtflags left;
|
||||
static constexpr fmtflags oct;
|
||||
static constexpr fmtflags right;
|
||||
static constexpr fmtflags scientific;
|
||||
static constexpr fmtflags showbase;
|
||||
static constexpr fmtflags showpoint;
|
||||
static constexpr fmtflags showpos;
|
||||
static constexpr fmtflags skipws;
|
||||
static constexpr fmtflags unitbuf;
|
||||
static constexpr fmtflags uppercase;
|
||||
static constexpr fmtflags adjustfield;
|
||||
static constexpr fmtflags basefield;
|
||||
static constexpr fmtflags floatfield;
|
||||
|
||||
typedef T2 iostate;
|
||||
static const iostate badbit;
|
||||
static const iostate eofbit;
|
||||
static const iostate failbit;
|
||||
static const iostate goodbit;
|
||||
static constexpr iostate badbit;
|
||||
static constexpr iostate eofbit;
|
||||
static constexpr iostate failbit;
|
||||
static constexpr iostate goodbit;
|
||||
|
||||
typedef T3 openmode;
|
||||
static const openmode app;
|
||||
static const openmode ate;
|
||||
static const openmode binary;
|
||||
static const openmode in;
|
||||
static const openmode out;
|
||||
static const openmode trunc;
|
||||
static constexpr openmode app;
|
||||
static constexpr openmode ate;
|
||||
static constexpr openmode binary;
|
||||
static constexpr openmode in;
|
||||
static constexpr openmode out;
|
||||
static constexpr openmode trunc;
|
||||
|
||||
typedef T4 seekdir;
|
||||
static const seekdir beg;
|
||||
static const seekdir cur;
|
||||
static const seekdir end;
|
||||
static constexpr seekdir beg;
|
||||
static constexpr seekdir cur;
|
||||
static constexpr seekdir end;
|
||||
|
||||
class Init;
|
||||
|
||||
@@ -160,7 +160,7 @@ protected:
|
||||
basic_ios();
|
||||
void init(basic_streambuf<charT,traits>* sb);
|
||||
void move(basic_ios& rhs);
|
||||
void swap(basic_ios& rhs);
|
||||
void swap(basic_ios& rhs) noexcept;
|
||||
void set_rdbuf(basic_streambuf<charT, traits>* sb);
|
||||
};
|
||||
|
||||
@@ -203,9 +203,9 @@ enum class io_errc
|
||||
};
|
||||
|
||||
concept_map ErrorCodeEnum<io_errc> { };
|
||||
error_code make_error_code(io_errc e);
|
||||
error_condition make_error_condition(io_errc e);
|
||||
storage-class-specifier const error_category& iostream_category;
|
||||
error_code make_error_code(io_errc e) noexcept;
|
||||
error_condition make_error_condition(io_errc e) noexcept;
|
||||
storage-class-specifier const error_category& iostream_category() noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
@@ -216,16 +216,22 @@ storage-class-specifier const error_category& iostream_category;
|
||||
#include <__locale>
|
||||
#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
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
typedef ptrdiff_t streamsize;
|
||||
|
||||
class ios_base
|
||||
class _LIBCPP_TYPE_VIS ios_base
|
||||
{
|
||||
public:
|
||||
class failure;
|
||||
class _LIBCPP_TYPE_VIS failure;
|
||||
|
||||
typedef unsigned int fmtflags;
|
||||
static const fmtflags boolalpha = 0x0001;
|
||||
@@ -266,22 +272,22 @@ public:
|
||||
enum seekdir {beg, cur, end};
|
||||
typedef seekdir seek_dir;
|
||||
|
||||
typedef _STD::streamoff streamoff;
|
||||
typedef _STD::streampos streampos;
|
||||
typedef _VSTD::streamoff streamoff;
|
||||
typedef _VSTD::streampos streampos;
|
||||
|
||||
class Init;
|
||||
class _LIBCPP_TYPE_VIS Init;
|
||||
|
||||
// 27.5.2.2 fmtflags state:
|
||||
fmtflags flags() const;
|
||||
fmtflags flags(fmtflags __fmtfl);
|
||||
fmtflags setf(fmtflags __fmtfl);
|
||||
fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
|
||||
void unsetf(fmtflags __mask);
|
||||
_LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
|
||||
_LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl);
|
||||
_LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl);
|
||||
_LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
|
||||
_LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask);
|
||||
|
||||
streamsize precision() const;
|
||||
streamsize precision(streamsize __prec);
|
||||
streamsize width() const;
|
||||
streamsize width(streamsize __wide);
|
||||
_LIBCPP_INLINE_VISIBILITY streamsize precision() const;
|
||||
_LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec);
|
||||
_LIBCPP_INLINE_VISIBILITY streamsize width() const;
|
||||
_LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide);
|
||||
|
||||
// 27.5.2.3 locales:
|
||||
locale imbue(const locale& __loc);
|
||||
@@ -307,22 +313,23 @@ private:
|
||||
public:
|
||||
static bool sync_with_stdio(bool __sync = true);
|
||||
|
||||
iostate rdstate() const;
|
||||
_LIBCPP_INLINE_VISIBILITY iostate rdstate() const;
|
||||
void clear(iostate __state = goodbit);
|
||||
void setstate(iostate __state);
|
||||
|
||||
bool good() const;
|
||||
bool eof() const;
|
||||
bool fail() const;
|
||||
bool bad() const;
|
||||
_LIBCPP_INLINE_VISIBILITY void setstate(iostate __state);
|
||||
|
||||
iostate exceptions() const;
|
||||
void exceptions(iostate __except);
|
||||
_LIBCPP_INLINE_VISIBILITY bool good() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool eof() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool fail() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool bad() const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
|
||||
_LIBCPP_INLINE_VISIBILITY void exceptions(iostate __iostate);
|
||||
|
||||
void __set_badbit_and_consider_rethrow();
|
||||
void __set_failbit_and_consider_rethrow();
|
||||
|
||||
protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ios_base() {// purposefully does no initialization
|
||||
}
|
||||
|
||||
@@ -339,7 +346,7 @@ protected:
|
||||
void __call_callbacks(event);
|
||||
void copyfmt(const ios_base&);
|
||||
void move(ios_base&);
|
||||
void swap(ios_base&);
|
||||
void swap(ios_base&) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void set_rdbuf(void* __sb)
|
||||
@@ -360,7 +367,11 @@ private:
|
||||
int* __index_;
|
||||
size_t __event_size_;
|
||||
size_t __event_cap_;
|
||||
#if __has_feature(cxx_atomic)
|
||||
static atomic<int> __xindex_;
|
||||
#else
|
||||
static int __xindex_;
|
||||
#endif
|
||||
long* __iarray_;
|
||||
size_t __iarray_size_;
|
||||
size_t __iarray_cap_;
|
||||
@@ -370,46 +381,47 @@ private:
|
||||
};
|
||||
|
||||
//enum class io_errc
|
||||
struct io_errc
|
||||
_LIBCPP_DECLARE_STRONG_ENUM(io_errc)
|
||||
{
|
||||
enum _ {
|
||||
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 <>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc> : public true_type { };
|
||||
|
||||
template <> struct is_error_code_enum<io_errc> : public true_type { };
|
||||
template <> struct is_error_code_enum<io_errc::_> : public true_type { };
|
||||
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
template <>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc::__lx> : public true_type { };
|
||||
#endif
|
||||
|
||||
const error_category& iostream_category();
|
||||
_LIBCPP_FUNC_VIS
|
||||
const error_category& iostream_category() _NOEXCEPT;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
error_code
|
||||
make_error_code(io_errc __e)
|
||||
make_error_code(io_errc __e) _NOEXCEPT
|
||||
{
|
||||
return error_code(static_cast<int>(__e), iostream_category());
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
error_condition
|
||||
make_error_condition(io_errc __e)
|
||||
make_error_condition(io_errc __e) _NOEXCEPT
|
||||
{
|
||||
return error_condition(static_cast<int>(__e), iostream_category());
|
||||
}
|
||||
|
||||
class ios_base::failure
|
||||
class _LIBCPP_EXCEPTION_ABI ios_base::failure
|
||||
: public system_error
|
||||
{
|
||||
public:
|
||||
{
|
||||
public:
|
||||
explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
|
||||
explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
|
||||
explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
|
||||
virtual ~failure() throw();
|
||||
};
|
||||
|
||||
class ios_base::Init
|
||||
class _LIBCPP_TYPE_VIS ios_base::Init
|
||||
{
|
||||
public:
|
||||
Init();
|
||||
@@ -523,21 +535,21 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
ios_base::eof() const
|
||||
{
|
||||
return __rdstate_ & eofbit;
|
||||
return (__rdstate_ & eofbit) != 0;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
ios_base::fail() const
|
||||
{
|
||||
return __rdstate_ & (failbit | badbit);
|
||||
return (__rdstate_ & (failbit | badbit)) != 0;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
ios_base::bad() const
|
||||
{
|
||||
return __rdstate_ & badbit;
|
||||
return (__rdstate_ & badbit) != 0;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -549,14 +561,14 @@ ios_base::exceptions() const
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
ios_base::exceptions(iostate __except)
|
||||
ios_base::exceptions(iostate __iostate)
|
||||
{
|
||||
__exceptions_ = __except;
|
||||
__exceptions_ = __iostate;
|
||||
clear(__rdstate_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_ios
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ios
|
||||
: public ios_base
|
||||
{
|
||||
public:
|
||||
@@ -568,7 +580,8 @@ public:
|
||||
typedef typename traits_type::pos_type pos_type;
|
||||
typedef typename traits_type::off_type off_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE // explicit
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool() const {return !fail();}
|
||||
_LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();}
|
||||
_LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();}
|
||||
@@ -580,43 +593,59 @@ public:
|
||||
_LIBCPP_ALWAYS_INLINE bool bad() const {return ios_base::bad();}
|
||||
|
||||
_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:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
|
||||
virtual ~basic_ios();
|
||||
|
||||
// 27.5.4.2 Members:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<char_type, traits_type>* tie() const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_streambuf<char_type, traits_type>* rdbuf() const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
|
||||
|
||||
basic_ios& copyfmt(const basic_ios& __rhs);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type fill() const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type fill(char_type __ch);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
locale imbue(const locale& __loc);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char narrow(char_type __c, char __dfault) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type widen(char __c) const;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
basic_ios() {// purposefully does no initialization
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void init(basic_streambuf<char_type, traits_type>* __sb);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void move(basic_ios& __rhs);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void move(basic_ios&& __rhs) {move(__rhs);}
|
||||
#endif
|
||||
void swap(basic_ios& __rhs);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(basic_ios& __rhs) _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
|
||||
private:
|
||||
basic_ostream<char_type, traits_type>* __tie_;
|
||||
char_type __fill_;
|
||||
mutable int_type __fill_;
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@@ -638,7 +667,7 @@ basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
|
||||
{
|
||||
ios_base::init(__sb);
|
||||
__tie_ = 0;
|
||||
__fill_ = widen(' ');
|
||||
__fill_ = traits_type::eof();
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@@ -710,6 +739,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_CharT
|
||||
basic_ios<_CharT, _Traits>::fill() const
|
||||
{
|
||||
if (traits_type::eq_int_type(traits_type::eof(), __fill_))
|
||||
__fill_ = widen(' ');
|
||||
return __fill_;
|
||||
}
|
||||
|
||||
@@ -753,11 +784,11 @@ basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs)
|
||||
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT
|
||||
{
|
||||
ios_base::swap(__rhs);
|
||||
_STD::swap(__tie_, __rhs.__tie_);
|
||||
_STD::swap(__fill_, __rhs.__fill_);
|
||||
_VSTD::swap(__tie_, __rhs.__tie_);
|
||||
_VSTD::swap(__fill_, __rhs.__fill_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@@ -960,6 +991,33 @@ defaultfloat(ios_base& __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
|
||||
|
||||
#endif // _LIBCPP_IOS
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace std
|
||||
template<class charT> struct char_traits;
|
||||
template<class T> class allocator;
|
||||
|
||||
class ios_base;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_ios;
|
||||
|
||||
template <class charT, class traits = char_traits<charT> > class basic_streambuf;
|
||||
@@ -88,36 +89,55 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
|
||||
#include <__config>
|
||||
#include <wchar.h> // for mbstate_t
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template<class _CharT> struct char_traits;
|
||||
template<class _Tp> class allocator;
|
||||
class _LIBCPP_TYPE_VIS ios_base;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ios;
|
||||
template<class _CharT> struct _LIBCPP_TYPE_VIS_ONLY char_traits;
|
||||
template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY allocator;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_streambuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_istream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ostream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_iostream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ios;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
|
||||
class basic_stringbuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
|
||||
class basic_istringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
|
||||
class basic_ostringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
|
||||
class basic_stringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_streambuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_istream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ostream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_iostream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_filebuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ifstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ofstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_fstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_stringbuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_istringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ostringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_stringstream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class istreambuf_iterator;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class ostreambuf_iterator;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_filebuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ifstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ofstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_fstream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY istreambuf_iterator;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY ostreambuf_iterator;
|
||||
|
||||
typedef basic_ios<char> ios;
|
||||
typedef basic_ios<wchar_t> wios;
|
||||
@@ -152,19 +172,20 @@ typedef basic_ifstream<wchar_t> wifstream;
|
||||
typedef basic_ofstream<wchar_t> wofstream;
|
||||
typedef basic_fstream<wchar_t> wfstream;
|
||||
|
||||
template <class _State> class fpos;
|
||||
template <class _State> class _LIBCPP_TYPE_VIS_ONLY fpos;
|
||||
typedef fpos<mbstate_t> streampos;
|
||||
typedef fpos<mbstate_t> wstreampos;
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
typedef fpos<mbstate_t> u16streampos;
|
||||
typedef fpos<mbstate_t> u32streampos;
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
typedef long long streamoff; // for char_traits in <string>
|
||||
|
||||
template <class _CharT, // for <stdexcept>
|
||||
class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> > class basic_string;
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_string;
|
||||
typedef basic_string<char, char_traits<char>, allocator<char> > string;
|
||||
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -40,18 +40,20 @@ extern wostream wclog;
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
extern _LIBCPP_VISIBLE istream cin;
|
||||
extern _LIBCPP_VISIBLE ostream cout;
|
||||
extern _LIBCPP_VISIBLE ostream cerr;
|
||||
extern _LIBCPP_VISIBLE ostream clog;
|
||||
extern _LIBCPP_VISIBLE wistream wcin;
|
||||
extern _LIBCPP_VISIBLE wostream wcout;
|
||||
extern _LIBCPP_VISIBLE wostream wcerr;
|
||||
extern _LIBCPP_VISIBLE wostream wclog;
|
||||
extern _LIBCPP_FUNC_VIS istream cin;
|
||||
extern _LIBCPP_FUNC_VIS ostream cout;
|
||||
extern _LIBCPP_FUNC_VIS ostream cerr;
|
||||
extern _LIBCPP_FUNC_VIS ostream clog;
|
||||
extern _LIBCPP_FUNC_VIS wistream wcin;
|
||||
extern _LIBCPP_FUNC_VIS wostream wcout;
|
||||
extern _LIBCPP_FUNC_VIS wostream wcerr;
|
||||
extern _LIBCPP_FUNC_VIS wostream wclog;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
||||
691
include/istream
691
include/istream
File diff suppressed because it is too large
Load Diff
1129
include/iterator
1129
include/iterator
File diff suppressed because it is too large
Load Diff
932
include/limits
932
include/limits
File diff suppressed because it is too large
Load Diff
1412
include/list
1412
include/list
File diff suppressed because it is too large
Load Diff
1288
include/locale
1288
include/locale
File diff suppressed because it is too large
Load Diff
1338
include/map
1338
include/map
File diff suppressed because it is too large
Load Diff
3707
include/memory
3707
include/memory
File diff suppressed because it is too large
Load Diff
180
include/mutex
180
include/mutex
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace std
|
||||
class mutex
|
||||
{
|
||||
public:
|
||||
mutex();
|
||||
constexpr mutex() noexcept;
|
||||
~mutex();
|
||||
|
||||
mutex(const mutex&) = delete;
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
recursive_mutex& operator=(const recursive_mutex&) = delete;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
bool try_lock() noexcept;
|
||||
void unlock();
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
bool try_lock() noexcept;
|
||||
template <class Rep, class Period>
|
||||
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
@@ -114,9 +114,9 @@ class unique_lock
|
||||
{
|
||||
public:
|
||||
typedef Mutex mutex_type;
|
||||
unique_lock();
|
||||
unique_lock() noexcept;
|
||||
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, adopt_lock_t);
|
||||
template <class Clock, class Duration>
|
||||
@@ -128,8 +128,8 @@ public:
|
||||
unique_lock(unique_lock const&) = delete;
|
||||
unique_lock& operator=(unique_lock const&) = delete;
|
||||
|
||||
unique_lock(unique_lock&& u);
|
||||
unique_lock& operator=(unique_lock&& u);
|
||||
unique_lock(unique_lock&& u) noexcept;
|
||||
unique_lock& operator=(unique_lock&& u) noexcept;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
@@ -141,16 +141,16 @@ public:
|
||||
|
||||
void unlock();
|
||||
|
||||
void swap(unique_lock& u);
|
||||
mutex_type* release();
|
||||
void swap(unique_lock& u) noexcept;
|
||||
mutex_type* release() noexcept;
|
||||
|
||||
bool owns_lock() const;
|
||||
explicit operator bool () const;
|
||||
mutex_type* mutex() const;
|
||||
bool owns_lock() const noexcept;
|
||||
explicit operator bool () const noexcept;
|
||||
mutex_type* mutex() const noexcept;
|
||||
};
|
||||
|
||||
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>
|
||||
int try_lock(L1&, L2&, L3&...);
|
||||
@@ -159,7 +159,7 @@ template <class L1, class L2, class... L3>
|
||||
|
||||
struct once_flag
|
||||
{
|
||||
constexpr once_flag();
|
||||
constexpr once_flag() noexcept;
|
||||
|
||||
once_flag(const once_flag&) = delete;
|
||||
once_flag& operator=(const once_flag&) = delete;
|
||||
@@ -175,12 +175,19 @@ template<class Callable, class ...Args>
|
||||
#include <__config>
|
||||
#include <__mutex_base>
|
||||
#include <functional>
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#include <tuple>
|
||||
#endif
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class recursive_mutex
|
||||
class _LIBCPP_TYPE_VIS recursive_mutex
|
||||
{
|
||||
pthread_mutex_t __m_;
|
||||
|
||||
@@ -194,14 +201,15 @@ private:
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
bool try_lock() _NOEXCEPT;
|
||||
void unlock() _NOEXCEPT;
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
native_handle_type native_handle() {return &__m_;}
|
||||
};
|
||||
|
||||
class timed_mutex
|
||||
class _LIBCPP_TYPE_VIS timed_mutex
|
||||
{
|
||||
mutex __m_;
|
||||
condition_variable __cv_;
|
||||
@@ -216,13 +224,14 @@ private:
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
bool try_lock() _NOEXCEPT;
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{return try_lock_until(chrono::monotonic_clock::now() + __d);}
|
||||
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
||||
template <class _Clock, class _Duration>
|
||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||
void unlock();
|
||||
void unlock() _NOEXCEPT;
|
||||
};
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
@@ -242,7 +251,7 @@ timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||
return false;
|
||||
}
|
||||
|
||||
class recursive_timed_mutex
|
||||
class _LIBCPP_TYPE_VIS recursive_timed_mutex
|
||||
{
|
||||
mutex __m_;
|
||||
condition_variable __cv_;
|
||||
@@ -258,13 +267,14 @@ private:
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
bool try_lock() _NOEXCEPT;
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{return try_lock_until(chrono::monotonic_clock::now() + __d);}
|
||||
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
||||
template <class _Clock, class _Duration>
|
||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||
void unlock();
|
||||
void unlock() _NOEXCEPT;
|
||||
};
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
@@ -330,7 +340,7 @@ try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3)
|
||||
return __r;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _L0, class _L1>
|
||||
void
|
||||
@@ -361,9 +371,9 @@ lock(_L0& __l0, _L1& __l1)
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _L0, class _L1, class ..._L2>
|
||||
template <class _L0, class _L1, class _L2, class ..._L3>
|
||||
void
|
||||
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
|
||||
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
@@ -372,7 +382,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
|
||||
case 0:
|
||||
{
|
||||
unique_lock<_L0> __u0(__l0);
|
||||
__i = try_lock(__l1, __l2...);
|
||||
__i = try_lock(__l1, __l2, __l3...);
|
||||
if (__i == -1)
|
||||
{
|
||||
__u0.release();
|
||||
@@ -385,54 +395,57 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
|
||||
case 1:
|
||||
{
|
||||
unique_lock<_L1> __u1(__l1);
|
||||
__i = try_lock(__l2..., __l0);
|
||||
__i = try_lock(__l2, __l3..., __l0);
|
||||
if (__i == -1)
|
||||
{
|
||||
__u1.release();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (__i == sizeof...(_L2))
|
||||
if (__i == sizeof...(_L3) + 1)
|
||||
__i = 0;
|
||||
else
|
||||
__i += 2;
|
||||
sched_yield();
|
||||
break;
|
||||
default:
|
||||
__lock_first(__i - 2, __l2..., __l0, __l1);
|
||||
__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class _L0, class _L1, class ..._L2>
|
||||
inline
|
||||
template <class _L0, class _L1, class _L2, class ..._L3>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
lock(_L0& __l0, _L1& __l1, _L2& ...__l2)
|
||||
lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
|
||||
{
|
||||
__lock_first(0, __l0, __l1, __l2...);
|
||||
__lock_first(0, __l0, __l1, __l2, __l3...);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
struct once_flag;
|
||||
struct _LIBCPP_TYPE_VIS once_flag;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Callable, class... _Args>
|
||||
void call_once(once_flag&, _Callable&&, _Args&&...);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void call_once(once_flag&, _Callable&&, _Args&&...);
|
||||
|
||||
#else
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Callable>
|
||||
void call_once(once_flag&, _Callable);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void call_once(once_flag&, _Callable);
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
struct once_flag
|
||||
struct _LIBCPP_TYPE_VIS_ONLY once_flag
|
||||
{
|
||||
// constexpr
|
||||
once_flag() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
once_flag() _NOEXCEPT : __state_(0) {}
|
||||
|
||||
private:
|
||||
once_flag(const once_flag&); // = delete;
|
||||
@@ -444,39 +457,77 @@ private:
|
||||
template<class _Callable, class... _Args>
|
||||
friend
|
||||
void call_once(once_flag&, _Callable&&, _Args&&...);
|
||||
#else
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
template<class _Callable>
|
||||
friend
|
||||
void call_once(once_flag&, _Callable);
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
};
|
||||
|
||||
template <class _F>
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Fp>
|
||||
class __call_once_param
|
||||
{
|
||||
_F __f_;
|
||||
_Fp __f_;
|
||||
public:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
explicit __call_once_param(_F&& __f) : __f_(_STD::move(__f)) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
#else
|
||||
explicit __call_once_param(const _F& __f) : __f_(__f) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()()
|
||||
{
|
||||
typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index;
|
||||
__execute(_Index());
|
||||
}
|
||||
|
||||
private:
|
||||
template <size_t ..._Indices>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __execute(__tuple_indices<_Indices...>)
|
||||
{
|
||||
__invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...);
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template <class _Fp>
|
||||
class __call_once_param
|
||||
{
|
||||
_Fp __f_;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()()
|
||||
{
|
||||
__f_();
|
||||
}
|
||||
};
|
||||
|
||||
template <class _F>
|
||||
#endif
|
||||
|
||||
template <class _Fp>
|
||||
void
|
||||
__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)();
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@@ -485,17 +536,16 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
|
||||
{
|
||||
if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul)
|
||||
if (__flag.__state_ != ~0ul)
|
||||
{
|
||||
typedef decltype(std::bind(std::forward<_Callable>(__func),
|
||||
std::forward<_Args>(__args)...)) _G;
|
||||
__call_once_param<_G> __p(std::bind(std::forward<_Callable>(__func),
|
||||
std::forward<_Args>(__args)...));
|
||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
|
||||
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _Gp;
|
||||
__call_once_param<_Gp> __p(_Gp(__decay_copy(_VSTD::forward<_Callable>(__func)),
|
||||
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Callable>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -509,7 +559,7 @@ call_once(once_flag& __flag, _Callable __func)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
||||
128
include/new
128
include/new
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -21,34 +21,46 @@ class bad_alloc
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_alloc() throw();
|
||||
bad_alloc(const bad_alloc&) throw();
|
||||
bad_alloc& operator=(const bad_alloc&) throw();
|
||||
virtual ~bad_alloc() throw();
|
||||
virtual const char* what() const throw();
|
||||
bad_alloc() noexcept;
|
||||
bad_alloc(const bad_alloc&) noexcept;
|
||||
bad_alloc& operator=(const bad_alloc&) 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 {};
|
||||
extern const nothrow_t nothrow;
|
||||
typedef void (*new_handler)();
|
||||
new_handler set_new_handler(new_handler new_p) throw();
|
||||
new_handler set_new_handler(new_handler new_p) noexcept;
|
||||
new_handler get_new_handler() noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
void* operator new(std::size_t size) throw(std::bad_alloc); // replaceable
|
||||
void* operator new(std::size_t size, const std::nothrow_t&) throw(); // replaceable
|
||||
void operator delete(void* ptr) throw(); // replaceable
|
||||
void operator delete(void* ptr, const std::nothrow_t&) throw(); // replaceable
|
||||
void* operator new(std::size_t size); // replaceable
|
||||
void* operator new(std::size_t size, const std::nothrow_t&) noexcept; // replaceable
|
||||
void operator delete(void* ptr) noexcept; // replaceable
|
||||
void operator delete(void* ptr, const std::nothrow_t&) noexcept; // replaceable
|
||||
|
||||
void* operator new[](std::size_t size) throw(std::bad_alloc); // replaceable
|
||||
void* operator new[](std::size_t size, const std::nothrow_t&) throw(); // replaceable
|
||||
void operator delete[](void* ptr) throw(); // replaceable
|
||||
void operator delete[](void* ptr, const std::nothrow_t&) throw(); // replaceable
|
||||
void* operator new[](std::size_t size); // replaceable
|
||||
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable
|
||||
void operator delete[](void* ptr) noexcept; // replaceable
|
||||
void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // replaceable
|
||||
|
||||
void* operator new (std::size_t size, void* ptr) throw();
|
||||
void* operator new[](std::size_t size, void* ptr) throw();
|
||||
void operator delete (void* ptr, void*) throw();
|
||||
void operator delete[](void* ptr, void*) throw();
|
||||
void* operator new (std::size_t size, void* ptr) noexcept;
|
||||
void* operator new[](std::size_t size, void* ptr) noexcept;
|
||||
void operator delete (void* ptr, void*) noexcept;
|
||||
void operator delete[](void* ptr, void*) noexcept;
|
||||
|
||||
*/
|
||||
|
||||
@@ -56,7 +68,9 @@ void operator delete[](void* ptr, void*) throw();
|
||||
#include <exception>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
@@ -65,42 +79,72 @@ class _LIBCPP_EXCEPTION_ABI bad_alloc
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_alloc() throw();
|
||||
virtual ~bad_alloc() throw();
|
||||
virtual const char* what() const throw();
|
||||
bad_alloc() _NOEXCEPT;
|
||||
virtual ~bad_alloc() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_array_new_length
|
||||
: public bad_alloc
|
||||
{
|
||||
public:
|
||||
bad_array_new_length() throw();
|
||||
virtual ~bad_array_new_length() throw();
|
||||
virtual const char* what() const throw();
|
||||
bad_array_new_length() _NOEXCEPT;
|
||||
virtual ~bad_array_new_length() _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 nothrow_t {};
|
||||
extern _LIBCPP_VISIBLE const nothrow_t nothrow;
|
||||
class _LIBCPP_EXCEPTION_ABI bad_array_length
|
||||
: 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)();
|
||||
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) throw();
|
||||
_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
|
||||
|
||||
} // std
|
||||
|
||||
_LIBCPP_VISIBLE void* operator new(std::size_t) throw(std::bad_alloc);
|
||||
_LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) throw();
|
||||
_LIBCPP_VISIBLE void operator delete(void*) throw();
|
||||
_LIBCPP_VISIBLE void operator delete(void*, const std::nothrow_t&) throw();
|
||||
#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_VISIBLE void* operator new[](std::size_t) throw(std::bad_alloc);
|
||||
_LIBCPP_VISIBLE void* operator new[](std::size_t, const std::nothrow_t&) throw();
|
||||
_LIBCPP_VISIBLE void operator delete[](void*) throw();
|
||||
_LIBCPP_VISIBLE void operator delete[](void*, const std::nothrow_t&) throw();
|
||||
_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
;
|
||||
_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
|
||||
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p) _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) throw() {return __p;}
|
||||
_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) throw() {return __p;}
|
||||
_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) throw() {}
|
||||
_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) throw() {}
|
||||
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
;
|
||||
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
|
||||
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p) _NOEXCEPT;
|
||||
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY 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;}
|
||||
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
|
||||
inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {}
|
||||
|
||||
#endif // _LIBCPP_NEW
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -60,7 +60,9 @@ template <class ForwardIterator, class T>
|
||||
#include <__config>
|
||||
#include <iterator>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -155,7 +157,7 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
|
||||
*__result = __t2 - __t1;
|
||||
__t1 = __t2;
|
||||
__t1 = _VSTD::move(__t2);
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
@@ -175,7 +177,7 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
|
||||
*__result = __binary_op(__t2, __t1);
|
||||
__t1 = __t2;
|
||||
__t1 = _VSTD::move(__t2);
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
@@ -184,10 +186,10 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
|
||||
iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
|
||||
{
|
||||
for (; __first != __last; ++__first, ++__value)
|
||||
*__first = __value;
|
||||
for (; __first != __last; ++__first, ++__value_)
|
||||
*__first = __value_;
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
300
include/ostream
300
include/ostream
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
virtual ~basic_ostream();
|
||||
|
||||
// 27.7.2.3 Assign/swap
|
||||
basic_ostream& operator=(const basic_ostream& rhs) = delete; // C++14
|
||||
basic_ostream& operator=(basic_ostream&& rhs);
|
||||
void swap(basic_ostream& rhs);
|
||||
|
||||
@@ -133,12 +134,14 @@ template <class charT, class traits, class T>
|
||||
#include <iterator>
|
||||
#include <bitset>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_ostream
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ostream
|
||||
: virtual public basic_ios<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -153,19 +156,24 @@ public:
|
||||
explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb);
|
||||
virtual ~basic_ostream();
|
||||
protected:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream(basic_ostream&& __rhs);
|
||||
#endif
|
||||
|
||||
// 27.7.2.3 Assign/swap
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
basic_ostream& operator=(const basic_ostream&) = delete;
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream& operator=(basic_ostream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_ostream& __rhs);
|
||||
public:
|
||||
|
||||
// 27.7.2.4 Prefix/suffix:
|
||||
class sentry;
|
||||
class _LIBCPP_TYPE_VIS_ONLY sentry;
|
||||
|
||||
// 27.7.2.6 Formatted output:
|
||||
basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&));
|
||||
@@ -203,7 +211,7 @@ protected:
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_ostream<_CharT, _Traits>::sentry
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ostream<_CharT, _Traits>::sentry
|
||||
{
|
||||
bool __ok_;
|
||||
basic_ostream<_CharT, _Traits>& __os_;
|
||||
@@ -216,7 +224,7 @@ public:
|
||||
~sentry();
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
// explicit
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool() const {return __ok_;}
|
||||
};
|
||||
|
||||
@@ -242,7 +250,7 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry()
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
if (__os_.rdbuf()->pubsync() == -1)
|
||||
__os_.setstate(ios_base::badbit);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -250,7 +258,7 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry()
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +269,7 @@ basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<char_type, traits_
|
||||
this->init(__sb);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -279,7 +287,7 @@ basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_ostream<_CharT, _Traits>::~basic_ostream()
|
||||
@@ -328,7 +336,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
@@ -337,12 +345,12 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
||||
_I __i(__sb);
|
||||
_I __eof;
|
||||
_O __o(*this);
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||
_Ip __i(__sb);
|
||||
_Ip __eof;
|
||||
_Op __o(*this);
|
||||
size_t __c = 0;
|
||||
for (; __i != __eof; ++__i, ++__o, ++__c)
|
||||
{
|
||||
@@ -358,7 +366,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
|
||||
{
|
||||
this->__set_failbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
else
|
||||
this->setstate(ios_base::badbit);
|
||||
@@ -369,7 +377,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -380,12 +388,12 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -395,7 +403,7 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -406,13 +414,13 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(),
|
||||
__flags == ios_base::oct || __flags == ios_base::hex ?
|
||||
static_cast<long>(static_cast<unsigned short>(__n)) :
|
||||
@@ -425,7 +433,7 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -436,12 +444,12 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -451,7 +459,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -462,13 +470,13 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(),
|
||||
__flags == ios_base::oct || __flags == ios_base::hex ?
|
||||
static_cast<long>(static_cast<unsigned int>(__n)) :
|
||||
@@ -481,7 +489,7 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -492,12 +500,12 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -507,7 +515,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -518,12 +526,12 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -533,7 +541,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -544,12 +552,12 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -559,7 +567,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -570,12 +578,12 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -585,7 +593,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -596,12 +604,12 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -611,7 +619,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -622,12 +630,12 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -637,7 +645,7 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -648,12 +656,12 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -663,7 +671,7 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -674,12 +682,12 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -689,7 +697,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -700,12 +708,12 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -715,7 +723,7 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -726,12 +734,12 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
||||
if (__pad_and_output(_I(__os),
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
&__c,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
&__c + 1 :
|
||||
@@ -747,7 +755,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
@@ -758,13 +766,13 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
_CharT __c = __os.widen(__cn);
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
||||
if (__pad_and_output(_I(__os),
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
&__c,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
&__c + 1 :
|
||||
@@ -780,7 +788,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
@@ -791,12 +799,12 @@ operator<<(basic_ostream<char, _Traits>& __os, char __c)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
||||
if (__pad_and_output(_I(__os),
|
||||
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
&__c,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
&__c + 1 :
|
||||
@@ -812,7 +820,7 @@ operator<<(basic_ostream<char, _Traits>& __os, char __c)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
@@ -823,12 +831,12 @@ operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
||||
if (__pad_and_output(_I(__os),
|
||||
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
(char*)&__c,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
(char*)&__c + 1 :
|
||||
@@ -844,7 +852,7 @@ operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
@@ -855,12 +863,12 @@ operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
||||
if (__pad_and_output(_I(__os),
|
||||
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
(char*)&__c,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
(char*)&__c + 1 :
|
||||
@@ -876,7 +884,7 @@ operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
@@ -887,13 +895,13 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
size_t __len = _Traits::length(__str);
|
||||
if (__pad_and_output(_I(__os),
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
__str,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
__str + __len :
|
||||
@@ -909,7 +917,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
@@ -920,11 +928,11 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
size_t __len = char_traits<char>::length(__strn);
|
||||
const int __bs = 100;
|
||||
_CharT __wbb[__bs];
|
||||
@@ -939,7 +947,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
|
||||
}
|
||||
for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
|
||||
*__p = __os.widen(*__strn);
|
||||
if (__pad_and_output(_I(__os),
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
__wb,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
__wb + __len :
|
||||
@@ -955,7 +963,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
@@ -966,13 +974,13 @@ operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
||||
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||
size_t __len = _Traits::length(__str);
|
||||
if (__pad_and_output(_I(__os),
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
__str,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
__str + __len :
|
||||
@@ -988,7 +996,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
@@ -999,13 +1007,13 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
||||
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||
size_t __len = _Traits::length((const char*)__str);
|
||||
if (__pad_and_output(_I(__os),
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
(const char*)__str,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
(const char*)__str + __len :
|
||||
@@ -1021,7 +1029,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
@@ -1032,13 +1040,13 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
||||
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||
size_t __len = _Traits::length((const char*)__str);
|
||||
if (__pad_and_output(_I(__os),
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
(const char*)__str,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
(const char*)__str + __len :
|
||||
@@ -1054,7 +1062,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
@@ -1065,12 +1073,12 @@ basic_ostream<_CharT, _Traits>::put(char_type __c)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
||||
_O __o(*this);
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||
_Op __o(*this);
|
||||
*__o = __c;
|
||||
if (__o.failed())
|
||||
this->setstate(ios_base::badbit);
|
||||
@@ -1081,7 +1089,7 @@ basic_ostream<_CharT, _Traits>::put(char_type __c)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1092,21 +1100,12 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __sen(*this);
|
||||
if (__sen && __n)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
||||
_O __o(*this);
|
||||
for (; __n; --__n, ++__o, ++__s)
|
||||
{
|
||||
*__o = *__s;
|
||||
if (__o.failed())
|
||||
{
|
||||
this->setstate(ios_base::badbit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (this->rdbuf()->sputn(__s, __n) != __n)
|
||||
this->setstate(ios_base::badbit);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -1114,7 +1113,7 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1125,7 +1124,7 @@ basic_ostream<_CharT, _Traits>::flush()
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
if (this->rdbuf())
|
||||
{
|
||||
sentry __s(*this);
|
||||
@@ -1141,7 +1140,7 @@ basic_ostream<_CharT, _Traits>::flush()
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1160,7 +1159,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
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))
|
||||
this->setstate(ios_base::failbit);
|
||||
@@ -1173,8 +1173,12 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
|
||||
{
|
||||
if (!this->fail())
|
||||
this->rdbuf()->pubseekoff(__off, __dir, ios_base::out);
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1))
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1206,7 +1210,7 @@ flush(basic_ostream<_CharT, _Traits>& __os)
|
||||
return __os;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Stream, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1214,15 +1218,15 @@ typename enable_if
|
||||
<
|
||||
!is_lvalue_reference<_Stream>::value &&
|
||||
is_base_of<ios_base, _Stream>::value,
|
||||
_Stream&
|
||||
_Stream&&
|
||||
>::type
|
||||
operator<<(_Stream&& __os, const _Tp& __x)
|
||||
{
|
||||
__os << __x;
|
||||
return __os;
|
||||
return _VSTD::move(__os);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
@@ -1232,13 +1236,13 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
size_t __len = __str.size();
|
||||
if (__pad_and_output(_I(__os),
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
__str.data(),
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
__str.data() + __len :
|
||||
@@ -1254,7 +1258,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
{
|
||||
__os.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return __os;
|
||||
}
|
||||
|
||||
@@ -1266,25 +1270,25 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
|
||||
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
|
||||
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();
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, size_t _Size>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, bitset<_Size>& __x)
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
|
||||
{
|
||||
return __os << __x.template to_string<_CharT, _Traits>
|
||||
(use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),
|
||||
use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
|
||||
}
|
||||
|
||||
extern template class basic_ostream<char>;
|
||||
extern template class basic_ostream<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<wchar_t>)
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
||||
328
include/queue
328
include/queue
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -31,21 +31,28 @@ protected:
|
||||
container_type c;
|
||||
|
||||
public:
|
||||
queue();
|
||||
queue() = default;
|
||||
~queue() = default;
|
||||
|
||||
queue(const queue& q) = default;
|
||||
queue(queue&& q) = default;
|
||||
|
||||
queue& operator=(const queue& q) = default;
|
||||
queue& operator=(queue&& q) = default;
|
||||
|
||||
explicit queue(const container_type& c);
|
||||
explicit queue(container_type&& c);
|
||||
queue(queue&& q);
|
||||
explicit queue(container_type&& c)
|
||||
template <class Alloc>
|
||||
explicit queue(const Alloc& a);
|
||||
template <class Alloc>
|
||||
queue(const container_type& c, const Alloc& a);
|
||||
template <class Alloc>
|
||||
queue(container_type&& c, const Alloc& a);
|
||||
template <class Alloc>
|
||||
queue(const queue& q, const Alloc& a);
|
||||
template <class Alloc>
|
||||
queue(queue&& q, const Alloc& a);
|
||||
|
||||
queue& operator=(queue&& q);
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
|
||||
@@ -59,7 +66,7 @@ public:
|
||||
template <class... Args> void emplace(Args&&... args);
|
||||
void pop();
|
||||
|
||||
void swap(queue& q);
|
||||
void swap(queue& q) noexcept(noexcept(swap(c, q.c)));
|
||||
};
|
||||
|
||||
template <class T, class Container>
|
||||
@@ -81,7 +88,8 @@ template <class T, class Container>
|
||||
bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y);
|
||||
|
||||
template <class T, class Container>
|
||||
void swap(queue<T, Container>& x, queue<T, Container>& y);
|
||||
void swap(queue<T, Container>& x, queue<T, Container>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class T, class Container = vector<T>,
|
||||
class Compare = less<typename Container::value_type>>
|
||||
@@ -99,7 +107,16 @@ protected:
|
||||
Compare comp;
|
||||
|
||||
public:
|
||||
explicit priority_queue(const Compare& comp = Compare());
|
||||
priority_queue() = default;
|
||||
~priority_queue() = default;
|
||||
|
||||
priority_queue(const priority_queue& q) = default;
|
||||
priority_queue(priority_queue&& q) = default;
|
||||
|
||||
priority_queue& operator=(const priority_queue& q) = default;
|
||||
priority_queue& operator=(priority_queue&& q) = default;
|
||||
|
||||
explicit priority_queue(const Compare& comp);
|
||||
priority_queue(const Compare& comp, const container_type& c);
|
||||
explicit priority_queue(const Compare& comp, container_type&& c);
|
||||
template <class InputIterator>
|
||||
@@ -111,8 +128,6 @@ public:
|
||||
template <class InputIterator>
|
||||
priority_queue(InputIterator first, InputIterator last,
|
||||
const Compare& comp, container_type&& c);
|
||||
priority_queue(priority_queue&& q);
|
||||
priority_queue& operator=(priority_queue&& q);
|
||||
template <class Alloc>
|
||||
explicit priority_queue(const Alloc& a);
|
||||
template <class Alloc>
|
||||
@@ -123,6 +138,8 @@ public:
|
||||
template <class Alloc>
|
||||
priority_queue(const Compare& comp, container_type&& c,
|
||||
const Alloc& a);
|
||||
template <class Alloc>
|
||||
priority_queue(const priority_queue& q, const Alloc& a);
|
||||
template <class Alloc>
|
||||
priority_queue(priority_queue&& q, const Alloc& a);
|
||||
|
||||
@@ -135,12 +152,14 @@ public:
|
||||
template <class... Args> void emplace(Args&&... args);
|
||||
void pop();
|
||||
|
||||
void swap(priority_queue& q);
|
||||
void swap(priority_queue& q)
|
||||
noexcept(noexcept(swap(c, q.c)) && noexcept(swap(comp.q.comp)));
|
||||
};
|
||||
|
||||
template <class T, class Container, class Compare>
|
||||
void swap(priority_queue<T, Container, Compare>& x,
|
||||
priority_queue<T, Container, Compare>& y);
|
||||
priority_queue<T, Container, Compare>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
} // std
|
||||
|
||||
@@ -152,22 +171,26 @@ template <class T, class Container, class Compare>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_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>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
|
||||
|
||||
template <class _Tp, class _Container = deque<_Tp> >
|
||||
class queue
|
||||
class _LIBCPP_TYPE_VIS_ONLY queue
|
||||
{
|
||||
public:
|
||||
typedef _Container container_type;
|
||||
@@ -180,82 +203,123 @@ protected:
|
||||
container_type c;
|
||||
|
||||
public:
|
||||
queue() : c() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
|
||||
: c() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(const queue& __q) : c(__q.c) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(queue&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
|
||||
: c(_VSTD::move(__q.c)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue& operator=(const queue& __q) {c = __q.c; return *this;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue& operator=(queue&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
|
||||
{c = _VSTD::move(__q.c); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit queue(const container_type& __c) : c(__c) {}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
explicit queue(container_type&& __c) : c(_STD::move(__c)) {}
|
||||
queue(queue&& __q) : c(_STD::move(__q.c)) {}
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit queue(const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(const queue& __q, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__q.c, __a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(const container_type& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__c, __a) {}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(container_type&& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_STD::move(__c), __a) {}
|
||||
: c(_VSTD::move(__c), __a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(queue&& __q, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_STD::move(__q.c), __a) {}
|
||||
: c(_VSTD::move(__q.c), __a) {}
|
||||
|
||||
queue& operator=(queue&& __q)
|
||||
{
|
||||
c = _STD::move(__q.c);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return c.empty();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return c.size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference front() {return c.front();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference front() const {return c.front();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference back() {return c.back();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference back() const {return c.back();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(const value_type& __v) {c.push_back(__v);}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(_Args&&... __args)
|
||||
{c.emplace_back(_STD::forward<_Args>(__args)...);}
|
||||
#endif
|
||||
{c.emplace_back(_VSTD::forward<_Args>(__args)...);}
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void pop() {c.pop_front();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(queue& __q)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(c, __q.c);
|
||||
}
|
||||
|
||||
template <class _T1, class _C1>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
|
||||
|
||||
|
||||
template <class _T1, class _C1>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
|
||||
};
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -263,7 +327,7 @@ operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -271,7 +335,7 @@ operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -279,7 +343,7 @@ operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -287,7 +351,7 @@ operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -295,7 +359,7 @@ operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -303,22 +367,23 @@ operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Alloc>
|
||||
struct uses_allocator<queue<_Tp, _Container>, _Alloc>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<queue<_Tp, _Container>, _Alloc>
|
||||
: public uses_allocator<_Container, _Alloc>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, class _Container = vector<_Tp>,
|
||||
class _Compare = less<typename _Container::value_type> >
|
||||
class priority_queue
|
||||
class _LIBCPP_TYPE_VIS_ONLY priority_queue
|
||||
{
|
||||
public:
|
||||
typedef _Container container_type;
|
||||
@@ -333,10 +398,40 @@ protected:
|
||||
value_compare comp;
|
||||
|
||||
public:
|
||||
explicit priority_queue(const value_compare& __comp = value_compare())
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value &&
|
||||
is_nothrow_default_constructible<value_compare>::value)
|
||||
: c(), comp() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue(priority_queue&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
|
||||
is_nothrow_move_constructible<value_compare>::value)
|
||||
: c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue& operator=(const priority_queue& __q)
|
||||
{c = __q.c; comp = __q.comp; return *this;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue& operator=(priority_queue&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
|
||||
is_nothrow_move_assignable<value_compare>::value)
|
||||
{c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit priority_queue(const value_compare& __comp)
|
||||
: c(), comp(__comp) {}
|
||||
priority_queue(const value_compare& __comp, const container_type& __c);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
explicit priority_queue(const value_compare& __comp, container_type&& __c);
|
||||
#endif
|
||||
template <class _InputIter>
|
||||
@@ -345,13 +440,11 @@ public:
|
||||
template <class _InputIter>
|
||||
priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp, const container_type& __c);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _InputIter>
|
||||
priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp, container_type&& __c);
|
||||
priority_queue(priority_queue&& __q);
|
||||
priority_queue& operator=(priority_queue&& __q);
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
explicit priority_queue(const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
@@ -369,7 +462,7 @@ public:
|
||||
priority_queue(const priority_queue& __q, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
priority_queue(const value_compare& __comp, container_type&& __c,
|
||||
const _Alloc& __a,
|
||||
@@ -379,60 +472,67 @@ public:
|
||||
priority_queue(priority_queue&& __q, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0);
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return c.empty();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return c.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference top() const {return c.front();}
|
||||
|
||||
void push(const value_type& __v);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void push(value_type&& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args> void emplace(_Args&&... __args);
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void pop();
|
||||
|
||||
void swap(priority_queue& __q);
|
||||
void swap(priority_queue& __q)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
|
||||
__is_nothrow_swappable<value_compare>::value);
|
||||
};
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp,
|
||||
const container_type& __c)
|
||||
: c(__c),
|
||||
comp(__comp)
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
|
||||
container_type&& __c)
|
||||
: c(_STD::move(__c)),
|
||||
: c(_VSTD::move(__c)),
|
||||
comp(__comp)
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _InputIter>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp)
|
||||
: c(__f, __l),
|
||||
comp(__comp)
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _InputIter>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp,
|
||||
const container_type& __c)
|
||||
@@ -440,46 +540,29 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
|
||||
comp(__comp)
|
||||
{
|
||||
c.insert(c.end(), __f, __l);
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _InputIter>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp,
|
||||
container_type&& __c)
|
||||
: c(_STD::move(__c)),
|
||||
: c(_VSTD::move(__c)),
|
||||
comp(__comp)
|
||||
{
|
||||
c.insert(c.end(), __f, __l);
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q)
|
||||
: c(_STD::move(__q.c)),
|
||||
comp(_STD::move(__q.comp))
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
priority_queue<_Tp, _Container, _Compare>&
|
||||
priority_queue<_Tp, _Container, _Compare>::operator=(priority_queue&& __q)
|
||||
{
|
||||
c = _STD::move(__q.c);
|
||||
comp = _STD::move(__q.comp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type*)
|
||||
@@ -489,7 +572,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
@@ -501,7 +584,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
|
||||
const container_type& __c,
|
||||
const _Alloc& __a,
|
||||
@@ -510,12 +593,12 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
|
||||
: c(__c, __a),
|
||||
comp(__comp)
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
@@ -523,103 +606,108 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue&
|
||||
: c(__q.c, __a),
|
||||
comp(__q.comp)
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
|
||||
container_type&& __c,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type*)
|
||||
: c(_STD::move(__c), __a),
|
||||
: c(_VSTD::move(__c), __a),
|
||||
comp(__comp)
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type*)
|
||||
: c(_STD::move(__q.c), __a),
|
||||
comp(_STD::move(__q.comp))
|
||||
: c(_VSTD::move(__q.c), __a),
|
||||
comp(_VSTD::move(__q.comp))
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
|
||||
{
|
||||
c.push_back(__v);
|
||||
_STD::push_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
|
||||
{
|
||||
c.push_back(_STD::move(__v));
|
||||
_STD::push_heap(c.begin(), c.end(), comp);
|
||||
c.push_back(_VSTD::move(__v));
|
||||
_VSTD::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class... _Args>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
|
||||
{
|
||||
c.emplace_back(_STD::forward<_Args>(__args)...);
|
||||
_STD::push_heap(c.begin(), c.end(), comp);
|
||||
c.emplace_back(_VSTD::forward<_Args>(__args)...);
|
||||
_VSTD::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::pop()
|
||||
{
|
||||
_STD::pop_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::pop_heap(c.begin(), c.end(), comp);
|
||||
c.pop_back();
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
|
||||
__is_nothrow_swappable<value_compare>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(c, __q.c);
|
||||
swap(comp, __q.comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(priority_queue<_Tp, _Container, _Compare>& __x,
|
||||
priority_queue<_Tp, _Container, _Compare>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare, class _Alloc>
|
||||
struct 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>
|
||||
{
|
||||
};
|
||||
|
||||
2266
include/random
2266
include/random
File diff suppressed because it is too large
Load Diff
117
include/ratio
117
include/ratio
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -23,13 +23,14 @@ class ratio
|
||||
public:
|
||||
static const intmax_t num;
|
||||
static const intmax_t den;
|
||||
typedef ratio<num, den> type;
|
||||
};
|
||||
|
||||
// ratio arithmetic
|
||||
template <class R1, class R2> struct ratio_add;
|
||||
template <class R1, class R2> struct ratio_subtract;
|
||||
template <class R1, class R2> struct ratio_multiply;
|
||||
template <class R1, class R2> struct ratio_divide;
|
||||
template <class R1, class R2> using ratio_add = ...;
|
||||
template <class R1, class R2> using ratio_subtract = ...;
|
||||
template <class R1, class R2> using ratio_multiply = ...;
|
||||
template <class R1, class R2> using ratio_divide = ...;
|
||||
|
||||
// ratio comparison
|
||||
template <class R1, class R2> struct ratio_equal;
|
||||
@@ -69,7 +70,11 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported
|
||||
#include <climits>
|
||||
#include <type_traits>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -87,6 +92,12 @@ struct __static_gcd<_Xp, 0>
|
||||
static const intmax_t value = _Xp;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct __static_gcd<0, 0>
|
||||
{
|
||||
static const intmax_t value = 1;
|
||||
};
|
||||
|
||||
// __static_lcm
|
||||
|
||||
template <intmax_t _Xp, intmax_t _Yp>
|
||||
@@ -220,7 +231,7 @@ public:
|
||||
};
|
||||
|
||||
template <intmax_t _Num, intmax_t _Den = 1>
|
||||
class ratio
|
||||
class _LIBCPP_TYPE_VIS_ONLY ratio
|
||||
{
|
||||
static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
|
||||
static_assert(_Den != 0, "ratio divide by 0");
|
||||
@@ -260,7 +271,7 @@ typedef ratio< 1000000000000000LL, 1LL> peta;
|
||||
typedef ratio<1000000000000000000LL, 1LL> exa;
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_multiply
|
||||
struct __ratio_multiply
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value;
|
||||
@@ -273,8 +284,21 @@ public:
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2> using ratio_multiply
|
||||
= typename __ratio_multiply<_R1, _R2>::type;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_divide
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_multiply
|
||||
: public __ratio_multiply<_R1, _R2>::type {};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_divide
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
||||
@@ -287,8 +311,21 @@ public:
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2> using ratio_divide
|
||||
= typename __ratio_divide<_R1, _R2>::type;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_add
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_divide
|
||||
: public __ratio_divide<_R1, _R2>::type {};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_add
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
||||
@@ -309,8 +346,21 @@ public:
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2> using ratio_add
|
||||
= typename __ratio_add<_R1, _R2>::type;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_subtract
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_add
|
||||
: public __ratio_add<_R1, _R2>::type {};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_subtract
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
||||
@@ -331,15 +381,28 @@ public:
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2> using ratio_subtract
|
||||
= typename __ratio_subtract<_R1, _R2>::type;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_subtract
|
||||
: public __ratio_subtract<_R1, _R2>::type {};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
// ratio_equal
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_equal
|
||||
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_equal
|
||||
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_not_equal
|
||||
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_not_equal
|
||||
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
|
||||
|
||||
// ratio_less
|
||||
|
||||
@@ -351,27 +414,27 @@ struct __ratio_less1
|
||||
static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Q>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, 0>
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Qp>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0>
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M2>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, _M2>
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M2>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2>
|
||||
{
|
||||
static const bool value = !_Odd;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M1>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, 0>
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0>
|
||||
{
|
||||
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>
|
||||
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>,
|
||||
ratio<_R2::den, _M2>, !_Odd>::value;
|
||||
@@ -397,19 +460,19 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL>
|
||||
};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_less
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_less
|
||||
: public integral_constant<bool, __ratio_less<_R1, _R2>::value> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_less_equal
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_less_equal
|
||||
: public integral_constant<bool, !ratio_less<_R2, _R1>::value> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_greater
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_greater
|
||||
: public integral_constant<bool, ratio_less<_R2, _R1>::value> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_greater_equal
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_greater_equal
|
||||
: public integral_constant<bool, !ratio_less<_R1, _R2>::value> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
|
||||
4934
include/regex
4934
include/regex
File diff suppressed because it is too large
Load Diff
578
include/scoped_allocator
Normal file
578
include/scoped_allocator
Normal file
@@ -0,0 +1,578 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- scoped_allocator --------------------------===//
|
||||
//
|
||||
// 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_SCOPED_ALLOCATOR
|
||||
#define _LIBCPP_SCOPED_ALLOCATOR
|
||||
|
||||
/*
|
||||
scoped_allocator synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template <class OuterAlloc, class... InnerAllocs>
|
||||
class scoped_allocator_adaptor : public OuterAlloc
|
||||
{
|
||||
typedef allocator_traits<OuterAlloc> OuterTraits; // exposition only
|
||||
scoped_allocator_adaptor<InnerAllocs...> inner; // exposition only
|
||||
public:
|
||||
|
||||
typedef OuterAlloc outer_allocator_type;
|
||||
typedef see below inner_allocator_type;
|
||||
|
||||
typedef typename OuterTraits::value_type value_type;
|
||||
typedef typename OuterTraits::size_type size_type;
|
||||
typedef typename OuterTraits::difference_type difference_type;
|
||||
typedef typename OuterTraits::pointer pointer;
|
||||
typedef typename OuterTraits::const_pointer const_pointer;
|
||||
typedef typename OuterTraits::void_pointer void_pointer;
|
||||
typedef typename OuterTraits::const_void_pointer const_void_pointer;
|
||||
|
||||
typedef see below propagate_on_container_copy_assignment;
|
||||
typedef see below propagate_on_container_move_assignment;
|
||||
typedef see below propagate_on_container_swap;
|
||||
|
||||
template <class Tp>
|
||||
struct rebind
|
||||
{
|
||||
typedef scoped_allocator_adaptor<
|
||||
OuterTraits::template rebind_alloc<Tp>, InnerAllocs...> other;
|
||||
};
|
||||
|
||||
scoped_allocator_adaptor();
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor(OuterA2&& outerAlloc,
|
||||
const InnerAllocs&... innerAllocs) noexcept;
|
||||
scoped_allocator_adaptor(const scoped_allocator_adaptor& other) noexcept;
|
||||
scoped_allocator_adaptor(scoped_allocator_adaptor&& other) noexcept;
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other) noexcept;
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept;
|
||||
|
||||
~scoped_allocator_adaptor();
|
||||
|
||||
inner_allocator_type& inner_allocator() noexcept;
|
||||
const inner_allocator_type& inner_allocator() const noexcept;
|
||||
|
||||
outer_allocator_type& outer_allocator() noexcept;
|
||||
const outer_allocator_type& outer_allocator() const noexcept;
|
||||
|
||||
pointer allocate(size_type n);
|
||||
pointer allocate(size_type n, const_void_pointer hint);
|
||||
void deallocate(pointer p, size_type n) noexcept;
|
||||
|
||||
size_type max_size() const;
|
||||
template <class T, class... Args> void construct(T* p, Args&& args);
|
||||
template <class T1, class T2, class... Args1, class... Args2>
|
||||
void construct(pair<T1, T2>* p, piecewise_construct t, tuple<Args1...> x,
|
||||
tuple<Args2...> y);
|
||||
template <class T1, class T2>
|
||||
void construct(pair<T1, T2>* p);
|
||||
template <class T1, class T2, class U, class V>
|
||||
void construct(pair<T1, T2>* p, U&& x, V&& y);
|
||||
template <class T1, class T2, class U, class V>
|
||||
void construct(pair<T1, T2>* p, const pair<U, V>& x);
|
||||
template <class T1, class T2, class U, class V>
|
||||
void construct(pair<T1, T2>* p, pair<U, V>&& x);
|
||||
template <class T> void destroy(T* p);
|
||||
|
||||
template <class T> void destroy(T* p) noexcept;
|
||||
|
||||
scoped_allocator_adaptor select_on_container_copy_construction() const noexcept;
|
||||
};
|
||||
|
||||
template <class OuterA1, class OuterA2, class... InnerAllocs>
|
||||
bool
|
||||
operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
|
||||
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
|
||||
|
||||
template <class OuterA1, class OuterA2, class... InnerAllocs>
|
||||
bool
|
||||
operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
|
||||
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <memory>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
|
||||
|
||||
// scoped_allocator_adaptor
|
||||
|
||||
template <class ..._Allocs>
|
||||
class scoped_allocator_adaptor;
|
||||
|
||||
template <class ..._Allocs> struct __get_poc_copy_assignment;
|
||||
|
||||
template <class _A0>
|
||||
struct __get_poc_copy_assignment<_A0>
|
||||
{
|
||||
static const bool value = allocator_traits<_A0>::
|
||||
propagate_on_container_copy_assignment::value;
|
||||
};
|
||||
|
||||
template <class _A0, class ..._Allocs>
|
||||
struct __get_poc_copy_assignment<_A0, _Allocs...>
|
||||
{
|
||||
static const bool value =
|
||||
allocator_traits<_A0>::propagate_on_container_copy_assignment::value ||
|
||||
__get_poc_copy_assignment<_Allocs...>::value;
|
||||
};
|
||||
|
||||
template <class ..._Allocs> struct __get_poc_move_assignment;
|
||||
|
||||
template <class _A0>
|
||||
struct __get_poc_move_assignment<_A0>
|
||||
{
|
||||
static const bool value = allocator_traits<_A0>::
|
||||
propagate_on_container_move_assignment::value;
|
||||
};
|
||||
|
||||
template <class _A0, class ..._Allocs>
|
||||
struct __get_poc_move_assignment<_A0, _Allocs...>
|
||||
{
|
||||
static const bool value =
|
||||
allocator_traits<_A0>::propagate_on_container_move_assignment::value ||
|
||||
__get_poc_move_assignment<_Allocs...>::value;
|
||||
};
|
||||
|
||||
template <class ..._Allocs> struct __get_poc_swap;
|
||||
|
||||
template <class _A0>
|
||||
struct __get_poc_swap<_A0>
|
||||
{
|
||||
static const bool value = allocator_traits<_A0>::
|
||||
propagate_on_container_swap::value;
|
||||
};
|
||||
|
||||
template <class _A0, class ..._Allocs>
|
||||
struct __get_poc_swap<_A0, _Allocs...>
|
||||
{
|
||||
static const bool value =
|
||||
allocator_traits<_A0>::propagate_on_container_swap::value ||
|
||||
__get_poc_swap<_Allocs...>::value;
|
||||
};
|
||||
|
||||
template <class ..._Allocs>
|
||||
class __scoped_allocator_storage;
|
||||
|
||||
template <class _OuterAlloc, class... _InnerAllocs>
|
||||
class __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
|
||||
: public _OuterAlloc
|
||||
{
|
||||
typedef _OuterAlloc outer_allocator_type;
|
||||
protected:
|
||||
typedef scoped_allocator_adaptor<_InnerAllocs...> inner_allocator_type;
|
||||
|
||||
private:
|
||||
inner_allocator_type __inner_;
|
||||
|
||||
protected:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage() _NOEXCEPT {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(_OuterA2&& __outerAlloc,
|
||||
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)),
|
||||
__inner_(__innerAllocs...) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, const _OuterA2&>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
|
||||
: outer_allocator_type(__other.outer_allocator()),
|
||||
__inner_(__other.inner_allocator()) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::move(__other.outer_allocator())),
|
||||
__inner_(_VSTD::move(__other.inner_allocator())) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(_OuterA2&& __o,
|
||||
const inner_allocator_type& __i) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::forward<_OuterA2>(__o)),
|
||||
__inner_(__i)
|
||||
{
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inner_allocator_type& inner_allocator() _NOEXCEPT {return __inner_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const inner_allocator_type& inner_allocator() const _NOEXCEPT {return __inner_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
outer_allocator_type& outer_allocator() _NOEXCEPT
|
||||
{return static_cast<outer_allocator_type&>(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const outer_allocator_type& outer_allocator() const _NOEXCEPT
|
||||
{return static_cast<const outer_allocator_type&>(*this);}
|
||||
|
||||
scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
select_on_container_copy_construction() const _NOEXCEPT
|
||||
{
|
||||
return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
|
||||
(
|
||||
allocator_traits<outer_allocator_type>::
|
||||
select_on_container_copy_construction(outer_allocator()),
|
||||
allocator_traits<inner_allocator_type>::
|
||||
select_on_container_copy_construction(inner_allocator())
|
||||
);
|
||||
}
|
||||
|
||||
template <class...> friend class __scoped_allocator_storage;
|
||||
};
|
||||
|
||||
template <class _OuterAlloc>
|
||||
class __scoped_allocator_storage<_OuterAlloc>
|
||||
: public _OuterAlloc
|
||||
{
|
||||
typedef _OuterAlloc outer_allocator_type;
|
||||
protected:
|
||||
typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage() _NOEXCEPT {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(_OuterA2&& __outerAlloc) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, const _OuterA2&>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT
|
||||
: outer_allocator_type(__other.outer_allocator()) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
__scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::move(__other.outer_allocator())) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inner_allocator_type& inner_allocator() _NOEXCEPT
|
||||
{return static_cast<inner_allocator_type&>(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const inner_allocator_type& inner_allocator() const _NOEXCEPT
|
||||
{return static_cast<const inner_allocator_type&>(*this);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
outer_allocator_type& outer_allocator() _NOEXCEPT
|
||||
{return static_cast<outer_allocator_type&>(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const outer_allocator_type& outer_allocator() const _NOEXCEPT
|
||||
{return static_cast<const outer_allocator_type&>(*this);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor<outer_allocator_type>
|
||||
select_on_container_copy_construction() const _NOEXCEPT
|
||||
{return scoped_allocator_adaptor<outer_allocator_type>(
|
||||
allocator_traits<outer_allocator_type>::
|
||||
select_on_container_copy_construction(outer_allocator())
|
||||
);}
|
||||
|
||||
__scoped_allocator_storage(const outer_allocator_type& __o,
|
||||
const inner_allocator_type& __i) _NOEXCEPT;
|
||||
|
||||
template <class...> friend class __scoped_allocator_storage;
|
||||
};
|
||||
|
||||
// __outermost
|
||||
|
||||
template <class _Alloc>
|
||||
decltype(declval<_Alloc>().outer_allocator(), true_type())
|
||||
__has_outer_allocator_test(_Alloc&& __a);
|
||||
|
||||
template <class _Alloc>
|
||||
false_type
|
||||
__has_outer_allocator_test(const volatile _Alloc& __a);
|
||||
|
||||
template <class _Alloc>
|
||||
struct __has_outer_allocator
|
||||
: public common_type
|
||||
<
|
||||
decltype(__has_outer_allocator_test(declval<_Alloc&>()))
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Alloc, bool = __has_outer_allocator<_Alloc>::value>
|
||||
struct __outermost
|
||||
{
|
||||
typedef _Alloc type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
type& operator()(type& __a) const _NOEXCEPT {return __a;}
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
struct __outermost<_Alloc, true>
|
||||
{
|
||||
typedef typename remove_reference
|
||||
<
|
||||
decltype(_VSTD::declval<_Alloc>().outer_allocator())
|
||||
>::type _OuterAlloc;
|
||||
typedef typename __outermost<_OuterAlloc>::type type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
type& operator()(_Alloc& __a) const _NOEXCEPT
|
||||
{return __outermost<_OuterAlloc>()(__a.outer_allocator());}
|
||||
};
|
||||
|
||||
template <class _OuterAlloc, class... _InnerAllocs>
|
||||
class _LIBCPP_TYPE_VIS_ONLY scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
|
||||
: public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
|
||||
{
|
||||
typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
|
||||
typedef allocator_traits<_OuterAlloc> _OuterTraits;
|
||||
public:
|
||||
typedef _OuterAlloc outer_allocator_type;
|
||||
typedef typename base::inner_allocator_type inner_allocator_type;
|
||||
typedef typename _OuterTraits::size_type size_type;
|
||||
typedef typename _OuterTraits::difference_type difference_type;
|
||||
typedef typename _OuterTraits::pointer pointer;
|
||||
typedef typename _OuterTraits::const_pointer const_pointer;
|
||||
typedef typename _OuterTraits::void_pointer void_pointer;
|
||||
typedef typename _OuterTraits::const_void_pointer const_void_pointer;
|
||||
|
||||
typedef integral_constant
|
||||
<
|
||||
bool,
|
||||
__get_poc_copy_assignment<outer_allocator_type,
|
||||
_InnerAllocs...>::value
|
||||
> propagate_on_container_copy_assignment;
|
||||
typedef integral_constant
|
||||
<
|
||||
bool,
|
||||
__get_poc_move_assignment<outer_allocator_type,
|
||||
_InnerAllocs...>::value
|
||||
> propagate_on_container_move_assignment;
|
||||
typedef integral_constant
|
||||
<
|
||||
bool,
|
||||
__get_poc_swap<outer_allocator_type, _InnerAllocs...>::value
|
||||
> propagate_on_container_swap;
|
||||
|
||||
template <class _Tp>
|
||||
struct rebind
|
||||
{
|
||||
typedef scoped_allocator_adaptor
|
||||
<
|
||||
typename _OuterTraits::template rebind_alloc<_Tp>, _InnerAllocs...
|
||||
> other;
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor() _NOEXCEPT {}
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(_OuterA2&& __outerAlloc,
|
||||
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
|
||||
: base(_VSTD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
|
||||
// scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, const _OuterA2&>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(
|
||||
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
|
||||
: base(__other) {}
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(
|
||||
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
|
||||
: base(_VSTD::move(__other)) {}
|
||||
|
||||
// ~scoped_allocator_adaptor() = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inner_allocator_type& inner_allocator() _NOEXCEPT
|
||||
{return base::inner_allocator();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const inner_allocator_type& inner_allocator() const _NOEXCEPT
|
||||
{return base::inner_allocator();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
outer_allocator_type& outer_allocator() _NOEXCEPT
|
||||
{return base::outer_allocator();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const outer_allocator_type& outer_allocator() const _NOEXCEPT
|
||||
{return base::outer_allocator();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer allocate(size_type __n)
|
||||
{return allocator_traits<outer_allocator_type>::
|
||||
allocate(outer_allocator(), __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer allocate(size_type __n, const_void_pointer __hint)
|
||||
{return allocator_traits<outer_allocator_type>::
|
||||
allocate(outer_allocator(), __n, __hint);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void deallocate(pointer __p, size_type __n) _NOEXCEPT
|
||||
{allocator_traits<outer_allocator_type>::
|
||||
deallocate(outer_allocator(), __p, __n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const
|
||||
{return allocator_traits<outer_allocator_type>::max_size(outer_allocator());}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void construct(_Tp* __p, _Args&& ...__args)
|
||||
{__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(),
|
||||
__p, _VSTD::forward<_Args>(__args)...);}
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void destroy(_Tp* __p)
|
||||
{
|
||||
typedef __outermost<outer_allocator_type> _OM;
|
||||
allocator_traits<typename _OM::type>::
|
||||
destroy(_OM()(outer_allocator()), __p);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT
|
||||
{return base::select_on_container_copy_construction();}
|
||||
|
||||
private:
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(_OuterA2&& __o,
|
||||
const inner_allocator_type& __i) _NOEXCEPT
|
||||
: base(_VSTD::forward<_OuterA2>(__o), __i) {}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __construct(integral_constant<int, 0>, _Tp* __p, _Args&& ...__args)
|
||||
{
|
||||
typedef __outermost<outer_allocator_type> _OM;
|
||||
allocator_traits<typename _OM::type>::construct
|
||||
(
|
||||
_OM()(outer_allocator()),
|
||||
__p,
|
||||
_VSTD::forward<_Args>(__args)...
|
||||
);
|
||||
}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __construct(integral_constant<int, 1>, _Tp* __p, _Args&& ...__args)
|
||||
{
|
||||
typedef __outermost<outer_allocator_type> _OM;
|
||||
allocator_traits<typename _OM::type>::construct
|
||||
(
|
||||
_OM()(outer_allocator()),
|
||||
__p,
|
||||
allocator_arg,
|
||||
inner_allocator(),
|
||||
_VSTD::forward<_Args>(__args)...
|
||||
);
|
||||
}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __construct(integral_constant<int, 2>, _Tp* __p, _Args&& ...__args)
|
||||
{
|
||||
typedef __outermost<outer_allocator_type> _OM;
|
||||
allocator_traits<typename _OM::type>::construct
|
||||
(
|
||||
_OM()(outer_allocator()),
|
||||
__p,
|
||||
_VSTD::forward<_Args>(__args)...,
|
||||
inner_allocator()
|
||||
);
|
||||
}
|
||||
|
||||
template <class...> friend class __scoped_allocator_storage;
|
||||
};
|
||||
|
||||
template <class _OuterA1, class _OuterA2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const scoped_allocator_adaptor<_OuterA1>& __a,
|
||||
const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT
|
||||
{
|
||||
return __a.outer_allocator() == __b.outer_allocator();
|
||||
}
|
||||
|
||||
template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a,
|
||||
const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT
|
||||
{
|
||||
return __a.outer_allocator() == __b.outer_allocator() &&
|
||||
__a.inner_allocator() == __b.inner_allocator();
|
||||
}
|
||||
|
||||
template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
|
||||
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT
|
||||
{
|
||||
return !(__a == __b);
|
||||
}
|
||||
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_SCOPED_ALLOCATOR
|
||||
652
include/set
652
include/set
File diff suppressed because it is too large
Load Diff
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
|
||||
246
include/sstream
246
include/sstream
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -175,14 +175,18 @@ typedef basic_stringstream<wchar_t> wstringstream;
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// basic_stringbuf
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class basic_stringbuf
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_stringbuf
|
||||
: public basic_streambuf<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -206,12 +210,12 @@ public:
|
||||
explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
explicit basic_stringbuf(const string_type& __s,
|
||||
ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_stringbuf(basic_stringbuf&& __rhs);
|
||||
#endif
|
||||
|
||||
// 27.8.1.2 Assign and swap:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_stringbuf& operator=(basic_stringbuf&& __rhs);
|
||||
#endif
|
||||
void swap(basic_stringbuf& __rhs);
|
||||
@@ -250,23 +254,42 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type&
|
||||
str(__s);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs)
|
||||
: __mode_(__rhs.__mode_)
|
||||
{
|
||||
ptrdiff_t __ninp = __rhs.gptr() - __rhs.eback();
|
||||
ptrdiff_t __einp = __rhs.egptr() - __rhs.eback();
|
||||
ptrdiff_t __nout = __rhs.pptr() - __rhs.pbase();
|
||||
ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
|
||||
ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
|
||||
__str_ = _STD::move(__rhs.__str_);
|
||||
char_type* __p = const_cast<char_type*>(__str_.data());
|
||||
this->setg(__p, __p + __ninp, __p + __einp);
|
||||
this->setp(__p, __p + __eout);
|
||||
this->pbump(__nout);
|
||||
__hm_ = __p + __hm;
|
||||
char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
|
||||
ptrdiff_t __binp = -1;
|
||||
ptrdiff_t __ninp = -1;
|
||||
ptrdiff_t __einp = -1;
|
||||
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_);
|
||||
__p = const_cast<char_type*>(__str_.data());
|
||||
if (__binp != -1)
|
||||
this->setg(__p + __binp, __p + __ninp, __p + __einp);
|
||||
if (__bout != -1)
|
||||
{
|
||||
this->setp(__p + __bout, __p + __eout);
|
||||
this->pbump(__nout);
|
||||
}
|
||||
__hm_ = __hm == -1 ? nullptr : __p + __hm;
|
||||
__p = const_cast<char_type*>(__rhs.__str_.data());
|
||||
__rhs.setg(__p, __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>::operator=(basic_stringbuf&& __rhs)
|
||||
{
|
||||
ptrdiff_t __ninp = __rhs.gptr() - __rhs.eback();
|
||||
ptrdiff_t __einp = __rhs.egptr() - __rhs.eback();
|
||||
ptrdiff_t __nout = __rhs.pptr() - __rhs.pbase();
|
||||
ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
|
||||
ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
|
||||
char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
|
||||
ptrdiff_t __binp = -1;
|
||||
ptrdiff_t __ninp = -1;
|
||||
ptrdiff_t __einp = -1;
|
||||
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_);
|
||||
__p = const_cast<char_type*>(__str_.data());
|
||||
if (__binp != -1)
|
||||
this->setg(__p + __binp, __p + __ninp, __p + __einp);
|
||||
if (__bout != -1)
|
||||
{
|
||||
this->setp(__p + __bout, __p + __eout);
|
||||
this->pbump(__nout);
|
||||
}
|
||||
__hm_ = __hm == -1 ? nullptr : __p + __hm;
|
||||
__mode_ = __rhs.__mode_;
|
||||
__str_ = _STD::move(__rhs.__str_);
|
||||
char_type* __p = const_cast<char_type*>(__str_.data());
|
||||
this->setg(__p, __p + __ninp, __p + __einp);
|
||||
this->setp(__p, __p + __eout);
|
||||
this->pbump(__nout);
|
||||
__hm_ = __p + __hm;
|
||||
__p = const_cast<char_type*>(__rhs.__str_.data());
|
||||
__rhs.setg(__p, __p, __p);
|
||||
__rhs.setp(__p, __p);
|
||||
@@ -298,34 +340,80 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void
|
||||
basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
|
||||
{
|
||||
ptrdiff_t __rninp = __rhs.gptr() - __rhs.eback();
|
||||
ptrdiff_t __reinp = __rhs.egptr() - __rhs.eback();
|
||||
ptrdiff_t __rnout = __rhs.pptr() - __rhs.pbase();
|
||||
ptrdiff_t __reout = __rhs.epptr() - __rhs.pbase();
|
||||
ptrdiff_t __rhm = __rhs.__hm_ - __rhs.pbase();
|
||||
ptrdiff_t __lninp = this->gptr() - this->eback();
|
||||
ptrdiff_t __leinp = this->egptr() - this->eback();
|
||||
ptrdiff_t __lnout = this->pptr() - this->pbase();
|
||||
ptrdiff_t __leout = this->epptr() - this->pbase();
|
||||
ptrdiff_t __lhm = this->__hm_ - this->pbase();
|
||||
_STD::swap(__mode_, __rhs.__mode_);
|
||||
char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
|
||||
ptrdiff_t __rbinp = -1;
|
||||
ptrdiff_t __rninp = -1;
|
||||
ptrdiff_t __reinp = -1;
|
||||
if (__rhs.eback() != nullptr)
|
||||
{
|
||||
__rbinp = __rhs.eback() - __p;
|
||||
__rninp = __rhs.gptr() - __p;
|
||||
__reinp = __rhs.egptr() - __p;
|
||||
}
|
||||
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_);
|
||||
__str_.swap(__rhs.__str_);
|
||||
char_type* __p = const_cast<char_type*>(__str_.data());
|
||||
this->setg(__p, __p + __rninp, __p + __reinp);
|
||||
this->setp(__p, __p + __reout);
|
||||
this->pbump(__rnout);
|
||||
__hm_ = __p + __rhm;
|
||||
__p = const_cast<char_type*>(__str_.data());
|
||||
if (__rbinp != -1)
|
||||
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);
|
||||
}
|
||||
else
|
||||
this->setp(nullptr, nullptr);
|
||||
__hm_ = __rhm == -1 ? nullptr : __p + __rhm;
|
||||
__p = const_cast<char_type*>(__rhs.__str_.data());
|
||||
__rhs.setg(__p, __p + __lninp, __p + __leinp);
|
||||
__rhs.setp(__p, __p + __leout);
|
||||
__rhs.pbump(__lnout);
|
||||
__rhs.__hm_ = __p + __lhm;
|
||||
if (__lbinp != -1)
|
||||
__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);
|
||||
}
|
||||
else
|
||||
__rhs.setp(nullptr, nullptr);
|
||||
__rhs.__hm_ = __lhm == -1 ? nullptr : __p + __lhm;
|
||||
locale __tl = __rhs.getloc();
|
||||
__rhs.pubimbue(this->getloc());
|
||||
this->pubimbue(__tl);
|
||||
@@ -434,7 +522,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
ptrdiff_t __nout = this->pptr() - this->pbase();
|
||||
ptrdiff_t __hm = __hm_ - this->pbase();
|
||||
__str_.push_back(char_type());
|
||||
@@ -449,9 +537,9 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
|
||||
{
|
||||
return traits_type::eof();
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
__hm_ = max(this->pptr() + 1, __hm_);
|
||||
__hm_ = _VSTD::max(this->pptr() + 1, __hm_);
|
||||
if (__mode_ & ios_base::in)
|
||||
{
|
||||
char_type* __p = const_cast<char_type*>(__str_.data());
|
||||
@@ -525,7 +613,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
|
||||
// basic_istringstream
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class basic_istringstream
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_istringstream
|
||||
: public basic_istream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -546,12 +634,12 @@ public:
|
||||
explicit basic_istringstream(ios_base::openmode __wch = ios_base::in);
|
||||
explicit basic_istringstream(const string_type& __s,
|
||||
ios_base::openmode __wch = ios_base::in);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_istringstream(basic_istringstream&& __rhs);
|
||||
|
||||
// 27.8.2.2 Assign and swap:
|
||||
basic_istringstream& operator=(basic_istringstream&& __rhs);
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void swap(basic_istringstream& __rhs);
|
||||
|
||||
// 27.8.2.3 Members:
|
||||
@@ -577,13 +665,13 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs)
|
||||
: basic_istream<_CharT, _Traits>(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -592,12 +680,12 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_istringstream<_CharT, _Traits, _Allocator>&
|
||||
basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs)
|
||||
{
|
||||
basic_istream<char_type, traits_type>::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -644,7 +732,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
|
||||
// basic_ostringstream
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class basic_ostringstream
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_ostringstream
|
||||
: public basic_ostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -665,12 +753,12 @@ public:
|
||||
explicit basic_ostringstream(ios_base::openmode __wch = ios_base::out);
|
||||
explicit basic_ostringstream(const string_type& __s,
|
||||
ios_base::openmode __wch = ios_base::out);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_ostringstream(basic_ostringstream&& __rhs);
|
||||
|
||||
// 27.8.2.2 Assign and swap:
|
||||
basic_ostringstream& operator=(basic_ostringstream&& __rhs);
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void swap(basic_ostringstream& __rhs);
|
||||
|
||||
// 27.8.2.3 Members:
|
||||
@@ -696,13 +784,13 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs)
|
||||
: basic_ostream<_CharT, _Traits>(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -711,12 +799,12 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>&
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs)
|
||||
{
|
||||
basic_ostream<char_type, traits_type>::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -763,7 +851,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
|
||||
// basic_stringstream
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class basic_stringstream
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_stringstream
|
||||
: public basic_iostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -784,12 +872,12 @@ public:
|
||||
explicit basic_stringstream(ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
explicit basic_stringstream(const string_type& __s,
|
||||
ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_stringstream(basic_stringstream&& __rhs);
|
||||
|
||||
// 27.8.2.2 Assign and swap:
|
||||
basic_stringstream& operator=(basic_stringstream&& __rhs);
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void swap(basic_stringstream& __rhs);
|
||||
|
||||
// 27.8.2.3 Members:
|
||||
@@ -815,13 +903,13 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs)
|
||||
: basic_iostream<_CharT, _Traits>(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -830,12 +918,12 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>&
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs)
|
||||
{
|
||||
basic_iostream<char_type, traits_type>::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
||||
123
include/stack
123
include/stack
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -31,14 +31,21 @@ protected:
|
||||
container_type c;
|
||||
|
||||
public:
|
||||
explicit stack();
|
||||
stack() = default;
|
||||
~stack() = default;
|
||||
|
||||
stack(const stack& q) = default;
|
||||
stack(stack&& q) = default;
|
||||
|
||||
stack& operator=(const stack& q) = default;
|
||||
stack& operator=(stack&& q) = default;
|
||||
|
||||
explicit stack(const container_type& c);
|
||||
explicit stack(container_type&& c);
|
||||
stack(stack&& s);
|
||||
stack& operator=(stack&& s);
|
||||
template <class Alloc> explicit stack(const Alloc& a);
|
||||
template <class Alloc> stack(const container_type& c, const Alloc& a);
|
||||
template <class Alloc> stack(container_type&& c, const Alloc& a);
|
||||
template <class Alloc> stack(const stack& c, const Alloc& a);
|
||||
template <class Alloc> stack(stack&& c, const Alloc& a);
|
||||
|
||||
bool empty() const;
|
||||
@@ -51,7 +58,7 @@ public:
|
||||
template <class... Args> void emplace(Args&&... args);
|
||||
void pop();
|
||||
|
||||
void swap(stack& c);
|
||||
void swap(stack& c) noexcept(noexcept(swap(c, q.c)));
|
||||
};
|
||||
|
||||
template <class T, class Container>
|
||||
@@ -68,7 +75,8 @@ template <class T, class Container>
|
||||
bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
|
||||
|
||||
template <class T, class Container>
|
||||
void swap(stack<T, Container>& x, stack<T, Container>& y);
|
||||
void swap(stack<T, Container>& x, stack<T, Container>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
} // std
|
||||
|
||||
@@ -77,22 +85,26 @@ template <class T, class Container>
|
||||
#include <__config>
|
||||
#include <deque>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_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>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
|
||||
|
||||
template <class _Tp, class _Container = deque<_Tp> >
|
||||
class stack
|
||||
class _LIBCPP_TYPE_VIS_ONLY stack
|
||||
{
|
||||
public:
|
||||
typedef _Container container_type;
|
||||
@@ -105,57 +117,99 @@ protected:
|
||||
container_type c;
|
||||
|
||||
public:
|
||||
stack() : c() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
|
||||
: c() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(const stack& __q) : c(__q.c) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(stack&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
|
||||
: c(_VSTD::move(__q.c)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack& operator=(const stack& __q) {c = __q.c; return *this;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack& operator=(stack&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
|
||||
{c = _VSTD::move(__q.c); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit stack(const container_type& __c) : c(__c) {}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
explicit stack(container_type&& __c) : c(_STD::move(__c)) {}
|
||||
stack(stack&& __s) : c(_STD::move(__s.c)) {}
|
||||
stack& operator=(stack&& __s) {c = _STD::move(__s.c); return *this;}
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit stack(const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(const container_type& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__c, __a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(const stack& __s, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__s.c, __a) {}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(container_type&& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_STD::move(__c), __a) {}
|
||||
: c(_VSTD::move(__c), __a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(stack&& __s, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_STD::move(__s.c), __a) {}
|
||||
#endif
|
||||
: c(_VSTD::move(__s.c), __a) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return c.empty();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return c.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference top() {return c.back();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference top() const {return c.back();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(const value_type& __v) {c.push_back(__v);}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
|
||||
template <class... _Args> void emplace(_Args&&... __args)
|
||||
{c.emplace_back(_STD::forward<_Args>(__args)...);}
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(_Args&&... __args)
|
||||
{c.emplace_back(_VSTD::forward<_Args>(__args)...);}
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void pop() {c.pop_back();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(stack& __s)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(c, __s.c);
|
||||
}
|
||||
|
||||
@@ -163,7 +217,7 @@ public:
|
||||
friend
|
||||
bool
|
||||
operator==(const stack<T1, _C1>& __x, const stack<T1, _C1>& __y);
|
||||
|
||||
|
||||
template <class T1, class _C1>
|
||||
friend
|
||||
bool
|
||||
@@ -171,7 +225,7 @@ public:
|
||||
};
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -179,7 +233,7 @@ operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -187,7 +241,7 @@ operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -195,7 +249,7 @@ operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -203,7 +257,7 @@ operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -211,7 +265,7 @@ operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -219,15 +273,16 @@ operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Alloc>
|
||||
struct uses_allocator<stack<_Tp, _Container>, _Alloc>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<stack<_Tp, _Container>, _Alloc>
|
||||
: public uses_allocator<_Container, _Alloc>
|
||||
{
|
||||
};
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- stdbool.h --------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_STDBOOL_H
|
||||
#define _LIBCPP_STDBOOL_H
|
||||
|
||||
/*
|
||||
stdbool.h synopsis
|
||||
|
||||
Macros:
|
||||
|
||||
__bool_true_false_are_defined
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <__config>
|
||||
#endif
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#undef __bool_true_false_are_defined
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#define bool _Bool
|
||||
#if __STDC_VERSION__ < 199901L && __GNUC__ < 3
|
||||
typedef int _Bool;
|
||||
#endif
|
||||
|
||||
#define false (bool)0
|
||||
#define true (bool)1
|
||||
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
#endif // _LIBCPP_STDBOOL_H
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -33,9 +33,9 @@ class xxx_error : public exception // at least indirectly
|
||||
{
|
||||
public:
|
||||
explicit xxx_error(const string& what_arg);
|
||||
explicit xxx_error(const char* what_arg); // extension
|
||||
explicit xxx_error(const char* what_arg);
|
||||
|
||||
virtual const char* what() const // returns what_arg
|
||||
virtual const char* what() const noexcept // returns what_arg
|
||||
};
|
||||
|
||||
} // std
|
||||
@@ -46,7 +46,9 @@ public:
|
||||
#include <exception>
|
||||
#include <iosfwd> // for string forward decl
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
@@ -60,12 +62,12 @@ public:
|
||||
explicit logic_error(const string&);
|
||||
explicit logic_error(const char*);
|
||||
|
||||
logic_error(const logic_error&) throw();
|
||||
logic_error& operator=(const logic_error&) throw();
|
||||
logic_error(const logic_error&) _NOEXCEPT;
|
||||
logic_error& operator=(const logic_error&) _NOEXCEPT;
|
||||
|
||||
virtual ~logic_error() throw();
|
||||
virtual ~logic_error() _NOEXCEPT;
|
||||
|
||||
virtual const char* what() const throw();
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI runtime_error
|
||||
@@ -77,12 +79,12 @@ public:
|
||||
explicit runtime_error(const string&);
|
||||
explicit runtime_error(const char*);
|
||||
|
||||
runtime_error(const runtime_error&) throw();
|
||||
runtime_error& operator=(const runtime_error&) throw();
|
||||
runtime_error(const runtime_error&) _NOEXCEPT;
|
||||
runtime_error& operator=(const runtime_error&) _NOEXCEPT;
|
||||
|
||||
virtual ~runtime_error() throw();
|
||||
virtual ~runtime_error() _NOEXCEPT;
|
||||
|
||||
virtual const char* what() const throw();
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI domain_error
|
||||
@@ -92,7 +94,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {}
|
||||
|
||||
virtual ~domain_error() throw();
|
||||
virtual ~domain_error() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI invalid_argument
|
||||
@@ -102,7 +104,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {}
|
||||
|
||||
virtual ~invalid_argument() throw();
|
||||
virtual ~invalid_argument() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI length_error
|
||||
@@ -112,7 +114,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {}
|
||||
|
||||
virtual ~length_error() throw();
|
||||
virtual ~length_error() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI out_of_range
|
||||
@@ -122,7 +124,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {}
|
||||
|
||||
virtual ~out_of_range() throw();
|
||||
virtual ~out_of_range() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI range_error
|
||||
@@ -132,7 +134,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {}
|
||||
|
||||
virtual ~range_error() throw();
|
||||
virtual ~range_error() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI overflow_error
|
||||
@@ -142,7 +144,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {}
|
||||
|
||||
virtual ~overflow_error() throw();
|
||||
virtual ~overflow_error() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI underflow_error
|
||||
@@ -152,10 +154,9 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {}
|
||||
|
||||
virtual ~underflow_error() throw();
|
||||
virtual ~underflow_error() _NOEXCEPT;
|
||||
};
|
||||
|
||||
|
||||
} // std
|
||||
|
||||
#endif // _LIBCPP_STDEXCEPT
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -112,12 +112,14 @@ protected:
|
||||
#include <iosfwd>
|
||||
#include <ios>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_streambuf
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_streambuf
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
@@ -399,13 +401,13 @@ template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb)
|
||||
{
|
||||
_STD::swap(__loc_, __sb.__loc_);
|
||||
_STD::swap(__binp_, __sb.__binp_);
|
||||
_STD::swap(__ninp_, __sb.__ninp_);
|
||||
_STD::swap(__einp_, __sb.__einp_);
|
||||
_STD::swap(__bout_, __sb.__bout_);
|
||||
_STD::swap(__nout_, __sb.__nout_);
|
||||
_STD::swap(__eout_, __sb.__eout_);
|
||||
_VSTD::swap(__loc_, __sb.__loc_);
|
||||
_VSTD::swap(__binp_, __sb.__binp_);
|
||||
_VSTD::swap(__ninp_, __sb.__ninp_);
|
||||
_VSTD::swap(__einp_, __sb.__einp_);
|
||||
_VSTD::swap(__bout_, __sb.__bout_);
|
||||
_VSTD::swap(__nout_, __sb.__nout_);
|
||||
_VSTD::swap(__eout_, __sb.__eout_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@@ -459,15 +461,15 @@ basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize)
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
typename basic_streambuf<_CharT, _Traits>::pos_type
|
||||
basic_streambuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __which)
|
||||
basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir,
|
||||
ios_base::openmode)
|
||||
{
|
||||
return pos_type(off_type(-1));
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
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));
|
||||
}
|
||||
@@ -538,7 +540,7 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
|
||||
{
|
||||
if (__nout_ < __eout_)
|
||||
*__nout_++ = *__s;
|
||||
else if (overflow(*__s) == __eof)
|
||||
else if (overflow(traits_type::to_int_type(*__s)) == __eof)
|
||||
break;
|
||||
}
|
||||
return __i;
|
||||
@@ -546,17 +548,16 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
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();
|
||||
}
|
||||
|
||||
extern template class basic_streambuf<char>;
|
||||
extern template class basic_streambuf<wchar_t>;
|
||||
|
||||
extern template class basic_ios<char>;
|
||||
extern template class basic_ios<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_streambuf<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_streambuf<wchar_t>)
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ios<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ios<wchar_t>)
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
||||
2470
include/string
2470
include/string
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -131,11 +131,13 @@ private:
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class strstreambuf
|
||||
class _LIBCPP_TYPE_VIS strstreambuf
|
||||
: public streambuf
|
||||
{
|
||||
public:
|
||||
@@ -149,10 +151,12 @@ public:
|
||||
strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = 0);
|
||||
strstreambuf(const unsigned char* __gnext, streamsize __n);
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf(strstreambuf&& __rhs);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf& operator=(strstreambuf&& __rhs);
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
virtual ~strstreambuf();
|
||||
|
||||
@@ -187,95 +191,150 @@ private:
|
||||
void __init(char* __gnext, streamsize __n, char* __pbeg);
|
||||
};
|
||||
|
||||
class istrstream
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf::strstreambuf(strstreambuf&& __rhs)
|
||||
: streambuf(__rhs),
|
||||
__strmode_(__rhs.__strmode_),
|
||||
__alsize_(__rhs.__alsize_),
|
||||
__palloc_(__rhs.__palloc_),
|
||||
__pfree_(__rhs.__pfree_)
|
||||
{
|
||||
__rhs.setg(nullptr, nullptr, nullptr);
|
||||
__rhs.setp(nullptr, nullptr);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf&
|
||||
strstreambuf::operator=(strstreambuf&& __rhs)
|
||||
{
|
||||
if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0)
|
||||
{
|
||||
if (__pfree_)
|
||||
__pfree_(eback());
|
||||
else
|
||||
delete [] eback();
|
||||
}
|
||||
streambuf::operator=(__rhs);
|
||||
__strmode_ = __rhs.__strmode_;
|
||||
__alsize_ = __rhs.__alsize_;
|
||||
__palloc_ = __rhs.__palloc_;
|
||||
__pfree_ = __rhs.__pfree_;
|
||||
__rhs.setg(nullptr, nullptr, nullptr);
|
||||
__rhs.setp(nullptr, nullptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
class _LIBCPP_TYPE_VIS istrstream
|
||||
: public istream
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit istrstream(const char* __s)
|
||||
: istream(&__sb_), __sb_(__s, 0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit istrstream(char* __s)
|
||||
: istream(&__sb_), __sb_(__s, 0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream(const char* __s, streamsize __n)
|
||||
: istream(&__sb_), __sb_(__s, __n) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream(char* __s, streamsize __n)
|
||||
: istream(&__sb_), __sb_(__s, __n) {}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream(istrstream&& __rhs)
|
||||
: istream(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: istream(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
istream::set_rdbuf(&__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream& operator=(istrstream&& __rhs)
|
||||
{
|
||||
istream::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
istream::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
virtual ~istrstream();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(istrstream& __rhs)
|
||||
{
|
||||
istream::swap(__rhs);
|
||||
__sb_.swap(__rhs.__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char *str() {return __sb_.str();}
|
||||
|
||||
private:
|
||||
strstreambuf __sb_;
|
||||
};
|
||||
|
||||
class ostrstream
|
||||
class _LIBCPP_TYPE_VIS ostrstream
|
||||
: public ostream
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream()
|
||||
: ostream(&__sb_) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
|
||||
: ostream(&__sb_),
|
||||
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
|
||||
{}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream(ostrstream&& __rhs)
|
||||
: ostream(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: ostream(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
ostream::set_rdbuf(&__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream& operator=(ostrstream&& __rhs)
|
||||
{
|
||||
ostream::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
ostream::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
virtual ~ostrstream();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(ostrstream& __rhs)
|
||||
{
|
||||
ostream::swap(__rhs);
|
||||
__sb_.swap(__rhs.__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char* str() {return __sb_.str();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int pcount() const {return __sb_.pcount();}
|
||||
|
||||
private:
|
||||
strstreambuf __sb_; // exposition only
|
||||
};
|
||||
|
||||
class strstream
|
||||
class _LIBCPP_TYPE_VIS strstream
|
||||
: public iostream
|
||||
{
|
||||
public:
|
||||
@@ -286,31 +345,36 @@ public:
|
||||
typedef char_traits<char>::off_type off_type;
|
||||
|
||||
// constructors/destructor
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream()
|
||||
: iostream(&__sb_) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
|
||||
: iostream(&__sb_),
|
||||
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
|
||||
{}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream(strstream&& __rhs)
|
||||
: iostream(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: iostream(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
iostream::set_rdbuf(&__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream& operator=(strstream&& __rhs)
|
||||
{
|
||||
iostream::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
iostream::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
virtual ~strstream();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(strstream& __rhs)
|
||||
{
|
||||
iostream::swap(__rhs);
|
||||
@@ -318,9 +382,13 @@ public:
|
||||
}
|
||||
|
||||
// Members:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int pcount() const {return __sb_.pcount();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char* str() {return __sb_.str();}
|
||||
|
||||
private:
|
||||
|
||||
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
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user