forked from boostorg/type_traits
Compare commits
1361 Commits
boost-1.26
...
modules
Author | SHA1 | Date | |
---|---|---|---|
defcaf7f9b | |||
22fc50f36d | |||
d2a4a6bf0a | |||
273678042d | |||
bc26f6b192 | |||
a10ca89479 | |||
a184e146e3 | |||
8583d1a967 | |||
b265ce8f3a | |||
e3dd034588 | |||
d37dc8c4b9 | |||
7ac69733b8 | |||
18b6e30e9c | |||
09b102587f | |||
a842eeda5c | |||
693488cb29 | |||
bfce306637 | |||
3d246cb5d1 | |||
567774cacb | |||
cdbb996d3a | |||
30396ed792 | |||
cea791882b | |||
396d97f5a6 | |||
61c9e7699c | |||
64eb4e2f40 | |||
c3c1357c3d | |||
cf497924b1 | |||
71208778dd | |||
4c2b7d5215 | |||
a105c3531c | |||
d1994736b9 | |||
d9d298170f | |||
95c8a8a567 | |||
89a062e7b8 | |||
1b0cf49465 | |||
2b8b797b88 | |||
a2cffe9c04 | |||
7ca204de52 | |||
92ceb4079b | |||
59951c1853 | |||
106b442289 | |||
e4228d7260 | |||
c6c7ff1647 | |||
5588bb1ab7 | |||
18962d99a4 | |||
f7f7dbf16e | |||
7a071a5918 | |||
f8e9879d4e | |||
bd5bede326 | |||
ea2dae279f | |||
7ee9910b2f | |||
b57a7a54e4 | |||
4e6975503f | |||
b0f9c6cda1 | |||
d91381b8f2 | |||
4a32bcc9ff | |||
741b8b395b | |||
97f71e0cb3 | |||
9351dae4a4 | |||
cbf7c56a66 | |||
12325df58f | |||
0044e85b4c | |||
f8069ad974 | |||
5ff6b669ea | |||
86855dac99 | |||
c54dd34571 | |||
17359415f5 | |||
f9e8143ac5 | |||
efc0be6b55 | |||
ba7a01aa96 | |||
dbc8980715 | |||
dea6757dbf | |||
decc409800 | |||
7d89ec0426 | |||
f9bc21647a | |||
cfe031d40d | |||
6f7e2ec545 | |||
04350b86c5 | |||
d2dbcca368 | |||
cbcb282722 | |||
f6ef5722ef | |||
453564a501 | |||
625c40e750 | |||
4ca80785f8 | |||
6a472a381d | |||
e1f882b25d | |||
0e09cb7178 | |||
5e7844bea1 | |||
c65f41d4c0 | |||
c71e2ffb6e | |||
55a3ee0a3d | |||
38f9545757 | |||
649c585b9c | |||
d8bdd309d7 | |||
941e29e0a6 | |||
13d477be5d | |||
9830bcb8a9 | |||
94e055c9ba | |||
23aa33892f | |||
6fca9826f6 | |||
cacb2bb3f6 | |||
3df3014681 | |||
ee7e6ff397 | |||
16e04ea7c0 | |||
99777eba8e | |||
fdb5378d12 | |||
72e02341a2 | |||
1ead421054 | |||
51957092d2 | |||
bdaa002b74 | |||
903b59e2a3 | |||
efc694d679 | |||
19bc3525a3 | |||
d49f6e05f5 | |||
b8e0395cd8 | |||
5737ed46eb | |||
b6351c3def | |||
45b893f52c | |||
eafca43cc6 | |||
f146e70e9b | |||
6fd9601014 | |||
af1f17cd15 | |||
a5bb8d7336 | |||
cbb9fecd92 | |||
ee4f7aab0c | |||
53aec15195 | |||
fcc0711c33 | |||
744b49751a | |||
7aeee229b9 | |||
2baafd4a3a | |||
0d7d9c72ef | |||
91c5184fca | |||
7639c5820b | |||
529b3fe7bd | |||
e4f356dab3 | |||
685c47ecca | |||
17af798061 | |||
e0868d6474 | |||
4b6b13ad25 | |||
c3412181c4 | |||
0c9643ee88 | |||
52fbd03a6c | |||
f78c5330cd | |||
baad6ce607 | |||
635388aafd | |||
66a146c1cb | |||
a408a29ffc | |||
5bd3e11429 | |||
344efaf161 | |||
56d111026c | |||
8d740945a8 | |||
e958c63a6d | |||
e574d2c134 | |||
0c59e22982 | |||
458b1fa071 | |||
ad326841ec | |||
373c9fc4b4 | |||
059ed8839d | |||
bd67d9075f | |||
3b6c340fc2 | |||
c2c0b47565 | |||
7b115c8d0e | |||
4c9add90d0 | |||
dec6869a3f | |||
7eab81300e | |||
8898c6d1bb | |||
a3114e9f79 | |||
6a1fbd45f6 | |||
6eb8a15c25 | |||
7bba2acbcc | |||
fbc50bfd12 | |||
02270ed668 | |||
770c095dcc | |||
63dea93d99 | |||
e2041351c8 | |||
b48fae5352 | |||
e3fb4a6e85 | |||
2cc2697e53 | |||
01f9a0b43a | |||
00951845fb | |||
eda07fdec9 | |||
963131c1db | |||
356635219b | |||
1305001a58 | |||
d06ee12c5c | |||
9052a3830e | |||
53f99bb1a6 | |||
59e81bca80 | |||
9e880c3187 | |||
9548118ed4 | |||
547263c001 | |||
7e9909324a | |||
307f37ab58 | |||
4c3706113a | |||
2bb1021fe8 | |||
e34ad30482 | |||
7e19a87e67 | |||
ab184c2def | |||
bc54a3f54f | |||
b06185c29f | |||
24fa07bbd7 | |||
e5003ad808 | |||
5240cd67d8 | |||
10f09a6327 | |||
75160cd755 | |||
8d938a4bb9 | |||
875b95974a | |||
84f9b6da68 | |||
28658d6c11 | |||
0155b7030c | |||
014ac72782 | |||
7d42b545e9 | |||
3a0382ccbe | |||
fb4430512d | |||
94e54c030d | |||
98d6eaf1e9 | |||
e9399adefa | |||
e4d3cba6dd | |||
fdf9b67335 | |||
ed21a2d9c7 | |||
b406b574a5 | |||
6d294b5ff2 | |||
23520c13a1 | |||
df4eccb911 | |||
0886e13a99 | |||
bfb6384a0a | |||
ac351390b2 | |||
85a03d3453 | |||
33bd73e26d | |||
30b029d937 | |||
f5823d6732 | |||
29c6fc7aa2 | |||
c8c95f18ca | |||
b78fd5f29d | |||
35c105501b | |||
5d5c651ea6 | |||
05c4fdcabb | |||
7beb519980 | |||
a6e879f091 | |||
5ed289c317 | |||
837fe4d245 | |||
3e9608230c | |||
1146f73070 | |||
af2546ae5c | |||
3530a015ed | |||
4cd7655730 | |||
4ac0c52b66 | |||
9ee7745626 | |||
51c82dc0fe | |||
73fd7479dd | |||
ceaddeef42 | |||
bb94535ba8 | |||
455e6129be | |||
7bc78f51ff | |||
b23f18cac2 | |||
d6f2dd9186 | |||
dfaad9ed21 | |||
54f3c61f08 | |||
907bbbb759 | |||
06d07e3d11 | |||
d17304143e | |||
defd5612a4 | |||
d59b9f419e | |||
bc98c3b05f | |||
33328ddad0 | |||
db654452a3 | |||
bd30493d1c | |||
26b2676928 | |||
6acc283b49 | |||
05982c1b09 | |||
336162c8c4 | |||
1321945e8b | |||
847b2b3b06 | |||
7af1f795c1 | |||
aa2158f97b | |||
7d7322655e | |||
a3bef3752c | |||
d5be3746a1 | |||
ced4870cb0 | |||
0ea90ad466 | |||
b47d4aa421 | |||
1154c16b34 | |||
aa8dcb47cf | |||
64421a443b | |||
d19ff6cec4 | |||
53f5c2776c | |||
0c3d8420ee | |||
3d81378e92 | |||
97db3128ad | |||
8f62efcdfc | |||
2260b04c5d | |||
468ed1b9be | |||
0cae4b02e4 | |||
06c90d642b | |||
1f6bc4d80b | |||
a427937573 | |||
079ea2af3a | |||
6907de979f | |||
27c0457cba | |||
31b509c52d | |||
7bf550d474 | |||
4b40530453 | |||
f0e7cfbf96 | |||
1268ba4c24 | |||
ea78f79bbd | |||
623f41d806 | |||
b67ceea791 | |||
8a3d01a5ea | |||
85df11dad2 | |||
c725b736be | |||
bb867c86d8 | |||
13d4b60dea | |||
909cd6ad9e | |||
f51a528591 | |||
9bb504b631 | |||
60d8c7d5e1 | |||
58b0bc964e | |||
7f792f96c9 | |||
9e05c49c7d | |||
551502a4a0 | |||
2efc763afc | |||
37955f2360 | |||
fe7317d1ba | |||
7b29d67a3e | |||
f59467e310 | |||
9898e1684e | |||
d24f722c5a | |||
c3b38bc3dd | |||
f6c6a3ef9f | |||
4fffc7637d | |||
627832e519 | |||
5f82b5ac50 | |||
4243962e40 | |||
97cea143b9 | |||
8637711758 | |||
b93bed1313 | |||
01f41ec30e | |||
38cbf9df96 | |||
f7e1f2d52e | |||
2b64ca10e5 | |||
4cf4d9c191 | |||
71c6fea390 | |||
1f3a3a1553 | |||
0bbffe0176 | |||
c526c89267 | |||
23d6106101 | |||
1f65f0351d | |||
217c337233 | |||
70afe1dd0d | |||
f80cbb0dad | |||
bc58964228 | |||
a0140edf50 | |||
08cb0bba32 | |||
bc8a92c7b6 | |||
58d70ed28b | |||
b9c1ca01f5 | |||
dc272078fc | |||
7d81a57758 | |||
26531e7e2c | |||
f176e0a26d | |||
0de68d2722 | |||
40fada5956 | |||
4154c00265 | |||
946221e550 | |||
f0021b147e | |||
1a5f11bb5a | |||
2f3fecf3f5 | |||
f1f534a923 | |||
7d4bb24bf6 | |||
e275dfc275 | |||
99576a12f6 | |||
0f82e72f34 | |||
5fcd9c3fd4 | |||
f1bb7f979c | |||
1b18be716f | |||
8151879fb2 | |||
e5c0382a1b | |||
f083968ba6 | |||
39660c2421 | |||
a0a9475d17 | |||
14d595e260 | |||
98954e1d15 | |||
b03c2df9c3 | |||
5d0cc6dca4 | |||
2fc6fea44b | |||
ac4a37449d | |||
2d04c70520 | |||
50e7e269e5 | |||
312bf1d8ce | |||
04a8a9ecc2 | |||
ebf5ae3b76 | |||
f5592c72c0 | |||
3267b296cf | |||
e19e733040 | |||
22fd60efe3 | |||
d66cb6e905 | |||
dca27f8b3d | |||
d9255a7958 | |||
904a4adf00 | |||
57134385f1 | |||
5a4f30208a | |||
9ab3aae3e6 | |||
863ba0a7c5 | |||
fe5f4e2253 | |||
fc2b8e14b9 | |||
821d5a177f | |||
b65423f1fa | |||
642bf8377d | |||
b554c5ae26 | |||
d3a0be9f48 | |||
0408a8888f | |||
6b7ed138b2 | |||
136b7dbd7f | |||
745bf9bee1 | |||
4da98d4e8c | |||
6f5f212fa0 | |||
17985daa3c | |||
693c7a9ca6 | |||
c4243e2914 | |||
979fc5b293 | |||
2f2ca65e48 | |||
e68fddd992 | |||
739956e561 | |||
68413905af | |||
587298b93a | |||
1c91d63197 | |||
cb98a630ff | |||
ae76223bab | |||
b069b3ce3c | |||
229e99880b | |||
2fc65e67a8 | |||
d44141cf88 | |||
e8e7724303 | |||
11cd9e6674 | |||
434e26e7a3 | |||
2d71379074 | |||
24548d6158 | |||
1dfcdd7bb2 | |||
c0ca135b78 | |||
79942e93cd | |||
ade5857d78 | |||
c1d885edbd | |||
4777c0b4a6 | |||
05e1b3b7a5 | |||
b21b0f0476 | |||
4a16185e27 | |||
bdd23b4b9b | |||
b7a24b7217 | |||
9fd4ee06b2 | |||
8ed541ac23 | |||
d124da05c8 | |||
965d6ed403 | |||
ef2d00be2a | |||
d97ca425ec | |||
7a0c636208 | |||
719ea20756 | |||
971fd13805 | |||
7cb0e840f1 | |||
01493e4acb | |||
b0f9674649 | |||
bc89aa6160 | |||
2180399398 | |||
987b01b28c | |||
2a645db56c | |||
d0dbb24faf | |||
3d3463b639 | |||
5fcc741db4 | |||
2b957cfd55 | |||
ad1ddddaf4 | |||
acf6e41edb | |||
34805a673f | |||
19b4c5c9ee | |||
93aa34671b | |||
916adca633 | |||
e31d0ab7bd | |||
e824cad0bd | |||
d3ac8b95c4 | |||
ab62bb1c14 | |||
3b86fe6cb4 | |||
d57c36d056 | |||
ef7436a729 | |||
fb0c253a86 | |||
28b599d17e | |||
ec6b822957 | |||
55ea6d614c | |||
286d08b1ea | |||
3b78213a41 | |||
fe2dafdde1 | |||
3ee10740eb | |||
b333158270 | |||
9f489b0d71 | |||
64daadea88 | |||
eaa601cc38 | |||
34fe226814 | |||
b3c24153c4 | |||
b1c92f301f | |||
4fb3457fe2 | |||
24b7d226d3 | |||
ba1588ebc1 | |||
d6683b9759 | |||
2fcd884d9c | |||
587401cc05 | |||
7af948ad26 | |||
2b84e5f125 | |||
eff5109f0c | |||
65ac4ddc5a | |||
17885c80f1 | |||
5ab8957b15 | |||
dcfd3a880b | |||
52a3eeeda4 | |||
cae9001400 | |||
703aa0c3b3 | |||
080125fffd | |||
d3cf98115f | |||
70345d87d3 | |||
defa583eba | |||
258c80886a | |||
13c3530448 | |||
e1b4d57733 | |||
c348b224da | |||
13af122a06 | |||
3c6adff2fd | |||
93d3c87b5d | |||
90fca0f64b | |||
d5465b7801 | |||
ad30bf473b | |||
18f8c75289 | |||
d584c75252 | |||
adf29f0d3f | |||
1f96f4732a | |||
5594993c44 | |||
a685e20578 | |||
d834d7aeab | |||
3c3071e4ef | |||
ea25faa853 | |||
e1b4b91692 | |||
e1b1831b79 | |||
fb7b527c37 | |||
abe3c03295 | |||
7513e68882 | |||
5a2ab9ffb0 | |||
81c4b8f860 | |||
60547bfef9 | |||
8f94dbbf35 | |||
3435d48f0e | |||
94eb94980e | |||
6aa0878fb3 | |||
1b1f90fdea | |||
fe41f0a4c1 | |||
c4c10e06c6 | |||
6bbee3cc59 | |||
8dc33362b9 | |||
3cf613228d | |||
f0da159e1f | |||
5f0de298dc | |||
6a8708a128 | |||
cf42ce1cfd | |||
ffa9927732 | |||
c76c7cc1ad | |||
9b12c8ad6a | |||
f71cdfc11e | |||
817d036e1e | |||
81b951012d | |||
9ad41f9ff6 | |||
5c0474dbc7 | |||
a838eafd5e | |||
ffd5e058b3 | |||
9de6a4924e | |||
c845f41f2d | |||
6b92cc7e26 | |||
7e8ed98615 | |||
79b690140e | |||
383c44d577 | |||
497b877d15 | |||
cf18d2bbac | |||
bbcfff0278 | |||
df74811a4c | |||
c0a2a3c012 | |||
0e78687e7d | |||
6f6e288daf | |||
0c7df66d0e | |||
5d936acc05 | |||
ee65713b9e | |||
d11a87472a | |||
dea1f79512 | |||
2131823bc2 | |||
9b3c90a320 | |||
74b5bea140 | |||
e9fbf0eaee | |||
b80c87f837 | |||
ada1f1b831 | |||
b2631acb58 | |||
3a6fa37355 | |||
abd3f9a3d6 | |||
d3f4c2daf0 | |||
a4b03d930c | |||
d0b1fdb484 | |||
f981615a99 | |||
9b4b60d87a | |||
393edd855b | |||
8ced326b70 | |||
9dca8381fe | |||
00e3a56d57 | |||
590d24cb2e | |||
d6fd3f6ccb | |||
8fd600df47 | |||
a04746196d | |||
88f5ca0bfd | |||
f00b6182ef | |||
1f815065bb | |||
3327d4c48f | |||
03bff14498 | |||
14d6a21eb1 | |||
f91ab70055 | |||
3b12bbb0d6 | |||
7c2d5eb2a6 | |||
6100ef9bac | |||
954cdb5e46 | |||
3c5c6a3be1 | |||
261db898d9 | |||
da8a57f9dc | |||
a0ae848ad2 | |||
1074233206 | |||
890debddb2 | |||
7f7cde4378 | |||
787e28368d | |||
c137710c27 | |||
a291374a23 | |||
acfc15eae3 | |||
2fe6e4f08b | |||
e347b45eef | |||
8c0269c1c2 | |||
e69dd6740a | |||
6f9d6798a7 | |||
a2b3727caf | |||
e9ae20d161 | |||
ba63463ab7 | |||
497c7c10e9 | |||
31ceaf1b02 | |||
d5c5988d92 | |||
937009e771 | |||
ad10d46cc5 | |||
a7d4ca60cf | |||
32f87190d6 | |||
77697c2134 | |||
f0b1834a4d | |||
ea6264018d | |||
c8f38de386 | |||
7b3dfb6f0a | |||
f53c38de37 | |||
7713e90dc3 | |||
d1403c7d10 | |||
df4224484f | |||
95587ab589 | |||
f23fef070e | |||
81918230c6 | |||
dc676dc982 | |||
ed84feb8b2 | |||
dec59cee34 | |||
6d0830f46f | |||
5b7204632a | |||
e236bd7c14 | |||
4b93facaaa | |||
c646121426 | |||
a867293d57 | |||
2429f259cc | |||
adfe8642af | |||
449c859c9d | |||
2131265b3d | |||
e75060956c | |||
1feea65d89 | |||
544307225b | |||
554cb99bf1 | |||
75abd7992c | |||
e7b1851330 | |||
c49466d872 | |||
03648e3664 | |||
5cee0e2652 | |||
314da4bb03 | |||
3874a62b66 | |||
79b4594c2b | |||
1554970121 | |||
2140b4c23c | |||
0ef52c07fa | |||
40d87a0683 | |||
703afdc9c1 | |||
23bd369b77 | |||
6ddc6c1d51 | |||
8886da6e1b | |||
b64cca729d | |||
fd843864fb | |||
2162f05dfc | |||
985ba7d10c | |||
a921c555f1 | |||
9cd79c769e | |||
c64eb91a2b | |||
a103ebe7ed | |||
e6314963a3 | |||
a75ba5f2af | |||
b95816426c | |||
c8294f4710 | |||
3bfd10465c | |||
551385bd9c | |||
8608d0a498 | |||
7f7a6d2324 | |||
e386b1acbe | |||
3656db0215 | |||
7f7f8a30d0 | |||
9903a5539d | |||
bff7255740 | |||
960c85dedc | |||
888910b677 | |||
1cfb87e358 | |||
d4290a588f | |||
269d7452b1 | |||
5e1995dcf8 | |||
f62a7094d5 | |||
e05726d61d | |||
0cd9189357 | |||
e41fd89f7e | |||
da123a1166 | |||
171fad88b8 | |||
c1072ec858 | |||
5d84dee264 | |||
db5707d8c3 | |||
9e0c22f76a | |||
e76b2462f1 | |||
6e2fae44d4 | |||
360373e3ee | |||
33db0b59ed | |||
204f156c3b | |||
969238f5f6 | |||
aabbd5c3c8 | |||
39cf0ec129 | |||
5976893b1a | |||
5cc1ceccd1 | |||
6842d7346b | |||
437c57d614 | |||
ea26a60081 | |||
2799200d4e | |||
8ac524debe | |||
5eb0486699 | |||
0bd2b25d5b | |||
0e4093146b | |||
e1a315e00e | |||
8375014c95 | |||
7fdc037def | |||
74d5955a7a | |||
0e0c39c08a | |||
28631034ca | |||
4f873ea632 | |||
087d133793 | |||
ee29b7660f | |||
104afb9ba4 | |||
023bec7ba0 | |||
5c40f50432 | |||
6b8890aec8 | |||
902217df24 | |||
c02516b25b | |||
6be68667fb | |||
459e0bb6a0 | |||
a865f64c2f | |||
eb24b1d9f1 | |||
19b82cc55b | |||
0986b590ee | |||
b67855e6da | |||
c93d93ccfc | |||
e0fb41d53c | |||
ec49c59545 | |||
1b5833a894 | |||
b722d7208b | |||
cdd2aee33e | |||
a430c8da1d | |||
0fe5ae981f | |||
eede6ec6e6 | |||
0977ea3b67 | |||
5346e1f373 | |||
47e6213bd8 | |||
b6378f93e9 | |||
ff704d8ed0 | |||
71d516c6f5 | |||
64e9b6ef07 | |||
c77a72a7cc | |||
edd98db5fb | |||
afd6785017 | |||
e66ffd9a99 | |||
fd67e7f2db | |||
d06a16e0e9 | |||
f8e246218e | |||
c9406a97fe | |||
58c6ce7362 | |||
4588039349 | |||
4bef4e5708 | |||
b74b5fdf87 | |||
056830ee59 | |||
0895150b76 | |||
0ae96f1401 | |||
d94c44f927 | |||
b097b5215e | |||
11a217d923 | |||
feb203903b | |||
60ba70f9a0 | |||
9dd5a79afa | |||
cf879100c6 | |||
0e8e26666e | |||
bb9fc4cfaf | |||
90c3c8e608 | |||
eea6aa420e | |||
466c4a68fc | |||
7cd9227cba | |||
30598c1e09 | |||
a5f067761a | |||
400f2555ae | |||
e7b1b3c773 | |||
1335987b92 | |||
89f18be48e | |||
908fa41cc3 | |||
c8d4c6ccd1 | |||
524cb0cfe7 | |||
3ac7119088 | |||
13ca0cf698 | |||
aff3d68580 | |||
be3077e203 | |||
fcc974dd99 | |||
9de89e9157 | |||
f1817aeee1 | |||
c9e77b9c8d | |||
405c4ba902 | |||
3e8055a725 | |||
f618d007b4 | |||
e398f63259 | |||
96cbc09229 | |||
28ddc6e6f5 | |||
68a4a628cf | |||
afe1661308 | |||
4f26adad46 | |||
bc45b934b6 | |||
8d163a019e | |||
0c934b3466 | |||
60369a1035 | |||
bbb3e5da87 | |||
57bdff2d23 | |||
8ecf616c39 | |||
da752aaaa9 | |||
b253d45376 | |||
0ab92896c6 | |||
44bd98cc6b | |||
87dcfccb54 | |||
cde7a04813 | |||
769487b134 | |||
407e286df1 | |||
5744aef20c | |||
101527367a | |||
f785342300 | |||
0e8f2434ca | |||
534e3294dc | |||
2e8f5e6a14 | |||
03d9c11026 | |||
5490bf61f3 | |||
e4814ae18a | |||
2d7661d661 | |||
e001183519 | |||
0126f5e959 | |||
ea4366f270 | |||
3bd6ccdf41 | |||
353dad4196 | |||
85e6b2fb7c | |||
a8248f5884 | |||
21d466f451 | |||
3cc8416611 | |||
d1420c8e5a | |||
72e51548aa | |||
fb2ea8595a | |||
aaefead804 | |||
4298d36237 | |||
713516cd7d | |||
912045e6ac | |||
9f60cc0b42 | |||
21b6ef16db | |||
1555130d16 | |||
8fa9c7e6a7 | |||
78eba00f6b | |||
93ccf162c7 | |||
1f23f44e86 | |||
c5da70812d | |||
00b86fc75c | |||
11e3e918ac | |||
e80413f337 | |||
e10f6cab43 | |||
6ba37d939d | |||
8197f3c4e0 | |||
bef8e90150 | |||
3c402d1377 | |||
0265a9354b | |||
2d9de2e57e | |||
7c73784313 | |||
5e7f4a9c2b | |||
8cfb381025 | |||
80e18d2937 | |||
f250146688 | |||
2d33f4a1bf | |||
0451d0d24f | |||
28dba3e799 | |||
a8c65cc595 | |||
2275f12df8 | |||
295936b175 | |||
ec72b74218 | |||
27eacb4039 | |||
c85d9e3b88 | |||
ed23fafc80 | |||
dcee03611b | |||
293d1cb900 | |||
97e7ce2abf | |||
4f323d9845 | |||
bb151449f7 | |||
60963a5d21 | |||
fe60c9c994 | |||
e20cc9b294 | |||
4d0bcdc9f5 | |||
76d2bb904b | |||
6378e00d86 | |||
dbac0a6f4c | |||
cff3acdd26 | |||
820cae7c2c | |||
7be7028a30 | |||
ae6dd08936 | |||
f674627e7b | |||
f799394457 | |||
48232e77cb | |||
51dda56abd | |||
69baca3355 | |||
797a419e4c | |||
f26b33201b | |||
d5a7f6f622 | |||
7959ba4206 | |||
f0372be9da | |||
522e5a9983 | |||
533693d031 | |||
413b552f6f | |||
c01e7f7d00 | |||
99a176c004 | |||
1748709ef6 | |||
db595df809 | |||
a809a802f6 | |||
b1269caaf6 | |||
bbd235a4b2 | |||
8d23867d2a | |||
bc351d63a4 | |||
16dd4cb998 | |||
de714a5da4 | |||
cc9fd8a34e | |||
20e4a364b2 | |||
3308f93b33 | |||
0acf61da07 | |||
1721b740ff | |||
6e89d59975 | |||
0ff77240a8 | |||
a74063a1a2 | |||
ece355a411 | |||
dac6a91362 | |||
6d862ae4d3 | |||
b5f0ef82b7 | |||
1708737f01 | |||
d1766db0a4 | |||
feb17336f9 | |||
88b97b0836 | |||
7eada50812 | |||
591657959b | |||
0c7e439b85 | |||
1a30e4cf63 | |||
117eddb5c9 | |||
9549babcd8 | |||
036f0593a0 | |||
d77497ffec | |||
9a4627f3b5 | |||
62132b3ad4 | |||
aba9d9e93d | |||
e675469610 | |||
a7e866cc1b | |||
3fc38a9b11 | |||
8caecf0af8 | |||
d8779a3dd6 | |||
bc9658d0a8 | |||
b152bda4a9 | |||
db9d9518a5 | |||
0e24b170a2 | |||
ecf079d691 | |||
2095e8d5a9 | |||
f3cd13084e | |||
9292ae9273 | |||
b1a35a8ee3 | |||
4c8fca9bc9 | |||
a9be3b15e3 | |||
f38310ae8a | |||
8dbdb5315b | |||
b5c4409c76 | |||
d453fa3e67 | |||
aef81a516f | |||
bc4d7d7b32 | |||
a0bb26cf98 | |||
e8f1b067e4 | |||
d83e054d04 | |||
004a786439 | |||
a603a6a21d | |||
b6b9a01a0b | |||
7e95b4e2a4 | |||
4b845146e2 | |||
118684962b | |||
8b941c5876 | |||
edc0635813 | |||
eca24d4e5a | |||
24f89286a7 | |||
0d1dd10357 | |||
810b1a9372 | |||
d9ef904fa1 | |||
955177b624 | |||
30571abccc | |||
c0c0da2eb6 | |||
33b763e752 | |||
cf105d7630 | |||
74e3b91d8f | |||
7c8c40f0fa | |||
ee95ccb724 | |||
0ad3ce3405 | |||
ff5d236eeb | |||
55b227c621 | |||
bfa2c80b6a | |||
c5d028b87e | |||
a94ec173f1 | |||
3086f4144f | |||
9ca0221b86 | |||
2de95cfbf7 | |||
8513618762 | |||
6a9d90291d | |||
8622528d91 | |||
b026d4b530 | |||
7ef0acbb18 | |||
6e31d51033 | |||
cccfc979be | |||
b4bd9ff9df | |||
3f8c89fde4 | |||
3bfee8baa6 | |||
17e53bc1be | |||
30693414d1 | |||
8b40505dfa | |||
710d73bed8 | |||
fa671bba10 | |||
642bcf966f | |||
0349d29c67 | |||
0a79e9cb27 | |||
119a76547b | |||
07c3946e77 | |||
945a5e3c82 | |||
8fa22b8024 | |||
22d2d9b641 | |||
bbbd77d3e9 | |||
42877c1d1b | |||
d1958e02f8 | |||
7dc55473ad | |||
2b9a6d5351 | |||
23278c28f2 | |||
3893bcc538 | |||
9ca727623b | |||
6ac28e8e19 | |||
ad5fc1a2ac | |||
e0b3b0418a | |||
8f2d14c5c9 | |||
3cdf8c8ed2 | |||
17c699a256 | |||
4e54b5db92 | |||
fa928962a6 | |||
55e2d27da4 | |||
ed97beb51f | |||
8b6ba77ba4 | |||
b3d31b8e24 | |||
39ce140cf7 | |||
9c48f6f31e | |||
d2828d68c9 | |||
ffb50c36ac | |||
b291a5b304 | |||
d425460fb1 | |||
8638d203ac | |||
2d74fe9a03 | |||
cc007d4c92 | |||
4acd9c06fc | |||
c3724f6bea | |||
7f3b917cea | |||
5359f483bc | |||
dca7128b46 | |||
76cac3e5dd | |||
113a49560e | |||
3db3f894df | |||
32f2d33eed | |||
ad627feb41 | |||
999e74e6db | |||
592f7512af | |||
673f2e35d9 | |||
970a90b365 | |||
1d0e43de3d | |||
0081a5017d | |||
2bce5b2c26 | |||
b55dc5cc24 | |||
8aaa85b7c3 | |||
9c45fdc67a | |||
3145bd52fe | |||
7bbae4111d | |||
8ec31e802e | |||
4ae0967156 | |||
f165299dd0 | |||
755f23ceea | |||
fc577f2a2d | |||
2ff80eac58 | |||
1924600d9e | |||
777e629b4d | |||
949d126e75 | |||
7cd3d12f92 | |||
3fe5c5fe0e | |||
372d08277f | |||
176f89e901 | |||
314d866dc9 | |||
5e66227e35 | |||
8ed1eb51be | |||
e77b6884a7 | |||
b509fb943a | |||
f737ceb667 | |||
416038f37d | |||
9c7099c693 | |||
df11683ba2 | |||
43e9e5c7ef | |||
2ffc663dd5 | |||
42f271a4dc | |||
d8914e583b | |||
ae7423f9ac | |||
eb1c21ad4c | |||
5ae6927668 | |||
35e8b1e042 | |||
d234acc0c7 | |||
b7b12865fb | |||
afc8b2c0c7 | |||
b76189ce85 | |||
76ad487517 | |||
37ed08578f | |||
26b87b8ca0 | |||
3706d50459 | |||
677e70fec6 | |||
9cada59f67 | |||
b34dbf1312 | |||
54405cf729 | |||
786733ac67 | |||
ce172f356b | |||
fb5108780d | |||
85cda0604e | |||
323dde4110 | |||
4b7ec4a6ba | |||
002c331fdb | |||
f9b5fa44f4 | |||
a7321a4260 | |||
311bcd7a5a | |||
5ddd3757f7 | |||
8f20b24bb5 | |||
4a88d0ef16 | |||
7e82ad2441 | |||
bf70e2aced | |||
3013105b1e | |||
3f87dccb57 | |||
138df12e67 | |||
9f8b4048b4 | |||
6318e7f127 | |||
36e538bd42 | |||
bde1254ebf | |||
d36390dff7 | |||
5f5d22fb8a | |||
1dbaf58f35 | |||
40a632a04e | |||
13cece3bae | |||
f8af2cbce6 | |||
cbce3789a0 | |||
2b71faafb6 | |||
52032cf9dd | |||
21d7b7699e | |||
9dda999d6c | |||
973bbc1164 | |||
084bd0ab1b | |||
0572dd3713 | |||
524468f579 | |||
9ad8445156 | |||
469c0f29e0 | |||
555a9f4039 | |||
98467ea686 | |||
04984055d5 | |||
91ef105c63 | |||
531442b4f1 | |||
a9c64bba20 | |||
e8b42afe69 | |||
ef03d3bef0 | |||
9329678518 | |||
bbb571febb | |||
6fe2742c15 | |||
3c5b4f6ab8 | |||
6e4f49afc6 | |||
814e55ff5e | |||
cf508a63da | |||
9586ee5966 | |||
021ee1971a | |||
73a6e46a1a | |||
1472db4c06 | |||
e0a3d316cc | |||
bd7e6c0c18 | |||
46652e39e6 | |||
f49d7192a7 | |||
f70b52cdc0 | |||
ad38d7a133 | |||
d3484d9b84 | |||
4b2788fdcb | |||
ee2b66b31f | |||
bac27107b7 | |||
026434c941 | |||
208f56cd68 | |||
012d6ed522 | |||
bb241cc1e2 | |||
3353896f3d | |||
f9f4952fef | |||
ba8d0a6df7 | |||
a1cb3d8550 | |||
d23af42bc3 | |||
a44fafcd68 | |||
dbe91fcc3a | |||
38f7de18d8 | |||
4481e52842 | |||
6fd18f08d0 | |||
cdc8512d63 | |||
612eea170c | |||
ac20374243 | |||
214c319cbc | |||
a4f0ca7ff0 | |||
8a40e1474f | |||
015c5aff8f | |||
6c67b3bbc0 | |||
406b57c444 | |||
ff4614a2a0 | |||
6af3ce77b5 | |||
1efa8a8319 | |||
0ffcc1f82e | |||
9dd512ac83 | |||
3e40fe2c5b | |||
d5669c55ea | |||
8ab81a2e6a | |||
d42475aa35 | |||
8ff8efdba7 | |||
f29eb40c5b | |||
1f83862245 | |||
84431c1e32 | |||
a4c44749cb | |||
1aa23ac1ce | |||
b74f038624 | |||
1151a7593a | |||
1ba525e29d | |||
8f8e96630c | |||
ac4289bd6c | |||
9788a1455d | |||
b8b462622b | |||
7be10f011f | |||
15ec877a06 | |||
57085fa2fd | |||
6ae020bb5c | |||
957183842d | |||
5d13b168b3 | |||
0076e5f3e2 | |||
a909c9c929 | |||
e0b24e8baa | |||
ab9f92f970 | |||
58b0a1c266 | |||
390fc256eb | |||
9a6f5dc39f | |||
7977b71a5e | |||
e0bfa608ce | |||
2c5d50d193 | |||
c4f487229a | |||
ea84470847 | |||
10b04fb413 | |||
db10a86c04 | |||
fea7fc1a3a | |||
415b3247dc | |||
36005cdb14 | |||
e41ec3d33a | |||
ae1023cdd0 | |||
e87486cf7b | |||
55e37c0fa0 | |||
6c02c10d7e | |||
47f23f8b4f | |||
cd1556d599 | |||
4bf4852012 | |||
989d554adc | |||
5ff78759b4 | |||
0b4cea1a65 | |||
be17f6c2a9 | |||
d8fbf9e9de | |||
f1ae54e40a | |||
2f0e29b4bc | |||
318bcae72e | |||
9994e68bc8 | |||
bd42bfe736 | |||
4f7c036ba9 | |||
4fe73d6f02 | |||
79417d9a29 | |||
ab1421b4da | |||
5e8187b321 | |||
3ff3c46800 | |||
dfcd99c89a | |||
1c8cc4d22f | |||
b50cc8e4f6 | |||
5b0657508c | |||
1eccbcddba | |||
3bb2f6a885 | |||
ecaab696b7 | |||
1f0a9440b0 | |||
1307a897df | |||
3294d07126 | |||
bddf43c4c1 | |||
f132cbf95c | |||
0da8ae4f17 | |||
862508b9aa | |||
9ef3324c86 | |||
7191a5eaea | |||
d419537e15 | |||
57f8b8fe9c | |||
1afdc58d44 | |||
c3b4b469a5 | |||
90fc4f311f | |||
26fcfa4616 | |||
bc5c28bd3c | |||
2822c3752f | |||
7504f83ee0 | |||
6ce582379a | |||
1bc7d114b2 | |||
cdb8730a93 | |||
82c8d15179 | |||
b270745d4a | |||
964ec6c642 | |||
226abdf852 | |||
3d45932549 | |||
48196cee54 | |||
3cff038f78 | |||
0e0afca36d | |||
77c0127cc6 | |||
b57557b3c3 | |||
b33bcd5f1f | |||
249fab960e | |||
23b292cccd | |||
c6fbfb05d2 | |||
e650f59e68 | |||
bcd934c959 | |||
7a8b460ce8 | |||
0482816876 | |||
cdb95f1786 | |||
57c83a61e5 | |||
894e2e1beb | |||
262616a267 | |||
e94b5d6989 | |||
a926ee3ba5 | |||
80c838ef88 |
57
.circleci/config.yml
Normal file
57
.circleci/config.yml
Normal file
@ -0,0 +1,57 @@
|
||||
version: 2
|
||||
|
||||
jobs:
|
||||
build:
|
||||
environment:
|
||||
- BOOST_LIBRARY=type_traits
|
||||
- CXX_STANDARD=gnu++11
|
||||
docker:
|
||||
- image: gcc:7
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Setting up Environment
|
||||
command: |
|
||||
echo 'export BOOST="$HOME/boost-local"' >> $BASH_ENV
|
||||
if [ $CIRCLE_BRANCH = "master" ]; then
|
||||
echo 'export BOOST_BRANCH="master"' >> $BASH_ENV;
|
||||
else
|
||||
echo 'export BOOST_BRANCH="develop"' >> $BASH_ENV;
|
||||
fi
|
||||
echo 'export BOOST_REMOVE="$BOOST/boost/libs/$BOOST_LIBRARY"' >> $BASH_ENV
|
||||
HOME_SED_=$(echo $HOME | sed -e 's/\//\\\//g')
|
||||
echo 'export HOME_SED=$HOME_SED_' >> $BASH_ENV
|
||||
- run:
|
||||
name: install pre dependencies
|
||||
command: |
|
||||
apt-get update -yqq
|
||||
apt-get install git xsltproc docbook-xsl docbook-xml -y
|
||||
- run:
|
||||
name: Initializing git repo for boost
|
||||
command: |
|
||||
echo BOOST=$BOOST BOOST_REMOVE=$BOOST_REMOVE BOOST_LIBRARY=$BOOST_LIBRARY BOOST_BRANCH=$BOOST_BRANCH PWD=$PWD
|
||||
mkdir $BOOST
|
||||
cd $BOOST
|
||||
git clone --single-branch --branch $BOOST_BRANCH https://github.com/boostorg/boost.git
|
||||
cd boost
|
||||
git submodule update --init --merge
|
||||
rm -rf $BOOST_REMOVE
|
||||
mv $HOME/project $BOOST_REMOVE
|
||||
- run:
|
||||
name: Bootstrapping boost-build
|
||||
command: |
|
||||
cd $BOOST/boost && ./bootstrap.sh && ./b2 headers
|
||||
echo "using xsltproc ;" | tee $HOME/user-config.jam
|
||||
echo "using boostbook : /usr/share/xml/docbook/stylesheet/docbook-xsl : /usr/share/sgml/docbook/dtd/xml/4.2 ;" | tee -a $HOME/user-config.jam
|
||||
- run:
|
||||
name: Building inspect
|
||||
command: |
|
||||
cd $BOOST/boost/tools/inspect/build && ../../../b2 -j2 address-model=64 architecture=x86 toolset=gcc cxxflags="-std=gnu++14" release dist-bin
|
||||
- run:
|
||||
name: Building docs
|
||||
command: |
|
||||
cd $BOOST_REMOVE/doc && rm -rf html && ../../../b2 -j2 address-model=64 architecture=x86 toolset=gcc cxxflags="-std=gnu++14" release
|
||||
- run:
|
||||
name: Running Inspect
|
||||
command: |
|
||||
cd $BOOST_REMOVE && ../../dist/bin/inspect -text
|
54
.drone.star
Normal file
54
.drone.star
Normal file
@ -0,0 +1,54 @@
|
||||
# Use, modification, and distribution are
|
||||
# subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
# file LICENSE.txt)
|
||||
#
|
||||
# Copyright Rene Rivera 2020.
|
||||
|
||||
# For Drone CI we use the Starlark scripting language to reduce duplication.
|
||||
# As the yaml syntax for Drone CI is rather limited.
|
||||
#
|
||||
#
|
||||
globalenv={}
|
||||
linuxglobalimage="cppalliance/droneubuntu1604:1"
|
||||
windowsglobalimage="cppalliance/dronevs2019"
|
||||
|
||||
def main(ctx):
|
||||
return [
|
||||
linux_cxx("TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x Job 1", "g++", packages="g++-4.4", buildtype="boost", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-4.4', 'CXXSTD': '98,0x'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x Job 2", "g++", packages="g++-4.6", buildtype="boost", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-4.6', 'CXXSTD': '03,0x'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11 Job 3", "g++-4.7", packages="g++-4.7", buildtype="boost", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-4.7', 'CXXSTD': '03,11'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11 Job 4", "g++-4.8", packages="g++-4.8", buildtype="boost", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-4.8', 'CXXSTD': '03,11'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11 Job 5", "g++-4.9", packages="g++-4.9", buildtype="boost", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-4.9', 'CXXSTD': '03,11'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z Job 6", "g++-5", packages="g++-5", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-5', 'CXXSTD': '03,11,14,1z'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z Job 7", "g++-5", packages="g++-5", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-5', 'CXXSTD': '03,11,14,1z', 'CXXSTD_DIALECT': 'cxxstd-dialect=gnu'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z Job 8", "g++-6", packages="g++-6", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-6', 'CXXSTD': '03,11,14,1z'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z Job 9", "g++-6", packages="g++-6", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-6', 'CXXSTD': '03,11,14,1z', 'CXXSTD_DIALECT': 'cxxstd-dialect=gnu'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17 Job 10", "g++-7", packages="g++-7", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-7', 'CXXSTD': '03,11,14,17'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17 Job 11", "g++-8", packages="g++-8", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-8', 'CXXSTD': '03,11,14,17'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=gcc COMPILER=g++-9 CXXSTD=03,11,14,17 Job 12", "g++-9", packages="g++-9", buildtype="boost", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-9', 'CXXSTD': '03,11,14,17,2a'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=gcc COMPILER=g++-10 CXXSTD=03,11,14,17,20 Job 13", "g++-10", packages="g++-10", image="cppalliance/droneubuntu2004:1", buildtype="boost", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-10', 'CXXSTD': '03,11,14,17,20'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03, Job 15", "clang++", packages="clang-3.5", llvm_os="precise", llvm_ver="3.5", buildtype="boost", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-3.5', 'CXXSTD': '03,11,14,1z'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03, Job 16", "clang++", packages="clang-3.6", llvm_os="precise", llvm_ver="3.6", buildtype="boost", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-3.6', 'CXXSTD': '03,11,14,1z'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03, Job 17", "clang++", packages="clang-3.7", llvm_os="precise", llvm_ver="3.7", buildtype="boost", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-3.7', 'CXXSTD': '03,11,14,1z'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03, Job 18", "clang++-3.8", packages="clang-3.8", llvm_os="precise", llvm_ver="3.8", buildtype="boost", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-3.8', 'CXXSTD': '03,11,14,1z'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03, Job 19", "clang++-3.9", packages="clang-3.9", llvm_os="precise", llvm_ver="3.9", buildtype="boost", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-3.9', 'CXXSTD': '03,11,14,1z'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03, Job 20", "clang++-4.0", packages="clang-4.0", llvm_os="xenial", llvm_ver="4.0", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-4.0', 'CXXSTD': '03,11,14,1z'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03, Job 21", "clang++-5.0", packages="clang-5.0", llvm_os="xenial", llvm_ver="5.0", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-5.0', 'CXXSTD': '03,11,14,1z'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-5.0 -stdlib=libc++ CXXSTD=03,11,14 Job 22", "clang++-5.0 -stdlib=libc++", packages="libc++-dev clang-5.0", llvm_os="xenial", llvm_ver="5.0", buildtype="boost", image=linuxglobalimage, environment={'COMPILER': 'clang++-5.0 -stdlib=libc++', 'TOOLSET': 'clang', 'CXXSTD': '03,11,14'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,1z, Job 23", "clang++-6.0", packages="clang-6.0", llvm_os="xenial", llvm_ver="6.0", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-6.0', 'CXXSTD': '03,11,14,1z'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-6.0 -stdlib=libc++ CXXSTD=03,11,14 Job 24", "clang++-6.0 -stdlib=libc++", packages="clang-6.0 libc++-dev", llvm_os="xenial", llvm_ver="6.0", buildtype="boost", image=linuxglobalimage, environment={'COMPILER': 'clang++-6.0 -stdlib=libc++', 'TOOLSET': 'clang', 'CXXSTD': '03,11,14'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,1z Job 25", "clang++-7", packages="clang-7", llvm_os="xenial", llvm_ver="7", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-7', 'CXXSTD': '03,11,14,1z'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17 2a Job 26", "clang++-8", packages="clang-8", llvm_os="xenial", llvm_ver="8", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-8', 'CXXSTD': '03,11,14,17,2a'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a Job 27", "clang++-9", packages="clang-9", llvm_os="xenial", llvm_ver="9", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-9', 'CXXSTD': '03,11,14,17,2a'}, globalenv=globalenv),
|
||||
linux_cxx("TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 Job 28", "clang++-10", packages="clang-10", llvm_os="xenial", llvm_ver="10", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-10', 'CXXSTD': '03,11,14,17,20'}, globalenv=globalenv),
|
||||
osx_cxx("XCode-11.7 CXXSTD=03,11,14,17,2a Job 29", "clang++", packages="", buildtype="boost", xcode_version="11.7", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '03,11,14,17,2a', 'DRONE_JOB_OS_NAME': 'osx'}, globalenv=globalenv),
|
||||
osx_cxx("XCode-10.2 CXXSTD=03,11,14,17,2a Job 30", "clang++", packages="", buildtype="boost", xcode_version="10.2", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '03,11,14,17,2a', 'DRONE_JOB_OS_NAME': 'osx'}, globalenv=globalenv),
|
||||
osx_cxx("XCode-9.4 CXXSTD=03,11,14,1z Job 31", "clang++", packages="", buildtype="boost", xcode_version="9.4", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_OS_NAME': 'osx'}, globalenv=globalenv),
|
||||
osx_cxx("XCode-9.0 CXXSTD=03,11,14,1z Job 32", "clang++", packages="", buildtype="boost", xcode_version="9", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_OS_NAME': 'osx'}, globalenv=globalenv),
|
||||
osx_cxx("XCode-8.3 CXXSTD=03,11,14,1z Job 33", "clang++", packages="", buildtype="boost", xcode_version="8.3", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_OS_NAME': 'osx'}, globalenv=globalenv),
|
||||
osx_cxx("XCode-8.0 CXXSTD=03,11,14,1z Job 34", "clang++", packages="", buildtype="boost", xcode_version="8", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_OS_NAME': 'osx'}, globalenv=globalenv),
|
||||
osx_cxx("XCode-7.3 CXXSTD=03,11,14,1z Job 35", "clang++", packages="", buildtype="boost", xcode_version="7.3", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_OS_NAME': 'osx'}, globalenv=globalenv),
|
||||
]
|
||||
|
||||
# from https://github.com/boostorg/boost-ci
|
||||
load("@boost_ci//ci/drone/:functions.star", "linux_cxx","windows_cxx","osx_cxx","freebsd_cxx")
|
3
.drone/after-success.sh
Executable file
3
.drone/after-success.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
3
.drone/before-install.sh
Executable file
3
.drone/before-install.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
3
.drone/before-script.sh
Executable file
3
.drone/before-script.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
56
.drone/boost.sh
Executable file
56
.drone/boost.sh
Executable file
@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
export TRAVIS_BUILD_DIR=$(pwd)
|
||||
export DRONE_BUILD_DIR=$(pwd)
|
||||
export TRAVIS_BRANCH=$DRONE_BRANCH
|
||||
export VCS_COMMIT_ID=$DRONE_COMMIT
|
||||
export GIT_COMMIT=$DRONE_COMMIT
|
||||
export REPO_NAME=$DRONE_REPO
|
||||
export PATH=~/.local/bin:/usr/local/bin:$PATH
|
||||
|
||||
echo '==================================> BEFORE_INSTALL'
|
||||
|
||||
. .drone/before-install.sh
|
||||
|
||||
echo '==================================> INSTALL'
|
||||
|
||||
cd ..
|
||||
git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
cd boost-root
|
||||
git submodule update --init tools/build
|
||||
git submodule update --init tools/boost_install
|
||||
git submodule update --init libs/headers
|
||||
git submodule update --init libs/config
|
||||
git submodule update --init libs/assert
|
||||
git submodule update --init libs/bind
|
||||
git submodule update --init libs/core
|
||||
git submodule update --init libs/detail
|
||||
git submodule update --init libs/function
|
||||
git submodule update --init libs/integer
|
||||
git submodule update --init libs/move
|
||||
git submodule update --init libs/mpl
|
||||
git submodule update --init libs/preprocessor
|
||||
git submodule update --init libs/static_assert
|
||||
git submodule update --init libs/throw_exception
|
||||
git submodule update --init libs/type_index
|
||||
git submodule update --init libs/utility
|
||||
cp -r $TRAVIS_BUILD_DIR/* libs/type_traits
|
||||
./bootstrap.sh
|
||||
./b2 headers
|
||||
|
||||
echo '==================================> BEFORE_SCRIPT'
|
||||
|
||||
. $DRONE_BUILD_DIR/.drone/before-script.sh
|
||||
|
||||
echo '==================================> SCRIPT'
|
||||
|
||||
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
|
||||
IFS=','
|
||||
for CXXLOCAL in $CXXSTD; do (cd libs/config/test && ../../../b2 config_info_travis_install toolset=$TOOLSET cxxstd=$CXXLOCAL $CXXSTD_DIALECT && echo With Standard Version $CXXLOCAL && ./config_info_travis && rm ./config_info_travis) done
|
||||
unset IFS
|
||||
./b2 libs/type_traits/test toolset=$TOOLSET cxxstd=$CXXSTD $CXXSTD_DIALECT
|
||||
|
||||
echo '==================================> AFTER_SUCCESS'
|
||||
|
||||
. $DRONE_BUILD_DIR/.drone/after-success.sh
|
482
.github/workflows/ci.yml
vendored
Normal file
482
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,482 @@
|
||||
# Copyright 2020 Evan Miller
|
||||
# Copyright 2020 Matt Borland
|
||||
# Copyright 2021 John Maddock
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
pull_request:
|
||||
release:
|
||||
types: [published, created, edited]
|
||||
jobs:
|
||||
ubuntu-focal:
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler: [ g++-9, g++-10, clang++-9, clang++-10 ]
|
||||
standard: [ c++03, c++11, c++14, c++17, c++2a, gnu++03, gnu++11, gnu++14, gnu++17, gnu++2a ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
with:
|
||||
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
|
||||
commit-filter-separator: ';'
|
||||
fail-fast: true
|
||||
- name: Set TOOLSET
|
||||
run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV
|
||||
- name: Add repository
|
||||
continue-on-error: true
|
||||
id: addrepo
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Retry Add Repo
|
||||
continue-on-error: true
|
||||
id: retry1
|
||||
if: steps.addrepo.outcome=='failure'
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Retry Add Repo 2
|
||||
continue-on-error: true
|
||||
id: retry2
|
||||
if: steps.retry1.outcome=='failure'
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Install packages
|
||||
run: sudo apt install g++-9 g++-10 clang-9 clang-10 libgmp-dev libmpfr-dev libfftw3-dev
|
||||
- name: Checkout main boost
|
||||
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
|
||||
- name: Update tools/boostdep
|
||||
run: git submodule update --init tools/boostdep
|
||||
working-directory: ../boost-root
|
||||
- name: Copy files
|
||||
run: cp -r $GITHUB_WORKSPACE/* libs/type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Install deps
|
||||
run: python tools/boostdep/depinst/depinst.py type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Bootstrap
|
||||
run: ./bootstrap.sh
|
||||
working-directory: ../boost-root
|
||||
- name: Generate headers
|
||||
run: ./b2 headers
|
||||
working-directory: ../boost-root
|
||||
- name: Generate user config
|
||||
run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} : <cxxflags>-std=${{ matrix.standard }} ;" > ~/user-config.jam'
|
||||
working-directory: ../boost-root
|
||||
- name: Config info install
|
||||
run: ../../../b2 config_info_travis_install toolset=$TOOLSET
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Config info
|
||||
run: ./config_info_travis
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Test
|
||||
run: ../../../b2 toolset=$TOOLSET
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
ubuntu-bionic:
|
||||
runs-on: ubuntu-18.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler: [ g++-7, g++-8, clang++-7, clang++-8 ]
|
||||
standard: [ c++03, c++11, c++14, c++17, gnu++03, gnu++11, gnu++14, gnu++17 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
with:
|
||||
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
|
||||
commit-filter-separator: ';'
|
||||
fail-fast: true
|
||||
- name: Set TOOLSET
|
||||
run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV
|
||||
- name: Add repository
|
||||
continue-on-error: true
|
||||
id: addrepo
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Retry Add Repo
|
||||
continue-on-error: true
|
||||
id: retry1
|
||||
if: steps.addrepo.outcome=='failure'
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Retry Add Repo 2
|
||||
continue-on-error: true
|
||||
id: retry2
|
||||
if: steps.retry1.outcome=='failure'
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Install packages
|
||||
run: sudo apt install g++-7 g++-8 clang-7 clang-8 libgmp-dev libmpfr-dev libfftw3-dev
|
||||
- name: Checkout main boost
|
||||
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
|
||||
- name: Update tools/boostdep
|
||||
run: git submodule update --init tools/boostdep
|
||||
working-directory: ../boost-root
|
||||
- name: Copy files
|
||||
run: cp -r $GITHUB_WORKSPACE/* libs/type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Install deps
|
||||
run: python tools/boostdep/depinst/depinst.py type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Bootstrap
|
||||
run: ./bootstrap.sh
|
||||
working-directory: ../boost-root
|
||||
- name: Generate headers
|
||||
run: ./b2 headers
|
||||
working-directory: ../boost-root
|
||||
- name: Generate user config
|
||||
run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} : <cxxflags>-std=${{ matrix.standard }} ;" > ~/user-config.jam'
|
||||
working-directory: ../boost-root
|
||||
- name: Config info install
|
||||
run: ../../../b2 config_info_travis_install toolset=$TOOLSET
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Config info
|
||||
run: ./config_info_travis
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Test
|
||||
run: ../../../b2 toolset=$TOOLSET
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
toolset: [ clang ]
|
||||
standard: [ "03", 11, 14, 17, 2a ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
with:
|
||||
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[linux];[Linux];[LINUX]'
|
||||
commit-filter-separator: ';'
|
||||
fail-fast: true
|
||||
- name: Checkout main boost
|
||||
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
|
||||
- name: Update tools/boostdep
|
||||
run: git submodule update --init tools/boostdep
|
||||
working-directory: ../boost-root
|
||||
- name: Copy files
|
||||
run: cp -r $GITHUB_WORKSPACE/* libs/type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Install deps
|
||||
run: python tools/boostdep/depinst/depinst.py type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Bootstrap
|
||||
run: ./bootstrap.sh
|
||||
working-directory: ../boost-root
|
||||
- name: Generate headers
|
||||
run: ./b2 headers
|
||||
working-directory: ../boost-root
|
||||
- name: Config info install
|
||||
run: ../../../b2 config_info_travis_install toolset=${{ matrix.toolset }} cxxstd=${{ matrix.standard }}
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Config info
|
||||
run: ./config_info_travis
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Test
|
||||
run: ../../../b2 toolset=${{ matrix.toolset }} cxxstd=${{ matrix.standard }}
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
windows_gcc:
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
env:
|
||||
ARGS: toolset=${{ matrix.toolset }} address-model=64 cxxstd=${{ matrix.standard }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
standard: [ 11, 14, 17 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
with:
|
||||
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[apple];[Apple];[APPLE];[linux];[Linux];[LINUX]'
|
||||
commit-filter-separator: ';'
|
||||
fail-fast: true
|
||||
- name: Checkout main boost
|
||||
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
|
||||
- name: Update tools/boostdep
|
||||
run: git submodule update --init tools/boostdep
|
||||
working-directory: ../boost-root
|
||||
- name: Copy files
|
||||
run: xcopy /s /e /q %GITHUB_WORKSPACE% libs\type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Install deps
|
||||
run: python tools/boostdep/depinst/depinst.py type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Bootstrap
|
||||
run: bootstrap
|
||||
working-directory: ../boost-root
|
||||
- name: Generate headers
|
||||
run: b2 headers
|
||||
working-directory: ../boost-root
|
||||
- name: Config info install
|
||||
run: ..\..\..\b2 config_info_travis_install cxxstd=${{ matrix.standard }} toolset=gcc
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Config info
|
||||
run: config_info_travis
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Test
|
||||
run: ..\..\..\b2 --hash cxxstd=${{ matrix.standard }} toolset=gcc
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
windows_msvc_14_0:
|
||||
runs-on: windows-2019
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
standard: [ 14, 17 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
with:
|
||||
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[apple];[Apple];[APPLE];[linux];[Linux];[LINUX]'
|
||||
commit-filter-separator: ';'
|
||||
fail-fast: true
|
||||
- name: Checkout main boost
|
||||
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
|
||||
- name: Update tools/boostdep
|
||||
run: git submodule update --init tools/boostdep
|
||||
working-directory: ../boost-root
|
||||
- name: Copy files
|
||||
run: xcopy /s /e /q %GITHUB_WORKSPACE% libs\type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Install deps
|
||||
run: python tools/boostdep/depinst/depinst.py type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Bootstrap
|
||||
run: bootstrap
|
||||
working-directory: ../boost-root
|
||||
- name: Generate headers
|
||||
run: b2 headers
|
||||
working-directory: ../boost-root
|
||||
- name: Config info install
|
||||
run: ..\..\..\b2 config_info_travis_install cxxstd=${{ matrix.standard }} toolset=msvc-14.0
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Config info
|
||||
run: config_info_travis
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Test
|
||||
run: ..\..\..\b2 --hash cxxstd=${{ matrix.standard }} toolset=msvc-14.0 define=CI_SUPPRESS_KNOWN_ISSUES
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
windows_msvc_14_2:
|
||||
runs-on: windows-2019
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
standard: [ 14, 17, latest ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
with:
|
||||
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[apple];[Apple];[APPLE];[linux];[Linux];[LINUX]'
|
||||
commit-filter-separator: ';'
|
||||
fail-fast: true
|
||||
- name: Checkout main boost
|
||||
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
|
||||
- name: Update tools/boostdep
|
||||
run: git submodule update --init tools/boostdep
|
||||
working-directory: ../boost-root
|
||||
- name: Copy files
|
||||
run: xcopy /s /e /q %GITHUB_WORKSPACE% libs\type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Install deps
|
||||
run: python tools/boostdep/depinst/depinst.py type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Bootstrap
|
||||
run: bootstrap
|
||||
working-directory: ../boost-root
|
||||
- name: Generate headers
|
||||
run: b2 headers
|
||||
working-directory: ../boost-root
|
||||
- name: Config info install
|
||||
run: ..\..\..\b2 config_info_travis_install cxxstd=${{ matrix.standard }} toolset=msvc-14.2
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Config info
|
||||
run: config_info_travis
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Test
|
||||
run: ..\..\..\b2 --hash cxxstd=${{ matrix.standard }} toolset=msvc-14.2 define=CI_SUPPRESS_KNOWN_ISSUES
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
windows_msvc_14_3:
|
||||
runs-on: windows-2022
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
standard: [ 14, 17, latest ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
with:
|
||||
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[apple];[Apple];[APPLE];[linux];[Linux];[LINUX]'
|
||||
commit-filter-separator: ';'
|
||||
fail-fast: true
|
||||
- name: Checkout main boost
|
||||
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
|
||||
- name: Update tools/boostdep
|
||||
run: git submodule update --init tools/boostdep
|
||||
working-directory: ../boost-root
|
||||
- name: Copy files
|
||||
run: xcopy /s /e /q %GITHUB_WORKSPACE% libs\type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Install deps
|
||||
run: python tools/boostdep/depinst/depinst.py type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Bootstrap
|
||||
run: bootstrap
|
||||
working-directory: ../boost-root
|
||||
- name: Generate headers
|
||||
run: b2 headers
|
||||
working-directory: ../boost-root
|
||||
- name: Config info install
|
||||
run: ..\..\..\b2 config_info_travis_install cxxstd=${{ matrix.standard }} toolset=msvc-14.3
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Config info
|
||||
run: config_info_travis
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Test
|
||||
run: ..\..\..\b2 --hash cxxstd=${{ matrix.standard }} toolset=msvc-14.3 define=CI_SUPPRESS_KNOWN_ISSUES
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
windows_msvc_14_2_clr:
|
||||
runs-on: windows-2019
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
standard: [ 14, 17 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
with:
|
||||
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[apple];[Apple];[APPLE];[linux];[Linux];[LINUX]'
|
||||
commit-filter-separator: ';'
|
||||
fail-fast: true
|
||||
- name: Checkout main boost
|
||||
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
|
||||
- name: Update tools/boostdep
|
||||
run: git submodule update --init tools/boostdep
|
||||
working-directory: ../boost-root
|
||||
- name: Copy files
|
||||
run: xcopy /s /e /q %GITHUB_WORKSPACE% libs\type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Install deps
|
||||
run: python tools/boostdep/depinst/depinst.py type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Bootstrap
|
||||
run: bootstrap
|
||||
working-directory: ../boost-root
|
||||
- name: Generate headers
|
||||
run: b2 headers
|
||||
working-directory: ../boost-root
|
||||
- name: Config info install
|
||||
run: ..\..\..\b2 config_info_travis_install cxxstd=${{ matrix.standard }} toolset=msvc-14.2 cxxflags=-clr asynch-exceptions=on
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Config info
|
||||
run: config_info_travis
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Test
|
||||
run: ..\..\..\b2 --hash cxxstd=${{ matrix.standard }} toolset=msvc-14.2 define=CI_SUPPRESS_KNOWN_ISSUES cxxflags=-clr asynch-exceptions=on
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
ubuntu-cuda:
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
standard: [ 11, 14, 17 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: Jimver/cuda-toolkit@v0.2.4
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
with:
|
||||
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
|
||||
commit-filter-separator: ';'
|
||||
fail-fast: true
|
||||
- name: Add repository
|
||||
continue-on-error: true
|
||||
id: addrepo
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Retry Add Repo
|
||||
continue-on-error: true
|
||||
id: retry1
|
||||
if: steps.addrepo.outcome=='failure'
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Retry Add Repo 2
|
||||
continue-on-error: true
|
||||
id: retry2
|
||||
if: steps.retry1.outcome=='failure'
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Install packages
|
||||
run: sudo apt install clang-10
|
||||
- name: Checkout main boost
|
||||
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
|
||||
- name: Update tools/boostdep
|
||||
run: git submodule update --init tools/boostdep
|
||||
working-directory: ../boost-root
|
||||
- name: Copy files
|
||||
run: cp -r $GITHUB_WORKSPACE/* libs/type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Install deps
|
||||
run: python tools/boostdep/depinst/depinst.py type_traits
|
||||
working-directory: ../boost-root
|
||||
- name: Bootstrap
|
||||
run: ./bootstrap.sh
|
||||
working-directory: ../boost-root
|
||||
- name: Generate headers
|
||||
run: ./b2 headers
|
||||
working-directory: ../boost-root
|
||||
- name: nvcc version
|
||||
run: nvcc --version
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Testing nvcc
|
||||
run: for file in $(cat cuda/cuda_tests.txt); do echo "testing $file.cpp" && nvcc -std=c++${{ matrix.standard }} -I../../.. -c -DTEST_VIA_STATIC_ASSERT $file.cpp || break -1; done
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
- name: Testing nvcc+clang
|
||||
run: for file in $(cat cuda/cuda_tests.txt); do echo "testing $file.cpp" && nvcc --compiler-bindir=clang++ -std=c++${{ matrix.standard }} -I../../.. -c -DTEST_VIA_STATIC_ASSERT $file.cpp || break -1; done
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
- name: Create .cu files
|
||||
run: for file in $(cat cuda/cuda_tests.txt); do cp $file.cpp $file.cu; done
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
- name: Testing nvcc on .cu files
|
||||
run: for file in $(cat cuda/cuda_tests.txt); do echo "testing $file.cu" && nvcc -std=c++${{ matrix.standard }} -I../../.. -c -DTEST_VIA_STATIC_ASSERT $file.cu || break -1; done
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
- name: Testing nvcc+clang on .cu files
|
||||
run: for file in $(cat cuda/cuda_tests.txt); do echo "testing $file.cu" && nvcc --compiler-bindir=clang++ -std=c++${{ matrix.standard }} -I../../.. -c -DTEST_VIA_STATIC_ASSERT $file.cu || break -1; done
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
- name: Testing clang on .cu files
|
||||
run: for file in $(cat cuda/cuda_tests.txt); do echo "testing $file.cu" && clang++ -nocudalib --no-cuda-version-check --cuda-gpu-arch=sm_75 -std=c++${{ matrix.standard }} -I../../.. -c -DTEST_VIA_STATIC_ASSERT $file.cu || break -1; done
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
- name: Testing nvcc on .cu files
|
||||
run: for file in $(cat cuda/cuda_tests.txt); do echo "testing $file.cu" && nvcc -std=c++${{ matrix.standard }} -I../../.. -c -DTEST_CUDA_DEVICE $file.cu || break -1; done
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
||||
- name: Testing clang on .cu files
|
||||
run: for file in $(cat cuda/cuda_tests.txt); do echo "testing $file.cu" && clang++ -nocudalib --no-cuda-version-check --cuda-gpu-arch=sm_75 -std=c++${{ matrix.standard }} -I../../.. -c -DTEST_CUDA_DEVICE $file.cu || break -1; done
|
||||
working-directory: ../boost-root/libs/type_traits/test
|
20
CMakeLists.txt
Normal file
20
CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
||||
# Copyright 2018 Mike Dev
|
||||
# Copyright 2019 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
# We support CMake 3.5, but prefer 3.16 policies and behavior
|
||||
cmake_minimum_required(VERSION 3.5...3.16)
|
||||
|
||||
project(boost_type_traits VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
|
||||
|
||||
add_library(boost_type_traits INTERFACE)
|
||||
add_library(Boost::type_traits ALIAS boost_type_traits)
|
||||
|
||||
target_include_directories(boost_type_traits INTERFACE include)
|
||||
|
||||
target_link_libraries(boost_type_traits
|
||||
INTERFACE
|
||||
Boost::config
|
||||
Boost::static_assert
|
||||
)
|
47
README.md
Normal file
47
README.md
Normal file
@ -0,0 +1,47 @@
|
||||
Boost TypeTraits Library
|
||||
============================
|
||||
|
||||
The Boost type-traits library contains a set of very specific traits classes, each of which encapsulate a single trait
|
||||
from the C++ type system; for example, is a type a pointer or a reference type? Or does a type have a trivial constructor, or a const-qualifier?
|
||||
|
||||
The type-traits classes share a unified design: each class inherits from the type true_type if the type has the specified property and inherits from false_type otherwise.
|
||||
|
||||
The type-traits library also contains a set of classes that perform a specific transformation on a type; for example, they can remove a top-level const or
|
||||
volatile qualifier from a type. Each class that performs a transformation defines a single typedef-member type that is the result of the transformation.
|
||||
|
||||
The full documentation is available on [boost.org](http://www.boost.org/doc/libs/release/libs/type_traits/index.html).
|
||||
|
||||
| | Master | Develop |
|
||||
|------------------|----------|-------------|
|
||||
| Travis | [](https://travis-ci.org/boostorg/type_traits) | [](https://travis-ci.org/boostorg/type_traits) |
|
||||
| Appveyor | [](https://ci.appveyor.com/project/jzmaddock/type-traits/branch/master) | [](https://ci.appveyor.com/project/jzmaddock/type-traits/branch/develop) |
|
||||
|
||||
|
||||
## Support, bugs and feature requests ##
|
||||
|
||||
Bugs and feature requests can be reported through the [Gitub issue tracker](https://github.com/boostorg/type_traits/issues)
|
||||
(see [open issues](https://github.com/boostorg/type_traits/issues) and
|
||||
[closed issues](https://github.com/boostorg/type_traits/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aclosed)).
|
||||
|
||||
You can submit your changes through a [pull request](https://github.com/boostorg/type_traits/pulls).
|
||||
|
||||
There is no mailing-list specific to Boost TypeTraits, although you can use the general-purpose Boost [mailing-list](http://lists.boost.org/mailman/listinfo.cgi/boost-users) using the tag [type_traits].
|
||||
|
||||
|
||||
## Development ##
|
||||
|
||||
Clone the whole boost project, which includes the individual Boost projects as submodules ([see boost+git doc](https://github.com/boostorg/boost/wiki/Getting-Started)):
|
||||
|
||||
git clone https://github.com/boostorg/boost
|
||||
cd boost
|
||||
git submodule update --init
|
||||
|
||||
The Boost TypeTraits Library is located in `libs/type_traits/`.
|
||||
|
||||
### Running tests ###
|
||||
First, make sure you are in `libs/type_traits/test`.
|
||||
You can either run all the tests listed in `Jamfile.v2` or run a single test:
|
||||
|
||||
../../../b2 <- run all tests
|
||||
../../../b2 config_info <- single test
|
||||
|
@ -1,590 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
<meta name="ProgId" content="FrontPage.Editor.Document">
|
||||
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
|
||||
<title>C++ Type traits</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" link="#0000FF" vlink="#800080">
|
||||
|
||||
<h2 align="center">C++ Type traits</h2>
|
||||
|
||||
<p align="center"><em>by John Maddock and Steve Cleary</em></p>
|
||||
|
||||
<p align="center"><em>This is the draft version of an article
|
||||
that appeared in the October 2000 issue of </em><a
|
||||
href="http://www.ddj.com"><em>Dr Dobb's Journal</em></a></p>
|
||||
|
||||
<p>Generic programming (writing code which works with any data
|
||||
type meeting a set of requirements) has become the method of
|
||||
choice for providing reusable code. However, there are times in
|
||||
generic programming when "generic" just isn't good
|
||||
enough - sometimes the differences between types are too large
|
||||
for an efficient generic implementation. This is when the traits
|
||||
technique becomes important - by encapsulating those properties
|
||||
that need to be considered on a type by type basis inside a
|
||||
traits class, we can minimise the amount of code that has to
|
||||
differ from one type to another, and maximise the amount of
|
||||
generic code.</p>
|
||||
|
||||
<p>Consider an example: when working with character strings, one
|
||||
common operation is to determine the length of a null terminated
|
||||
string. Clearly it's possible to write generic code that can do
|
||||
this, but it turns out that there are much more efficient methods
|
||||
available: for example, the C library functions <font size="2"
|
||||
face="Courier New">strlen</font> and <font size="2"
|
||||
face="Courier New">wcslen</font> are usually written in assembler,
|
||||
and with suitable hardware support can be considerably faster
|
||||
than a generic version written in C++. The authors of the C++
|
||||
standard library realised this, and abstracted the properties of <font
|
||||
size="2" face="Courier New">char</font> and <font size="2"
|
||||
face="Courier New">wchar_t</font> into the class <font size="2"
|
||||
face="Courier New">char_traits</font>. Generic code that works
|
||||
with character strings can simply use <font size="2"
|
||||
face="Courier New">char_traits<>::length</font> to
|
||||
determine the length of a null terminated string, safe in the
|
||||
knowledge that specialisations of <font size="2"
|
||||
face="Courier New">char_traits</font> will use the most
|
||||
appropriate method available to them.</p>
|
||||
|
||||
<h4>Type traits</h4>
|
||||
|
||||
<p>Class <font size="2" face="Courier New">char_traits</font> is
|
||||
a classic example of a collection of type specific properties
|
||||
wrapped up in a single class - what Nathan Myers termed a <i>baggage
|
||||
class</i>[1]. In the Boost type-traits library, we[2] have
|
||||
written a set of very specific traits classes, each of which
|
||||
encapsulate a single trait from the C++ type system; for example,
|
||||
is a type a pointer or a reference type? Or does a type have a
|
||||
trivial constructor, or a const-qualifier? The type-traits
|
||||
classes share a unified design: each class has a single member <i>value</i>,
|
||||
a compile-time constant that is true if the type has the
|
||||
specified property, and false otherwise. As we will show, these
|
||||
classes can be used in generic programming to determine the
|
||||
properties of a given type and introduce optimisations that are
|
||||
appropriate for that case.</p>
|
||||
|
||||
<p>The type-traits library also contains a set of classes that
|
||||
perform a specific transformation on a type; for example, they
|
||||
can remove a top-level const or volatile qualifier from a type.
|
||||
Each class that performs a transformation defines a single
|
||||
typedef-member <i>type</i> that is the result of the
|
||||
transformation. All of the type-traits classes are defined inside
|
||||
namespace <font size="2" face="Courier New">boost</font>; for
|
||||
brevity, namespace-qualification is omitted in most of the code
|
||||
samples given.</p>
|
||||
|
||||
<h4>Implementation</h4>
|
||||
|
||||
<p>There are far too many separate classes contained in the type-traits
|
||||
library to give a full implementation here - see the source code
|
||||
in the Boost library for the full details - however, most of the
|
||||
implementation is fairly repetitive anyway, so here we will just
|
||||
give you a flavour for how some of the classes are implemented.
|
||||
Beginning with possibly the simplest class in the library, is_void<T>
|
||||
has a member <i>value</i> that is true only if T is void.</p>
|
||||
|
||||
<pre>template <typename T>
|
||||
struct is_void
|
||||
{ static const bool value = false; };
|
||||
|
||||
template <>
|
||||
struct is_void<void>
|
||||
{ static const bool value = true; };</pre>
|
||||
|
||||
<p>Here we define a primary version of the template class <font
|
||||
size="2" face="Courier New">is_void</font>, and provide a full-specialisation
|
||||
when T is void. While full specialisation of a template class is
|
||||
an important technique, sometimes we need a solution that is
|
||||
halfway between a fully generic solution, and a full
|
||||
specialisation. This is exactly the situation for which the
|
||||
standards committee defined partial template-class specialisation.
|
||||
As an example, consider the class boost::is_pointer<T>:
|
||||
here we needed a primary version that handles all the cases where
|
||||
T is not a pointer, and a partial specialisation to handle all
|
||||
the cases where T is a pointer:</p>
|
||||
|
||||
<pre>template <typename T>
|
||||
struct is_pointer
|
||||
{ static const bool value = false; };
|
||||
|
||||
template <typename T>
|
||||
struct is_pointer<T*>
|
||||
{ static const bool value = true; };</pre>
|
||||
|
||||
<p>The syntax for partial specialisation is somewhat arcane and
|
||||
could easily occupy an article in its own right; like full
|
||||
specialisation, in order to write a partial specialisation for a
|
||||
class, you must first declare the primary template. The partial
|
||||
specialisation contains an extra <…> after the class
|
||||
name that contains the partial specialisation parameters; these
|
||||
define the types that will bind to that partial specialisation
|
||||
rather than the default template. The rules for what can appear
|
||||
in a partial specialisation are somewhat convoluted, but as a
|
||||
rule of thumb if you can legally write two function overloads of
|
||||
the form:</p>
|
||||
|
||||
<pre>void foo(T);
|
||||
void foo(U);</pre>
|
||||
|
||||
<p>Then you can also write a partial specialisation of the form:</p>
|
||||
|
||||
<pre>template <typename T>
|
||||
class c{ /*details*/ };
|
||||
|
||||
template <typename T>
|
||||
|
||||
class c<U>{ /*details*/ };</pre>
|
||||
|
||||
<p>This rule is by no means foolproof, but it is reasonably
|
||||
simple to remember and close enough to the actual rule to be
|
||||
useful for everyday use.</p>
|
||||
|
||||
<p>As a more complex example of partial specialisation consider
|
||||
the class remove_bounds<T>. This class defines a single
|
||||
typedef-member <i>type</i> that is the same type as T but with
|
||||
any top-level array bounds removed; this is an example of a
|
||||
traits class that performs a transformation on a type:</p>
|
||||
|
||||
<pre>template <typename T>
|
||||
struct remove_bounds
|
||||
{ typedef T type; };
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
struct remove_bounds<T[N]>
|
||||
{ typedef T type; };</pre>
|
||||
|
||||
<p>The aim of remove_bounds is this: imagine a generic algorithm
|
||||
that is passed an array type as a template parameter, <font
|
||||
size="2" face="Courier New">remove_bounds</font> provides a means
|
||||
of determining the underlying type of the array. For example <code>remove_bounds<int[4][5]>::type</code>
|
||||
would evaluate to the type <code>int[5]</code>. This example also
|
||||
shows that the number of template parameters in a partial
|
||||
specialisation does not have to match the number in the default
|
||||
template. However, the number of parameters that appear after the
|
||||
class name do have to match the number and type of the parameters
|
||||
in the default template.</p>
|
||||
|
||||
<h4>Optimised copy</h4>
|
||||
|
||||
<p>As an example of how the type traits classes can be used,
|
||||
consider the standard library algorithm copy:</p>
|
||||
|
||||
<pre>template<typename Iter1, typename Iter2>
|
||||
Iter2 copy(Iter1 first, Iter1 last, Iter2 out);</pre>
|
||||
|
||||
<p>Obviously, there's no problem writing a generic version of
|
||||
copy that works for all iterator types Iter1 and Iter2; however,
|
||||
there are some circumstances when the copy operation can best be
|
||||
performed by a call to <font size="2" face="Courier New">memcpy</font>.
|
||||
In order to implement copy in terms of <font size="2"
|
||||
face="Courier New">memcpy</font> all of the following conditions
|
||||
need to be met:</p>
|
||||
|
||||
<ul>
|
||||
<li>Both of the iterator types Iter1 and Iter2 must be
|
||||
pointers.</li>
|
||||
<li>Both Iter1 and Iter2 must point to the same type -
|
||||
excluding <font size="2" face="Courier New">const</font>
|
||||
and <font size="2" face="Courier New">volatile</font>-qualifiers.</li>
|
||||
<li>The type pointed to by Iter1 must have a trivial
|
||||
assignment operator.</li>
|
||||
</ul>
|
||||
|
||||
<p>By trivial assignment operator we mean that the type is either
|
||||
a scalar type[3] or:</p>
|
||||
|
||||
<ul>
|
||||
<li>The type has no user defined assignment operator.</li>
|
||||
<li>The type does not have any data members that are
|
||||
references.</li>
|
||||
<li>All base classes, and all data member objects must have
|
||||
trivial assignment operators.</li>
|
||||
</ul>
|
||||
|
||||
<p>If all these conditions are met then a type can be copied
|
||||
using <font size="2" face="Courier New">memcpy</font> rather than
|
||||
using a compiler generated assignment operator. The type-traits
|
||||
library provides a class <i>has_trivial_assign</i>, such that <code>has_trivial_assign<T>::value</code>
|
||||
is true only if T has a trivial assignment operator. This class
|
||||
"just works" for scalar types, but has to be explicitly
|
||||
specialised for class/struct types that also happen to have a
|
||||
trivial assignment operator. In other words if <i>has_trivial_assign</i>
|
||||
gives the wrong answer, it will give the "safe" wrong
|
||||
answer - that trivial assignment is not allowable.</p>
|
||||
|
||||
<p>The code for an optimised version of copy that uses <font
|
||||
size="2" face="Courier New">memcpy</font> where appropriate is
|
||||
given in listing 1. The code begins by defining a template class <i>copier</i>,
|
||||
that takes a single Boolean template parameter, and has a static
|
||||
template member function <font size="2" face="Courier New">do_copy</font>
|
||||
which performs the generic version of <font size="2">copy</font>
|
||||
(in other words the "slow but safe version"). Following
|
||||
that there is a specialisation for <i>copier<true></i>:
|
||||
again this defines a static template member function <font
|
||||
size="2" face="Courier New">do_copy</font>, but this version uses
|
||||
memcpy to perform an "optimised" copy.</p>
|
||||
|
||||
<p>In order to complete the implementation, what we need now is a
|
||||
version of copy, that calls <code>copier<true>::do_copy</code>
|
||||
if it is safe to use <font size="2" face="Courier New">memcpy</font>,
|
||||
and otherwise calls <code>copier<false>::do_copy</code> to
|
||||
do a "generic" copy. This is what the version in
|
||||
listing 1 does. To understand how the code works look at the code
|
||||
for <font size="2" face="Courier New">copy</font> and consider
|
||||
first the two typedefs <i>v1_t</i> and <i>v2_t</i>. These use <code>std::iterator_traits<Iter1>::value_type</code>
|
||||
to determine what type the two iterators point to, and then feed
|
||||
the result into another type-traits class <i>remove_cv</i> that
|
||||
removes the top-level const-volatile-qualifiers: this will allow
|
||||
copy to compare the two types without regard to const- or
|
||||
volatile-qualifiers. Next, <font size="2" face="Courier New">copy</font>
|
||||
declares an enumerated value <i>can_opt</i> that will become the
|
||||
template parameter to copier - declaring this here as a constant
|
||||
is really just a convenience - the value could be passed directly
|
||||
to class <font size="2" face="Courier New">copier</font>. The
|
||||
value of <i>can_opt</i> is computed by verifying that all of the
|
||||
following are true:</p>
|
||||
|
||||
<ul>
|
||||
<li>first that the two iterators point to the same type by
|
||||
using a type-traits class <i>is_same</i>.</li>
|
||||
<li>Then that both iterators are real pointers - using the
|
||||
class <i>is_pointer</i> described above.</li>
|
||||
<li>Finally that the pointed-to types have a trivial
|
||||
assignment operator using <i>has_trivial_assign</i>.</li>
|
||||
</ul>
|
||||
|
||||
<p>Finally we can use the value of <i>can_opt</i> as the template
|
||||
argument to copier - this version of copy will now adapt to
|
||||
whatever parameters are passed to it, if its possible to use <font
|
||||
size="2" face="Courier New">memcpy</font>, then it will do so,
|
||||
otherwise it will use a generic copy.</p>
|
||||
|
||||
<h4>Was it worth it?</h4>
|
||||
|
||||
<p>It has often been repeated in these columns that "premature
|
||||
optimisation is the root of all evil" [4]. So the question
|
||||
must be asked: was our optimisation premature? To put this in
|
||||
perspective the timings for our version of copy compared a
|
||||
conventional generic copy[5] are shown in table 1.</p>
|
||||
|
||||
<p>Clearly the optimisation makes a difference in this case; but,
|
||||
to be fair, the timings are loaded to exclude cache miss effects
|
||||
- without this accurate comparison between algorithms becomes
|
||||
difficult. However, perhaps we can add a couple of caveats to the
|
||||
premature optimisation rule:</p>
|
||||
|
||||
<ul>
|
||||
<li>If you use the right algorithm for the job in the first
|
||||
place then optimisation will not be required; in some
|
||||
cases, <font size="2" face="Courier New">memcpy</font> is
|
||||
the right algorithm.</li>
|
||||
<li>If a component is going to be reused in many places by
|
||||
many people then optimisations may well be worthwhile
|
||||
where they would not be so for a single case - in other
|
||||
words, the likelihood that the optimisation will be
|
||||
absolutely necessary somewhere, sometime is that much
|
||||
higher. Just as importantly the perceived value of the
|
||||
stock implementation will be higher: there is no point
|
||||
standardising an algorithm if users reject it on the
|
||||
grounds that there are better, more heavily optimised
|
||||
versions available.</li>
|
||||
</ul>
|
||||
|
||||
<h4>Table 1: Time taken to copy 1000 elements using copy<const
|
||||
T*, T*> (times in micro-seconds)</h4>
|
||||
|
||||
<table border="1" cellpadding="7" cellspacing="1" width="529">
|
||||
<tr>
|
||||
<td valign="top" width="33%"><p align="center">Version</p>
|
||||
</td>
|
||||
<td valign="top" width="33%"><p align="center">T</p>
|
||||
</td>
|
||||
<td valign="top" width="33%"><p align="center">Time</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="33%">"Optimised" copy</td>
|
||||
<td valign="top" width="33%">char</td>
|
||||
<td valign="top" width="33%">0.99</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="33%">Conventional copy</td>
|
||||
<td valign="top" width="33%">char</td>
|
||||
<td valign="top" width="33%">8.07</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="33%">"Optimised" copy</td>
|
||||
<td valign="top" width="33%">int</td>
|
||||
<td valign="top" width="33%">2.52</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="33%">Conventional copy</td>
|
||||
<td valign="top" width="33%">int</td>
|
||||
<td valign="top" width="33%">8.02</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<h4>Pair of References</h4>
|
||||
|
||||
<p>The optimised copy example shows how type traits may be used
|
||||
to perform optimisation decisions at compile-time. Another
|
||||
important usage of type traits is to allow code to compile that
|
||||
otherwise would not do so unless excessive partial specialization
|
||||
is used. This is possible by delegating partial specialization to
|
||||
the type traits classes. Our example for this form of usage is a
|
||||
pair that can hold references [6].</p>
|
||||
|
||||
<p>First, let us examine the definition of "std::pair",
|
||||
omitting the comparision operators, default constructor, and
|
||||
template copy constructor for simplicity:</p>
|
||||
|
||||
<pre>template <typename T1, typename T2>
|
||||
struct pair
|
||||
{
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
|
||||
T1 first;
|
||||
T2 second;
|
||||
|
||||
pair(const T1 & nfirst, const T2 & nsecond)
|
||||
:first(nfirst), second(nsecond) { }
|
||||
};</pre>
|
||||
|
||||
<p>Now, this "pair" cannot hold references as it
|
||||
currently stands, because the constructor would require taking a
|
||||
reference to a reference, which is currently illegal [7]. Let us
|
||||
consider what the constructor's parameters would have to be in
|
||||
order to allow "pair" to hold non-reference types,
|
||||
references, and constant references:</p>
|
||||
|
||||
<table border="1" cellpadding="7" cellspacing="1" width="638">
|
||||
<tr>
|
||||
<td valign="top" width="50%">Type of "T1"</td>
|
||||
<td valign="top" width="50%">Type of parameter to
|
||||
initializing constructor</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%"><pre>T</pre>
|
||||
</td>
|
||||
<td valign="top" width="50%"><pre>const T &</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%"><pre>T &</pre>
|
||||
</td>
|
||||
<td valign="top" width="50%"><pre>T &</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%"><pre>const T &</pre>
|
||||
</td>
|
||||
<td valign="top" width="50%"><pre>const T &</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>A little familiarity with the type traits classes allows us to
|
||||
construct a single mapping that allows us to determine the type
|
||||
of parameter from the type of the contained class. The type
|
||||
traits classes provide a transformation "add_reference",
|
||||
which adds a reference to its type, unless it is already a
|
||||
reference.</p>
|
||||
|
||||
<table border="1" cellpadding="7" cellspacing="1" width="580">
|
||||
<tr>
|
||||
<td valign="top" width="21%">Type of "T1"</td>
|
||||
<td valign="top" width="27%">Type of "const T1"</td>
|
||||
<td valign="top" width="53%">Type of "add_reference<const
|
||||
T1>::type"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="21%"><pre>T</pre>
|
||||
</td>
|
||||
<td valign="top" width="27%"><pre>const T</pre>
|
||||
</td>
|
||||
<td valign="top" width="53%"><pre>const T &</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="21%"><pre>T &</pre>
|
||||
</td>
|
||||
<td valign="top" width="27%"><pre>T & [8]</pre>
|
||||
</td>
|
||||
<td valign="top" width="53%"><pre>T &</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="21%"><pre>const T &</pre>
|
||||
</td>
|
||||
<td valign="top" width="27%"><pre>const T &</pre>
|
||||
</td>
|
||||
<td valign="top" width="53%"><pre>const T &</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>This allows us to build a primary template definition for
|
||||
"pair" that can contain non-reference types, reference
|
||||
types, and constant reference types:</p>
|
||||
|
||||
<pre>template <typename T1, typename T2>
|
||||
struct pair
|
||||
{
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
|
||||
T1 first;
|
||||
T2 second;
|
||||
|
||||
pair(boost::add_reference<const T1>::type nfirst,
|
||||
boost::add_reference<const T2>::type nsecond)
|
||||
:first(nfirst), second(nsecond) { }
|
||||
};</pre>
|
||||
|
||||
<p>Add back in the standard comparision operators, default
|
||||
constructor, and template copy constructor (which are all the
|
||||
same), and you have a std::pair that can hold reference types!</p>
|
||||
|
||||
<p>This same extension <i>could</i> have been done using partial
|
||||
template specialization of "pair", but to specialize
|
||||
"pair" in this way would require three partial
|
||||
specializations, plus the primary template. Type traits allows us
|
||||
to define a single primary template that adjusts itself auto-magically
|
||||
to any of these partial specializations, instead of a brute-force
|
||||
partial specialization approach. Using type traits in this
|
||||
fashion allows programmers to delegate partial specialization to
|
||||
the type traits classes, resulting in code that is easier to
|
||||
maintain and easier to understand.</p>
|
||||
|
||||
<h4>Conclusion</h4>
|
||||
|
||||
<p>We hope that in this article we have been able to give you
|
||||
some idea of what type-traits are all about. A more complete
|
||||
listing of the available classes are in the boost documentation,
|
||||
along with further examples using type traits. Templates have
|
||||
enabled C++ uses to take the advantage of the code reuse that
|
||||
generic programming brings; hopefully this article has shown that
|
||||
generic programming does not have to sink to the lowest common
|
||||
denominator, and that templates can be optimal as well as generic.</p>
|
||||
|
||||
<h4>Acknowledgements</h4>
|
||||
|
||||
<p>The authors would like to thank Beman Dawes and Howard Hinnant
|
||||
for their helpful comments when preparing this article.</p>
|
||||
|
||||
<h4>References</h4>
|
||||
|
||||
<ol>
|
||||
<li>Nathan C. Myers, C++ Report, June 1995.</li>
|
||||
<li>The type traits library is based upon contributions by
|
||||
Steve Cleary, Beman Dawes, Howard Hinnant and John
|
||||
Maddock: it can be found at www.boost.org.</li>
|
||||
<li>A scalar type is an arithmetic type (i.e. a built-in
|
||||
integer or floating point type), an enumeration type, a
|
||||
pointer, a pointer to member, or a const- or volatile-qualified
|
||||
version of one of these types.</li>
|
||||
<li>This quote is from Donald Knuth, ACM Computing Surveys,
|
||||
December 1974, pg 268.</li>
|
||||
<li>The test code is available as part of the boost utility
|
||||
library (see algo_opt_examples.cpp), the code was
|
||||
compiled with gcc 2.95 with all optimisations turned on,
|
||||
tests were conducted on a 400MHz Pentium II machine
|
||||
running Microsoft Windows 98.</li>
|
||||
<li>John Maddock and Howard Hinnant have submitted a "compressed_pair"
|
||||
library to Boost, which uses a technique similar to the
|
||||
one described here to hold references. Their pair also
|
||||
uses type traits to determine if any of the types are
|
||||
empty, and will derive instead of contain to conserve
|
||||
space -- hence the name "compressed".</li>
|
||||
<li>This is actually an issue with the C++ Core Language
|
||||
Working Group (issue #106), submitted by Bjarne
|
||||
Stroustrup. The tentative resolution is to allow a "reference
|
||||
to a reference to T" to mean the same thing as a
|
||||
"reference to T", but only in template
|
||||
instantiation, in a method similar to multiple cv-qualifiers.</li>
|
||||
<li>For those of you who are wondering why this shouldn't be
|
||||
const-qualified, remember that references are always
|
||||
implicitly constant (for example, you can't re-assign a
|
||||
reference). Remember also that "const T &"
|
||||
is something completely different. For this reason, cv-qualifiers
|
||||
on template type arguments that are references are
|
||||
ignored.</li>
|
||||
</ol>
|
||||
|
||||
<h2>Listing 1</h2>
|
||||
|
||||
<pre>namespace detail{
|
||||
|
||||
template <bool b>
|
||||
struct copier
|
||||
{
|
||||
template<typename I1, typename I2>
|
||||
static I2 do_copy(I1 first,
|
||||
I1 last, I2 out);
|
||||
};
|
||||
|
||||
template <bool b>
|
||||
template<typename I1, typename I2>
|
||||
I2 copier<b>::do_copy(I1 first,
|
||||
I1 last,
|
||||
I2 out)
|
||||
{
|
||||
while(first != last)
|
||||
{
|
||||
*out = *first;
|
||||
++out;
|
||||
++first;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
template <>
|
||||
struct copier<true>
|
||||
{
|
||||
template<typename I1, typename I2>
|
||||
static I2* do_copy(I1* first, I1* last, I2* out)
|
||||
{
|
||||
memcpy(out, first, (last-first)*sizeof(I2));
|
||||
return out+(last-first);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template<typename I1, typename I2>
|
||||
inline I2 copy(I1 first, I1 last, I2 out)
|
||||
{
|
||||
typedef typename
|
||||
boost::remove_cv<
|
||||
typename std::iterator_traits<I1>
|
||||
::value_type>::type v1_t;
|
||||
|
||||
typedef typename
|
||||
boost::remove_cv<
|
||||
typename std::iterator_traits<I2>
|
||||
::value_type>::type v2_t;
|
||||
|
||||
enum{ can_opt =
|
||||
boost::is_same<v1_t, v2_t>::value
|
||||
&& boost::is_pointer<I1>::value
|
||||
&& boost::is_pointer<I2>::value
|
||||
&& boost::
|
||||
has_trivial_assign<v1_t>::value
|
||||
};
|
||||
|
||||
return detail::copier<can_opt>::
|
||||
do_copy(first, last, out);
|
||||
}</pre>
|
||||
|
||||
<hr>
|
||||
|
||||
<p><EFBFBD> Copyright John Maddock and Steve Cleary, 2000</p>
|
||||
</body>
|
||||
</html>
|
19
cxx_type_traits.htm
Normal file
19
cxx_type_traits.htm
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; URL=doc/html/boost_typetraits/background.html">
|
||||
<!-- boostinspect:nounlinked -->
|
||||
</head>
|
||||
<body><P>
|
||||
Automatic redirection failed, please go to
|
||||
<a href="doc/html/boost_typetraits/background.html">doc/html/boost_typetraits/background.html.</a></P>
|
||||
<P>Copyright John Maddock 2006</P>
|
||||
<P>Distributed under the Boost Software License, Version 1.0. (See accompanying file <A href="../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</A> or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</A>).</P>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/alignment_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
NESTED_DECL(alignment_of)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
NESTED_TEST(alignment_of, int)
|
||||
NESTED_TEST(alignment_of, int_constructible)
|
||||
|
||||
align_test(int);
|
||||
align_test(char);
|
||||
align_test(double);
|
||||
align_test(int[4]);
|
||||
align_test(int(*)(int));
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
align_test(char&);
|
||||
align_test(char (&)(int));
|
||||
align_test(char(&)[4]);
|
||||
#endif
|
||||
align_test(int*);
|
||||
//align_test(const int);
|
||||
align_test(VB);
|
||||
align_test(VD);
|
||||
value_test(0, ::boost::alignment_of<void>::value);
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
unsigned int expected_failures = 0;
|
||||
|
@ -1,197 +0,0 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/arithmetic_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
NESTED_DECL(is_void)
|
||||
NESTED_DECL(is_integral)
|
||||
NESTED_DECL(is_float)
|
||||
NESTED_DECL(is_arithmetic)
|
||||
NESTED_DECL(is_fundamental)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
NESTED_TEST(is_void, void)
|
||||
NESTED_TEST(is_void, int)
|
||||
NESTED_TEST(is_integral, int)
|
||||
NESTED_TEST(is_integral, float)
|
||||
NESTED_TEST(is_float, void)
|
||||
NESTED_TEST(is_float, double)
|
||||
NESTED_TEST(is_arithmetic, void)
|
||||
NESTED_TEST(is_arithmetic, int)
|
||||
NESTED_TEST(is_fundamental, UDT)
|
||||
NESTED_TEST(is_fundamental, int)
|
||||
|
||||
value_test(true, boost::is_void<void>::value)
|
||||
value_test(true, boost::is_void<const void>::value)
|
||||
value_test(true, boost::is_void<volatile void>::value)
|
||||
value_test(true, boost::is_void<const volatile void>::value)
|
||||
value_test(false, boost::is_void<int>::value)
|
||||
|
||||
value_test(false, boost::is_integral<UDT>::value)
|
||||
value_test(false, boost::is_integral<void>::value)
|
||||
value_test(true, boost::is_integral<bool>::value)
|
||||
value_test(true, boost::is_integral<char>::value)
|
||||
value_test(true, boost::is_integral<signed char>::value)
|
||||
value_test(true, boost::is_integral<unsigned char>::value)
|
||||
value_test(true, boost::is_integral<wchar_t>::value)
|
||||
value_test(true, boost::is_integral<short>::value)
|
||||
value_test(true, boost::is_integral<unsigned short>::value)
|
||||
value_test(true, boost::is_integral<int>::value)
|
||||
value_test(true, boost::is_integral<unsigned int>::value)
|
||||
value_test(true, boost::is_integral<long>::value)
|
||||
value_test(true, boost::is_integral<unsigned long>::value)
|
||||
value_test(false, boost::is_integral<float>::value)
|
||||
value_test(false, boost::is_integral<double>::value)
|
||||
value_test(false, boost::is_integral<long double>::value)
|
||||
#ifdef ULLONG_MAX
|
||||
value_test(true, boost::is_integral<long long>::value)
|
||||
value_test(true, boost::is_integral<unsigned long long>::value)
|
||||
#endif
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||
value_test(true, boost::is_integral<__int64>::value)
|
||||
value_test(true, boost::is_integral<unsigned __int64>::value)
|
||||
#endif
|
||||
//const qualified ints:
|
||||
value_test(true, boost::is_integral<const bool>::value)
|
||||
value_test(true, boost::is_integral<const char>::value)
|
||||
value_test(true, boost::is_integral<const signed char>::value)
|
||||
value_test(true, boost::is_integral<const unsigned char>::value)
|
||||
value_test(true, boost::is_integral<const wchar_t>::value)
|
||||
value_test(true, boost::is_integral<const short>::value)
|
||||
value_test(true, boost::is_integral<const unsigned short>::value)
|
||||
value_test(true, boost::is_integral<const int>::value)
|
||||
value_test(true, boost::is_integral<const unsigned int>::value)
|
||||
value_test(true, boost::is_integral<const long>::value)
|
||||
value_test(true, boost::is_integral<const unsigned long>::value)
|
||||
#ifdef ULLONG_MAX
|
||||
value_test(true, boost::is_integral<const long long>::value)
|
||||
value_test(true, boost::is_integral<const unsigned long long>::value)
|
||||
#endif
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||
value_test(true, boost::is_integral<const __int64>::value)
|
||||
value_test(true, boost::is_integral<const unsigned __int64>::value)
|
||||
#endif
|
||||
// volatile qualified ints:
|
||||
value_test(true, boost::is_integral<volatile bool>::value)
|
||||
value_test(true, boost::is_integral<volatile char>::value)
|
||||
value_test(true, boost::is_integral<volatile signed char>::value)
|
||||
value_test(true, boost::is_integral<volatile unsigned char>::value)
|
||||
value_test(true, boost::is_integral<volatile wchar_t>::value)
|
||||
value_test(true, boost::is_integral<volatile short>::value)
|
||||
value_test(true, boost::is_integral<volatile unsigned short>::value)
|
||||
value_test(true, boost::is_integral<volatile int>::value)
|
||||
value_test(true, boost::is_integral<volatile unsigned int>::value)
|
||||
value_test(true, boost::is_integral<volatile long>::value)
|
||||
value_test(true, boost::is_integral<volatile unsigned long>::value)
|
||||
#ifdef ULLONG_MAX
|
||||
value_test(true, boost::is_integral<volatile long long>::value)
|
||||
value_test(true, boost::is_integral<volatile unsigned long long>::value)
|
||||
#endif
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||
value_test(true, boost::is_integral<volatile __int64>::value)
|
||||
value_test(true, boost::is_integral<volatile unsigned __int64>::value)
|
||||
#endif
|
||||
//const qualified ints:
|
||||
value_test(true, boost::is_integral<const volatile bool>::value)
|
||||
value_test(true, boost::is_integral<const volatile char>::value)
|
||||
value_test(true, boost::is_integral<const volatile signed char>::value)
|
||||
value_test(true, boost::is_integral<const volatile unsigned char>::value)
|
||||
value_test(true, boost::is_integral<const volatile wchar_t>::value)
|
||||
value_test(true, boost::is_integral<const volatile short>::value)
|
||||
value_test(true, boost::is_integral<const volatile unsigned short>::value)
|
||||
value_test(true, boost::is_integral<const volatile int>::value)
|
||||
value_test(true, boost::is_integral<const volatile unsigned int>::value)
|
||||
value_test(true, boost::is_integral<const volatile long>::value)
|
||||
value_test(true, boost::is_integral<const volatile unsigned long>::value)
|
||||
#ifdef ULLONG_MAX
|
||||
value_test(true, boost::is_integral<const volatile long long>::value)
|
||||
value_test(true, boost::is_integral<const volatile unsigned long long>::value)
|
||||
#endif
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||
value_test(true, boost::is_integral<const volatile __int64>::value)
|
||||
value_test(true, boost::is_integral<const volatile unsigned __int64>::value)
|
||||
#endif
|
||||
value_test(true, boost::is_float<const volatile float>::value)
|
||||
value_test(true, boost::is_float<const volatile double>::value)
|
||||
value_test(true, boost::is_float<const volatile long double>::value)
|
||||
value_test(true, boost::is_float<volatile float>::value)
|
||||
value_test(true, boost::is_float<volatile double>::value)
|
||||
value_test(true, boost::is_float<volatile long double>::value)
|
||||
value_test(true, boost::is_float<const float>::value)
|
||||
value_test(true, boost::is_float<const double>::value)
|
||||
value_test(true, boost::is_float<const long double>::value)
|
||||
value_test(true, boost::is_float<float>::value)
|
||||
value_test(true, boost::is_float<double>::value)
|
||||
value_test(true, boost::is_float<long double>::value)
|
||||
value_test(false, boost::is_float<int>::value)
|
||||
value_test(false, boost::is_float<void>::value)
|
||||
value_test(false, boost::is_float<UDT>::value)
|
||||
|
||||
|
||||
value_test(false, boost::is_arithmetic<UDT>::value)
|
||||
value_test(false, boost::is_arithmetic<void>::value)
|
||||
value_test(true, boost::is_arithmetic<bool>::value)
|
||||
value_test(true, boost::is_arithmetic<char>::value)
|
||||
value_test(true, boost::is_arithmetic<signed char>::value)
|
||||
value_test(true, boost::is_arithmetic<unsigned char>::value)
|
||||
value_test(true, boost::is_arithmetic<wchar_t>::value)
|
||||
value_test(true, boost::is_arithmetic<short>::value)
|
||||
value_test(true, boost::is_arithmetic<unsigned short>::value)
|
||||
value_test(true, boost::is_arithmetic<int>::value)
|
||||
value_test(true, boost::is_arithmetic<unsigned int>::value)
|
||||
value_test(true, boost::is_arithmetic<long>::value)
|
||||
value_test(true, boost::is_arithmetic<unsigned long>::value)
|
||||
value_test(true, boost::is_arithmetic<float>::value)
|
||||
value_test(true, boost::is_arithmetic<double>::value)
|
||||
value_test(true, boost::is_arithmetic<long double>::value)
|
||||
#ifdef ULLONG_MAX
|
||||
value_test(true, boost::is_arithmetic<long long>::value)
|
||||
value_test(true, boost::is_arithmetic<unsigned long long>::value)
|
||||
#endif
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||
value_test(true, boost::is_arithmetic<__int64>::value)
|
||||
value_test(true, boost::is_arithmetic<unsigned __int64>::value)
|
||||
#endif
|
||||
|
||||
value_test(false, boost::is_fundamental<UDT>::value)
|
||||
value_test(true, boost::is_fundamental<void>::value)
|
||||
value_test(true, boost::is_fundamental<bool>::value)
|
||||
value_test(true, boost::is_fundamental<char>::value)
|
||||
value_test(true, boost::is_fundamental<signed char>::value)
|
||||
value_test(true, boost::is_fundamental<unsigned char>::value)
|
||||
value_test(true, boost::is_fundamental<wchar_t>::value)
|
||||
value_test(true, boost::is_fundamental<short>::value)
|
||||
value_test(true, boost::is_fundamental<unsigned short>::value)
|
||||
value_test(true, boost::is_fundamental<int>::value)
|
||||
value_test(true, boost::is_fundamental<unsigned int>::value)
|
||||
value_test(true, boost::is_fundamental<long>::value)
|
||||
value_test(true, boost::is_fundamental<unsigned long>::value)
|
||||
value_test(true, boost::is_fundamental<float>::value)
|
||||
value_test(true, boost::is_fundamental<double>::value)
|
||||
value_test(true, boost::is_fundamental<long double>::value)
|
||||
#ifdef ULLONG_MAX
|
||||
value_test(true, boost::is_fundamental<long long>::value)
|
||||
value_test(true, boost::is_fundamental<unsigned long long>::value)
|
||||
#endif
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||
value_test(true, boost::is_fundamental<__int64>::value)
|
||||
value_test(true, boost::is_fundamental<unsigned __int64>::value)
|
||||
#endif
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
unsigned int expected_failures = 0;
|
||||
|
@ -1,116 +0,0 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/composite_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
NESTED_DECL(is_array)
|
||||
NESTED_DECL(is_pointer)
|
||||
NESTED_DECL(is_reference)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
NESTED_TEST(is_array, int)
|
||||
NESTED_TEST(is_array, int[2])
|
||||
NESTED_TEST(is_array, int[3][4])
|
||||
NESTED_TEST(is_array, int const [5])
|
||||
NESTED_TEST(is_array, int(&)[2])
|
||||
NESTED_TEST(is_array, int (*)(double))
|
||||
NESTED_TEST(is_pointer, int)
|
||||
NESTED_TEST(is_pointer, int*)
|
||||
NESTED_TEST(is_reference, int)
|
||||
NESTED_TEST(is_reference, int&)
|
||||
|
||||
value_test(false, boost::is_array<int>::value)
|
||||
value_test(false, boost::is_array<int*>::value)
|
||||
value_test(false, boost::is_array<const int*>::value)
|
||||
value_test(false, boost::is_array<const volatile int*>::value)
|
||||
value_test(false, boost::is_array<int*const>::value)
|
||||
value_test(false, boost::is_array<const int*volatile>::value)
|
||||
value_test(false, boost::is_array<const volatile int*const>::value)
|
||||
value_test(true, boost::is_array<int[2]>::value)
|
||||
value_test(true, boost::is_array<const int[2]>::value)
|
||||
value_test(true, boost::is_array<const volatile int[2]>::value)
|
||||
value_test(true, boost::is_array<int[2][3]>::value)
|
||||
value_test(true, boost::is_array<UDT[2]>::value)
|
||||
value_test(false, boost::is_array<int(&)[2]>::value)
|
||||
value_test(false, boost::is_array<f1>::value)
|
||||
value_test(false, boost::is_array<void>::value)
|
||||
|
||||
value_test(false, boost::is_pointer<int>::value)
|
||||
value_test(false, boost::is_pointer<int&>::value)
|
||||
value_test(true, boost::is_pointer<int*>::value)
|
||||
value_test(true, boost::is_pointer<const int*>::value)
|
||||
value_test(true, boost::is_pointer<volatile int*>::value)
|
||||
value_test(true, boost::is_pointer<non_pointer*>::value)
|
||||
// these were false in previous versions (JM 20 Dec 2000):
|
||||
value_test(true, boost::is_pointer<int*const>::value)
|
||||
value_test(true, boost::is_pointer<int*volatile>::value)
|
||||
value_test(true, boost::is_pointer<int*const volatile>::value)
|
||||
// JM 02 Oct 2000:
|
||||
value_test(false, boost::is_pointer<non_pointer>::value)
|
||||
value_test(false, boost::is_pointer<int*&>::value)
|
||||
value_test(false, boost::is_pointer<int(&)[2]>::value)
|
||||
value_test(false, boost::is_pointer<int[2]>::value)
|
||||
value_test(false, boost::is_pointer<char[sizeof(void*)]>::value)
|
||||
value_test(false, boost::is_pointer<void>::value)
|
||||
|
||||
value_test(true, boost::is_pointer<f1>::value)
|
||||
value_test(true, boost::is_pointer<f2>::value)
|
||||
value_test(true, boost::is_pointer<f3>::value)
|
||||
// Steve: was 'true', should be 'false', via 3.9.2p3
|
||||
value_test(false, boost::is_pointer<mf1>::value)
|
||||
value_test(false, boost::is_pointer<mf2>::value)
|
||||
value_test(false, boost::is_pointer<mf3>::value)
|
||||
value_test(false, boost::is_pointer<mf4>::value)
|
||||
|
||||
value_test(false, boost::is_reference<bool>::value)
|
||||
value_test(true, boost::is_reference<int&>::value)
|
||||
value_test(true, boost::is_reference<const int&>::value)
|
||||
value_test(true, boost::is_reference<volatile int &>::value)
|
||||
value_test(true, boost::is_reference<const volatile int &>::value)
|
||||
value_test(true, boost::is_reference<r_type>::value)
|
||||
value_test(true, boost::is_reference<cr_type>::value)
|
||||
value_test(true, boost::is_reference<const UDT&>::value)
|
||||
value_test(false, boost::is_reference<void>::value)
|
||||
|
||||
value_test(false, boost::is_member_pointer<f1>::value)
|
||||
value_test(false, boost::is_member_pointer<f2>::value)
|
||||
value_test(false, boost::is_member_pointer<f3>::value)
|
||||
value_test(false, boost::is_member_pointer<void*>::value)
|
||||
value_test(true, boost::is_member_pointer<mf1>::value)
|
||||
value_test(true, boost::is_member_pointer<mf2>::value)
|
||||
value_test(true, boost::is_member_pointer<mf3>::value)
|
||||
value_test(true, boost::is_member_pointer<mf4>::value)
|
||||
value_test(false, boost::is_member_pointer<void>::value)
|
||||
|
||||
value_test(false, boost::is_enum<int>::value)
|
||||
value_test(true, boost::is_enum<enum_UDT>::value)
|
||||
value_test(false, boost::is_enum<int_convertible>::value)
|
||||
value_test(false, boost::is_enum<int&>::value)
|
||||
value_test(false, boost::is_enum<void>::value)
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
#ifdef __BORLANDC__
|
||||
unsigned int expected_failures = 2;
|
||||
#elif defined(__GNUC__)
|
||||
unsigned int expected_failures = 1; // can't handle cv-qualified references
|
||||
#elif defined(BOOST_MSVC)
|
||||
unsigned int expected_failures = 1;
|
||||
#else
|
||||
unsigned int expected_failures = 0;
|
||||
#endif
|
||||
|
||||
|
@ -1,240 +0,0 @@
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1999
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* This file provides some example of type_traits usage -
|
||||
* by "optimising" various algorithms:
|
||||
*
|
||||
* opt::copy - optimised for trivial copy (cf std::copy)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <typeinfo>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
|
||||
#include <boost/timer.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::cin;
|
||||
|
||||
namespace opt{
|
||||
|
||||
//
|
||||
// opt::copy
|
||||
// same semantics as std::copy
|
||||
// calls memcpy where appropiate.
|
||||
//
|
||||
|
||||
namespace detail{
|
||||
|
||||
template<typename I1, typename I2>
|
||||
I2 copy_imp(I1 first, I1 last, I2 out)
|
||||
{
|
||||
while(first != last)
|
||||
{
|
||||
*out = *first;
|
||||
++out;
|
||||
++first;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
template <bool b>
|
||||
struct copier
|
||||
{
|
||||
template<typename I1, typename I2>
|
||||
static I2 do_copy(I1 first, I1 last, I2 out)
|
||||
{ return copy_imp(first, last, out); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct copier<true>
|
||||
{
|
||||
template<typename I1, typename I2>
|
||||
static I2* do_copy(I1* first, I1* last, I2* out)
|
||||
{
|
||||
memcpy(out, first, (last-first)*sizeof(I2));
|
||||
return out+(last-first);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_ITERATOR_TRAITS
|
||||
|
||||
template<typename I1, typename I2>
|
||||
inline I2 copy(I1 first, I1 last, I2 out)
|
||||
{
|
||||
typedef typename boost::remove_cv<typename std::iterator_traits<I1>::value_type>::type v1_t;
|
||||
typedef typename boost::remove_cv<typename std::iterator_traits<I2>::value_type>::type v2_t;
|
||||
return detail::copier<
|
||||
::boost::type_traits::ice_and<
|
||||
::boost::is_same<v1_t, v2_t>::value,
|
||||
::boost::is_pointer<I1>::value,
|
||||
::boost::is_pointer<I2>::value,
|
||||
::boost::has_trivial_assign<v1_t>::value
|
||||
>::value>::do_copy(first, last, out);
|
||||
}
|
||||
|
||||
#else // BOOST_NO_STD_ITERATOR_TRAITS
|
||||
|
||||
//
|
||||
// If there is no standard iterator_traits then we have to
|
||||
// use overloading rather than iterator_traits to detect
|
||||
// when we have T*'s to copy. Note that we cannot overload
|
||||
// copy directly as that will cause some standard conforming
|
||||
// code to fail to build:
|
||||
|
||||
namespace detail{
|
||||
|
||||
template<typename I1, typename I2>
|
||||
inline I2 copy_(const I1& first, const I1& last, const I2& out)
|
||||
{
|
||||
return detail::copier<false>::do_copy(first, last, out);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T* copy_(const T* first, const T* last, T* out)
|
||||
{
|
||||
return detail::copier<
|
||||
::boost::has_trivial_assign<T>::value
|
||||
>::do_copy(first, last, out);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<typename I1, typename I2>
|
||||
inline I2 copy(I1 first, I1 last, I2 out)
|
||||
{
|
||||
return detail::copy_(first, last, out);
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_STD_ITERATOR_TRAITS
|
||||
|
||||
}; // namespace opt
|
||||
|
||||
//
|
||||
// define some global data:
|
||||
//
|
||||
const int array_size = 1000;
|
||||
int i_array_[array_size] = {0,};
|
||||
const int ci_array_[array_size] = {0,};
|
||||
char c_array_[array_size] = {0,};
|
||||
const char cc_array_[array_size] = { 0,};
|
||||
//
|
||||
// since arrays aren't iterators we define a set of pointer
|
||||
// aliases into the arrays (otherwise the compiler is entitled
|
||||
// to deduce the type passed to the template functions as
|
||||
// T (&)[N] rather than T*).
|
||||
int* i_array = i_array_;
|
||||
const int* ci_array = ci_array_;
|
||||
char* c_array = c_array_;
|
||||
const char* cc_array = cc_array_;
|
||||
|
||||
const int iter_count = 1000000;
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::timer t;
|
||||
double result;
|
||||
int i;
|
||||
cout << "Measuring times in micro-seconds per 1000 elements processed" << endl << endl;
|
||||
cout << "testing copy...\n"
|
||||
"[Some standard library versions may already perform this optimisation.]" << endl;
|
||||
|
||||
// cache load:
|
||||
opt::copy(ci_array, ci_array + array_size, i_array);
|
||||
|
||||
// time optimised version:
|
||||
t.restart();
|
||||
for(i = 0; i < iter_count; ++i)
|
||||
{
|
||||
opt::copy(ci_array, ci_array + array_size, i_array);
|
||||
}
|
||||
result = t.elapsed();
|
||||
cout << "opt::copy<const int*, int*>: " << result << endl;
|
||||
|
||||
// cache load:
|
||||
std::copy(ci_array, ci_array + array_size, i_array);
|
||||
|
||||
// time standard version:
|
||||
t.restart();
|
||||
for(i = 0; i < iter_count; ++i)
|
||||
{
|
||||
std::copy(ci_array, ci_array + array_size, i_array);
|
||||
}
|
||||
result = t.elapsed();
|
||||
cout << "std::copy<const int*, int*>: " << result << endl;
|
||||
|
||||
// cache load:
|
||||
opt::detail::copier<false>::do_copy(ci_array, ci_array + array_size, i_array);
|
||||
|
||||
// time unoptimised version:
|
||||
t.restart();
|
||||
for(i = 0; i < iter_count; ++i)
|
||||
{
|
||||
opt::detail::copier<false>::do_copy(ci_array, ci_array + array_size, i_array);
|
||||
}
|
||||
result = t.elapsed();
|
||||
cout << "standard \"unoptimised\" copy: " << result << endl << endl;
|
||||
|
||||
// cache load:
|
||||
opt::copy(cc_array, cc_array + array_size, c_array);
|
||||
|
||||
// time optimised version:
|
||||
t.restart();
|
||||
for(i = 0; i < iter_count; ++i)
|
||||
{
|
||||
opt::copy(cc_array, cc_array + array_size, c_array);
|
||||
}
|
||||
result = t.elapsed();
|
||||
cout << "opt::copy<const char*, char*>: " << result << endl;
|
||||
|
||||
// cache load:
|
||||
std::copy(cc_array, cc_array + array_size, c_array);
|
||||
|
||||
// time standard version:
|
||||
t.restart();
|
||||
for(i = 0; i < iter_count; ++i)
|
||||
{
|
||||
std::copy(cc_array, cc_array + array_size, c_array);
|
||||
}
|
||||
result = t.elapsed();
|
||||
cout << "std::copy<const char*, char*>: " << result << endl;
|
||||
|
||||
// cache load:
|
||||
opt::detail::copier<false>::do_copy(cc_array, cc_array + array_size, c_array);
|
||||
|
||||
// time unoptimised version:
|
||||
t.restart();
|
||||
for(i = 0; i < iter_count; ++i)
|
||||
{
|
||||
opt::detail::copier<false>::do_copy(cc_array, cc_array + array_size, c_array);
|
||||
}
|
||||
result = t.elapsed();
|
||||
cout << "standard \"unoptimised\" copy: " << result << endl << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,113 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Compiler Status: linux
|
||||
</title>
|
||||
</head>
|
||||
<body bgcolor="#ffffff" text="#000000">
|
||||
<h1><img border border="0" src="../c++boost.gif" width="277" height="86"></h1>
|
||||
<h1>Compiler Status: linux</h1>
|
||||
|
||||
<p><b>Run Date:</b> 07 Jan 2001 22:21 GMT</p>
|
||||
<p><b>System Configuration:</b> Linux 2.2.13</p>
|
||||
<p>
|
||||
<table border="1" cellspacing="0" cellpadding="5">
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td>Test<br>Type</td>
|
||||
<td>GNU<br>GCC<br>2.95.2</td>
|
||||
<td>GNU<br>GCC<br>2.95.2<br>STLport<br>4.0</td>
|
||||
<td>Comeau C++<br>4.2.44 beta3<br>STLport<br>4.0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/alignment_test.cpp">libs/type_traits/alignment_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td><font color="#FF0000">Fail</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/arithmetic_traits_test.cpp">libs/type_traits/arithmetic_traits_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/composite_traits_test.cpp">libs/type_traits/composite_traits_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/cv_traits_test.cpp">libs/type_traits/cv_traits_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/is_convertible_test.cpp">libs/type_traits/is_convertible_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/is_same_test.cpp">libs/type_traits/is_same_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/object_type_traits_test.cpp">libs/type_traits/object_type_traits_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td><font color="#FF0000">Fail</font></td>
|
||||
<td><font color="#FF0000">Fail</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/transform_traits_test.cpp">libs/type_traits/transform_traits_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/trivial_destructor_example.cpp">libs/type_traits/trivial_destructor_example.cpp</a></td>
|
||||
<td>compile</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/copy_example.cpp">libs/type_traits/copy_example.cpp</a></td>
|
||||
<td>compile</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/fill_example.cpp">libs/type_traits/fill_example.cpp</a></td>
|
||||
<td>compile</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/iter_swap_example.cpp">libs/type_traits/iter_swap_example.cpp</a></td>
|
||||
<td>compile</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
</table></p>
|
||||
<p>
|
||||
Notes: A hand-crafted <limits> Standard header has been
|
||||
applied to all configurations.
|
||||
The tests were run on a GNU libc 2.2 system which has improved
|
||||
wide character support compared to previous versions.</p>
|
||||
</body>
|
||||
</html>
|
@ -1,162 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Compiler Status: win32
|
||||
</title>
|
||||
</head>
|
||||
<body bgcolor="#ffffff" text="#000000">
|
||||
<h1><img border border="0" src="../c++boost.gif" width="277" height="86"></h1>
|
||||
<h1>Compiler Status: win32</h1>
|
||||
|
||||
<p><b>Run Date:</b> 03 Feb 2001 11:25 GMT</p>
|
||||
<p><b>System Configuration:</b> Microsoft Windows 32bit</p>
|
||||
<p>
|
||||
<table border="1" cellspacing="0" cellpadding="5">
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td>Test<br>Type</td>
|
||||
<td>cygwin<br>GCC 2.95.2</td>
|
||||
<td>cygwin<br>GCC 2.95.2<br>+ SGI STL 3.3</td>
|
||||
<td>cygwin<br>GCC 2.95.2<br>+ STLPort 4</td>
|
||||
<td>Borland<br>5.5.1</td>
|
||||
<td>Borland<br>5.4</td>
|
||||
<td>Microsoft<br>VC++<br>6.0 SP4</td>
|
||||
<td>Microsoft<br>VC++<br>6.0 SP4<br>STLport<br>4.0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/alignment_test.cpp">libs/type_traits/alignment_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/arithmetic_traits_test.cpp">libs/type_traits/arithmetic_traits_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/composite_traits_test.cpp">libs/type_traits/composite_traits_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/cv_traits_test.cpp">libs/type_traits/cv_traits_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/is_convertible_test.cpp">libs/type_traits/is_convertible_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td><font color="#FF0000">Fail</font></td>
|
||||
<td><font color="#FF0000">Fail</font></td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/is_same_test.cpp">libs/type_traits/is_same_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/object_type_traits_test.cpp">libs/type_traits/object_type_traits_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/transform_traits_test.cpp">libs/type_traits/transform_traits_test.cpp</a></td>
|
||||
<td>run</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td><font color="#FF0000">Fail</font></td>
|
||||
<td><font color="#FF0000">Fail</font></td>
|
||||
<td><font color="#FF0000">Fail</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/trivial_destructor_example.cpp">libs/type_traits/trivial_destructor_example.cpp</a></td>
|
||||
<td>compile</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/copy_example.cpp">libs/type_traits/copy_example.cpp</a></td>
|
||||
<td>compile</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/fill_example.cpp">libs/type_traits/fill_example.cpp</a></td>
|
||||
<td>compile</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../libs/type_traits/iter_swap_example.cpp">libs/type_traits/iter_swap_example.cpp</a></td>
|
||||
<td>compile</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td>Pass</td>
|
||||
<td><font color="#FF0000">Fail</font></td>
|
||||
<td><font color="#FF0000">Fail</font></td>
|
||||
</tr>
|
||||
</table></p>
|
||||
<p>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
@ -1,50 +0,0 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/cv_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
NESTED_DECL(is_const)
|
||||
NESTED_DECL(is_volatile)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
NESTED_TEST(is_const, int)
|
||||
NESTED_TEST(is_const, const int)
|
||||
NESTED_TEST(is_const, volatile int)
|
||||
NESTED_TEST(is_volatile, int)
|
||||
NESTED_TEST(is_volatile, const int)
|
||||
NESTED_TEST(is_volatile, volatile int)
|
||||
|
||||
value_test(false, boost::is_const<void>::value)
|
||||
value_test(true, boost::is_const<const void>::value)
|
||||
value_test(false, boost::is_const<int>::value)
|
||||
value_test(true, boost::is_const<const int>::value)
|
||||
value_test(true, boost::is_const<const UDT>::value)
|
||||
value_test(true, boost::is_const<const volatile UDT>::value)
|
||||
value_test(false, boost::is_volatile<void>::value)
|
||||
value_test(true, boost::is_volatile<volatile void>::value)
|
||||
value_test(false, boost::is_volatile<int>::value)
|
||||
value_test(true, boost::is_volatile<volatile int>::value)
|
||||
value_test(true, boost::is_volatile<volatile UDT>::value)
|
||||
value_test(true, boost::is_volatile<volatile UDT>::value)
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
#ifdef BOOST_MSVC
|
||||
unsigned int expected_failures = 2;
|
||||
#else
|
||||
unsigned int expected_failures = 0;
|
||||
#endif
|
||||
|
@ -1,191 +0,0 @@
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1999
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* This file provides some example of type_traits usage -
|
||||
* by "optimising" various algorithms:
|
||||
*
|
||||
* opt::fill - optimised for trivial copy/small types (cf std::fill)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <typeinfo>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
|
||||
#include <boost/timer.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/call_traits.hpp>
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE) || (defined(std) && defined(__SGI_STL_PORT))
|
||||
namespace std{ using :: memset; }
|
||||
#endif
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::cin;
|
||||
|
||||
namespace opt{
|
||||
//
|
||||
// fill
|
||||
// same as std::fill, uses memset where appropriate, along with call_traits
|
||||
// to "optimise" parameter passing.
|
||||
//
|
||||
namespace detail{
|
||||
|
||||
template <typename I, typename T>
|
||||
void do_fill_(I first, I last, typename boost::call_traits<T>::param_type val)
|
||||
{
|
||||
while(first != last)
|
||||
{
|
||||
*first = val;
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
template <bool opt>
|
||||
struct filler
|
||||
{
|
||||
template <typename I, typename T>
|
||||
struct rebind
|
||||
{
|
||||
static void do_fill(I first, I last, typename boost::call_traits<T>::param_type val)
|
||||
{ do_fill_<I,T>(first, last, val); }
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct filler<true>
|
||||
{
|
||||
template <typename I, typename T>
|
||||
struct rebind
|
||||
{
|
||||
static void do_fill(I first, I last, T val)
|
||||
{
|
||||
std::memset(first, val, last-first);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template <class I, class T>
|
||||
inline void fill(I first, I last, const T& val)
|
||||
{
|
||||
typedef detail::filler<
|
||||
::boost::type_traits::ice_and<
|
||||
::boost::is_pointer<I>::value,
|
||||
::boost::is_arithmetic<T>::value,
|
||||
(sizeof(T) == 1)
|
||||
>::value> filler_t;
|
||||
typedef typename filler_t:: template rebind<I,T> binder;
|
||||
binder::do_fill(first, last, val);
|
||||
}
|
||||
|
||||
}; // namespace opt
|
||||
|
||||
//
|
||||
// define some global data:
|
||||
//
|
||||
const int array_size = 1000;
|
||||
int i_array_[array_size] = {0,};
|
||||
const int ci_array_[array_size] = {0,};
|
||||
char c_array_[array_size] = {0,};
|
||||
const char cc_array_[array_size] = { 0,};
|
||||
//
|
||||
// since arrays aren't iterators we define a set of pointer
|
||||
// aliases into the arrays (otherwise the compiler is entitled
|
||||
// to deduce the type passed to the template functions as
|
||||
// T (&)[N] rather than T*).
|
||||
int* i_array = i_array_;
|
||||
const int* ci_array = ci_array_;
|
||||
char* c_array = c_array_;
|
||||
const char* cc_array = cc_array_;
|
||||
|
||||
const int iter_count = 1000000;
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::timer t;
|
||||
double result;
|
||||
int i;
|
||||
//
|
||||
// test destroy_array,
|
||||
// compare destruction time of an array of ints
|
||||
// with unoptimised form.
|
||||
//
|
||||
cout << "Measuring times in micro-seconds per 1000 elements processed" << endl << endl;
|
||||
|
||||
cout << "testing fill(char)...\n"
|
||||
"[Some standard library versions may already perform this optimisation.]" << endl;
|
||||
|
||||
// cache load:
|
||||
opt::fill(c_array, c_array + array_size, (char)3);
|
||||
|
||||
// time optimised version:
|
||||
t.restart();
|
||||
for(i = 0; i < iter_count; ++i)
|
||||
{
|
||||
opt::fill(c_array, c_array + array_size, (char)3);
|
||||
}
|
||||
result = t.elapsed();
|
||||
cout << "opt::fill<char*, char>: " << result << endl;
|
||||
|
||||
// cache load:
|
||||
std::fill(c_array, c_array + array_size, (char)3);
|
||||
|
||||
// time standard version:
|
||||
t.restart();
|
||||
for(i = 0; i < iter_count; ++i)
|
||||
{
|
||||
std::fill(c_array, c_array + array_size, (char)3);
|
||||
}
|
||||
result = t.elapsed();
|
||||
cout << "std::fill<char*, char>: " << result << endl << endl;
|
||||
|
||||
cout << "testing fill(int)...\n"
|
||||
"[Tests the effect of call_traits pass-by-value optimisation -\nthe value of this optimisation may depend upon hardware characteristics.]" << endl;
|
||||
|
||||
// cache load:
|
||||
opt::fill(i_array, i_array + array_size, 3);
|
||||
|
||||
// timer optimised version:
|
||||
t.restart();
|
||||
for(i = 0; i < iter_count; ++i)
|
||||
{
|
||||
opt::fill(i_array, i_array + array_size, 3);
|
||||
}
|
||||
result = t.elapsed();
|
||||
cout << "opt::fill<int*, int>: " << result << endl;
|
||||
|
||||
// cache load:
|
||||
std::fill(i_array, i_array + array_size, 3);
|
||||
|
||||
// time standard version:
|
||||
t.restart();
|
||||
for(i = 0; i < iter_count; ++i)
|
||||
{
|
||||
std::fill(i_array, i_array + array_size, 3);
|
||||
}
|
||||
result = t.elapsed();
|
||||
cout << "std::fill<int*, int>: " << result << endl << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,23 +0,0 @@
|
||||
// (C) Copyright Boost.org 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
// See boost/detail/call_traits.hpp and boost/detail/ob_call_traits.hpp
|
||||
// for full copyright notices.
|
||||
|
||||
#ifndef BOOST_CALL_TRAITS_HPP
|
||||
#define BOOST_CALL_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
#include <boost/detail/ob_call_traits.hpp>
|
||||
#else
|
||||
#include <boost/detail/call_traits.hpp>
|
||||
#endif
|
||||
|
||||
#endif // BOOST_CALL_TRAITS_HPP
|
@ -1,427 +0,0 @@
|
||||
// Boost config.hpp configuration header file ------------------------------//
|
||||
|
||||
// (C) Copyright Boost.org 1999. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Boost config.hpp policy and rationale documentation has been moved to
|
||||
// http://www.boost.org/libs/config
|
||||
|
||||
// Revision History (excluding minor changes for specific compilers)
|
||||
// 31 Dec 00 BOOST_NO_CV_SPECIALIZATIONS
|
||||
// BOOST_NO_CV_VOID_SPECIALIZATIONS (John Maddock)
|
||||
// 17 Nov 00 BOOST_NO_AUTO_PTR (John Maddock)
|
||||
// 4 Oct 00 BOOST_NO_STD_MIN_MAX (Jeremy Siek)
|
||||
// 29 Sep 00 BOOST_NO_INTEGRAL_INT64_T (Jens Maurer)
|
||||
// 25 Sep 00 BOOST_NO_STD_ALLOCATOR (Jeremy Siek)
|
||||
// 18 SEP 00 BOOST_NO_SLIST, BOOST_NO_HASH,
|
||||
// BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||
// BOOST_NO_LIMITS (Jeremy Siek)
|
||||
// 1 Sep 00 BOOST_NO_PRIVATE_IN_AGGREGATE added. (Mark Rodgers)
|
||||
// 23 Jul 00 Fixed spelling of BOOST_NO_INCLASS_MEMBER_INITIALIZATION in
|
||||
// comment (Dave Abrahams).
|
||||
// 10 Jul 00 BOOST_NO_POINTER_TO_MEMBER_CONST added (Mark Rodgers)
|
||||
// 26 Jun 00 BOOST_NO_STD_ITERATOR, BOOST_MSVC_STD_ITERATOR,
|
||||
// BOOST_NO_STD_ITERATOR_TRAITS, BOOST_NO_USING_TEMPLATE,
|
||||
// added (Jeremy Siek)
|
||||
// 20 Jun 00 BOOST_MSVC added (Aleksey Gurtovoy)
|
||||
// 14 Jun 00 BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS (Jens M.)
|
||||
// 22 Mar 00 BOOST_MSVC6_MEMBER_TEMPLATES added (Dave Abrahams)
|
||||
// 18 Feb 00 BOOST_NO_INCLASS_MEMBER_INITIALIZATION added (Jens Maurer)
|
||||
// 26 Jan 00 Borland compiler support added (John Maddock)
|
||||
// 26 Jan 00 Sun compiler support added (J<>rg Schaible)
|
||||
// 30 Dec 99 BOOST_NMEMBER_TEMPLATES compatibility moved here from
|
||||
// smart_ptr.hpp. (Dave Abrahams)
|
||||
// 15 Nov 99 BOOST_NO_OPERATORS_IN_NAMESPACE,
|
||||
// BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION added (Beman Dawes)
|
||||
// 11 Oct 99 BOOST_NO_STDC_NAMESPACE refined; <cstddef> supplied
|
||||
// 29 Sep 99 BOOST_NO_STDC_NAMESPACE added (Ed Brey)
|
||||
// 24 Sep 99 BOOST_DECL added (Ed Brey)
|
||||
// 10 Aug 99 Endedness flags added, GNU CC support added
|
||||
// 22 Jul 99 Initial version
|
||||
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
#define BOOST_CONFIG_HPP
|
||||
|
||||
// Conformance Flag Macros -------------------------------------------------//
|
||||
//
|
||||
// Conformance flag macros should identify the absence of C++ Standard
|
||||
// conformance rather than its presence. This ensures that standard conforming
|
||||
// compilers do not require a lot of configuration flag macros. It places the
|
||||
// burden where it should be, on non-conforming compilers. In the future,
|
||||
// hopefully, less rather than more conformance flags will have to be defined.
|
||||
|
||||
// BOOST_NO_CV_SPECIALIZATIONS: if template specialisations for cv-qualified types
|
||||
// conflict with a specialistaion for unqualififed type.
|
||||
|
||||
// BOOST_NO_CV_VOID_SPECIALIZATIONS: if template specialisations for cv-void types
|
||||
// conflict with a specialistaion for void.
|
||||
|
||||
// BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS: Template value
|
||||
// parameters cannot have a dependent type, for example
|
||||
// "template<class T, typename T::type value> class X { ... };"
|
||||
|
||||
// BOOST_NO_INCLASS_MEMBER_INITIALIZATION: Compiler violates std::9.4.2/4.
|
||||
|
||||
// BOOST_NO_INT64_T: <boost/cstdint.hpp> does not support 64-bit integer
|
||||
// types. (Set by <boost/cstdint.hpp> rather than <boost/config.hpp>).
|
||||
|
||||
// BOOST_NO_INTEGRAL_INT64_T: int64_t as defined by <boost/cstdint.hpp> is
|
||||
// not an integral type.
|
||||
|
||||
// BOOST_NO_MEMBER_TEMPLATES: Member template functions not fully supported.
|
||||
// Also see BOOST_MSVC6_MEMBER_TEMPLATES in the Compiler Control section below.
|
||||
|
||||
// BOOST_NO_MEMBER_TEMPLATE_FRIENDS: Member template friend syntax
|
||||
// ("template<class P> friend class frd;") described in the C++ Standard,
|
||||
// 14.5.3, not supported.
|
||||
|
||||
// BOOST_NO_OPERATORS_IN_NAMESPACE: Compiler requires inherited operator
|
||||
// friend functions to be defined at namespace scope, then using'ed to boost.
|
||||
// Probably GCC specific. See boost/operators.hpp for example.
|
||||
|
||||
// BOOST_NO_POINTER_TO_MEMBER_CONST: The compiler does not correctly handle
|
||||
// pointers to const member functions, preventing use of these in overloaded
|
||||
// function templates. See boost/functional.hpp for example.
|
||||
|
||||
// BOOST_NO_PRIVATE_IN_AGGREGATE: The compiler misreads 8.5.1, treating classes
|
||||
// as non-aggregate if they contain private or protected member functions.
|
||||
|
||||
// BOOST_NO_STD_ITERATOR: The C++ implementation fails to provide the
|
||||
// std::iterator class.
|
||||
|
||||
// BOOST_NO_STD_ITERATOR_TRAITS: The compiler does not provide a standard
|
||||
// compliant implementation of std::iterator_traits. Note that
|
||||
// the compiler may still have a non-standard implementation.
|
||||
|
||||
// BOOST_NO_STDC_NAMESPACE: The contents of C++ standard headers for C library
|
||||
// functions (the <c...> headers) have not been placed in namespace std.
|
||||
// Because the use of std::size_t is so common, a specific workaround for
|
||||
// <cstddef> (and thus std::size_t) is provided in this header (see below).
|
||||
// For other <c...> headers, a workaround must be provided in the boost header:
|
||||
//
|
||||
// #include <cstdlib> // for abs
|
||||
// #ifdef BOOST_NO_STDC_NAMESPACE
|
||||
// namespace std { using ::abs; }
|
||||
// #endif
|
||||
|
||||
// BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION. Class template partial
|
||||
// specialization (14.5.4 [temp.class.spec]) not supported.
|
||||
|
||||
// BOOST_NO_USING_TEMPLATE: The compiler will not accept a using declaration
|
||||
// that imports a template from the global namespace into a named namespace.
|
||||
// Probably Borland specific.
|
||||
|
||||
// BOOST_NO_AUTO_PTR: If the compiler / library supplies non-standard or broken
|
||||
// std::auto_ptr.
|
||||
|
||||
// Compiler Control or Information Macros ----------------------------------//
|
||||
//
|
||||
// Compilers often supply features outside of the C++ Standard which need to be
|
||||
// controlled or detected. As usual, reasonable default behavior should occur
|
||||
// if any of these macros are not defined.
|
||||
|
||||
// BOOST_DECL: Certain compilers for Microsoft operating systems require
|
||||
// non-standard class and function decoration if dynamic load library linking
|
||||
// is desired. BOOST_DECL supplies that decoration, defaulting to a nul string
|
||||
// so that it is harmless when not required. Boost does not encourage the use
|
||||
// of BOOST_DECL - it is non-standard and to be avoided if practical to do so.
|
||||
|
||||
// BOOST_DECL_EXPORTS: User defined, BOOST_DECL_EXPORTS causes BOOST_DECL to
|
||||
// be defined as __declspec(dllexport) rather than __declspec(dllimport).
|
||||
|
||||
// BOOST_MSVC6_MEMBER_TEMPLATES: Microsoft Visual C++ 6.0 has enough member
|
||||
// template idiosyncrasies (being polite) that BOOST_NO_MEMBER_TEMPLATES is
|
||||
// defined for this compiler. BOOST_MSVC6_MEMBER_TEMPLATES is defined to allow
|
||||
// compiler specific workarounds.
|
||||
|
||||
// BOOST_MSVC: defined as _MSC_VER for the Microsoft compiler only. In general,
|
||||
// boost headers should test for a specific conformance flag macro (for
|
||||
// example, BOOST_NO_MEMBER_TEMPLATE_FRIENDS) rather than a specific compiler.
|
||||
// VC++ is a special case, however, since many libraries try to support it yet
|
||||
// it has so many conformance issues that sometimes it is just easier to test
|
||||
// for it directly. On the other hand, the obvious way to do this doesn't work,
|
||||
// as many non-Microsoft compilers define _MSC_VER. Thus BOOST_MSVC.
|
||||
|
||||
// BOOST_MSVC_STD_ITERATOR: Microsoft's broken version of std::iterator
|
||||
// is being used.
|
||||
|
||||
// BOOST_SYSTEM_HAS_STDINT_H: There are no 1998 C++ Standard headers <stdint.h>
|
||||
// or <cstdint>, although the 1999 C Standard does include <stdint.h>.
|
||||
// If <stdint.h> is present, <boost/stdint.h> can make good use of it,
|
||||
// so a flag is supplied (signalling presence; thus the default is not
|
||||
// present, conforming to the current C++ standard).
|
||||
|
||||
// BOOST_NO_SLIST: The C++ implementation does not provide the slist class.
|
||||
|
||||
// BOOST_NO_HASH: The C++ implementation does not provide the hash_set
|
||||
// or hash_map classes.
|
||||
|
||||
// BOOST_STD_EXTENSION_NAMESPACE: The name of the namespace in which the slist,
|
||||
// hash_set and/or hash_map templates are defined in this implementation (if any).
|
||||
|
||||
// BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS: The standard library does not provide
|
||||
// templated iterator constructors for its containers.
|
||||
|
||||
// BOOST_NO_LIMITS: The C++ implementation does not provide the <limits> header.
|
||||
|
||||
// BOOST_NO_INTRINSIC_WCHAR_T: The C++ implementation does not provide wchar_t,
|
||||
// or it is really a synonym for another integral type. Use this symbol to
|
||||
// decide whether it is appropriate to explicitly specialize a template on
|
||||
// wchar_t if there is already a specialization for other integer types.
|
||||
|
||||
// BOOST_NO_STD_ALLOCATOR: The C++ standard library does not provide
|
||||
// a standards conforming std::allocator.
|
||||
|
||||
// BOOST_NO_STD_MIN_MAX: The C++ standard library does not provide
|
||||
// the min() and max() template functions that should be in <algorithm>.
|
||||
|
||||
// Compilers are listed in alphabetic order (except VC++ last - see below)---//
|
||||
|
||||
// GNU CC (also known as GCC and G++) --------------------------------------//
|
||||
|
||||
# if defined __GNUC__
|
||||
# if __GNUC__ == 2 && __GNUC_MINOR__ == 91
|
||||
// egcs 1.1 won't parse smart_ptr.hpp without this:
|
||||
# define BOOST_NO_AUTO_PTR
|
||||
# endif
|
||||
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 95
|
||||
# include <iterator> // not sure this is the right way to do this -JGS
|
||||
# if !defined(_CXXRT_STD) && !defined(__SGI_STL) // need to ask Dietmar about this -JGS
|
||||
# define BOOST_NO_STD_ITERATOR
|
||||
# define BOOST_NO_LIMITS
|
||||
# endif
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# define BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
# endif
|
||||
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 8
|
||||
# define BOOST_NO_MEMBER_TEMPLATES
|
||||
# endif
|
||||
|
||||
// Kai C++ ------------------------------------------------------------------//
|
||||
|
||||
#elif defined __KCC
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
|
||||
// Greenhills C++ -----------------------------------------------------------//
|
||||
|
||||
#elif defined __ghs
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
|
||||
// Borland ------------------------------------------------------------------//
|
||||
|
||||
#elif defined __BORLANDC__
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
# if __BORLANDC__ <= 0x0551
|
||||
# define BOOST_NO_INTEGRAL_INT64_T
|
||||
# define BOOST_NO_PRIVATE_IN_AGGREGATE
|
||||
# endif
|
||||
# if __BORLANDC__ <= 0x0550
|
||||
// Borland C++ Builder 4 and 5:
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# define BOOST_NO_USING_TEMPLATE
|
||||
# if __BORLANDC__ == 0x0550
|
||||
// Borland C++ Builder 5, command-line compiler 5.5:
|
||||
# define BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
# endif
|
||||
# endif
|
||||
# if defined BOOST_DECL_EXPORTS
|
||||
# define BOOST_DECL __declspec(dllexport)
|
||||
# else
|
||||
# define BOOST_DECL __declspec(dllimport)
|
||||
# endif
|
||||
# define BOOST_NO_CV_SPECIALIZATIONS
|
||||
# define BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
|
||||
// Intel -------------------------------------------------------------------//
|
||||
|
||||
# elif defined __ICL
|
||||
# include <iterator> // not sure this is the right way to do this -JGS
|
||||
# if __SGI_STL_PORT >= 0x400 || __SGI_STL_PORT >= 0x321 && defined(__STL_USE_NAMESPACES)
|
||||
// a perfectly good implementation of std::iterator is supplied
|
||||
# elif defined(__SGI_STL_ITERATOR)
|
||||
# define BOOST_NO_STD_ITERATOR // No std::iterator in this case
|
||||
# else // assume using dinkumware's STL that comes with VC++ 6.0
|
||||
# define BOOST_MSVC_STD_ITERATOR
|
||||
# define BOOST_NO_STD_ITERATOR_TRAITS
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||
# define BOOST_NO_STD_ALLOCATOR
|
||||
# define BOOST_NO_STD_MIN_MAX
|
||||
# endif
|
||||
|
||||
|
||||
// Metrowerks CodeWarrior --------------------------------------------------//
|
||||
|
||||
# elif defined __MWERKS__
|
||||
# if __MWERKS__ <= 0x4000
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# endif
|
||||
# if __MWERKS__ <= 0x2301
|
||||
# define BOOST_NO_POINTER_TO_MEMBER_CONST
|
||||
# endif
|
||||
# if __MWERKS__ >= 0x2300
|
||||
# define BOOST_SYSTEM_HAS_STDINT_H
|
||||
# endif
|
||||
# if defined BOOST_DECL_EXPORTS
|
||||
# define BOOST_DECL __declspec(dllexport)
|
||||
# else
|
||||
# define BOOST_DECL __declspec(dllimport)
|
||||
# endif
|
||||
|
||||
# define BOOST_STD_EXTENSION_NAMESPACE Metrowerks
|
||||
|
||||
// Sun Workshop Compiler C++ ------------------------------------------------//
|
||||
|
||||
# elif defined __SUNPRO_CC
|
||||
# if __SUNPRO_CC <= 0x500
|
||||
# define BOOST_NO_MEMBER_TEMPLATES
|
||||
# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# endif
|
||||
|
||||
// Microsoft Visual C++ (excluding Intel/EDG front end) --------------------//
|
||||
//
|
||||
// Must remain the last #elif since some other vendors (Metrowerks, for
|
||||
// example) also #define _MSC_VER
|
||||
|
||||
# elif defined _MSC_VER
|
||||
# define BOOST_MSVC _MSC_VER
|
||||
|
||||
// turn off the warnings before we #include anything
|
||||
# pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info
|
||||
# pragma warning( disable : 4503 ) // warning: decorated name length exceeded
|
||||
|
||||
# if _MSC_VER <= 1200 // 1200 == VC++ 6.0
|
||||
# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
# define BOOST_NO_PRIVATE_IN_AGGREGATE
|
||||
|
||||
# define BOOST_NO_INTEGRAL_INT64_T
|
||||
# define BOOST_NO_INTRINSIC_WCHAR_T
|
||||
|
||||
// VC++ 6.0 has member templates but they have numerous problems including
|
||||
// cases of silent failure, so for safety we define:
|
||||
# define BOOST_NO_MEMBER_TEMPLATES
|
||||
// For VC++ experts wishing to attempt workarounds, we define:
|
||||
# define BOOST_MSVC6_MEMBER_TEMPLATES
|
||||
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
|
||||
|
||||
# include <iterator> // not sure this is the right way to do this -JGS
|
||||
# if __SGI_STL_PORT >= 0x400 || __SGI_STL_PORT >= 0x321 && defined(__STL_USE_NAMESPACES)
|
||||
// a perfectly good implementation of std::iterator is supplied
|
||||
# elif defined(__SGI_STL_ITERATOR)
|
||||
# define BOOST_NO_STD_ITERATOR // No std::iterator in this case
|
||||
# else
|
||||
# define BOOST_MSVC_STD_ITERATOR 1
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||
# define BOOST_NO_STD_ALLOCATOR
|
||||
# ifndef _CPPLIB_VER
|
||||
// Updated Dinkum library defines this, and provides
|
||||
// its own min and max definitions.
|
||||
# define BOOST_NO_STD_MIN_MAX
|
||||
# undef min
|
||||
# undef max
|
||||
# endif
|
||||
# ifndef NOMINMAX
|
||||
// avoid spurious NOMINMAX redefinition warning
|
||||
# define NOMINMAX
|
||||
# endif
|
||||
# endif
|
||||
# define BOOST_NO_STD_ITERATOR_TRAITS
|
||||
# define BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
|
||||
|
||||
// Make sure at least one standard library header is included so that library
|
||||
// implementation detection will work, even if no standard headers have been
|
||||
// included in front of a boost header. (Ed Brey 5 Jun 00)
|
||||
# include <cstddef>
|
||||
|
||||
// Determine if the standard library implementation is already pulling names
|
||||
// into std. STLport defines the following if so. (Ed Brey 5 Jun 00)
|
||||
# ifndef __STL_IMPORT_VENDOR_CSTD
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
# if defined BOOST_DECL_EXPORTS
|
||||
# define BOOST_DECL __declspec(dllexport)
|
||||
# else
|
||||
# define BOOST_DECL __declspec(dllimport)
|
||||
# endif
|
||||
|
||||
# endif // Microsoft (excluding Intel/EDG frontend)
|
||||
|
||||
# ifndef BOOST_DECL
|
||||
# define BOOST_DECL // default for compilers not needing this decoration.
|
||||
# endif
|
||||
|
||||
// end of compiler specific portion ----------------------------------------//
|
||||
|
||||
#ifndef BOOST_STD_EXTENSION_NAMESPACE
|
||||
# define BOOST_STD_EXTENSION_NAMESPACE std
|
||||
#endif
|
||||
|
||||
// Check for old name "BOOST_NMEMBER_TEMPLATES" for compatibility -----------//
|
||||
// Don't use BOOST_NMEMBER_TEMPLATES. It is deprecated and will be removed soon.
|
||||
#if defined( BOOST_NMEMBER_TEMPLATES ) && !defined( BOOST_NO_MEMBER_TEMPLATES )
|
||||
#define BOOST_NO_MEMBER_TEMPLATES
|
||||
#endif
|
||||
|
||||
// BOOST_NO_STDC_NAMESPACE workaround --------------------------------------//
|
||||
//
|
||||
// Because std::size_t usage is so common, even in boost headers which do not
|
||||
// otherwise use the C library, the <cstddef> workaround is included here so
|
||||
// that ugly workaround code need not appear in many other boost headers.
|
||||
// NOTE WELL: This is a workaround for non-conforming compilers; <cstddef>
|
||||
// must still be #included in the usual places so that <cstddef> inclusion
|
||||
// works as expected with standard conforming compilers. The resulting
|
||||
// double inclusion of <cstddef> is harmless.
|
||||
|
||||
# ifdef BOOST_NO_STDC_NAMESPACE
|
||||
# include <cstddef>
|
||||
namespace std { using ::ptrdiff_t; using ::size_t; }
|
||||
// using ::wchar_t; removed since wchar_t is a C++ built-in type (Ed Brey)
|
||||
# endif
|
||||
|
||||
#ifdef BOOST_NO_STD_MIN_MAX
|
||||
namespace std {
|
||||
template <class _Tp>
|
||||
inline const _Tp& min(const _Tp& __a, const _Tp& __b) {
|
||||
return __b < __a ? __b : __a;
|
||||
}
|
||||
template <class _Tp>
|
||||
inline const _Tp& max(const _Tp& __a, const _Tp& __b) {
|
||||
return __a < __b ? __b : __a;
|
||||
}
|
||||
#ifdef BOOST_MSVC
|
||||
inline long min(long __a, long __b) {
|
||||
return __b < __a ? __b : __a;
|
||||
}
|
||||
inline long max(long __a, long __b) {
|
||||
return __a < __b ? __b : __a;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // BOOST_CONFIG_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,138 +0,0 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
|
||||
// call_traits: defines typedefs for function usage
|
||||
// (see libs/utility/call_traits.htm)
|
||||
|
||||
/* Release notes:
|
||||
23rd July 2000:
|
||||
Fixed array specialization. (JM)
|
||||
Added Borland specific fixes for reference types
|
||||
(issue raised by Steve Cleary).
|
||||
*/
|
||||
|
||||
#ifndef BOOST_DETAIL_CALL_TRAITS_HPP
|
||||
#define BOOST_DETAIL_CALL_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <typename T, bool isp, bool b1, bool b2>
|
||||
struct ct_imp
|
||||
{
|
||||
typedef const T& param_type;
|
||||
};
|
||||
|
||||
template <typename T, bool isp>
|
||||
struct ct_imp<T, isp, true, true>
|
||||
{
|
||||
typedef T const param_type;
|
||||
};
|
||||
|
||||
template <typename T, bool b1, bool b2>
|
||||
struct ct_imp<T, true, b1, b2>
|
||||
{
|
||||
typedef T const param_type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct call_traits
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
//
|
||||
// C++ Builder workaround: we should be able to define a compile time
|
||||
// constant and pass that as a single template parameter to ct_imp<T,bool>,
|
||||
// however compiler bugs prevent this - instead pass three bool's to
|
||||
// ct_imp<T,bool,bool,bool> and add an extra partial specialisation
|
||||
// of ct_imp to handle the logic. (JM)
|
||||
typedef typename detail::ct_imp<T, ::boost::is_pointer<typename remove_const<T>::type>::value, ::boost::is_arithmetic<typename remove_const<T>::type>::value, sizeof(T) <= sizeof(void*)>::param_type param_type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct call_traits<T&>
|
||||
{
|
||||
typedef T& value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef T& param_type; // hh removed const
|
||||
};
|
||||
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x551)
|
||||
// these are illegal specialisations; cv-qualifies applied to
|
||||
// references have no effect according to [8.3.2p1],
|
||||
// C++ Builder requires them though as it treats cv-qualified
|
||||
// references as distinct types...
|
||||
template <typename T>
|
||||
struct call_traits<T&const>
|
||||
{
|
||||
typedef T& value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef T& param_type; // hh removed const
|
||||
};
|
||||
template <typename T>
|
||||
struct call_traits<T&volatile>
|
||||
{
|
||||
typedef T& value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef T& param_type; // hh removed const
|
||||
};
|
||||
template <typename T>
|
||||
struct call_traits<T&const volatile>
|
||||
{
|
||||
typedef T& value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef T& param_type; // hh removed const
|
||||
};
|
||||
#endif
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
struct call_traits<T [N]>
|
||||
{
|
||||
private:
|
||||
typedef T array_type[N];
|
||||
public:
|
||||
// degrades array to pointer:
|
||||
typedef const T* value_type;
|
||||
typedef array_type& reference;
|
||||
typedef const array_type& const_reference;
|
||||
typedef const T* const param_type;
|
||||
};
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
struct call_traits<const T [N]>
|
||||
{
|
||||
private:
|
||||
typedef const T array_type[N];
|
||||
public:
|
||||
// degrades array to pointer:
|
||||
typedef const T* value_type;
|
||||
typedef array_type& reference;
|
||||
typedef const array_type& const_reference;
|
||||
typedef const T* const param_type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_CALL_TRAITS_HPP
|
@ -1,125 +0,0 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
//
|
||||
// Crippled version for crippled compilers:
|
||||
// see libs/utility/call_traits.htm
|
||||
//
|
||||
|
||||
/* Release notes:
|
||||
01st October 2000:
|
||||
Fixed call_traits on VC6, using "poor man's partial specialisation",
|
||||
using ideas taken from "Generative programming" by Krzysztof Czarnecki
|
||||
& Ulrich Eisenecker.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_OB_CALL_TRAITS_HPP
|
||||
#define BOOST_OB_CALL_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES)
|
||||
//
|
||||
// use member templates to emulate
|
||||
// partial specialisation:
|
||||
//
|
||||
namespace detail{
|
||||
|
||||
template <class T>
|
||||
struct standard_call_traits
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef const T& param_type;
|
||||
};
|
||||
template <class T>
|
||||
struct simple_call_traits
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef const T param_type;
|
||||
};
|
||||
template <class T>
|
||||
struct reference_call_traits
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T reference;
|
||||
typedef T const_reference;
|
||||
typedef T param_type;
|
||||
};
|
||||
template <bool simple, bool reference>
|
||||
struct call_traits_chooser
|
||||
{
|
||||
template <class T>
|
||||
struct rebind
|
||||
{
|
||||
typedef standard_call_traits<T> type;
|
||||
};
|
||||
};
|
||||
template <>
|
||||
struct call_traits_chooser<true, false>
|
||||
{
|
||||
template <class T>
|
||||
struct rebind
|
||||
{
|
||||
typedef simple_call_traits<T> type;
|
||||
};
|
||||
};
|
||||
template <>
|
||||
struct call_traits_chooser<false, true>
|
||||
{
|
||||
template <class T>
|
||||
struct rebind
|
||||
{
|
||||
typedef reference_call_traits<T> type;
|
||||
};
|
||||
};
|
||||
} // namespace detail
|
||||
template <typename T>
|
||||
struct call_traits
|
||||
{
|
||||
private:
|
||||
typedef detail::call_traits_chooser<(is_pointer<T>::value || is_arithmetic<T>::value) && sizeof(T) <= sizeof(void*), is_reference<T>::value> chooser;
|
||||
typedef typename chooser::template rebind<T> bound_type;
|
||||
typedef typename bound_type::type call_traits_type;
|
||||
public:
|
||||
typedef typename call_traits_type::value_type value_type;
|
||||
typedef typename call_traits_type::reference reference;
|
||||
typedef typename call_traits_type::const_reference const_reference;
|
||||
typedef typename call_traits_type::param_type param_type;
|
||||
};
|
||||
|
||||
#else
|
||||
//
|
||||
// sorry call_traits is completely non-functional
|
||||
// blame your broken compiler:
|
||||
//
|
||||
|
||||
template <typename T>
|
||||
struct call_traits
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef const T& param_type;
|
||||
};
|
||||
|
||||
#endif // member templates
|
||||
|
||||
}
|
||||
|
||||
#endif // BOOST_OB_CALL_TRAITS_HPP
|
@ -1,379 +0,0 @@
|
||||
// Boost smart_ptr.hpp header file -----------------------------------------//
|
||||
|
||||
// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. Permission to copy,
|
||||
// use, modify, sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided "as is"
|
||||
// without express or implied warranty, and with no claim as to its
|
||||
// suitability for any purpose.
|
||||
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
|
||||
// Revision History
|
||||
// 19 Oct 00 Make shared_ptr ctor from auto_ptr explicit. (Robert Vugts)
|
||||
// 24 Jul 00 Change throw() to // never throws. See lib guidelines
|
||||
// Exception-specification rationale. (Beman Dawes)
|
||||
// 22 Jun 00 Remove #if continuations to fix GCC 2.95.2 problem (Beman Dawes)
|
||||
// 1 Feb 00 Additional shared_ptr BOOST_NO_MEMBER_TEMPLATES workarounds
|
||||
// (Dave Abrahams)
|
||||
// 31 Dec 99 Condition tightened for no member template friend workaround
|
||||
// (Dave Abrahams)
|
||||
// 30 Dec 99 Moved BOOST_NMEMBER_TEMPLATES compatibility code to config.hpp
|
||||
// (Dave Abrahams)
|
||||
// 30 Nov 99 added operator ==, operator !=, and std::swap and std::less
|
||||
// specializations for shared types (Darin Adler)
|
||||
// 11 Oct 99 replaced op[](int) with op[](std::size_t) (Ed Brey, Valentin
|
||||
// Bonnard), added shared_ptr workaround for no member template
|
||||
// friends (Matthew Langston)
|
||||
// 25 Sep 99 added shared_ptr::swap and shared_array::swap (Luis Coelho).
|
||||
// 20 Jul 99 changed name to smart_ptr.hpp, #include <boost/config.hpp>,
|
||||
// #include <boost/utility.hpp> and use boost::noncopyable
|
||||
// 17 May 99 remove scoped_array and shared_array operator*() as
|
||||
// unnecessary (Beman Dawes)
|
||||
// 14 May 99 reorder code so no effects when bad_alloc thrown (Abrahams/Dawes)
|
||||
// 13 May 99 remove certain throw() specifiers to avoid generated try/catch
|
||||
// code cost (Beman Dawes)
|
||||
// 11 May 99 get() added, conversion to T* placed in macro guard (Valentin
|
||||
// Bonnard, Dave Abrahams, and others argued for elimination
|
||||
// of the automatic conversion)
|
||||
// 28 Apr 99 #include <memory> fix (Valentin Bonnard)
|
||||
// 28 Apr 99 rename transfer() to share() for clarity (Dave Abrahams)
|
||||
// 28 Apr 99 remove unsafe shared_array template conversions(Valentin Bonnard)
|
||||
// 28 Apr 99 p(r) changed to p(r.px) for clarity (Dave Abrahams)
|
||||
// 21 Apr 99 reset() self assignment fix (Valentin Bonnard)
|
||||
// 21 Apr 99 dispose() provided to improve clarity (Valentin Bonnard)
|
||||
// 27 Apr 99 leak when new throws fixes (Dave Abrahams)
|
||||
// 21 Oct 98 initial Version (Greg Colvin/Beman Dawes)
|
||||
|
||||
#ifndef BOOST_SMART_PTR_HPP
|
||||
#define BOOST_SMART_PTR_HPP
|
||||
|
||||
#include <boost/config.hpp> // for broken compiler workarounds
|
||||
#include <cstddef> // for std::size_t
|
||||
#include <memory> // for std::auto_ptr
|
||||
#include <algorithm> // for std::swap
|
||||
#include <boost/utility.hpp> // for boost::noncopyable
|
||||
#include <functional> // for std::less
|
||||
|
||||
namespace boost {
|
||||
|
||||
// scoped_ptr --------------------------------------------------------------//
|
||||
|
||||
// scoped_ptr mimics a built-in pointer except that it guarantees deletion
|
||||
// of the object pointed to, either on destruction of the scoped_ptr or via
|
||||
// an explicit reset(). scoped_ptr is a simple solution for simple needs;
|
||||
// see shared_ptr (below) or std::auto_ptr if your needs are more complex.
|
||||
|
||||
template<typename T> class scoped_ptr : noncopyable {
|
||||
|
||||
T* ptr;
|
||||
|
||||
public:
|
||||
typedef T element_type;
|
||||
|
||||
explicit scoped_ptr( T* p=0 ) : ptr(p) {} // never throws
|
||||
~scoped_ptr() { delete ptr; }
|
||||
|
||||
void reset( T* p=0 ) { if ( ptr != p ) { delete ptr; ptr = p; } }
|
||||
T& operator*() const { return *ptr; } // never throws
|
||||
T* operator->() const { return ptr; } // never throws
|
||||
T* get() const { return ptr; } // never throws
|
||||
#ifdef BOOST_SMART_PTR_CONVERSION
|
||||
// get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk!
|
||||
operator T*() const { return ptr; } // never throws
|
||||
#endif
|
||||
}; // scoped_ptr
|
||||
|
||||
// scoped_array ------------------------------------------------------------//
|
||||
|
||||
// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to
|
||||
// is guaranteed, either on destruction of the scoped_array or via an explicit
|
||||
// reset(). See shared_array or std::vector if your needs are more complex.
|
||||
|
||||
template<typename T> class scoped_array : noncopyable {
|
||||
|
||||
T* ptr;
|
||||
|
||||
public:
|
||||
typedef T element_type;
|
||||
|
||||
explicit scoped_array( T* p=0 ) : ptr(p) {} // never throws
|
||||
~scoped_array() { delete [] ptr; }
|
||||
|
||||
void reset( T* p=0 ) { if ( ptr != p ) {delete [] ptr; ptr=p;} }
|
||||
|
||||
T* get() const { return ptr; } // never throws
|
||||
#ifdef BOOST_SMART_PTR_CONVERSION
|
||||
// get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk!
|
||||
operator T*() const { return ptr; } // never throws
|
||||
#else
|
||||
T& operator[](std::size_t i) const { return ptr[i]; } // never throws
|
||||
#endif
|
||||
}; // scoped_array
|
||||
|
||||
// shared_ptr --------------------------------------------------------------//
|
||||
|
||||
// An enhanced relative of scoped_ptr with reference counted copy semantics.
|
||||
// The object pointed to is deleted when the last shared_ptr pointing to it
|
||||
// is destroyed or reset.
|
||||
|
||||
template<typename T> class shared_ptr {
|
||||
public:
|
||||
typedef T element_type;
|
||||
|
||||
explicit shared_ptr(T* p =0) : px(p) {
|
||||
try { pn = new long(1); } // fix: prevent leak if new throws
|
||||
catch (...) { delete p; throw; }
|
||||
}
|
||||
|
||||
shared_ptr(const shared_ptr& r) : px(r.px) { ++*(pn = r.pn); } // never throws
|
||||
|
||||
~shared_ptr() { dispose(); }
|
||||
|
||||
shared_ptr& operator=(const shared_ptr& r) {
|
||||
share(r.px,r.pn);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined( BOOST_NO_MEMBER_TEMPLATES )
|
||||
template<typename Y>
|
||||
shared_ptr(const shared_ptr<Y>& r) : px(r.px) { // never throws
|
||||
++*(pn = r.pn);
|
||||
}
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template<typename Y>
|
||||
explicit shared_ptr(std::auto_ptr<Y>& r) {
|
||||
pn = new long(1); // may throw
|
||||
px = r.release(); // fix: moved here to stop leak if new throws
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename Y>
|
||||
shared_ptr& operator=(const shared_ptr<Y>& r) {
|
||||
share(r.px,r.pn);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
template<typename Y>
|
||||
shared_ptr& operator=(std::auto_ptr<Y>& r) {
|
||||
// code choice driven by guarantee of "no effect if new throws"
|
||||
if (*pn == 1) { delete px; }
|
||||
else { // allocate new reference counter
|
||||
long * tmp = new long(1); // may throw
|
||||
--*pn; // only decrement once danger of new throwing is past
|
||||
pn = tmp;
|
||||
} // allocate new reference counter
|
||||
px = r.release(); // fix: moved here so doesn't leak if new throws
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
explicit shared_ptr(std::auto_ptr<T>& r) {
|
||||
pn = new long(1); // may throw
|
||||
px = r.release(); // fix: moved here to stop leak if new throws
|
||||
}
|
||||
|
||||
shared_ptr& operator=(std::auto_ptr<T>& r) {
|
||||
// code choice driven by guarantee of "no effect if new throws"
|
||||
if (*pn == 1) { delete px; }
|
||||
else { // allocate new reference counter
|
||||
long * tmp = new long(1); // may throw
|
||||
--*pn; // only decrement once danger of new throwing is past
|
||||
pn = tmp;
|
||||
} // allocate new reference counter
|
||||
px = r.release(); // fix: moved here so doesn't leak if new throws
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void reset(T* p=0) {
|
||||
if ( px == p ) return; // fix: self-assignment safe
|
||||
if (--*pn == 0) { delete px; }
|
||||
else { // allocate new reference counter
|
||||
try { pn = new long; } // fix: prevent leak if new throws
|
||||
catch (...) {
|
||||
++*pn; // undo effect of --*pn above to meet effects guarantee
|
||||
delete p;
|
||||
throw;
|
||||
} // catch
|
||||
} // allocate new reference counter
|
||||
*pn = 1;
|
||||
px = p;
|
||||
} // reset
|
||||
|
||||
T& operator*() const { return *px; } // never throws
|
||||
T* operator->() const { return px; } // never throws
|
||||
T* get() const { return px; } // never throws
|
||||
#ifdef BOOST_SMART_PTR_CONVERSION
|
||||
// get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk!
|
||||
operator T*() const { return px; } // never throws
|
||||
#endif
|
||||
|
||||
long use_count() const { return *pn; } // never throws
|
||||
bool unique() const { return *pn == 1; } // never throws
|
||||
|
||||
void swap(shared_ptr<T>& other) // never throws
|
||||
{ std::swap(px,other.px); std::swap(pn,other.pn); }
|
||||
|
||||
// Tasteless as this may seem, making all members public allows member templates
|
||||
// to work in the absence of member template friends. (Matthew Langston)
|
||||
// Don't split this line into two; that causes problems for some GCC 2.95.2 builds
|
||||
#if defined(BOOST_NO_MEMBER_TEMPLATES) || !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS )
|
||||
private:
|
||||
#endif
|
||||
|
||||
T* px; // contained pointer
|
||||
long* pn; // ptr to reference counter
|
||||
|
||||
// Don't split this line into two; that causes problems for some GCC 2.95.2 builds
|
||||
#if !defined( BOOST_NO_MEMBER_TEMPLATES ) && !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS )
|
||||
template<typename Y> friend class shared_ptr;
|
||||
#endif
|
||||
|
||||
void dispose() { if (--*pn == 0) { delete px; delete pn; } }
|
||||
|
||||
void share(T* rpx, long* rpn) {
|
||||
if (pn != rpn) {
|
||||
dispose();
|
||||
px = rpx;
|
||||
++*(pn = rpn);
|
||||
}
|
||||
} // share
|
||||
}; // shared_ptr
|
||||
|
||||
template<typename T, typename U>
|
||||
inline bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b)
|
||||
{ return a.get() == b.get(); }
|
||||
|
||||
template<typename T, typename U>
|
||||
inline bool operator!=(const shared_ptr<T>& a, const shared_ptr<U>& b)
|
||||
{ return a.get() != b.get(); }
|
||||
|
||||
// shared_array ------------------------------------------------------------//
|
||||
|
||||
// shared_array extends shared_ptr to arrays.
|
||||
// The array pointed to is deleted when the last shared_array pointing to it
|
||||
// is destroyed or reset.
|
||||
|
||||
template<typename T> class shared_array {
|
||||
public:
|
||||
typedef T element_type;
|
||||
|
||||
explicit shared_array(T* p =0) : px(p) {
|
||||
try { pn = new long(1); } // fix: prevent leak if new throws
|
||||
catch (...) { delete [] p; throw; }
|
||||
}
|
||||
|
||||
shared_array(const shared_array& r) : px(r.px) // never throws
|
||||
{ ++*(pn = r.pn); }
|
||||
|
||||
~shared_array() { dispose(); }
|
||||
|
||||
shared_array& operator=(const shared_array& r) {
|
||||
if (pn != r.pn) {
|
||||
dispose();
|
||||
px = r.px;
|
||||
++*(pn = r.pn);
|
||||
}
|
||||
return *this;
|
||||
} // operator=
|
||||
|
||||
void reset(T* p=0) {
|
||||
if ( px == p ) return; // fix: self-assignment safe
|
||||
if (--*pn == 0) { delete [] px; }
|
||||
else { // allocate new reference counter
|
||||
try { pn = new long; } // fix: prevent leak if new throws
|
||||
catch (...) {
|
||||
++*pn; // undo effect of --*pn above to meet effects guarantee
|
||||
delete [] p;
|
||||
throw;
|
||||
} // catch
|
||||
} // allocate new reference counter
|
||||
*pn = 1;
|
||||
px = p;
|
||||
} // reset
|
||||
|
||||
T* get() const { return px; } // never throws
|
||||
#ifdef BOOST_SMART_PTR_CONVERSION
|
||||
// get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk!
|
||||
operator T*() const { return px; } // never throws
|
||||
#else
|
||||
T& operator[](std::size_t i) const { return px[i]; } // never throws
|
||||
#endif
|
||||
|
||||
long use_count() const { return *pn; } // never throws
|
||||
bool unique() const { return *pn == 1; } // never throws
|
||||
|
||||
void swap(shared_array<T>& other) // never throws
|
||||
{ std::swap(px,other.px); std::swap(pn,other.pn); }
|
||||
|
||||
private:
|
||||
|
||||
T* px; // contained pointer
|
||||
long* pn; // ptr to reference counter
|
||||
|
||||
void dispose() { if (--*pn == 0) { delete [] px; delete pn; } }
|
||||
|
||||
}; // shared_array
|
||||
|
||||
template<typename T>
|
||||
inline bool operator==(const shared_array<T>& a, const shared_array<T>& b)
|
||||
{ return a.get() == b.get(); }
|
||||
|
||||
template<typename T>
|
||||
inline bool operator!=(const shared_array<T>& a, const shared_array<T>& b)
|
||||
{ return a.get() != b.get(); }
|
||||
|
||||
} // namespace boost
|
||||
|
||||
// specializations for things in namespace std -----------------------------//
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
namespace std {
|
||||
|
||||
// Specialize std::swap to use the fast, non-throwing swap that's provided
|
||||
// as a member function instead of using the default algorithm which creates
|
||||
// a temporary and uses assignment.
|
||||
|
||||
template<typename T>
|
||||
inline void swap(boost::shared_ptr<T>& a, boost::shared_ptr<T>& b)
|
||||
{ a.swap(b); }
|
||||
|
||||
template<typename T>
|
||||
inline void swap(boost::shared_array<T>& a, boost::shared_array<T>& b)
|
||||
{ a.swap(b); }
|
||||
|
||||
// Specialize std::less so we can use shared pointers and arrays as keys in
|
||||
// associative collections.
|
||||
|
||||
// It's still a controversial question whether this is better than supplying
|
||||
// a full range of comparison operators (<, >, <=, >=).
|
||||
|
||||
template<typename T>
|
||||
struct less< boost::shared_ptr<T> >
|
||||
: binary_function<boost::shared_ptr<T>, boost::shared_ptr<T>, bool>
|
||||
{
|
||||
bool operator()(const boost::shared_ptr<T>& a,
|
||||
const boost::shared_ptr<T>& b) const
|
||||
{ return less<T*>()(a.get(),b.get()); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct less< boost::shared_array<T> >
|
||||
: binary_function<boost::shared_array<T>, boost::shared_array<T>, bool>
|
||||
{
|
||||
bool operator()(const boost::shared_array<T>& a,
|
||||
const boost::shared_array<T>& b) const
|
||||
{ return less<T*>()(a.get(),b.get()); }
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
#endif // BOOST_SMART_PTR_HPP
|
||||
|
||||
|
@ -1,57 +0,0 @@
|
||||
// boost timer.hpp header file ---------------------------------------------//
|
||||
|
||||
// (C) Copyright Beman Dawes 1994-99. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
|
||||
// Revision History
|
||||
// 25 Sep 99 elapsed_max() and elapsed_min() added (John Maddock)
|
||||
// 16 Jul 99 Second beta
|
||||
// 6 Jul 99 Initial boost version
|
||||
|
||||
#ifndef BOOST_TIMER_HPP
|
||||
#define BOOST_TIMER_HPP
|
||||
|
||||
#include <boost/smart_ptr.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
// timer -------------------------------------------------------------------//
|
||||
|
||||
// A timer object measures elapsed time.
|
||||
|
||||
// It is recommended that implementations measure wall clock rather than CPU
|
||||
// time since the intended use is performance measurement on systems where
|
||||
// total elapsed time is more important than just process or CPU time.
|
||||
|
||||
// Warnings: The maximum measurable elapsed time may well be only 596.5+ hours
|
||||
// due to implementation limitations. The accuracy of timings depends on the
|
||||
// accuracy of timing information provided by the underlying platform, and
|
||||
// this varies a great deal from platform to platform.
|
||||
|
||||
class timer {
|
||||
|
||||
public:
|
||||
timer(); // postcondition: elapsed()==0
|
||||
timer( const timer& src ); // post: elapsed()==src.elapsed()
|
||||
~timer();
|
||||
timer& operator=( const timer& src ); // post: elapsed()==src.elapsed()
|
||||
void restart(); // post: elapsed()==0
|
||||
double elapsed() const; // return elapsed time in seconds
|
||||
|
||||
double elapsed_max() const; // return estimated maximum value for elapsed()
|
||||
// Portability warning: elapsed_max() may return too high a value on systems
|
||||
// where std::clock_t overflows or resets at surprising values.
|
||||
double elapsed_min() const; // return minimum value for elapsed()
|
||||
|
||||
private:
|
||||
class _timer;
|
||||
scoped_ptr<_timer> _imp; // hide implementation details
|
||||
}; // timer
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TIMER_HPP
|
@ -1,42 +0,0 @@
|
||||
// (C) Copyright Boost.org 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
// See boost/detail/type_traits.hpp and boost/detail/ob_type_traits.hpp
|
||||
// for full copyright notices.
|
||||
|
||||
#ifndef BOOST_TYPE_TRAITS_HPP
|
||||
#define BOOST_TYPE_TRAITS_HPP
|
||||
|
||||
#include <boost/type_traits/fwd.hpp>
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#include <boost/type_traits/conversion_traits.hpp>
|
||||
#include <boost/type_traits/arithmetic_traits.hpp>
|
||||
#include <boost/type_traits/cv_traits.hpp>
|
||||
#include <boost/type_traits/composite_traits.hpp>
|
||||
#include <boost/type_traits/alignment_traits.hpp>
|
||||
#include <boost/type_traits/object_traits.hpp>
|
||||
#include <boost/type_traits/transform_traits.hpp>
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
//
|
||||
// undefine helper macro's:
|
||||
//
|
||||
#undef BOOST_IS_CLASS
|
||||
#undef BOOST_IS_ENUM
|
||||
#undef BOOST_IS_UNION
|
||||
#undef BOOST_IS_POD
|
||||
#undef BOOST_IS_EMPTY
|
||||
#undef BOOST_HAS_TRIVIAL_CONSTRUCTOR
|
||||
#undef BOOST_HAS_TRIVIAL_COPY
|
||||
#undef BOOST_HAS_TRIVIAL_ASSIGN
|
||||
#undef BOOST_HAS_TRIVIAL_DESTRUCTOR
|
||||
|
||||
#endif // BOOST_TYPE_TRAITS_HPP
|
||||
|
||||
|
||||
|
@ -1,82 +0,0 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000.
|
||||
// Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
//
|
||||
// defines alignment_of:
|
||||
|
||||
#ifndef ALIGNMENT_TYPE_TRAITS_HPP
|
||||
#define ALIGNMENT_TYPE_TRAITS_HPP
|
||||
|
||||
#include <cstdlib>
|
||||
#ifndef BOOST_ICE_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
//
|
||||
// get the alignment of some arbitrary type:
|
||||
namespace detail{
|
||||
|
||||
template <class T>
|
||||
struct alignment_of_hack
|
||||
{
|
||||
char c;
|
||||
T t;
|
||||
alignment_of_hack();
|
||||
};
|
||||
|
||||
template <unsigned A, unsigned S>
|
||||
struct alignment_logic
|
||||
{
|
||||
BOOST_DECL_MC(std::size_t, value, A < S ? A : S);
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class T>
|
||||
struct alignment_of
|
||||
{
|
||||
BOOST_DECL_MC(std::size_t, value,
|
||||
(::boost::detail::alignment_logic<
|
||||
sizeof(detail::alignment_of_hack<T>) - sizeof(T),
|
||||
sizeof(T)
|
||||
>::value));
|
||||
};
|
||||
|
||||
//
|
||||
// references have to be treated specially, assume
|
||||
// that a reference is just a special pointer:
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <class T>
|
||||
struct alignment_of<T&>
|
||||
{
|
||||
public:
|
||||
BOOST_DECL_MC(std::size_t, value, alignment_of<T*>::value);
|
||||
};
|
||||
#endif
|
||||
//
|
||||
// void has to be treated specially:
|
||||
template <>
|
||||
struct alignment_of<void>
|
||||
{ BOOST_DECL_MC(std::size_t, value, 0); };
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <>
|
||||
struct alignment_of<const void>
|
||||
{ BOOST_DECL_MC(std::size_t, value, 0); };
|
||||
template <>
|
||||
struct alignment_of<volatile void>
|
||||
{ BOOST_DECL_MC(std::size_t, value, 0); };
|
||||
template <>
|
||||
struct alignment_of<const volatile void>
|
||||
{ BOOST_DECL_MC(std::size_t, value, 0); };
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // ALIGNMENT_TYPE_TRAITS_HPP
|
||||
|
||||
|
@ -1,262 +0,0 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
//
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
//
|
||||
// defines traits classes for arithmetic types:
|
||||
// is_void, is_integral, is_float, is_arithmetic, is_fundamental.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ARITHMETIC_TYPE_TRAITS_HPP
|
||||
#define ARITHMETIC_TYPE_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_ICE_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_FWD_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/fwd.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
//* is a type T void - is_void<T>
|
||||
template <typename T> struct is_void{ BOOST_DECL_MC(bool, value, false); };
|
||||
template <> struct is_void<void>{ BOOST_DECL_MC(bool, value, true); };
|
||||
|
||||
//* is a type T an integral type described in the standard (3.9.1p3)
|
||||
template <typename T> struct is_integral
|
||||
{ BOOST_DECL_MC(bool, value, false); };
|
||||
template <> struct is_integral<unsigned char>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<unsigned short>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<unsigned int>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<unsigned long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<signed char>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<signed short>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<signed int>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<signed long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<char>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#ifndef BOOST_MSVC
|
||||
template <> struct is_integral<wchar_t>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif
|
||||
template <> struct is_integral<bool>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
|
||||
#if defined(ULLONG_MAX) || defined(ULONG_LONG_MAX)
|
||||
template <> struct is_integral<unsigned long long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<long long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER) && !defined(__MWERKS__)
|
||||
template <> struct is_integral<unsigned __int64>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<__int64>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif
|
||||
|
||||
//* is a type T a floating-point type described in the standard (3.9.1p8)
|
||||
template <typename T> struct is_float
|
||||
{ BOOST_DECL_MC(bool, value, false); };
|
||||
template <> struct is_float<float>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_float<double>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_float<long double>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
|
||||
//
|
||||
// declare cv-qualified specialisations of these templates only
|
||||
// if BOOST_NO_CV_SPECIALIZATIONS is not defined:
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <> struct is_void<const void>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_void<volatile void>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_void<const volatile void>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif
|
||||
#ifndef BOOST_NO_CV_SPECIALIZATIONS
|
||||
// const-variations:
|
||||
template <> struct is_integral<const unsigned char>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const unsigned short>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const unsigned int>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const unsigned long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const signed char>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const signed short>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const signed int>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const signed long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const char>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#ifndef BOOST_MSVC
|
||||
template <> struct is_integral<const wchar_t>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif
|
||||
template <> struct is_integral<const bool>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
|
||||
#if defined(ULLONG_MAX) || defined(ULONG_LONG_MAX)
|
||||
template <> struct is_integral<const unsigned long long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const long long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif // ULLONG_MAX
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER) && !defined(__MWERKS__)
|
||||
template <> struct is_integral<const unsigned __int64>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const __int64>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif //__int64
|
||||
|
||||
template <> struct is_float<const float>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_float<const double>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_float<const long double>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
|
||||
// volatile-variations:
|
||||
template <> struct is_integral<volatile unsigned char>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<volatile unsigned short>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<volatile unsigned int>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<volatile unsigned long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<volatile signed char>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<volatile signed short>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<volatile signed int>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<volatile signed long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<volatile char>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#ifndef BOOST_MSVC
|
||||
template <> struct is_integral<volatile wchar_t>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif
|
||||
template <> struct is_integral<volatile bool>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
|
||||
#ifdef ULLONG_MAX
|
||||
template <> struct is_integral<volatile unsigned long long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<volatile long long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif // ULLONG_MAX
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER) && !defined(__MWERKS__)
|
||||
template <> struct is_integral<volatile unsigned __int64>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<volatile __int64>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif //__int64
|
||||
|
||||
template <> struct is_float<volatile float>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_float<volatile double>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_float<volatile long double>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
|
||||
// const-volatile-variations:
|
||||
template <> struct is_integral<const volatile unsigned char>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const volatile unsigned short>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const volatile unsigned int>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const volatile unsigned long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const volatile signed char>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const volatile signed short>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const volatile signed int>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const volatile signed long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const volatile char>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#ifndef BOOST_MSVC
|
||||
template <> struct is_integral<const volatile wchar_t>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif
|
||||
template <> struct is_integral<const volatile bool>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
|
||||
#ifdef ULLONG_MAX
|
||||
template <> struct is_integral<const volatile unsigned long long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const volatile long long>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif // ULLONG_MAX
|
||||
#if defined(__BORLANDC__) || defined(_MSC_VER) && !defined(__MWERKS__)
|
||||
template <> struct is_integral<const volatile unsigned __int64>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_integral<const volatile __int64>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif //__int64
|
||||
|
||||
template <> struct is_float<const volatile float>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_float<const volatile double>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <> struct is_float<const volatile long double>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
|
||||
#endif // BOOST_NO_CV_SPECIALIZATIONS
|
||||
|
||||
//* is a type T an arithmetic type described in the standard (3.9.1p8)
|
||||
template <typename T>
|
||||
struct is_arithmetic
|
||||
{
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_or<
|
||||
::boost::is_integral<T>::value,
|
||||
::boost::is_float<T>::value
|
||||
>::value));
|
||||
};
|
||||
|
||||
//* is a type T a fundamental type described in the standard (3.9.1)
|
||||
template <typename T>
|
||||
struct is_fundamental
|
||||
{
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_or<
|
||||
::boost::is_arithmetic<T>::value,
|
||||
::boost::is_void<T>::value
|
||||
>::value));
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,357 +0,0 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
//
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
//
|
||||
// defines traits classes for composite types:
|
||||
// is_array, is_pointer, is_reference, is_member_pointer, is_enum, is_union.
|
||||
//
|
||||
// Some workarounds in here use ideas suggested from "Generic<Programming>:
|
||||
// Mappings between Types and Values"
|
||||
// by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html).
|
||||
// Mat Marcus and Jesse Jones posted a version of is_pointer very similar to this one
|
||||
// on the boost list (Copyright 2000 Adobe Systems Incorporated and others.
|
||||
// All rights reserved.).
|
||||
// Fixes for is_array are based on a newgroup posting by Jonathan Lundquist.
|
||||
|
||||
#ifndef COMPOSITE_TYPE_TRAITS_HPP
|
||||
#define COMPOSITE_TYPE_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_ICE_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_FWD_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/fwd.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_CONVERSION_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/conversion_traits.hpp>
|
||||
#endif
|
||||
#ifndef CV_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/cv_traits.hpp>
|
||||
#endif
|
||||
#ifndef ARITHMETIC_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/arithmetic_traits.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* is_array
|
||||
*
|
||||
**********************************************/
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <typename T> struct is_array
|
||||
{ BOOST_DECL_MC(bool, value, false); };
|
||||
template <typename T, std::size_t N> struct is_array<T[N]>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <typename T, std::size_t N> struct is_array<const T[N]>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <typename T, std::size_t N> struct is_array<volatile T[N]>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <typename T, std::size_t N> struct is_array<const volatile T[N]>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
namespace detail{
|
||||
struct pointer_helper
|
||||
{
|
||||
pointer_helper(const volatile void*);
|
||||
};
|
||||
yes_type is_pointer_helper(pointer_helper);
|
||||
no_type is_pointer_helper(...);
|
||||
template <class T>
|
||||
yes_type is_pointer_helper3(T (*)(void));
|
||||
template <class T, class A1>
|
||||
yes_type is_pointer_helper3(T (*)(A1));
|
||||
template <class T, class A1, class A2>
|
||||
yes_type is_pointer_helper3(T (*)(A1, A2));
|
||||
template <class T, class A1, class A2, class A3>
|
||||
yes_type is_pointer_helper3(T (*)(A1, A2, A3));
|
||||
no_type is_pointer_helper3(...);
|
||||
|
||||
yes_type is_array_helper(const volatile void*, const volatile void*);
|
||||
template <class T>
|
||||
no_type is_array_helper(T*const volatile*, const volatile void*);
|
||||
no_type is_array_helper(...);
|
||||
} // namespace detail
|
||||
template <typename T>
|
||||
struct is_array
|
||||
{
|
||||
private:
|
||||
static T t;
|
||||
public:
|
||||
BOOST_DECL_MC(bool, value, (1 == sizeof(detail::is_array_helper(&t, t)))
|
||||
& !is_reference<T>::value
|
||||
& !(1 == sizeof(detail::is_pointer_helper3(t))) );
|
||||
};
|
||||
template <>
|
||||
struct is_array<void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <>
|
||||
struct is_array<const void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
template <>
|
||||
struct is_array<volatile void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
template <>
|
||||
struct is_array<const volatile void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* is_pointer
|
||||
*
|
||||
**********************************************/
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
namespace detail{
|
||||
template <typename T> struct is_pointer_helper
|
||||
{ BOOST_DECL_MC(bool, value, false); };
|
||||
template <typename T> struct is_pointer_helper<T*>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <typename T> struct is_pointer_helper<T*const>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <typename T> struct is_pointer_helper<T*volatile>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <typename T> struct is_pointer_helper<T*const volatile>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
} // namespace detail
|
||||
template <typename T> struct is_pointer
|
||||
{ BOOST_DECL_MC(bool, value, (::boost::type_traits::ice_and< ::boost::detail::is_pointer_helper<T>::value, !::boost::is_member_pointer<T>::value>::value)); };
|
||||
#else
|
||||
template <typename T>
|
||||
struct is_pointer
|
||||
{
|
||||
private:
|
||||
static T t;
|
||||
public:
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_and<
|
||||
!::boost::is_reference<T>::value,
|
||||
!::boost::is_array<T>::value,
|
||||
(::boost::type_traits::ice_or<
|
||||
(1 == sizeof(detail::is_pointer_helper(t))),
|
||||
(1 == sizeof(detail::is_pointer_helper3(t)))
|
||||
>::value)
|
||||
>::value ) );
|
||||
};
|
||||
template <>
|
||||
struct is_pointer <void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <>
|
||||
struct is_pointer <const void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
template <>
|
||||
struct is_pointer <volatile void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
template <>
|
||||
struct is_pointer <const volatile void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* is_reference
|
||||
*
|
||||
**********************************************/
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <typename T> struct is_reference
|
||||
{ BOOST_DECL_MC(bool, value, false); };
|
||||
template <typename T> struct is_reference<T&>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#if defined(__BORLANDC__)
|
||||
// these are illegal specialisations; cv-qualifies applied to
|
||||
// references have no effect according to [8.3.2p1],
|
||||
// C++ Builder requires them though as it treats cv-qualified
|
||||
// references as distinct types...
|
||||
template <typename T> struct is_reference<T&const>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <typename T> struct is_reference<T&volatile>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <typename T> struct is_reference<T&const volatile>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif
|
||||
#else
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4181)
|
||||
# endif // BOOST_MSVC
|
||||
template <typename T> struct is_reference
|
||||
{
|
||||
private:
|
||||
typedef T const volatile cv_t;
|
||||
public:
|
||||
BOOST_DECL_MC(bool, value, (::boost::type_traits::ice_or<!::boost::is_const<cv_t>::value, !::boost::is_volatile<cv_t>::value>::value));
|
||||
};
|
||||
template <> struct is_reference<void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <> struct is_reference<const void>
|
||||
{ BOOST_DECL_MC(bool, value, false); };
|
||||
template <> struct is_reference<volatile void>
|
||||
{ BOOST_DECL_MC(bool, value, false); };
|
||||
template <> struct is_reference<const volatile void>
|
||||
{ BOOST_DECL_MC(bool, value, false); };
|
||||
#endif
|
||||
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
# endif // BOOST_MSVC
|
||||
#endif
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* is_union
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T> struct is_union
|
||||
{
|
||||
private:
|
||||
typedef typename remove_cv<T>::type cvt;
|
||||
public:
|
||||
BOOST_DECL_MC(bool, value, BOOST_IS_UNION(cvt));
|
||||
};
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* is_enum
|
||||
*
|
||||
**********************************************/
|
||||
namespace detail{
|
||||
struct int_convertible
|
||||
{
|
||||
int_convertible(int);
|
||||
};
|
||||
} // namespace detail
|
||||
#ifndef __BORLANDC__
|
||||
template <typename T> struct is_enum
|
||||
{
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_and<
|
||||
!::boost::is_arithmetic<T>::value,
|
||||
!::boost::is_reference<T>::value,
|
||||
::boost::is_convertible<T, detail::int_convertible>::value
|
||||
>::value));
|
||||
};
|
||||
#else // __BORLANDC__
|
||||
//
|
||||
// buggy is_convertible prevents working
|
||||
// implementation of is_enum:
|
||||
template <typename T> struct is_enum
|
||||
{
|
||||
public:
|
||||
BOOST_DECL_MC(bool, value, BOOST_IS_ENUM(T));
|
||||
};
|
||||
#endif
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* is_member_pointer
|
||||
*
|
||||
**********************************************/
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <typename T> struct is_member_pointer
|
||||
{ BOOST_DECL_MC(bool, value, false); };
|
||||
template <typename T, typename U> struct is_member_pointer<U T::*>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#ifdef __GNUC__
|
||||
// gcc workaround (JM 02 Oct 2000)
|
||||
template <typename T, typename U> struct is_member_pointer<U (T::*)(void)>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <typename T, typename U, typename A1> struct is_member_pointer<U (T::*)(A1)>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <typename T, typename U, typename A1, typename A2> struct is_member_pointer<U (T::*)(A1, A2)>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <typename T, typename U, typename A1, typename A2, typename A3> struct is_member_pointer<U (T::*)(A1, A2, A3)>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <typename T, typename U, typename A1, typename A2, typename A3, typename A4> struct is_member_pointer<U (T::*)(A1, A2, A3, A4)>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <typename T, typename U, typename A1, typename A2, typename A3, typename A4, typename A5> struct is_member_pointer<U (T::*)(A1, A2, A3, A4, A5)>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
#endif
|
||||
#else
|
||||
namespace detail{
|
||||
template <class T, class U>
|
||||
yes_type is_member_pointer_helper(T (U::*));
|
||||
template <class T, class U>
|
||||
yes_type is_member_pointer_helper(T (U::*)(void));
|
||||
template <class T, class U, class A1>
|
||||
yes_type is_member_pointer_helper(T (U::*)(A1));
|
||||
template <class T, class U, class A1, class A2>
|
||||
yes_type is_member_pointer_helper(T (U::*)(A1, A2));
|
||||
template <class T, class U, class A1, class A2, class A3>
|
||||
yes_type is_member_pointer_helper(T (U::*)(A1, A2, A3));
|
||||
template <class T, class U, class A1, class A2, class A3, class A4>
|
||||
yes_type is_member_pointer_helper(T (U::*)(A1, A2, A3, A4));
|
||||
template <class T, class U, class A1, class A2, class A3, class A4, class A5>
|
||||
yes_type is_member_pointer_helper(T (U::*)(A1, A2, A3, A4, A5));
|
||||
no_type is_member_pointer_helper(...);
|
||||
}
|
||||
template <typename T>
|
||||
struct is_member_pointer
|
||||
{
|
||||
private:
|
||||
static T t;
|
||||
public:
|
||||
BOOST_DECL_MC(bool, value, (1 == sizeof(detail::is_member_pointer_helper(t))) );
|
||||
};
|
||||
template <>
|
||||
struct is_member_pointer<void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <>
|
||||
struct is_member_pointer<const void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
template <>
|
||||
struct is_member_pointer<volatile void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
template <>
|
||||
struct is_member_pointer<const volatile void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // COMPOSITE_TYPE_TRAITS_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,224 +0,0 @@
|
||||
|
||||
// Copyright (C) 2000 John Maddock (john_maddock@compuserve.com)
|
||||
// Copyright (C) 2000 Jeremy Siek (jsiek@lsc.nd.edu)
|
||||
// Copyright (C) 1999, 2000 Jaakko J<>rvi (jaakko.jarvi@cs.utu.fi)
|
||||
//
|
||||
// Permission to copy and use this software is granted,
|
||||
// provided this copyright notice appears in all copies.
|
||||
// Permission to modify the code and to distribute modified code is granted,
|
||||
// provided this copyright notice appears in all copies, and a notice
|
||||
// that the code was modified is included with the copyright notice.
|
||||
//
|
||||
// This software is provided "as is" without express or implied warranty,
|
||||
// and with no claim as to its suitability for any purpose.
|
||||
|
||||
#ifndef BOOST_CONVERSION_TYPE_TRAITS_HPP
|
||||
#define BOOST_CONVERSION_TYPE_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_ICE_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_FWD_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/fwd.hpp>
|
||||
#endif
|
||||
#ifndef ARITHMETIC_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/arithmetic_traits.hpp>
|
||||
#endif
|
||||
//
|
||||
// is one type convertable to another?
|
||||
//
|
||||
// there are multiple versions of the is_convertible
|
||||
// template, almost every compiler seems to require its
|
||||
// own version.
|
||||
//
|
||||
// Thanks to Andrei Alexandrescu for the original version of the
|
||||
// conversion detection technique!
|
||||
//
|
||||
|
||||
namespace boost{
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
|
||||
//
|
||||
// MS specific version:
|
||||
//
|
||||
namespace detail{
|
||||
|
||||
// This workaround is necessary to handle when From is void
|
||||
// which is normally taken care of by the partial specialization
|
||||
// of the is_convertible class.
|
||||
using ::boost::type_traits::yes_type;
|
||||
using ::boost::type_traits::no_type;
|
||||
|
||||
struct from_not_void_conversion {
|
||||
template <class From, class To>
|
||||
struct bind {
|
||||
static no_type check(...);
|
||||
static yes_type check(To);
|
||||
public:
|
||||
void foo(); // avoid warning about all members being private
|
||||
static From from;
|
||||
enum { exists = sizeof( check(from) ) == sizeof(yes_type) };
|
||||
};
|
||||
};
|
||||
struct from_is_void_conversion {
|
||||
template <class From, class To>
|
||||
struct bind {
|
||||
enum { exists = ::boost::is_void<To>::value };
|
||||
};
|
||||
};
|
||||
|
||||
template <class From>
|
||||
struct conversion_helper {
|
||||
typedef from_not_void_conversion type;
|
||||
};
|
||||
template <>
|
||||
struct conversion_helper<void> {
|
||||
typedef from_is_void_conversion type;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
template <class From, class To>
|
||||
struct is_convertible
|
||||
{
|
||||
typedef typename detail::conversion_helper<From>::type Selector;
|
||||
typedef Selector::template bind<From,To> Conversion;
|
||||
public:
|
||||
enum { value = Conversion::exists };
|
||||
};
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
//
|
||||
// special version for Borland compilers
|
||||
// this version breaks when used for some
|
||||
// UDT conversions:
|
||||
//
|
||||
template <class From, class To>
|
||||
struct is_convertible_helper
|
||||
{
|
||||
private:
|
||||
// This workaround for Borland breaks the EDG C++ frontend,
|
||||
// so we only use it for Borland.
|
||||
template <class T>
|
||||
struct checker
|
||||
{
|
||||
static type_traits::no_type check(...);
|
||||
static type_traits::yes_type check(T);
|
||||
};
|
||||
static From from;
|
||||
public:
|
||||
static const bool value = sizeof( checker<To>::check(from) ) == sizeof(type_traits::yes_type);
|
||||
|
||||
void foo(); // avoid warning about all members being private
|
||||
};
|
||||
|
||||
template <class From, class To>
|
||||
struct is_convertible
|
||||
{
|
||||
private:
|
||||
typedef is_convertible_helper<From, To> c_type;
|
||||
enum{ v = c_type::value };
|
||||
char force_it[v ? 1 : 2];
|
||||
public:
|
||||
static const bool value = is_convertible_helper<From, To>::value;
|
||||
};
|
||||
|
||||
template <class From>
|
||||
struct is_convertible<From, void>
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
template <class To>
|
||||
struct is_convertible<void, To>
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
template <>
|
||||
struct is_convertible<void, void>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
//
|
||||
// special version for gcc compiler
|
||||
//
|
||||
namespace detail{
|
||||
struct any_conversion
|
||||
{
|
||||
template <class T>
|
||||
any_conversion(const T&);
|
||||
};
|
||||
template <class T>
|
||||
struct checker
|
||||
{
|
||||
static boost::type_traits::no_type check(any_conversion ...);
|
||||
static boost::type_traits::yes_type check(T, int);
|
||||
};
|
||||
} // namespace detail
|
||||
template <class From, class To>
|
||||
struct is_convertible
|
||||
{
|
||||
private:
|
||||
static From from;
|
||||
public:
|
||||
static const bool value = sizeof( detail::checker<To>::check(from, 0) ) == sizeof(type_traits::yes_type);
|
||||
|
||||
void foo(); // avoid warning about all members being private
|
||||
};
|
||||
|
||||
template <class From>
|
||||
struct is_convertible<From, void>
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
template <class To>
|
||||
struct is_convertible<void, To>
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
template <>
|
||||
struct is_convertible<void, void>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template <class From, class To>
|
||||
struct is_convertible
|
||||
{
|
||||
private:
|
||||
static type_traits::no_type check(...);
|
||||
static type_traits::yes_type check(To);
|
||||
static From from;
|
||||
public:
|
||||
BOOST_DECL_MC(bool, value, sizeof( check(from) ) == sizeof(type_traits::yes_type));
|
||||
void foo(); // avoid warning about all members being private
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <class From>
|
||||
struct is_convertible<From, void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
|
||||
template <class To>
|
||||
struct is_convertible<void, To>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_convertible<void, void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, true);
|
||||
};
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
#endif // is_convertible
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
@ -1,214 +0,0 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
//
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
//
|
||||
// defines traits classes for cv-qualified types:
|
||||
// is_const, is_volatile, remove_const, remove_volatile, remove_cv.
|
||||
//
|
||||
|
||||
#ifndef CV_TYPE_TRAITS_HPP
|
||||
#define CV_TYPE_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_ICE_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_FWD_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/fwd.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
namespace detail{
|
||||
//
|
||||
// implementation helper:
|
||||
//
|
||||
template <class T>
|
||||
struct cv_traits_imp{};
|
||||
|
||||
template <class T>
|
||||
struct cv_traits_imp<T*>
|
||||
{
|
||||
BOOST_DECL_MC(bool, is_const, false);
|
||||
BOOST_DECL_MC(bool, is_volatile, false);
|
||||
typedef T unqualified_type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct cv_traits_imp<const T*>
|
||||
{
|
||||
BOOST_DECL_MC(bool, is_const, true);
|
||||
BOOST_DECL_MC(bool, is_volatile, false);
|
||||
typedef T unqualified_type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct cv_traits_imp<volatile T*>
|
||||
{
|
||||
BOOST_DECL_MC(bool, is_const, false);
|
||||
BOOST_DECL_MC(bool, is_volatile, true);
|
||||
typedef T unqualified_type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct cv_traits_imp<const volatile T*>
|
||||
{
|
||||
BOOST_DECL_MC(bool, is_const, true);
|
||||
BOOST_DECL_MC(bool, is_volatile, true);
|
||||
typedef T unqualified_type;
|
||||
};
|
||||
|
||||
template <class T, bool is_vol>
|
||||
struct remove_const_helper
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
template <class T>
|
||||
struct remove_const_helper<T, true>
|
||||
{
|
||||
typedef volatile T type;
|
||||
};
|
||||
|
||||
template <class T, bool is_vol>
|
||||
struct remove_volatile_helper
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
template <class T>
|
||||
struct remove_volatile_helper<T, true>
|
||||
{
|
||||
typedef const T type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// * convert a type T to a non-volatile type - remove_volatile<T>
|
||||
template <typename T>
|
||||
struct remove_volatile
|
||||
{
|
||||
typedef typename detail::cv_traits_imp<T*>::unqualified_type uq_type;
|
||||
typedef typename detail::remove_volatile_helper<uq_type, ::boost::is_const<T>::value>::type type;
|
||||
};
|
||||
template <typename T> struct remove_volatile<T&>{ typedef T& type; };
|
||||
|
||||
// * convert a type T to non-const type - remove_const<T>
|
||||
template <typename T>
|
||||
struct remove_const
|
||||
{
|
||||
typedef typename detail::cv_traits_imp<T*>::unqualified_type uq_type;
|
||||
typedef typename detail::remove_const_helper<uq_type, ::boost::is_volatile<T>::value>::type type;
|
||||
};
|
||||
template <typename T> struct remove_const<T&>{ typedef T& type; };
|
||||
|
||||
// convert a type T to a non-cv-qualified type - remove_cv<T>
|
||||
template <typename T>
|
||||
struct remove_cv
|
||||
{
|
||||
typedef typename detail::cv_traits_imp<T*>::unqualified_type type;
|
||||
};
|
||||
template <typename T> struct remove_cv<T&>{ typedef T& type; };
|
||||
|
||||
//* is a type T declared const - is_const<T>
|
||||
template <typename T>
|
||||
struct is_const
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, detail::cv_traits_imp<T*>::is_const);
|
||||
};
|
||||
|
||||
//* is a type T declared volatile - is_volatile<T>
|
||||
template <typename T>
|
||||
struct is_volatile
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, detail::cv_traits_imp<T*>::is_volatile);
|
||||
};
|
||||
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
// The following three don't work:
|
||||
template <typename T> struct remove_volatile{ typedef T type; };
|
||||
template <typename T> struct remove_const{ typedef T type; };
|
||||
template <typename T> struct remove_cv{ typedef T type; };
|
||||
|
||||
namespace detail{
|
||||
using ::boost::type_traits::yes_type;
|
||||
using ::boost::type_traits::no_type;
|
||||
yes_type is_const_helper(const volatile void*);
|
||||
no_type is_const_helper(volatile void *);
|
||||
yes_type is_volatile_helper(const volatile void*);
|
||||
no_type is_volatile_helper(const void *);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct is_const
|
||||
{
|
||||
private:
|
||||
static T t;
|
||||
public:
|
||||
BOOST_DECL_MC(bool, value, (sizeof(detail::yes_type) == sizeof(detail::is_const_helper(&t))));
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_const<void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <>
|
||||
struct is_const<const void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, true);
|
||||
};
|
||||
template <>
|
||||
struct is_const<volatile void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
template <>
|
||||
struct is_const<const volatile void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, true);
|
||||
};
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
struct is_volatile
|
||||
{
|
||||
private:
|
||||
static T t;
|
||||
public:
|
||||
BOOST_DECL_MC(bool, value, (sizeof(detail::yes_type) == sizeof(detail::is_volatile_helper(&t))));
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_volatile<void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <>
|
||||
struct is_volatile<const void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
template <>
|
||||
struct is_volatile<volatile void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, true);
|
||||
};
|
||||
template <>
|
||||
struct is_volatile<const volatile void>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, true);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // CV_TYPE_TRAITS_HPP
|
||||
|
||||
|
@ -1,140 +0,0 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
//
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
//
|
||||
// forward declarations of type_traits classes
|
||||
//
|
||||
#ifndef BOOST_FWD_TYPE_TRAITS_HPP
|
||||
#define BOOST_FWD_TYPE_TRAITS_HPP
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
//
|
||||
// Helper macros for builtin compiler support.
|
||||
// If your compiler has builtin support for any of the following
|
||||
// traits concepts, then redefine the appropriate macros to pick
|
||||
// up on the compiler support:
|
||||
//
|
||||
// (these should largely ignore cv-qualifiers)
|
||||
// BOOST_IS_CLASS(T) should evaluate to true if T is a class or struct type
|
||||
// BOOST_IS_ENUM(T) should evaluate to true if T is an enumerator type
|
||||
// BOOST_IS_UNION(T) should evaluate to true if T is a union type
|
||||
// BOOST_IS_POD(T) should evaluate to true if T is a POD type
|
||||
// BOOST_IS_EMPTY(T) should evaluate to true if T is an empty struct or union
|
||||
// BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) should evaluate to true if "T x;" has no effect
|
||||
// BOOST_HAS_TRIVIAL_COPY(T) should evaluate to true if T(t) <==> memcpy
|
||||
// BOOST_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy
|
||||
// BOOST_HAS_TRIVIAL_DESTRUCTOR(T) should evaluate to true if ~T() has no effect
|
||||
|
||||
#define BOOST_IS_CLASS(T) false
|
||||
#define BOOST_IS_ENUM(T) false
|
||||
#define BOOST_IS_UNION(T) false
|
||||
#define BOOST_IS_POD(T) false
|
||||
#define BOOST_IS_EMPTY(T) false
|
||||
#define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) false
|
||||
#define BOOST_HAS_TRIVIAL_COPY(T) false
|
||||
#define BOOST_HAS_TRIVIAL_ASSIGN(T) false
|
||||
#define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) false
|
||||
|
||||
|
||||
namespace boost{
|
||||
//
|
||||
// forward declare all type traits templates here
|
||||
//
|
||||
// conversion_traits.hpp:
|
||||
template <class From, class To>
|
||||
struct is_convertible;
|
||||
// alignment_traits.hpp:
|
||||
template <class T>
|
||||
struct alignment_of;
|
||||
// arithmetic_traits.hpp:
|
||||
template <class T>
|
||||
struct is_void;
|
||||
template <class T>
|
||||
struct is_integral;
|
||||
template <class T>
|
||||
struct is_float;
|
||||
template <class T>
|
||||
struct is_arithmetic;
|
||||
template <class T>
|
||||
struct is_fundamental;
|
||||
|
||||
// cv_traits.hpp:
|
||||
template <class T>
|
||||
struct is_const;
|
||||
template <class T>
|
||||
struct is_volatile;
|
||||
template <class T>
|
||||
struct remove_const;
|
||||
template <class T>
|
||||
struct remove_volatile;
|
||||
template <class T>
|
||||
struct remove_cv;
|
||||
|
||||
// composite_traits.hpp:
|
||||
template <class T>
|
||||
struct is_array;
|
||||
template <class T>
|
||||
struct is_pointer;
|
||||
template <class T>
|
||||
struct is_reference;
|
||||
template <class T>
|
||||
struct is_member_pointer;
|
||||
template <class T>
|
||||
struct is_enum;
|
||||
template <class T>
|
||||
struct is_union;
|
||||
|
||||
// object_traits.hpp:
|
||||
template <class T>
|
||||
struct is_object;
|
||||
template <class T>
|
||||
struct is_scalar;
|
||||
template <class T>
|
||||
struct is_class;
|
||||
template <class T>
|
||||
struct is_compound;
|
||||
template <class T>
|
||||
struct is_POD;
|
||||
template <class T>
|
||||
struct has_trivial_constructor;
|
||||
template <class T>
|
||||
struct has_trivial_copy;
|
||||
template <class T>
|
||||
struct has_trivial_assign;
|
||||
template <class T>
|
||||
struct has_trivial_destructor;
|
||||
template <class T>
|
||||
struct is_empty;
|
||||
|
||||
// transform_traits.hpp:
|
||||
template <class T>
|
||||
struct remove_reference;
|
||||
template <class T>
|
||||
struct add_reference;
|
||||
template <class T>
|
||||
struct remove_bounds;
|
||||
template <class T>
|
||||
struct remove_pointer;
|
||||
template <class T>
|
||||
struct add_pointer;
|
||||
|
||||
// same_traits.hpp:
|
||||
template <class T, class U>
|
||||
struct is_same;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_FWD_TYPE_TRAITS_HPP
|
||||
|
||||
|
||||
|
||||
|
@ -1,76 +0,0 @@
|
||||
|
||||
// (C) Copyright John Maddock and Steve Cleary 2000.
|
||||
// Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
//
|
||||
// macros and helpers for working with integral-constant-expressions.
|
||||
|
||||
#ifndef BOOST_ICE_TYPE_TRAITS_HPP
|
||||
#define BOOST_ICE_TYPE_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
#define BOOST_DECL_MC(type, name, value) enum{name = value }
|
||||
#define BOOST_DECL_MC2(type, name, v1, v2) enum{name = v1,v2 }
|
||||
#else
|
||||
#define BOOST_DECL_MC(type, name, value) static const type name = value
|
||||
#define BOOST_DECL_MC2(type, name, v1, v2) static const type name = v1,v2
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost{
|
||||
namespace type_traits{
|
||||
|
||||
typedef char yes_type;
|
||||
typedef double no_type;
|
||||
|
||||
template <bool b>
|
||||
struct ice_not
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
template <>
|
||||
struct ice_not<true>
|
||||
{ BOOST_DECL_MC(bool, value, false); };
|
||||
|
||||
template <bool b1, bool b2, bool b3 = false, bool b4 = false, bool b5 = false, bool b6 = false, bool b7 = false>
|
||||
struct ice_or;
|
||||
template <bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7>
|
||||
struct ice_or
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, true);
|
||||
};
|
||||
template <>
|
||||
struct ice_or<false, false, false, false, false, false, false>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
|
||||
template <bool b1, bool b2, bool b3 = true, bool b4 = true, bool b5 = true, bool b6 = true, bool b7 = true>
|
||||
struct ice_and;
|
||||
template <bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7>
|
||||
struct ice_and
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, false);
|
||||
};
|
||||
template <>
|
||||
struct ice_and<true, true, true, true, true, true, true>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, true);
|
||||
};
|
||||
|
||||
|
||||
} // namespace type_traits
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ICE_TYPE_TRAITS_HPP
|
||||
|
||||
|
||||
|
||||
|
@ -1,318 +0,0 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
//
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
//
|
||||
// defines object traits classes:
|
||||
// is_object, is_scalar, is_class, is_compound, is_POD,
|
||||
// has_trivial_constructor, has_trivial_copy, has_trivial_assign,
|
||||
// has_trivial_destructor, is_empty.
|
||||
//
|
||||
|
||||
#ifndef OBJECT_TYPE_TRAITS_HPP
|
||||
#define OBJECT_TYPE_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_ICE_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_FWD_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/fwd.hpp>
|
||||
#endif
|
||||
#ifndef COMPOSITE_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/composite_traits.hpp>
|
||||
#endif
|
||||
#ifndef ARITHMETIC_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/arithmetic_traits.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* is_object
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T>
|
||||
struct is_object
|
||||
{
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_and<
|
||||
!::boost::is_reference<T>::value,
|
||||
!::boost::is_void<T>::value
|
||||
>::value));
|
||||
};
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* is_scalar
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T>
|
||||
struct is_scalar
|
||||
{
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_or<
|
||||
::boost::is_arithmetic<T>::value,
|
||||
::boost::is_enum<T>::value,
|
||||
::boost::is_pointer<T>::value,
|
||||
::boost::is_member_pointer<T>::value
|
||||
>::value));
|
||||
};
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* is_class
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T>
|
||||
struct is_class
|
||||
{
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_and<
|
||||
!::boost::is_union<T>::value,
|
||||
!::boost::is_scalar<T>::value,
|
||||
!::boost::is_array<T>::value,
|
||||
!::boost::is_reference<T>::value,
|
||||
!::boost::is_void<T>::value
|
||||
>::value));
|
||||
};
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* is_compound
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T> struct is_compound
|
||||
{
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_or<
|
||||
::boost::is_array<T>::value,
|
||||
::boost::is_pointer<T>::value,
|
||||
::boost::is_reference<T>::value,
|
||||
::boost::is_class<T>::value,
|
||||
::boost::is_union<T>::value,
|
||||
::boost::is_enum<T>::value,
|
||||
::boost::is_member_pointer<T>::value
|
||||
>::value));
|
||||
};
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* is_POD
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T> struct is_POD
|
||||
{
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_or<
|
||||
::boost::is_scalar<T>::value,
|
||||
::boost::is_void<T>::value,
|
||||
BOOST_IS_POD(T)
|
||||
>::value));
|
||||
};
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <typename T, std::size_t sz>
|
||||
struct is_POD<T[sz]>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value, ::boost::is_POD<T>::value);
|
||||
};
|
||||
#endif
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* has_trivial_constructor
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T>
|
||||
struct has_trivial_constructor
|
||||
{
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_or<
|
||||
::boost::is_POD<T>::value,
|
||||
BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)
|
||||
>::value));
|
||||
};
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* has_trivial_copy
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T>
|
||||
struct has_trivial_copy
|
||||
{
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_and<
|
||||
::boost::type_traits::ice_or<
|
||||
::boost::is_POD<T>::value,
|
||||
BOOST_HAS_TRIVIAL_COPY(T)
|
||||
>::value,
|
||||
!::boost::is_volatile<T>::value
|
||||
>::value));
|
||||
};
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* has_trivial_assign
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T>
|
||||
struct has_trivial_assign
|
||||
{
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_and<
|
||||
::boost::type_traits::ice_or<
|
||||
::boost::is_POD<T>::value,
|
||||
BOOST_HAS_TRIVIAL_ASSIGN(T)
|
||||
>::value,
|
||||
!::boost::is_const<T>::value,
|
||||
!::boost::is_volatile<T>::value
|
||||
>::value));
|
||||
};
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* has_trivial_destructor
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T>
|
||||
struct has_trivial_destructor
|
||||
{
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_or<
|
||||
::boost::is_POD<T>::value,
|
||||
BOOST_HAS_TRIVIAL_DESTRUCTOR(T)
|
||||
>::value));
|
||||
};
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* is_empty
|
||||
*
|
||||
**********************************************/
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
namespace detail{
|
||||
|
||||
template <typename T>
|
||||
struct empty_helper_t1 : public T
|
||||
{
|
||||
#ifdef __MWERKS__
|
||||
empty_helper_t1(); // hh compiler bug workaround
|
||||
#endif
|
||||
int i[256];
|
||||
};
|
||||
struct empty_helper_t2 { int i[256]; };
|
||||
|
||||
template <typename T, bool b, bool b2>
|
||||
struct empty_helper{ BOOST_DECL_MC(bool, value, false); };
|
||||
|
||||
template <typename T>
|
||||
struct empty_helper<T, true, false>
|
||||
{
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(sizeof(empty_helper_t1<T>) == sizeof(empty_helper_t2)));
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct is_empty
|
||||
{
|
||||
private:
|
||||
typedef typename remove_cv<T>::type cvt;
|
||||
public:
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_or<
|
||||
::boost::detail::empty_helper<T,
|
||||
::boost::is_class<T>::value ,
|
||||
::boost::is_convertible<T,int>::value
|
||||
>::value,
|
||||
BOOST_IS_EMPTY(cvt)
|
||||
>::value));
|
||||
};
|
||||
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES)
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <typename T>
|
||||
struct empty_helper_t1 : public T
|
||||
{
|
||||
int i[256];
|
||||
};
|
||||
struct empty_helper_t2 { int i[256]; };
|
||||
|
||||
template <typename T>
|
||||
struct empty_helper_base
|
||||
{
|
||||
enum{ value = (sizeof(empty_helper_t1<T>) == sizeof(empty_helper_t2)) };
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct empty_helper_nonbase
|
||||
{
|
||||
enum{ value = false };
|
||||
};
|
||||
|
||||
template <bool base>
|
||||
struct empty_helper_chooser
|
||||
{
|
||||
template <class T>
|
||||
struct rebind
|
||||
{
|
||||
typedef empty_helper_nonbase<T> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct empty_helper_chooser<true>
|
||||
{
|
||||
template <class T>
|
||||
struct rebind
|
||||
{
|
||||
typedef empty_helper_base<T> type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename T>
|
||||
struct is_empty
|
||||
{
|
||||
private:
|
||||
typedef ::boost::detail::empty_helper_chooser<
|
||||
::boost::type_traits::ice_and<
|
||||
!::boost::is_convertible<T,int>::value,
|
||||
!::boost::is_convertible<T,double>::value,
|
||||
!::boost::is_pointer<T>::value,
|
||||
!::boost::is_member_pointer<T>::value,
|
||||
!::boost::is_array<T>::value,
|
||||
!::boost::is_void<T>::value,
|
||||
!::boost::is_convertible<T, const volatile void*>::value
|
||||
>::value> chooser;
|
||||
typedef typename chooser::template rebind<T> bound_type;
|
||||
typedef typename bound_type::type eh_type;
|
||||
public:
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_or<eh_type::value, BOOST_IS_EMPTY(T)>::value));
|
||||
};
|
||||
|
||||
#else
|
||||
template <typename T> struct is_empty
|
||||
{ enum{ value = BOOST_IS_EMPTY(T) }; };
|
||||
#endif // defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES)
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // OBJECT_TYPE_TRAITS_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,90 +0,0 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant & John Maddock 2000.
|
||||
// Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
//
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
//
|
||||
// defines is_same:
|
||||
|
||||
#ifndef SAME_TRAITS_HPP
|
||||
#define SAME_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_ICE_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_FWD_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/fwd.hpp>
|
||||
#endif
|
||||
#if !defined(COMPOSITE_TYPE_TRAITS_HPP) && defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC)
|
||||
#include <boost/type_traits/composite_traits.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* is_same
|
||||
*
|
||||
**********************************************/
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
template <typename T, typename U>
|
||||
struct is_same
|
||||
{ BOOST_DECL_MC(bool, value, false); };
|
||||
|
||||
template <typename T>
|
||||
struct is_same<T, T>
|
||||
{ BOOST_DECL_MC(bool, value, true); };
|
||||
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
|
||||
namespace detail{
|
||||
|
||||
template<class T1>
|
||||
struct is_same_part_1 {
|
||||
template<class T2> struct part_2 { enum { value = false }; };
|
||||
template<> struct part_2<T1> { enum { value = true }; };
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class T1, class T2>
|
||||
struct is_same : detail::is_same_part_1<T1>::template part_2<T2> {};
|
||||
|
||||
#else // BOOST_MSVC
|
||||
|
||||
namespace detail{
|
||||
template <class T>
|
||||
::boost::type_traits::yes_type is_same_helper(T*, T*);
|
||||
::boost::type_traits::no_type is_same_helper(...);
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
struct is_same
|
||||
{
|
||||
private:
|
||||
static T t;
|
||||
static U u;
|
||||
public:
|
||||
BOOST_DECL_MC(bool, value,
|
||||
(::boost::type_traits::ice_and<
|
||||
(sizeof(type_traits::yes_type) == sizeof(detail::is_same_helper(&t,&u))),
|
||||
(::boost::is_reference<T>::value == ::boost::is_reference<U>::value),
|
||||
(sizeof(T) == sizeof(U))
|
||||
>::value));
|
||||
};
|
||||
|
||||
#endif // BOOST_MSVC
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // SAME_TRAITS_HPP
|
||||
|
||||
|
||||
|
@ -1,187 +0,0 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
//
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
//
|
||||
// defines traits classes for transforming one type to another:
|
||||
// remove_reference, add_reference, remove_bounds, remove_pointer.
|
||||
//
|
||||
|
||||
#ifndef TRANSFORM_TRAITS_HPP
|
||||
#define TRANSFORM_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_ICE_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_FWD_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/fwd.hpp>
|
||||
#endif
|
||||
#if !defined(COMPOSITE_TYPE_TRAITS_HPP) && defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
#include <boost/type_traits/composite_traits.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* remove_reference
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T>
|
||||
struct remove_reference
|
||||
{ typedef T type; };
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <typename T>
|
||||
struct remove_reference<T&>
|
||||
{ typedef T type; };
|
||||
#endif
|
||||
#if defined(__BORLANDC__) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
// these are illegal specialisations; cv-qualifies applied to
|
||||
// references have no effect according to [8.3.2p1],
|
||||
// C++ Builder requires them though as it treats cv-qualified
|
||||
// references as distinct types...
|
||||
template <typename T>
|
||||
struct remove_reference<T&const>
|
||||
{ typedef T type; };
|
||||
template <typename T>
|
||||
struct remove_reference<T&volatile>
|
||||
{ typedef T type; };
|
||||
template <typename T>
|
||||
struct remove_reference<T&const volatile>
|
||||
{ typedef T type; };
|
||||
#endif
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* add_reference
|
||||
*
|
||||
**********************************************/
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <typename T>
|
||||
struct add_reference
|
||||
{ typedef T& type; };
|
||||
template <typename T>
|
||||
struct add_reference<T&>
|
||||
{ typedef T& type; };
|
||||
#elif defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES)
|
||||
namespace detail{
|
||||
|
||||
template <bool>
|
||||
struct reference_adder
|
||||
{
|
||||
template <class T>
|
||||
struct rebind
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct reference_adder<true>
|
||||
{
|
||||
template <class T>
|
||||
struct rebind
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename T>
|
||||
struct add_reference
|
||||
{
|
||||
private:
|
||||
typedef typename detail::reference_adder< ::boost::is_reference<T>::value>::template rebind<T> binder;
|
||||
public:
|
||||
typedef typename binder::type type;
|
||||
};
|
||||
|
||||
#else
|
||||
template <typename T>
|
||||
struct add_reference
|
||||
{ typedef T& type; };
|
||||
#endif
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* remove_bounds
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T>
|
||||
struct remove_bounds
|
||||
{ typedef T type; };
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <typename T, std::size_t N>
|
||||
struct remove_bounds<T[N]>
|
||||
{ typedef T type; };
|
||||
template <typename T, std::size_t N>
|
||||
struct remove_bounds<const T[N]>
|
||||
{ typedef const T type; };
|
||||
template <typename T, std::size_t N>
|
||||
struct remove_bounds<volatile T[N]>
|
||||
{ typedef volatile T type; };
|
||||
template <typename T, std::size_t N>
|
||||
struct remove_bounds<const volatile T[N]>
|
||||
{ typedef const volatile T type; };
|
||||
#endif
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* remove_pointer
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T>
|
||||
struct remove_pointer
|
||||
{ typedef T type; };
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <typename T>
|
||||
struct remove_pointer<T*>
|
||||
{ typedef T type; };
|
||||
template <typename T>
|
||||
struct remove_pointer<T*const>
|
||||
{ typedef T type; };
|
||||
template <typename T>
|
||||
struct remove_pointer<T*volatile>
|
||||
{ typedef T type; };
|
||||
template <typename T>
|
||||
struct remove_pointer<T*const volatile>
|
||||
{ typedef T type; };
|
||||
#endif
|
||||
|
||||
/**********************************************
|
||||
*
|
||||
* add_pointer
|
||||
*
|
||||
**********************************************/
|
||||
template <typename T>
|
||||
struct add_pointer
|
||||
{
|
||||
private:
|
||||
typedef typename remove_reference<T>::type no_ref_type;
|
||||
typedef typename remove_bounds<no_ref_type>::type no_b_type;
|
||||
public:
|
||||
typedef no_b_type* type;
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
//
|
||||
// if there is no partial specialisation support
|
||||
// include a bunch of full specialisations as a workaround:
|
||||
//
|
||||
#include <boost/type_traits/transform_traits_spec.hpp>
|
||||
#else
|
||||
#define BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(x)
|
||||
#endif
|
||||
|
||||
#endif // TRANSFORM_TRAITS_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,74 +0,0 @@
|
||||
|
||||
// Copyright (c) 2001 Aleksey Gurtovoy.
|
||||
// Permission to copy, use, modify, sell and distribute this software is
|
||||
// granted provided this copyright notice appears in all copies.
|
||||
// This software is provided "as is" without express or implied warranty,
|
||||
// and with no claim as to its suitability for any purpose.
|
||||
|
||||
#ifndef BOOST_TT_TRANSFORM_TRAITS_SPEC_HPP
|
||||
#define BOOST_TT_TRANSFORM_TRAITS_SPEC_HPP
|
||||
|
||||
#ifndef TRANSFORM_TRAITS_HPP
|
||||
#include <boost/type_traits/transform_traits.hpp>
|
||||
#endif
|
||||
|
||||
#define BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_CONST_VOLATILE_RANK1(T) \
|
||||
template<> struct remove_const<T const> { typedef T type; }; \
|
||||
template<> struct remove_const<T const volatile> { typedef T volatile type; }; \
|
||||
template<> struct remove_volatile<T volatile> { typedef T type; }; \
|
||||
template<> struct remove_volatile<T const volatile> { typedef T const type; }; \
|
||||
template<> struct remove_cv<T const> { typedef T type; }; \
|
||||
template<> struct remove_cv<T volatile> { typedef T type; }; \
|
||||
template<> struct remove_cv<T const volatile> { typedef T type; }; \
|
||||
/**/
|
||||
|
||||
#define BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_1(T) \
|
||||
template<> struct remove_pointer<T*> { typedef T type; }; \
|
||||
template<> struct remove_reference<T&> { typedef T type; }; \
|
||||
/**/
|
||||
|
||||
#define BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_2(T) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_1(T) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_1(T const) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_1(T volatile) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_1(T const volatile) \
|
||||
/**/
|
||||
|
||||
#define BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_1(T) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_PTR_REF_RANK_2(T) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_CONST_VOLATILE_RANK1(T) \
|
||||
/**/
|
||||
|
||||
#define BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_2(T) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_1(T*) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_1(T const*) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_1(T volatile*) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_1(T const volatile*) \
|
||||
/**/
|
||||
|
||||
#define BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(T) \
|
||||
namespace boost { \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_1(T) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_2(T) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_2(T*) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_2(T const*) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_2(T volatile*) \
|
||||
BOOST_TYPE_TRAITS_SPECIALIZATION_REMOVE_ALL_RANK_2(T const volatile*) \
|
||||
} \
|
||||
/**/
|
||||
|
||||
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(char)
|
||||
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(signed char)
|
||||
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(unsigned char)
|
||||
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(signed short)
|
||||
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(unsigned short)
|
||||
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(signed int)
|
||||
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(unsigned int)
|
||||
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(signed long)
|
||||
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(unsigned long)
|
||||
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(float)
|
||||
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(double)
|
||||
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(long double)
|
||||
|
||||
#endif // BOOST_TT_TRANSFORM_TRAITS_SPEC_HPP
|
||||
|
@ -1,361 +0,0 @@
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
// common test code for type-traits tests
|
||||
// WARNING: contains code as well as declarations!
|
||||
|
||||
|
||||
#ifndef BOOST_TYPE_TRAITS_TEST_HPP
|
||||
#define BOOST_TYPE_TRAITS_TEST_HPP
|
||||
#include <iostream>
|
||||
#include <typeinfo>
|
||||
//
|
||||
// define tests here
|
||||
unsigned failures = 0;
|
||||
unsigned test_count = 0;
|
||||
//
|
||||
// This must get defined within the test file.
|
||||
// All compilers have bugs, set this to the number of
|
||||
// regressions *expected* from a given compiler,
|
||||
// if there are no workarounds for the bugs, *and*
|
||||
// the regressions have been investigated.
|
||||
//
|
||||
extern unsigned int expected_failures;
|
||||
//
|
||||
// proc check_result()
|
||||
// Checks that there were no regressions:
|
||||
//
|
||||
int check_result(int argc, char** argv)
|
||||
{
|
||||
std::cout << test_count << " tests completed, "
|
||||
<< failures << " failures found, "
|
||||
<< expected_failures << " failures expected from this compiler." << std::endl;
|
||||
if((argc == 2)
|
||||
&& (argv[1][0] == '-')
|
||||
&& (argv[1][1] == 'a')
|
||||
&& (argv[1][2] == 0))
|
||||
{
|
||||
std::cout << "Press any key to continue...";
|
||||
std::cin.get();
|
||||
}
|
||||
return (failures == expected_failures) ? 0 : failures;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// this one is to verify that a constant is indeed a
|
||||
// constant-integral-expression:
|
||||
//
|
||||
template <bool>
|
||||
struct checker
|
||||
{
|
||||
static void check(bool, bool, const char*, bool){ ++test_count; }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct checker<false>
|
||||
{
|
||||
static void check(bool o, bool n, const char* name, bool soft)
|
||||
{
|
||||
++test_count;
|
||||
++failures;
|
||||
// if this is a soft test, then failure is expected,
|
||||
// or may depend upon factors outside our control
|
||||
// (like compiler options)...
|
||||
if(soft)++expected_failures;
|
||||
std::cout << "checking value of " << name << "...failed" << std::endl;
|
||||
std::cout << "\tfound: " << n << " expected " << o << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
struct type_checker
|
||||
{
|
||||
static void check(const char* TT, const char* TU, const char* expression)
|
||||
{
|
||||
++test_count;
|
||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
if((typeid(T) != typeid(U))
|
||||
|| (::boost::is_reference<T>::value != ::boost::is_reference<U>::value)
|
||||
|| (::boost::is_const<T>::value != ::boost::is_const<U>::value)
|
||||
|| (::boost::is_volatile<T>::value != ::boost::is_volatile<U>::value))
|
||||
{
|
||||
#endif
|
||||
++failures;
|
||||
std::cout << "checking type of " << expression << "...failed" << std::endl;
|
||||
std::cout << " expected type was " << TT << std::endl;
|
||||
std::cout << " typeid(" << TT << ") was: " << typeid(T).name() << std::endl;
|
||||
std::cout << " typeid(" << TU << ") was: " << typeid(U).name() << std::endl;
|
||||
std::cout << " In template class " << typeid(type_checker<T,U>).name() << std::endl;
|
||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <class T>
|
||||
struct type_checker<T,T>
|
||||
{
|
||||
static void check(const char*, const char*, const char*)
|
||||
{
|
||||
++test_count;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#define value_test(v, x) checker<(v == x)>::check(v, x, #x, false);
|
||||
#define soft_value_test(v, x) checker<(v == x)>::check(v, x, #x, true);
|
||||
|
||||
#define value_fail(v, x) \
|
||||
++test_count; \
|
||||
++failures; \
|
||||
std::cout << "checking value of " << #x << "...failed" << std::endl; \
|
||||
std::cout << " " #x " does not compile on this compiler" << std::endl;
|
||||
|
||||
|
||||
#define type_test(v, x) type_checker<v,x>::check(#v, #x, #x);
|
||||
#define type_test3(v, x, z) type_checker<v,x,z>::check(#v, #x "," #z, #x "," #z);
|
||||
#ifndef SHORT_TRANSFORM_TEST
|
||||
#define transform_check(name, from_suffix, to_suffix)\
|
||||
type_test(bool to_suffix, name<bool from_suffix>::type);\
|
||||
type_test(char to_suffix, name<char from_suffix>::type);\
|
||||
type_test(wchar_t to_suffix, name<wchar_t from_suffix>::type);\
|
||||
type_test(signed char to_suffix, name<signed char from_suffix>::type);\
|
||||
type_test(unsigned char to_suffix, name<unsigned char from_suffix>::type);\
|
||||
type_test(short to_suffix, name<short from_suffix>::type);\
|
||||
type_test(unsigned short to_suffix, name<unsigned short from_suffix>::type);\
|
||||
type_test(int to_suffix, name<int from_suffix>::type);\
|
||||
type_test(unsigned int to_suffix, name<unsigned int from_suffix>::type);\
|
||||
type_test(long to_suffix, name<long from_suffix>::type);\
|
||||
type_test(unsigned long to_suffix, name<unsigned long from_suffix>::type);\
|
||||
type_test(float to_suffix, name<float from_suffix>::type);\
|
||||
type_test(long double to_suffix, name<long double from_suffix>::type);\
|
||||
type_test(double to_suffix, name<double from_suffix>::type);\
|
||||
type_test(UDT to_suffix, name<UDT from_suffix>::type);\
|
||||
type_test(enum1 to_suffix, name<enum1 from_suffix>::type);
|
||||
#else
|
||||
#define transform_check(name, from_suffix, to_suffix)\
|
||||
type_test(int to_suffix, name<int from_suffix>::type);\
|
||||
type_test(UDT to_suffix, name<UDT from_suffix>::type);\
|
||||
type_test(enum1 to_suffix, name<enum1 from_suffix>::type);
|
||||
#endif
|
||||
|
||||
#define boost_dummy_macro_param
|
||||
|
||||
template <class T>
|
||||
struct test_align
|
||||
{
|
||||
struct padded
|
||||
{
|
||||
char c;
|
||||
T t;
|
||||
};
|
||||
static void do_it()
|
||||
{
|
||||
padded p;
|
||||
unsigned a = reinterpret_cast<char*>(&(p.t)) - reinterpret_cast<char*>(&p);
|
||||
++test_count;
|
||||
// only fail if we do not have a multiple of the actual value:
|
||||
if((a > ::boost::alignment_of<T>::value) || (a % ::boost::alignment_of<T>::value))
|
||||
{
|
||||
++failures;
|
||||
std::cout << "checking value of " << typeid(boost::alignment_of<T>).name() << "...failed" << std::endl;
|
||||
std::cout << "\tfound: " << boost::alignment_of<T>::value << " expected " << a << std::endl;
|
||||
}
|
||||
// suppress warnings about unused variables:
|
||||
(void)p;
|
||||
(void)a;
|
||||
}
|
||||
};
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <class T>
|
||||
struct test_align<T&>
|
||||
{
|
||||
static void do_it()
|
||||
{
|
||||
//
|
||||
// we can't do the usual test because we can't take the address
|
||||
// of a reference, so check that the result is the same as for a
|
||||
// pointer type instead:
|
||||
unsigned a = boost::alignment_of<T*>::value;
|
||||
++test_count;
|
||||
if(a != boost::alignment_of<T&>::value)
|
||||
{
|
||||
++failures;
|
||||
std::cout << "checking value of " << typeid(boost::alignment_of<T&>).name() << "...failed" << std::endl;
|
||||
std::cout << "\tfound: " << boost::alignment_of<T&>::value << " expected " << a << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#define align_test(T) test_align<T>::do_it()
|
||||
|
||||
//
|
||||
// the following code allows us to test that a particular
|
||||
// template functions correctly when instanciated inside another template
|
||||
// (some bugs only show up in that situation). For each template
|
||||
// we declare one NESTED_DECL(classname) that sets up the template class
|
||||
// and multiple NESTED_TEST(classname, template-arg) declarations, to carry
|
||||
// the actual tests:
|
||||
template <bool b>
|
||||
struct nested_test
|
||||
{
|
||||
typedef nested_test type;
|
||||
bool run_time_value;
|
||||
const char* what;
|
||||
nested_test(bool b2, const char* w) : run_time_value(b2), what(w) { check(); }
|
||||
void check()
|
||||
{
|
||||
++test_count;
|
||||
if(b != run_time_value)
|
||||
{
|
||||
++failures;
|
||||
std::cerr << "Mismatch between runtime and compile time values in " << what << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#define NESTED_DECL(what)\
|
||||
template <class T> \
|
||||
struct BOOST_TT_JOIN(nested_tester_,what){\
|
||||
nested_test< (0 != ::boost::what<T>::value)> tester;\
|
||||
BOOST_TT_JOIN(nested_tester_,what)(const char* s) : tester(::boost::what<T>::value, s){}\
|
||||
};
|
||||
#define NESTED_TEST(what, with)\
|
||||
{BOOST_TT_JOIN(nested_tester_,what)<with> check(#what "<" #with ">"); (void)check;}
|
||||
|
||||
#define BOOST_TT_JOIN( X, Y ) BOOST_DO_TT_JOIN( X, Y )
|
||||
#define BOOST_DO_TT_JOIN( X, Y ) X##Y
|
||||
|
||||
|
||||
|
||||
//
|
||||
// define some types to test with:
|
||||
//
|
||||
enum enum_UDT{ one, two, three };
|
||||
struct UDT
|
||||
{
|
||||
UDT(){};
|
||||
~UDT(){};
|
||||
UDT(const UDT&);
|
||||
UDT& operator=(const UDT&);
|
||||
int i;
|
||||
|
||||
void f1();
|
||||
int f2();
|
||||
int f3(int);
|
||||
int f4(int, float);
|
||||
};
|
||||
|
||||
typedef void(*f1)();
|
||||
typedef int(*f2)(int);
|
||||
typedef int(*f3)(int, bool);
|
||||
typedef void (UDT::*mf1)();
|
||||
typedef int (UDT::*mf2)();
|
||||
typedef int (UDT::*mf3)(int);
|
||||
typedef int (UDT::*mf4)(int, float);
|
||||
typedef int (UDT::*mp);
|
||||
|
||||
// cv-qualifiers applied to reference types should have no effect
|
||||
// declare these here for later use with is_reference and remove_reference:
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4181)
|
||||
# endif // BOOST_MSVC
|
||||
typedef int& r_type;
|
||||
typedef const r_type cr_type;
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
# endif // BOOST_MSVC
|
||||
|
||||
struct POD_UDT { int x; };
|
||||
struct empty_UDT{ ~empty_UDT(){}; };
|
||||
struct empty_POD_UDT{};
|
||||
union union_UDT
|
||||
{
|
||||
int x;
|
||||
double y;
|
||||
~union_UDT();
|
||||
};
|
||||
union POD_union_UDT
|
||||
{
|
||||
int x;
|
||||
double y;
|
||||
};
|
||||
union empty_union_UDT
|
||||
{
|
||||
~empty_union_UDT();
|
||||
};
|
||||
union empty_POD_union_UDT{};
|
||||
|
||||
class Base { };
|
||||
|
||||
class Deriverd : public Base { };
|
||||
|
||||
class NonDerived { };
|
||||
|
||||
enum enum1
|
||||
{
|
||||
one_,two_
|
||||
};
|
||||
|
||||
enum enum2
|
||||
{
|
||||
three_,four_
|
||||
};
|
||||
|
||||
struct VB
|
||||
{
|
||||
virtual ~VB(){};
|
||||
};
|
||||
|
||||
struct VD : VB
|
||||
{
|
||||
~VD(){};
|
||||
};
|
||||
//
|
||||
// struct non_pointer:
|
||||
// used to verify that is_pointer does not return
|
||||
// true for class types that implement operator void*()
|
||||
//
|
||||
struct non_pointer
|
||||
{
|
||||
operator void*(){return this;}
|
||||
};
|
||||
struct non_int_pointer
|
||||
{
|
||||
int i;
|
||||
operator int*(){return &i;}
|
||||
};
|
||||
struct int_constructible
|
||||
{
|
||||
int_constructible(int);
|
||||
};
|
||||
struct int_convertible
|
||||
{
|
||||
operator int();
|
||||
};
|
||||
//
|
||||
// struct non_empty:
|
||||
// used to verify that is_empty does not emit
|
||||
// spurious warnings or errors.
|
||||
//
|
||||
struct non_empty : boost::noncopyable
|
||||
{
|
||||
int i;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // BOOST_TYPE_TRAITS_TEST_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,96 +0,0 @@
|
||||
// boost utility.hpp header file -------------------------------------------//
|
||||
|
||||
// (C) Copyright boost.org 1999. Permission to copy, use, modify, sell
|
||||
// and distribute this software is granted provided this copyright
|
||||
// notice appears in all copies. This software is provided "as is" without
|
||||
// express or implied warranty, and with no claim as to its suitability for
|
||||
// any purpose.
|
||||
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
|
||||
// Classes appear in alphabetical order
|
||||
|
||||
// Revision History
|
||||
// 26 Jan 00 protected noncopyable destructor added (Miki Jovanovic)
|
||||
// 10 Dec 99 next() and prior() templates added (Dave Abrahams)
|
||||
// 30 Aug 99 moved cast templates to cast.hpp (Beman Dawes)
|
||||
// 3 Aug 99 cast templates added
|
||||
// 20 Jul 99 name changed to utility.hpp
|
||||
// 9 Jun 99 protected noncopyable default ctor
|
||||
// 2 Jun 99 Initial Version. Class noncopyable only contents (Dave Abrahams)
|
||||
|
||||
#ifndef BOOST_UTILITY_HPP
|
||||
#define BOOST_UTILITY_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <cstddef> // for size_t
|
||||
#include <utility> // for std::pair
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
// next() and prior() template functions -----------------------------------//
|
||||
|
||||
// Helper functions for classes like bidirectional iterators not supporting
|
||||
// operator+ and operator-.
|
||||
//
|
||||
// Usage:
|
||||
// const std::list<T>::iterator p = get_some_iterator();
|
||||
// const std::list<T>::iterator prev = boost::prior(p);
|
||||
|
||||
// Contributed by Dave Abrahams
|
||||
|
||||
template <class T>
|
||||
T next(T x) { return ++x; }
|
||||
|
||||
template <class T>
|
||||
T prior(T x) { return --x; }
|
||||
|
||||
|
||||
// class noncopyable -------------------------------------------------------//
|
||||
|
||||
// Private copy constructor and copy assignment ensure classes derived from
|
||||
// class noncopyable cannot be copied.
|
||||
|
||||
// Contributed by Dave Abrahams
|
||||
|
||||
class noncopyable
|
||||
{
|
||||
protected:
|
||||
noncopyable(){}
|
||||
~noncopyable(){}
|
||||
private: // emphasize the following members are private
|
||||
noncopyable( const noncopyable& );
|
||||
const noncopyable& operator=( const noncopyable& );
|
||||
}; // noncopyable
|
||||
|
||||
// class tied -------------------------------------------------------//
|
||||
|
||||
// A helper for conveniently assigning the two values from a pair
|
||||
// into separate variables. The idea for this comes from Jaakko J<>rvi's
|
||||
// Binder/Lambda Library.
|
||||
|
||||
// Constributed by Jeremy Siek
|
||||
|
||||
template <class A, class B>
|
||||
class tied {
|
||||
public:
|
||||
inline tied(A& a, B& b) : _a(a), _b(b) { }
|
||||
template <class U, class V>
|
||||
inline tied& operator=(const std::pair<U,V>& p) {
|
||||
_a = p.first;
|
||||
_b = p.second;
|
||||
return *this;
|
||||
}
|
||||
protected:
|
||||
A& _a;
|
||||
B& _b;
|
||||
};
|
||||
|
||||
template <class A, class B>
|
||||
inline tied<A,B> tie(A& a, B& b) { return tied<A,B>(a, b); }
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UTILITY_HPP
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,72 +0,0 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/conversion_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
value_test(true, (boost::is_convertible<Deriverd,Base>::value));
|
||||
value_test(true, (boost::is_convertible<Deriverd,Deriverd>::value));
|
||||
value_test(true, (boost::is_convertible<Base,Base>::value));
|
||||
value_test(false, (boost::is_convertible<Base,Deriverd>::value));
|
||||
value_test(true, (boost::is_convertible<Deriverd,Deriverd>::value));
|
||||
value_test(false, (boost::is_convertible<NonDerived,Base>::value));
|
||||
value_test(false, (boost::is_convertible<boost::noncopyable, int>::value));
|
||||
value_test(true, (boost::is_convertible<float,int>::value));
|
||||
#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
value_test(false, (boost::is_convertible<float,void>::value));
|
||||
value_test(false, (boost::is_convertible<void,float>::value));
|
||||
value_test(true, (boost::is_convertible<void,void>::value));
|
||||
#endif
|
||||
value_test(true, (boost::is_convertible<enum1, int>::value));
|
||||
value_test(true, (boost::is_convertible<Deriverd*, Base*>::value));
|
||||
value_test(false, (boost::is_convertible<Base*, Deriverd*>::value));
|
||||
value_test(true, (boost::is_convertible<Deriverd&, Base&>::value));
|
||||
value_test(false, (boost::is_convertible<Base&, Deriverd&>::value));
|
||||
value_test(true, (boost::is_convertible<const Deriverd*, const Base*>::value));
|
||||
value_test(false, (boost::is_convertible<const Base*, const Deriverd*>::value));
|
||||
value_test(true, (boost::is_convertible<const Deriverd&, const Base&>::value));
|
||||
value_test(false, (boost::is_convertible<const Base&, const Deriverd&>::value));
|
||||
|
||||
value_test(false, (boost::is_convertible<const int *, int*>::value));
|
||||
value_test(false, (boost::is_convertible<const int&, int&>::value));
|
||||
value_test(true, (boost::is_convertible<int*, int[2]>::value));
|
||||
value_test(false, (boost::is_convertible<const int*, int[3]>::value));
|
||||
value_test(true, (boost::is_convertible<const int&, int>::value));
|
||||
value_test(true, (boost::is_convertible<int(&)[4], const int*>::value));
|
||||
value_test(true, (boost::is_convertible<int(&)(int), int(*)(int)>::value));
|
||||
value_test(true, (boost::is_convertible<int *, const int*>::value));
|
||||
value_test(true, (boost::is_convertible<int&, const int&>::value));
|
||||
value_test(true, (boost::is_convertible<int[2], int*>::value));
|
||||
value_test(true, (boost::is_convertible<int[2], const int*>::value));
|
||||
value_test(false, (boost::is_convertible<const int[2], int*>::value));
|
||||
|
||||
value_test(true, (boost::is_convertible<non_pointer, void*>::value));
|
||||
value_test(false, (boost::is_convertible<non_pointer, int*>::value));
|
||||
value_test(true, (boost::is_convertible<non_int_pointer, int*>::value));
|
||||
value_test(true, (boost::is_convertible<non_int_pointer, void*>::value));
|
||||
value_test(true, (boost::is_convertible<int, int_constructible>::value));
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
#ifdef __BORLANDC__
|
||||
unsigned int expected_failures = 1;
|
||||
#else
|
||||
unsigned int expected_failures = 0;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
value_test(true, (::boost::is_same<int, int>::value))
|
||||
value_test(false, (::boost::is_same<int, const int>::value))
|
||||
value_test(false, (::boost::is_same<int, int&>::value))
|
||||
value_test(false, (::boost::is_same<const int, int&>::value))
|
||||
value_test(false, (::boost::is_same<int, const int&>::value))
|
||||
value_test(false, (::boost::is_same<int*, const int*>::value))
|
||||
value_test(false, (::boost::is_same<int*, int*const>::value))
|
||||
value_test(false, (::boost::is_same<int, int[2]>::value))
|
||||
value_test(false, (::boost::is_same<int*, int[2]>::value))
|
||||
value_test(false, (::boost::is_same<int[4], int[2]>::value))
|
||||
value_test(false, (::boost::is_same<void, int>::value))
|
||||
value_test(true, (::boost::is_same<void, void>::value))
|
||||
value_test(false, (::boost::is_same<void, const void>::value))
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
#ifdef BOOST_MSVC
|
||||
// can't separate void and cv-void:
|
||||
unsigned int expected_failures = 1;
|
||||
#else
|
||||
unsigned int expected_failures = 0;
|
||||
#endif
|
||||
|
@ -1,110 +0,0 @@
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1999
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* This file provides some example of type_traits usage -
|
||||
* by "optimising" various algorithms:
|
||||
*
|
||||
* opt::iter_swap - uses type_traits to determine whether the iterator is a proxy
|
||||
* in which case it uses a "safe" approach, otherwise calls swap
|
||||
* on the assumption that swap may be specialised for the pointed-to type.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <typeinfo>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include <boost/type_traits.hpp>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::cin;
|
||||
|
||||
namespace opt{
|
||||
|
||||
//
|
||||
// iter_swap:
|
||||
// tests whether iterator is a proxying iterator or not, and
|
||||
// uses optimal form accordingly:
|
||||
//
|
||||
namespace detail{
|
||||
|
||||
template <bool b>
|
||||
struct swapper
|
||||
{
|
||||
template <typename I>
|
||||
static void do_swap(I one, I two)
|
||||
{
|
||||
typedef typename std::iterator_traits<I>::value_type v_t;
|
||||
v_t v = *one;
|
||||
*one = *two;
|
||||
*two = v;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef __GNUC__
|
||||
using std::swap;
|
||||
#endif
|
||||
|
||||
template <>
|
||||
struct swapper<true>
|
||||
{
|
||||
template <typename I>
|
||||
static void do_swap(I one, I two)
|
||||
{
|
||||
using std::swap;
|
||||
swap(*one, *two);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template <typename I1, typename I2>
|
||||
inline void iter_swap(I1 one, I2 two)
|
||||
{
|
||||
typedef typename std::iterator_traits<I1>::reference r1_t;
|
||||
typedef typename std::iterator_traits<I2>::reference r2_t;
|
||||
detail::swapper<
|
||||
::boost::type_traits::ice_and<
|
||||
::boost::is_reference<r1_t>::value,
|
||||
::boost::is_reference<r2_t>::value,
|
||||
::boost::is_same<r1_t, r2_t>::value
|
||||
>::value>::do_swap(one, two);
|
||||
}
|
||||
|
||||
|
||||
}; // namespace opt
|
||||
|
||||
int main()
|
||||
{
|
||||
//
|
||||
// testing iter_swap
|
||||
// really just a check that it does in fact compile...
|
||||
std::vector<int> v1;
|
||||
v1.push_back(0);
|
||||
v1.push_back(1);
|
||||
std::vector<bool> v2;
|
||||
v2.push_back(0);
|
||||
v2.push_back(1);
|
||||
opt::iter_swap(v1.begin(), v1.begin()+1);
|
||||
opt::iter_swap(v2.begin(), v2.begin()+1);
|
||||
|
||||
cout << "Press any key to exit...";
|
||||
cin.get();
|
||||
}
|
||||
|
||||
|
@ -1,580 +0,0 @@
|
||||
*** libs/type_traits/alignment_test.cpp ***
|
||||
|
||||
** GCC 2.95.2
|
||||
g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/alignment_test.cpp
|
||||
./boosttmp.exe
|
||||
13 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** GCC 2.95.2 STLport 4.0
|
||||
g++ -o boosttmp.exe -V 2.95.2-stlport -ftemplate-depth-30 -I../.. ../../libs/type_traits/alignment_test.cpp
|
||||
./boosttmp.exe
|
||||
13 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** Comeau C++ 4.2.44 beta3
|
||||
como -o boosttmp.exe -I../.. ../../libs/type_traits/alignment_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
./boosttmp.exe
|
||||
checking value of boost::alignment_of<double>...failed
|
||||
found: 4 expected 8
|
||||
13 tests completed, 1 failures found, 0 failures expected from this compiler.
|
||||
Fail
|
||||
|
||||
*** libs/type_traits/arithmetic_traits_test.cpp ***
|
||||
|
||||
** GCC 2.95.2
|
||||
g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/arithmetic_traits_test.cpp
|
||||
./boosttmp.exe
|
||||
111 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** GCC 2.95.2 STLport 4.0
|
||||
g++ -o boosttmp.exe -V 2.95.2-stlport -ftemplate-depth-30 -I../.. ../../libs/type_traits/arithmetic_traits_test.cpp
|
||||
./boosttmp.exe
|
||||
111 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** Comeau C++ 4.2.44 beta3
|
||||
como -o boosttmp.exe -I../.. ../../libs/type_traits/arithmetic_traits_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
./boosttmp.exe
|
||||
111 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
*** libs/type_traits/composite_traits_test.cpp ***
|
||||
|
||||
** GCC 2.95.2
|
||||
g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/composite_traits_test.cpp
|
||||
./boosttmp.exe
|
||||
checking value of boost::is_reference<cr_type>::value...failed
|
||||
found: 0 expected 1
|
||||
65 tests completed, 1 failures found, 1 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** GCC 2.95.2 STLport 4.0
|
||||
g++ -o boosttmp.exe -V 2.95.2-stlport -ftemplate-depth-30 -I../.. ../../libs/type_traits/composite_traits_test.cpp
|
||||
./boosttmp.exe
|
||||
checking value of boost::is_reference<cr_type>::value...failed
|
||||
found: 0 expected 1
|
||||
65 tests completed, 1 failures found, 1 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** Comeau C++ 4.2.44 beta3
|
||||
como -o boosttmp.exe -I../.. ../../libs/type_traits/composite_traits_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::basic_ostream<T1, T2> &_STL::_M_put_num<T1, T2, T3>(_STL::basic_ostream<T1, T2> &, T3) [with T1=char, T2=_STL::char_traits<char>, T3=bool] assigned to file composite_traits_test.o
|
||||
C++ prelinker: executing: /usr/local/bin/realcomo -c --version --display_mode --wchar_t_keyword --bool --enum_overloading --explicit --typename --extern_inline --new_for_init --exceptions --alternative_tokens --diag_suppress=161 -I../.. ../../libs/type_traits/composite_traits_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::basic_ostream<T1, T2> &_STL::_M_put_num<T1, T2, T3>(_STL::basic_ostream<T1, T2> &, T3) [with T1=char, T2=_STL::char_traits<char>, T3=unsigned long] assigned to file composite_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_inf [with T1=bool] assigned to file composite_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_inf [with T1=bool] assigned to file composite_traits_test.o
|
||||
C++ prelinker: executing: /usr/local/bin/realcomo -c --version --display_mode --wchar_t_keyword --bool --enum_overloading --explicit --typename --extern_inline --new_for_init --exceptions --alternative_tokens --diag_suppress=161 -I../.. ../../libs/type_traits/composite_traits_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=bool, N2=false, N3=true, N4=(int)0, N5=false] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=char, N2=(char)-128, N3=(char)127, N4=(int)-1, N5=true] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=signed char, N2=(signed char)-128, N3=(signed char)127, N4=(int)-1, N5=true] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned char, N2=(unsigned char)0, N3=(unsigned char)255, N4=(int)-1, N5=true] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=wchar_t, N2=(wchar_t)-2147483648, N3=(wchar_t)2147483647, N4=(int)-1, N5=true] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=short, N2=(short)-32768, N3=(short)32767, N4=(int)-1, N5=true] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned short, N2=(unsigned short)0, N3=(unsigned short)65535, N4=(int)-1, N5=true] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=int, N2=(int)-2147483648, N3=(int)2147483647, N4=(int)-1, N5=true] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned int, N2=(unsigned int)0, N3=(unsigned int)4294967295, N4=(int)-1, N5=true] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=long, N2=(long)-2147483648, N3=(long)2147483647, N4=(int)-1, N5=true] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned long, N2=(unsigned long)0, N3=(unsigned long)4294967295, N4=(int)-1, N5=true] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=long long, N2=(long long)-9223372036854775808, N3=(long long)9223372036854775807, N4=(int)-1, N5=true] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned long long, N2=(unsigned long long)0, N3=(unsigned long long)18446744073709551615, N4=(int)-1, N5=true] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_inf [with T1=bool] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_qNaN [with T1=bool] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_sNaN [with T1=bool] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_qNaN [with T1=bool] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_sNaN [with T1=bool] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_qNaN [with T1=bool] adopted by file composite_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_sNaN [with T1=bool] adopted by file composite_traits_test.o
|
||||
./boosttmp.exe
|
||||
65 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
*** libs/type_traits/cv_traits_test.cpp ***
|
||||
|
||||
** GCC 2.95.2
|
||||
g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/cv_traits_test.cpp
|
||||
./boosttmp.exe
|
||||
18 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** GCC 2.95.2 STLport 4.0
|
||||
g++ -o boosttmp.exe -V 2.95.2-stlport -ftemplate-depth-30 -I../.. ../../libs/type_traits/cv_traits_test.cpp
|
||||
./boosttmp.exe
|
||||
18 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** Comeau C++ 4.2.44 beta3
|
||||
como -o boosttmp.exe -I../.. ../../libs/type_traits/cv_traits_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::basic_ostream<T1, T2> &_STL::_M_put_num<T1, T2, T3>(_STL::basic_ostream<T1, T2> &, T3) [with T1=char, T2=_STL::char_traits<char>, T3=bool] assigned to file cv_traits_test.o
|
||||
C++ prelinker: executing: /usr/local/bin/realcomo -c --version --display_mode --wchar_t_keyword --bool --enum_overloading --explicit --typename --extern_inline --new_for_init --exceptions --alternative_tokens --diag_suppress=161 -I../.. ../../libs/type_traits/cv_traits_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::basic_ostream<T1, T2> &_STL::_M_put_num<T1, T2, T3>(_STL::basic_ostream<T1, T2> &, T3) [with T1=char, T2=_STL::char_traits<char>, T3=unsigned long] assigned to file cv_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_inf [with T1=bool] assigned to file cv_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_inf [with T1=bool] assigned to file cv_traits_test.o
|
||||
C++ prelinker: executing: /usr/local/bin/realcomo -c --version --display_mode --wchar_t_keyword --bool --enum_overloading --explicit --typename --extern_inline --new_for_init --exceptions --alternative_tokens --diag_suppress=161 -I../.. ../../libs/type_traits/cv_traits_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=bool, N2=false, N3=true, N4=(int)0, N5=false] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=char, N2=(char)-128, N3=(char)127, N4=(int)-1, N5=true] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=signed char, N2=(signed char)-128, N3=(signed char)127, N4=(int)-1, N5=true] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned char, N2=(unsigned char)0, N3=(unsigned char)255, N4=(int)-1, N5=true] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=wchar_t, N2=(wchar_t)-2147483648, N3=(wchar_t)2147483647, N4=(int)-1, N5=true] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=short, N2=(short)-32768, N3=(short)32767, N4=(int)-1, N5=true] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned short, N2=(unsigned short)0, N3=(unsigned short)65535, N4=(int)-1, N5=true] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=int, N2=(int)-2147483648, N3=(int)2147483647, N4=(int)-1, N5=true] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned int, N2=(unsigned int)0, N3=(unsigned int)4294967295, N4=(int)-1, N5=true] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=long, N2=(long)-2147483648, N3=(long)2147483647, N4=(int)-1, N5=true] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned long, N2=(unsigned long)0, N3=(unsigned long)4294967295, N4=(int)-1, N5=true] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=long long, N2=(long long)-9223372036854775808, N3=(long long)9223372036854775807, N4=(int)-1, N5=true] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned long long, N2=(unsigned long long)0, N3=(unsigned long long)18446744073709551615, N4=(int)-1, N5=true] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_inf [with T1=bool] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_qNaN [with T1=bool] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_sNaN [with T1=bool] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_qNaN [with T1=bool] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_sNaN [with T1=bool] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_qNaN [with T1=bool] adopted by file cv_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_sNaN [with T1=bool] adopted by file cv_traits_test.o
|
||||
./boosttmp.exe
|
||||
18 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
*** libs/type_traits/is_convertible_test.cpp ***
|
||||
|
||||
** GCC 2.95.2
|
||||
g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/is_convertible_test.cpp
|
||||
./boosttmp.exe
|
||||
37 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** GCC 2.95.2 STLport 4.0
|
||||
g++ -o boosttmp.exe -V 2.95.2-stlport -ftemplate-depth-30 -I../.. ../../libs/type_traits/is_convertible_test.cpp
|
||||
./boosttmp.exe
|
||||
37 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** Comeau C++ 4.2.44 beta3
|
||||
como -o boosttmp.exe -I../.. ../../libs/type_traits/is_convertible_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::basic_ostream<T1, T2> &_STL::_M_put_num<T1, T2, T3>(_STL::basic_ostream<T1, T2> &, T3) [with T1=char, T2=_STL::char_traits<char>, T3=bool] assigned to file is_convertible_test.o
|
||||
C++ prelinker: executing: /usr/local/bin/realcomo -c --version --display_mode --wchar_t_keyword --bool --enum_overloading --explicit --typename --extern_inline --new_for_init --exceptions --alternative_tokens --diag_suppress=161 -I../.. ../../libs/type_traits/is_convertible_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::basic_ostream<T1, T2> &_STL::_M_put_num<T1, T2, T3>(_STL::basic_ostream<T1, T2> &, T3) [with T1=char, T2=_STL::char_traits<char>, T3=unsigned long] assigned to file is_convertible_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_inf [with T1=bool] assigned to file is_convertible_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_inf [with T1=bool] assigned to file is_convertible_test.o
|
||||
C++ prelinker: executing: /usr/local/bin/realcomo -c --version --display_mode --wchar_t_keyword --bool --enum_overloading --explicit --typename --extern_inline --new_for_init --exceptions --alternative_tokens --diag_suppress=161 -I../.. ../../libs/type_traits/is_convertible_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=bool, N2=false, N3=true, N4=(int)0, N5=false] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=char, N2=(char)-128, N3=(char)127, N4=(int)-1, N5=true] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=signed char, N2=(signed char)-128, N3=(signed char)127, N4=(int)-1, N5=true] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned char, N2=(unsigned char)0, N3=(unsigned char)255, N4=(int)-1, N5=true] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=wchar_t, N2=(wchar_t)-2147483648, N3=(wchar_t)2147483647, N4=(int)-1, N5=true] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=short, N2=(short)-32768, N3=(short)32767, N4=(int)-1, N5=true] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned short, N2=(unsigned short)0, N3=(unsigned short)65535, N4=(int)-1, N5=true] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=int, N2=(int)-2147483648, N3=(int)2147483647, N4=(int)-1, N5=true] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned int, N2=(unsigned int)0, N3=(unsigned int)4294967295, N4=(int)-1, N5=true] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=long, N2=(long)-2147483648, N3=(long)2147483647, N4=(int)-1, N5=true] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned long, N2=(unsigned long)0, N3=(unsigned long)4294967295, N4=(int)-1, N5=true] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=long long, N2=(long long)-9223372036854775808, N3=(long long)9223372036854775807, N4=(int)-1, N5=true] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned long long, N2=(unsigned long long)0, N3=(unsigned long long)18446744073709551615, N4=(int)-1, N5=true] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_inf [with T1=bool] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_qNaN [with T1=bool] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_sNaN [with T1=bool] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_qNaN [with T1=bool] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_sNaN [with T1=bool] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_qNaN [with T1=bool] adopted by file is_convertible_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_sNaN [with T1=bool] adopted by file is_convertible_test.o
|
||||
./boosttmp.exe
|
||||
37 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
*** libs/type_traits/is_same_test.cpp ***
|
||||
|
||||
** GCC 2.95.2
|
||||
g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/is_same_test.cpp
|
||||
./boosttmp.exe
|
||||
10 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** GCC 2.95.2 STLport 4.0
|
||||
g++ -o boosttmp.exe -V 2.95.2-stlport -ftemplate-depth-30 -I../.. ../../libs/type_traits/is_same_test.cpp
|
||||
./boosttmp.exe
|
||||
10 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** Comeau C++ 4.2.44 beta3
|
||||
como -o boosttmp.exe -I../.. ../../libs/type_traits/is_same_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::basic_ostream<T1, T2> &_STL::_M_put_num<T1, T2, T3>(_STL::basic_ostream<T1, T2> &, T3) [with T1=char, T2=_STL::char_traits<char>, T3=bool] assigned to file is_same_test.o
|
||||
C++ prelinker: executing: /usr/local/bin/realcomo -c --version --display_mode --wchar_t_keyword --bool --enum_overloading --explicit --typename --extern_inline --new_for_init --exceptions --alternative_tokens --diag_suppress=161 -I../.. ../../libs/type_traits/is_same_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::basic_ostream<T1, T2> &_STL::_M_put_num<T1, T2, T3>(_STL::basic_ostream<T1, T2> &, T3) [with T1=char, T2=_STL::char_traits<char>, T3=unsigned long] assigned to file is_same_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_inf [with T1=bool] assigned to file is_same_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_inf [with T1=bool] assigned to file is_same_test.o
|
||||
C++ prelinker: executing: /usr/local/bin/realcomo -c --version --display_mode --wchar_t_keyword --bool --enum_overloading --explicit --typename --extern_inline --new_for_init --exceptions --alternative_tokens --diag_suppress=161 -I../.. ../../libs/type_traits/is_same_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=bool, N2=false, N3=true, N4=(int)0, N5=false] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=char, N2=(char)-128, N3=(char)127, N4=(int)-1, N5=true] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=signed char, N2=(signed char)-128, N3=(signed char)127, N4=(int)-1, N5=true] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned char, N2=(unsigned char)0, N3=(unsigned char)255, N4=(int)-1, N5=true] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=wchar_t, N2=(wchar_t)-2147483648, N3=(wchar_t)2147483647, N4=(int)-1, N5=true] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=short, N2=(short)-32768, N3=(short)32767, N4=(int)-1, N5=true] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned short, N2=(unsigned short)0, N3=(unsigned short)65535, N4=(int)-1, N5=true] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=int, N2=(int)-2147483648, N3=(int)2147483647, N4=(int)-1, N5=true] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned int, N2=(unsigned int)0, N3=(unsigned int)4294967295, N4=(int)-1, N5=true] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=long, N2=(long)-2147483648, N3=(long)2147483647, N4=(int)-1, N5=true] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned long, N2=(unsigned long)0, N3=(unsigned long)4294967295, N4=(int)-1, N5=true] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=long long, N2=(long long)-9223372036854775808, N3=(long long)9223372036854775807, N4=(int)-1, N5=true] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned long long, N2=(unsigned long long)0, N3=(unsigned long long)18446744073709551615, N4=(int)-1, N5=true] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_inf [with T1=bool] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_qNaN [with T1=bool] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_sNaN [with T1=bool] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_qNaN [with T1=bool] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_sNaN [with T1=bool] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_qNaN [with T1=bool] adopted by file is_same_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_sNaN [with T1=bool] adopted by file is_same_test.o
|
||||
./boosttmp.exe
|
||||
10 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
*** libs/type_traits/object_type_traits_test.cpp ***
|
||||
|
||||
** GCC 2.95.2
|
||||
g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/object_type_traits_test.cpp
|
||||
./boosttmp.exe
|
||||
checking value of boost::has_trivial_constructor<empty_UDT>::value...failed
|
||||
found: 0 expected 1
|
||||
checking value of boost::has_trivial_copy<empty_UDT>::value...failed
|
||||
found: 0 expected 1
|
||||
checking value of boost::has_trivial_assign<empty_UDT>::value...failed
|
||||
found: 0 expected 1
|
||||
checking value of boost::is_empty<empty_UDT>::value...failed
|
||||
found: 0 expected 1
|
||||
checking value of boost::is_empty<empty_POD_UDT>::value...failed
|
||||
found: 0 expected 1
|
||||
checking value of boost::is_empty<empty_union_UDT>::value...failed
|
||||
boost::is_empty<empty_union_UDT>::value does not compile on this compiler
|
||||
checking value of boost::is_empty<boost::noncopyable>::value...failed
|
||||
found: 0 expected 1
|
||||
122 tests completed, 7 failures found, 7 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** GCC 2.95.2 STLport 4.0
|
||||
g++ -o boosttmp.exe -V 2.95.2-stlport -ftemplate-depth-30 -I../.. ../../libs/type_traits/object_type_traits_test.cpp
|
||||
./boosttmp.exe
|
||||
checking value of boost::has_trivial_constructor<empty_UDT>::value...failed
|
||||
found: 0 expected 1
|
||||
checking value of boost::has_trivial_copy<empty_UDT>::value...failed
|
||||
found: 0 expected 1
|
||||
checking value of boost::has_trivial_assign<empty_UDT>::value...failed
|
||||
found: 0 expected 1
|
||||
checking value of boost::is_empty<empty_union_UDT>::value...failed
|
||||
boost::is_empty<empty_union_UDT>::value does not compile on this compiler
|
||||
122 tests completed, 4 failures found, 7 failures expected from this compiler.
|
||||
Fail
|
||||
|
||||
** Comeau C++ 4.2.44 beta3
|
||||
como -o boosttmp.exe -I../.. ../../libs/type_traits/object_type_traits_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
./boosttmp.exe
|
||||
checking value of boost::has_trivial_constructor<empty_UDT>::value...failed
|
||||
found: 0 expected 1
|
||||
checking value of boost::has_trivial_copy<empty_UDT>::value...failed
|
||||
found: 0 expected 1
|
||||
checking value of boost::has_trivial_assign<empty_UDT>::value...failed
|
||||
found: 0 expected 1
|
||||
checking value of boost::is_empty<empty_union_UDT>::value...failed
|
||||
boost::is_empty<empty_union_UDT>::value does not compile on this compiler
|
||||
122 tests completed, 4 failures found, 0 failures expected from this compiler.
|
||||
Fail
|
||||
|
||||
*** libs/type_traits/transform_traits_test.cpp ***
|
||||
|
||||
** GCC 2.95.2
|
||||
g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/transform_traits_test.cpp
|
||||
./boosttmp.exe
|
||||
checking type of boost::remove_reference<cr_type>::type...failed
|
||||
expected type was int
|
||||
typeid(int) was: i
|
||||
typeid(boost::remove_reference<cr_type>::type) was: i
|
||||
In template class t12type_checker2ZiZCRi
|
||||
39 tests completed, 1 failures found, 1 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** GCC 2.95.2 STLport 4.0
|
||||
g++ -o boosttmp.exe -V 2.95.2-stlport -ftemplate-depth-30 -I../.. ../../libs/type_traits/transform_traits_test.cpp
|
||||
./boosttmp.exe
|
||||
checking type of boost::remove_reference<cr_type>::type...failed
|
||||
expected type was int
|
||||
typeid(int) was: i
|
||||
typeid(boost::remove_reference<cr_type>::type) was: i
|
||||
In template class t12type_checker2ZiZCRi
|
||||
39 tests completed, 1 failures found, 1 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
** Comeau C++ 4.2.44 beta3
|
||||
como -o boosttmp.exe -I../.. ../../libs/type_traits/transform_traits_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::basic_ostream<T1, T2> &_STL::_M_put_num<T1, T2, T3>(_STL::basic_ostream<T1, T2> &, T3) [with T1=char, T2=_STL::char_traits<char>, T3=bool] assigned to file transform_traits_test.o
|
||||
C++ prelinker: executing: /usr/local/bin/realcomo -c --version --display_mode --wchar_t_keyword --bool --enum_overloading --explicit --typename --extern_inline --new_for_init --exceptions --alternative_tokens --diag_suppress=161 -I../.. ../../libs/type_traits/transform_traits_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::basic_ostream<T1, T2> &_STL::_M_put_num<T1, T2, T3>(_STL::basic_ostream<T1, T2> &, T3) [with T1=char, T2=_STL::char_traits<char>, T3=unsigned long] assigned to file transform_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_inf [with T1=bool] assigned to file transform_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_inf [with T1=bool] assigned to file transform_traits_test.o
|
||||
C++ prelinker: executing: /usr/local/bin/realcomo -c --version --display_mode --wchar_t_keyword --bool --enum_overloading --explicit --typename --extern_inline --new_for_init --exceptions --alternative_tokens --diag_suppress=161 -I../.. ../../libs/type_traits/transform_traits_test.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../boost/type_traits/type_traits_test.hpp", line 236: warning: type
|
||||
qualifiers are meaningless in this declaration
|
||||
typedef const r_type cr_type;
|
||||
^
|
||||
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=bool, N2=false, N3=true, N4=(int)0, N5=false] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=char, N2=(char)-128, N3=(char)127, N4=(int)-1, N5=true] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=signed char, N2=(signed char)-128, N3=(signed char)127, N4=(int)-1, N5=true] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned char, N2=(unsigned char)0, N3=(unsigned char)255, N4=(int)-1, N5=true] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=wchar_t, N2=(wchar_t)-2147483648, N3=(wchar_t)2147483647, N4=(int)-1, N5=true] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=short, N2=(short)-32768, N3=(short)32767, N4=(int)-1, N5=true] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned short, N2=(unsigned short)0, N3=(unsigned short)65535, N4=(int)-1, N5=true] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=int, N2=(int)-2147483648, N3=(int)2147483647, N4=(int)-1, N5=true] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned int, N2=(unsigned int)0, N3=(unsigned int)4294967295, N4=(int)-1, N5=true] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=long, N2=(long)-2147483648, N3=(long)2147483647, N4=(int)-1, N5=true] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned long, N2=(unsigned long)0, N3=(unsigned long)4294967295, N4=(int)-1, N5=true] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=long long, N2=(long long)-9223372036854775808, N3=(long long)9223372036854775807, N4=(int)-1, N5=true] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_Integer_limits<T1, N2, N3, N4, N5>::digits [with T1=unsigned long long, N2=(unsigned long long)0, N3=(unsigned long long)18446744073709551615, N4=(int)-1, N5=true] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_inf [with T1=bool] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_qNaN [with T1=bool] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_F_sNaN [with T1=bool] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_qNaN [with T1=bool] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_D_sNaN [with T1=bool] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_qNaN [with T1=bool] adopted by file transform_traits_test.o
|
||||
C++ prelinker: _STL::_LimG<T1>::_L_sNaN [with T1=bool] adopted by file transform_traits_test.o
|
||||
./boosttmp.exe
|
||||
39 tests completed, 0 failures found, 0 failures expected from this compiler.
|
||||
Pass
|
||||
|
||||
*** libs/type_traits/trivial_destructor_example.cpp ***
|
||||
|
||||
** GCC 2.95.2
|
||||
g++ -c -ftemplate-depth-30 -I../.. ../../libs/type_traits/trivial_destructor_example.cpp
|
||||
Pass
|
||||
|
||||
** GCC 2.95.2 STLport 4.0
|
||||
g++ -c -V 2.95.2-stlport -ftemplate-depth-30 -I../.. ../../libs/type_traits/trivial_destructor_example.cpp
|
||||
Pass
|
||||
|
||||
** Comeau C++ 4.2.44 beta3
|
||||
como -c -I../.. ../../libs/type_traits/trivial_destructor_example.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
"../../libs/type_traits/trivial_destructor_example.cpp", line 99: warning:
|
||||
variable "ci_array" was declared but never referenced
|
||||
const int ci_array[array_size] = {0,};
|
||||
^
|
||||
|
||||
"../../libs/type_traits/trivial_destructor_example.cpp", line 101: warning:
|
||||
variable "cc_array" was declared but never referenced
|
||||
const char cc_array[array_size] = { 0,};
|
||||
^
|
||||
|
||||
Pass
|
||||
|
||||
*** libs/type_traits/copy_example.cpp ***
|
||||
|
||||
** GCC 2.95.2
|
||||
g++ -c -ftemplate-depth-30 -I../.. ../../libs/type_traits/copy_example.cpp
|
||||
Pass
|
||||
|
||||
** GCC 2.95.2 STLport 4.0
|
||||
g++ -c -V 2.95.2-stlport -ftemplate-depth-30 -I../.. ../../libs/type_traits/copy_example.cpp
|
||||
Pass
|
||||
|
||||
** Comeau C++ 4.2.44 beta3
|
||||
como -c -I../.. ../../libs/type_traits/copy_example.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
Pass
|
||||
|
||||
*** libs/type_traits/fill_example.cpp ***
|
||||
|
||||
** GCC 2.95.2
|
||||
g++ -c -ftemplate-depth-30 -I../.. ../../libs/type_traits/fill_example.cpp
|
||||
Pass
|
||||
|
||||
** GCC 2.95.2 STLport 4.0
|
||||
g++ -c -V 2.95.2-stlport -ftemplate-depth-30 -I../.. ../../libs/type_traits/fill_example.cpp
|
||||
Pass
|
||||
|
||||
** Comeau C++ 4.2.44 beta3
|
||||
como -c -I../.. ../../libs/type_traits/fill_example.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
Pass
|
||||
|
||||
*** libs/type_traits/iter_swap_example.cpp ***
|
||||
|
||||
** GCC 2.95.2
|
||||
g++ -c -ftemplate-depth-30 -I../.. ../../libs/type_traits/iter_swap_example.cpp
|
||||
Pass
|
||||
|
||||
** GCC 2.95.2 STLport 4.0
|
||||
g++ -c -V 2.95.2-stlport -ftemplate-depth-30 -I../.. ../../libs/type_traits/iter_swap_example.cpp
|
||||
Pass
|
||||
|
||||
** Comeau C++ 4.2.44 beta3
|
||||
como -c -I../.. ../../libs/type_traits/iter_swap_example.cpp
|
||||
Comeau C/C++ 4.2.44 (Aug 2 2000 16:10:16) for RedHat_LINUX_INTEL_ELF_BETA3
|
||||
Copyright 1988-2000 Comeau Computing. All rights reserved.
|
||||
MODE:non-strict C++
|
||||
|
||||
Pass
|
||||
|
@ -1,191 +0,0 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/object_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
NESTED_DECL(is_class)
|
||||
NESTED_DECL(is_object)
|
||||
NESTED_DECL(is_scalar)
|
||||
NESTED_DECL(is_compound)
|
||||
NESTED_DECL(is_POD)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
NESTED_TEST(is_class, int)
|
||||
NESTED_TEST(is_class, UDT)
|
||||
NESTED_TEST(is_object, int)
|
||||
NESTED_TEST(is_object, void)
|
||||
NESTED_TEST(is_object, UDT)
|
||||
NESTED_TEST(is_scalar, void)
|
||||
NESTED_TEST(is_scalar, int)
|
||||
NESTED_TEST(is_compound, int)
|
||||
NESTED_TEST(is_compound, UDT)
|
||||
NESTED_TEST(is_POD, int)
|
||||
NESTED_TEST(is_POD, UDT)
|
||||
|
||||
value_test(false, boost::is_class<int>::value)
|
||||
value_test(false, boost::is_class<const int>::value)
|
||||
value_test(false, boost::is_class<volatile int>::value)
|
||||
value_test(false, boost::is_class<int*>::value)
|
||||
value_test(false, boost::is_class<int* const>::value)
|
||||
value_test(false, boost::is_class<int[2]>::value)
|
||||
value_test(false, boost::is_class<int&>::value)
|
||||
value_test(false, boost::is_class<mf4>::value)
|
||||
value_test(false, boost::is_class<f1>::value)
|
||||
value_test(false, boost::is_class<enum_UDT>::value)
|
||||
value_test(true, boost::is_class<UDT>::value)
|
||||
value_test(true, boost::is_class<UDT const>::value)
|
||||
value_test(true, boost::is_class<UDT volatile>::value)
|
||||
value_test(true, boost::is_class<empty_UDT>::value)
|
||||
value_test(true, boost::is_class<std::iostream>::value)
|
||||
value_test(false, boost::is_class<UDT*>::value)
|
||||
value_test(false, boost::is_class<UDT[2]>::value)
|
||||
value_test(false, boost::is_class<UDT&>::value)
|
||||
value_test(false, boost::is_class<void>::value)
|
||||
|
||||
value_test(true, boost::is_object<int>::value)
|
||||
value_test(true, boost::is_object<UDT>::value)
|
||||
value_test(false, boost::is_object<int&>::value)
|
||||
value_test(false, boost::is_object<void>::value)
|
||||
|
||||
value_test(true, boost::is_scalar<int>::value)
|
||||
value_test(true, boost::is_scalar<void*>::value)
|
||||
value_test(false, boost::is_scalar<void>::value)
|
||||
value_test(false, boost::is_scalar<UDT>::value)
|
||||
value_test(false, boost::is_scalar<int&>::value)
|
||||
|
||||
value_test(true, boost::is_compound<UDT>::value)
|
||||
value_test(true, boost::is_compound<void*>::value)
|
||||
value_test(false, boost::is_compound<void>::value)
|
||||
value_test(false, boost::is_compound<int>::value)
|
||||
|
||||
value_test(true, boost::is_POD<int>::value)
|
||||
value_test(true, boost::is_POD<int*>::value)
|
||||
value_test(false, boost::is_POD<int&>::value)
|
||||
value_test(true, boost::is_POD<int*const>::value)
|
||||
value_test(true, boost::is_POD<const int>::value)
|
||||
value_test(true, boost::is_POD<volatile int>::value)
|
||||
value_test(false, boost::is_POD<const int&>::value)
|
||||
value_test(true, boost::is_POD<int[2]>::value)
|
||||
value_test(true, boost::is_POD<int[3][2]>::value)
|
||||
value_test(true, boost::is_POD<int[2][4][5][6][3]>::value)
|
||||
value_test(true, boost::is_POD<f1>::value)
|
||||
value_test(true, boost::is_POD<mf2>::value)
|
||||
value_test(false, boost::is_POD<UDT>::value)
|
||||
value_test(false, boost::is_POD<empty_UDT>::value)
|
||||
value_test(true, boost::is_POD<enum_UDT>::value)
|
||||
value_test(true, boost::is_POD<void>::value)
|
||||
|
||||
value_test(true, boost::has_trivial_constructor<int>::value)
|
||||
value_test(true, boost::has_trivial_constructor<int*>::value)
|
||||
value_test(true, boost::has_trivial_constructor<int*const>::value)
|
||||
value_test(true, boost::has_trivial_constructor<const int>::value)
|
||||
value_test(true, boost::has_trivial_constructor<volatile int>::value)
|
||||
value_test(true, boost::has_trivial_constructor<int[2]>::value)
|
||||
value_test(true, boost::has_trivial_constructor<int[3][2]>::value)
|
||||
value_test(true, boost::has_trivial_constructor<int[2][4][5][6][3]>::value)
|
||||
value_test(true, boost::has_trivial_constructor<f1>::value)
|
||||
value_test(true, boost::has_trivial_constructor<mf2>::value)
|
||||
value_test(false, boost::has_trivial_constructor<UDT>::value)
|
||||
value_test(true, boost::has_trivial_constructor<empty_UDT>::value)
|
||||
value_test(true, boost::has_trivial_constructor<enum_UDT>::value)
|
||||
value_test(true, boost::has_trivial_constructor<void>::value)
|
||||
|
||||
value_test(true, boost::has_trivial_copy<int>::value)
|
||||
value_test(true, boost::has_trivial_copy<int*>::value)
|
||||
value_test(true, boost::has_trivial_copy<int*const>::value)
|
||||
value_test(true, boost::has_trivial_copy<const int>::value)
|
||||
// Steve: was 'false' -- should be 'true' via 3.9p3, 3.9p10
|
||||
value_test(false, boost::has_trivial_copy<volatile int>::value)
|
||||
value_test(true, boost::has_trivial_copy<int[2]>::value)
|
||||
value_test(true, boost::has_trivial_copy<int[3][2]>::value)
|
||||
value_test(true, boost::has_trivial_copy<int[2][4][5][6][3]>::value)
|
||||
value_test(true, boost::has_trivial_copy<f1>::value)
|
||||
value_test(true, boost::has_trivial_copy<mf2>::value)
|
||||
value_test(false, boost::has_trivial_copy<UDT>::value)
|
||||
value_test(true, boost::has_trivial_copy<empty_UDT>::value)
|
||||
value_test(true, boost::has_trivial_copy<enum_UDT>::value)
|
||||
value_test(true, boost::has_trivial_copy<void>::value)
|
||||
|
||||
value_test(true, boost::has_trivial_assign<int>::value)
|
||||
value_test(true, boost::has_trivial_assign<int*>::value)
|
||||
value_test(false, boost::has_trivial_assign<int*const>::value)
|
||||
value_test(false, boost::has_trivial_assign<const int>::value)
|
||||
// Steve: was 'false' -- should be 'true' via 3.9p3, 3.9p10
|
||||
value_test(false, boost::has_trivial_assign<volatile int>::value)
|
||||
value_test(true, boost::has_trivial_assign<int[2]>::value)
|
||||
value_test(true, boost::has_trivial_assign<int[3][2]>::value)
|
||||
value_test(true, boost::has_trivial_assign<int[2][4][5][6][3]>::value)
|
||||
value_test(true, boost::has_trivial_assign<f1>::value)
|
||||
value_test(true, boost::has_trivial_assign<mf2>::value)
|
||||
value_test(false, boost::has_trivial_assign<UDT>::value)
|
||||
value_test(true, boost::has_trivial_assign<empty_UDT>::value)
|
||||
value_test(true, boost::has_trivial_assign<enum_UDT>::value)
|
||||
value_test(true, boost::has_trivial_assign<void>::value)
|
||||
|
||||
value_test(true, boost::has_trivial_destructor<int>::value)
|
||||
value_test(true, boost::has_trivial_destructor<int*>::value)
|
||||
value_test(true, boost::has_trivial_destructor<int*const>::value)
|
||||
value_test(true, boost::has_trivial_destructor<const int>::value)
|
||||
value_test(true, boost::has_trivial_destructor<volatile int>::value)
|
||||
value_test(true, boost::has_trivial_destructor<int[2]>::value)
|
||||
value_test(true, boost::has_trivial_destructor<int[3][2]>::value)
|
||||
value_test(true, boost::has_trivial_destructor<int[2][4][5][6][3]>::value)
|
||||
value_test(true, boost::has_trivial_destructor<f1>::value)
|
||||
value_test(true, boost::has_trivial_destructor<mf2>::value)
|
||||
value_test(false, boost::has_trivial_destructor<UDT>::value)
|
||||
value_test(false, boost::has_trivial_destructor<empty_UDT>::value)
|
||||
value_test(true, boost::has_trivial_destructor<enum_UDT>::value)
|
||||
value_test(true, boost::has_trivial_destructor<void>::value)
|
||||
|
||||
soft_value_test(false, boost::is_empty<int>::value)
|
||||
soft_value_test(false, boost::is_empty<int*>::value)
|
||||
soft_value_test(false, boost::is_empty<int&>::value)
|
||||
soft_value_test(false, boost::is_empty<void>::value)
|
||||
#if defined(__MWERKS__)
|
||||
// apparent compiler bug causes this to fail to compile:
|
||||
value_fail(false, boost::is_empty<int[2]>::value)
|
||||
#else
|
||||
soft_value_test(false, boost::is_empty<int[2]>::value)
|
||||
#endif
|
||||
soft_value_test(false, boost::is_empty<f1>::value)
|
||||
soft_value_test(false, boost::is_empty<mf1>::value)
|
||||
soft_value_test(false, boost::is_empty<UDT>::value)
|
||||
soft_value_test(true, boost::is_empty<empty_UDT>::value)
|
||||
soft_value_test(true, boost::is_empty<empty_POD_UDT>::value)
|
||||
// this one will not compile on most compilers,
|
||||
// because we can't tell the difference between
|
||||
// unions and classes:
|
||||
value_fail(true, boost::is_empty<empty_union_UDT>::value)
|
||||
soft_value_test(false, boost::is_empty<enum_UDT>::value)
|
||||
soft_value_test(true, boost::is_empty<boost::noncopyable>::value)
|
||||
soft_value_test(false, boost::is_empty<non_empty>::value)
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
#ifdef __BORLANDC__
|
||||
// can't handle enum's or classes that are POD's
|
||||
unsigned int expected_failures = 10;
|
||||
#elif defined(__GNUC__)
|
||||
// classes that are POD's, or empty:
|
||||
unsigned int expected_failures = 4;
|
||||
#elif defined(BOOST_MSVC)
|
||||
// can't handle classes that are POD's or arrays that are POD's
|
||||
unsigned int expected_failures = 19;
|
||||
#else
|
||||
unsigned int expected_failures = 4;
|
||||
#endif
|
||||
|
||||
|
@ -1,14 +0,0 @@
|
||||
run libs/type_traits/alignment_test.cpp
|
||||
run libs/type_traits/arithmetic_traits_test.cpp
|
||||
run libs/type_traits/composite_traits_test.cpp
|
||||
run libs/type_traits/cv_traits_test.cpp
|
||||
run libs/type_traits/is_convertible_test.cpp
|
||||
run libs/type_traits/is_same_test.cpp
|
||||
run libs/type_traits/object_type_traits_test.cpp
|
||||
run libs/type_traits/transform_traits_test.cpp
|
||||
compile libs/type_traits/trivial_destructor_example.cpp
|
||||
compile libs/type_traits/copy_example.cpp
|
||||
compile libs/type_traits/fill_example.cpp
|
||||
compile libs/type_traits/iter_swap_example.cpp
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,395 +0,0 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#include <boost/type_traits/transform_traits.hpp>
|
||||
#include <boost/type_traits/cv_traits.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
|
||||
//
|
||||
// some of these tests, particularly those involving
|
||||
// the use of the transform_check macro are tantamount
|
||||
// to "compiler-abuse", and actually hide a *lot* of
|
||||
// template test code. To prevent "Internal Compiler Error"
|
||||
// type messages, we have to split these up into lots of
|
||||
// separate functions:
|
||||
#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ < 0x550))
|
||||
#define SHORT_TRANSFORM_TEST
|
||||
#endif
|
||||
#include "boost/type_traits/type_traits_test.hpp"
|
||||
|
||||
#define BOOST_DECL_TRANSFORM_TEST(name, type, from, to)\
|
||||
void name(){ transform_check(type, from, to) }
|
||||
#define BOOST_DECL_TRANSFORM_TEST3(name, type, from)\
|
||||
void name(){ transform_check(type, from, boost_dummy_macro_param) }
|
||||
#define BOOST_DECL_TRANSFORM_TEST2(name, type)\
|
||||
void name(){ transform_check(type, boost_dummy_macro_param, boost_dummy_macro_param) }
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for remove_const:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_const_test_1, ::boost::remove_const, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_2, ::boost::remove_const, volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_3, ::boost::remove_const, const volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_const_test_4, ::boost::remove_const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_6, ::boost::remove_const, *const, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_7, ::boost::remove_const, *volatile, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_8, ::boost::remove_const, *const volatile, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_9, ::boost::remove_const, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_11, ::boost::remove_const, volatile*, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_12, ::boost::remove_const, const[2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_13, ::boost::remove_const, volatile[2], volatile[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_14, ::boost::remove_const, const volatile[2], volatile[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_15, ::boost::remove_const, [2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_16, ::boost::remove_const, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_const_test_17, ::boost::remove_const, const*const, const*)
|
||||
|
||||
void check_remove_const()
|
||||
{
|
||||
remove_const_test_1();
|
||||
remove_const_test_2();
|
||||
remove_const_test_3();
|
||||
remove_const_test_4();
|
||||
remove_const_test_6();
|
||||
remove_const_test_7();
|
||||
remove_const_test_8();
|
||||
remove_const_test_9();
|
||||
remove_const_test_11();
|
||||
remove_const_test_12();
|
||||
remove_const_test_13();
|
||||
remove_const_test_14();
|
||||
remove_const_test_15();
|
||||
remove_const_test_16();
|
||||
remove_const_test_17();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for remove_volatile:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_1, ::boost::remove_volatile, const, const)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_volatile_test_2, ::boost::remove_volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_3, ::boost::remove_volatile, const volatile, const)
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_volatile_test_4, ::boost::remove_volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_volatile_test_5, ::boost::remove_volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_6, ::boost::remove_volatile, *const, *const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_7, ::boost::remove_volatile, *volatile, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_8, ::boost::remove_volatile, *const volatile, *const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_9, ::boost::remove_volatile, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_10, ::boost::remove_volatile, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_11, ::boost::remove_volatile, volatile*, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_12, ::boost::remove_volatile, const[2], const[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_13, ::boost::remove_volatile, volatile[2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_14, ::boost::remove_volatile, const volatile[2], const[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_15, ::boost::remove_volatile, [2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_16, ::boost::remove_volatile, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_volatile_test_17, ::boost::remove_volatile, const*volatile, const*)
|
||||
|
||||
void check_remove_volatile()
|
||||
{
|
||||
remove_volatile_test_1();
|
||||
remove_volatile_test_2();
|
||||
remove_volatile_test_3();
|
||||
remove_volatile_test_4();
|
||||
remove_volatile_test_5();
|
||||
remove_volatile_test_6();
|
||||
remove_volatile_test_7();
|
||||
remove_volatile_test_8();
|
||||
remove_volatile_test_9();
|
||||
remove_volatile_test_10();
|
||||
remove_volatile_test_11();
|
||||
remove_volatile_test_12();
|
||||
remove_volatile_test_13();
|
||||
remove_volatile_test_14();
|
||||
remove_volatile_test_15();
|
||||
remove_volatile_test_16();
|
||||
remove_volatile_test_17();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for remove_cv:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_cv_test_1, ::boost::remove_cv, const)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_cv_test_2, ::boost::remove_cv, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_cv_test_3, ::boost::remove_cv, const volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_cv_test_4, ::boost::remove_cv)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_5, ::boost::remove_cv, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_6, ::boost::remove_cv, *const, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_7, ::boost::remove_cv, *volatile, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_8, ::boost::remove_cv, *const volatile, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_9, ::boost::remove_cv, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_10, ::boost::remove_cv, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_11, ::boost::remove_cv, volatile*, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_12, ::boost::remove_cv, const[2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_13, ::boost::remove_cv, volatile[2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_14, ::boost::remove_cv, const volatile[2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_15, ::boost::remove_cv, [2], [2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_16, ::boost::remove_cv, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_cv_test_17, ::boost::remove_cv, const*volatile, const*)
|
||||
|
||||
void check_remove_cv()
|
||||
{
|
||||
remove_cv_test_1();
|
||||
remove_cv_test_2();
|
||||
remove_cv_test_3();
|
||||
remove_cv_test_4();
|
||||
remove_cv_test_5();
|
||||
remove_cv_test_6();
|
||||
remove_cv_test_7();
|
||||
remove_cv_test_8();
|
||||
remove_cv_test_9();
|
||||
remove_cv_test_10();
|
||||
remove_cv_test_11();
|
||||
remove_cv_test_12();
|
||||
remove_cv_test_13();
|
||||
remove_cv_test_14();
|
||||
remove_cv_test_15();
|
||||
remove_cv_test_16();
|
||||
remove_cv_test_17();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for remove_reference:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_1, ::boost::remove_reference, const, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_2, ::boost::remove_reference, volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_reference_test_3, ::boost::remove_reference, &)
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_reference_test_4, ::boost::remove_reference)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_5, ::boost::remove_reference, const &, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_6, ::boost::remove_reference, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_7, ::boost::remove_reference, *volatile, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_reference_test_8, ::boost::remove_reference, &)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_9, ::boost::remove_reference, const &, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_10, ::boost::remove_reference, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_11, ::boost::remove_reference, volatile*, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_12, ::boost::remove_reference, const[2], const[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_reference_test_13, ::boost::remove_reference, (&)[2], [2])
|
||||
|
||||
void check_remove_reference()
|
||||
{
|
||||
remove_reference_test_1();
|
||||
remove_reference_test_2();
|
||||
remove_reference_test_3();
|
||||
remove_reference_test_4();
|
||||
remove_reference_test_5();
|
||||
remove_reference_test_6();
|
||||
remove_reference_test_7();
|
||||
remove_reference_test_8();
|
||||
remove_reference_test_9();
|
||||
remove_reference_test_10();
|
||||
remove_reference_test_11();
|
||||
remove_reference_test_12();
|
||||
remove_reference_test_13();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for remove_bounds:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_1, ::boost::remove_bounds, const, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_2, ::boost::remove_bounds, volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_bounds_test_3, ::boost::remove_bounds, [2])
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_bounds_test_4, ::boost::remove_bounds)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_5, ::boost::remove_bounds, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_6, ::boost::remove_bounds, *, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_7, ::boost::remove_bounds, *volatile, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_8, ::boost::remove_bounds, const [2], const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_9, ::boost::remove_bounds, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_10, ::boost::remove_bounds, const*, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_11, ::boost::remove_bounds, volatile*, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_12, ::boost::remove_bounds, const[2][3], const[3])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_bounds_test_13, ::boost::remove_bounds, (&)[2], (&)[2])
|
||||
|
||||
void check_remove_bounds()
|
||||
{
|
||||
remove_bounds_test_1();
|
||||
remove_bounds_test_2();
|
||||
remove_bounds_test_3();
|
||||
remove_bounds_test_4();
|
||||
remove_bounds_test_5();
|
||||
remove_bounds_test_6();
|
||||
remove_bounds_test_7();
|
||||
remove_bounds_test_8();
|
||||
remove_bounds_test_9();
|
||||
remove_bounds_test_10();
|
||||
remove_bounds_test_11();
|
||||
remove_bounds_test_12();
|
||||
remove_bounds_test_13();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for remove_pointer:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_1, ::boost::remove_pointer, const, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_2, ::boost::remove_pointer, volatile, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_pointer_test_3, ::boost::remove_pointer, *)
|
||||
BOOST_DECL_TRANSFORM_TEST2(remove_pointer_test_4, ::boost::remove_pointer)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_5, ::boost::remove_pointer, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_6, ::boost::remove_pointer, &, &)
|
||||
BOOST_DECL_TRANSFORM_TEST3(remove_pointer_test_7, ::boost::remove_pointer, *volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_8, ::boost::remove_pointer, const [2], const[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_9, ::boost::remove_pointer, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_10, ::boost::remove_pointer, const*, const)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_11, ::boost::remove_pointer, volatile*, volatile)
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_12, ::boost::remove_pointer, const[2][3], const[2][3])
|
||||
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_13, ::boost::remove_pointer, (&)[2], (&)[2])
|
||||
|
||||
void check_remove_pointer()
|
||||
{
|
||||
remove_pointer_test_1();
|
||||
remove_pointer_test_2();
|
||||
remove_pointer_test_3();
|
||||
remove_pointer_test_4();
|
||||
remove_pointer_test_5();
|
||||
remove_pointer_test_6();
|
||||
remove_pointer_test_7();
|
||||
remove_pointer_test_8();
|
||||
remove_pointer_test_9();
|
||||
remove_pointer_test_10();
|
||||
remove_pointer_test_11();
|
||||
remove_pointer_test_12();
|
||||
remove_pointer_test_13();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for add_reference:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_1, ::boost::add_reference, const, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_2, ::boost::add_reference, volatile, volatile&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_3, ::boost::add_reference, *, *&)
|
||||
//BOOST_DECL_TRANSFORM_TEST2(add_reference_test_4, ::boost::add_reference)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_5, ::boost::add_reference, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_6, ::boost::add_reference, &, &)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_7, ::boost::add_reference, *volatile, *volatile&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_8, ::boost::add_reference, const [2], const (&)[2])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_9, ::boost::add_reference, const &, const&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_10, ::boost::add_reference, const*, const*&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_11, ::boost::add_reference, volatile*, volatile*&)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_12, ::boost::add_reference, const[2][3], const (&)[2][3])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_reference_test_13, ::boost::add_reference, (&)[2], (&)[2])
|
||||
|
||||
void check_add_reference()
|
||||
{
|
||||
add_reference_test_1();
|
||||
add_reference_test_2();
|
||||
add_reference_test_3();
|
||||
//add_reference_test_4();
|
||||
add_reference_test_5();
|
||||
add_reference_test_6();
|
||||
add_reference_test_7();
|
||||
add_reference_test_8();
|
||||
add_reference_test_9();
|
||||
add_reference_test_10();
|
||||
add_reference_test_11();
|
||||
add_reference_test_12();
|
||||
add_reference_test_13();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* tests for add_pointer:
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_1, ::boost::add_pointer, const, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_2, ::boost::add_pointer, volatile, volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_3, ::boost::add_pointer, *, **)
|
||||
//BOOST_DECL_TRANSFORM_TEST2(add_pointer_test_4, ::boost::add_pointer)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_7, ::boost::add_pointer, *volatile, *volatile*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_10, ::boost::add_pointer, const*, const**)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_11, ::boost::add_pointer, volatile*, volatile**)
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_5, ::boost::add_pointer, const &, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_6, ::boost::add_pointer, &, *)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_8, ::boost::add_pointer, const [2], const *)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_9, ::boost::add_pointer, const &, const*)
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_12, ::boost::add_pointer, const[2][3], const (*)[3])
|
||||
BOOST_DECL_TRANSFORM_TEST(add_pointer_test_13, ::boost::add_pointer, (&)[2], *)
|
||||
#endif
|
||||
|
||||
void check_add_pointer()
|
||||
{
|
||||
add_pointer_test_1();
|
||||
add_pointer_test_2();
|
||||
add_pointer_test_3();
|
||||
//add_pointer_test_4();
|
||||
add_pointer_test_7();
|
||||
add_pointer_test_10();
|
||||
add_pointer_test_11();
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
add_pointer_test_5();
|
||||
add_pointer_test_6();
|
||||
add_pointer_test_8();
|
||||
add_pointer_test_9();
|
||||
add_pointer_test_12();
|
||||
add_pointer_test_13();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
check_remove_const();
|
||||
check_remove_volatile();
|
||||
check_remove_cv();
|
||||
check_remove_reference();
|
||||
check_remove_bounds();
|
||||
check_remove_pointer();
|
||||
check_add_reference();
|
||||
check_add_pointer();
|
||||
|
||||
type_test(void, boost::remove_const<void>::type)
|
||||
type_test(void, boost::remove_volatile<void>::type)
|
||||
type_test(void, boost::remove_cv<void>::type)
|
||||
|
||||
type_test(int, boost::remove_reference<cr_type>::type)
|
||||
type_test(void, boost::remove_reference<void>::type)
|
||||
|
||||
type_test(void, boost::remove_bounds<void>::type)
|
||||
type_test(void, boost::remove_pointer<void>::type)
|
||||
|
||||
return check_result(argc, argv);
|
||||
}
|
||||
|
||||
//
|
||||
// define the number of failures expected for given compilers:
|
||||
#ifdef __BORLANDC__
|
||||
#ifdef SHORT_TRANSFORM_TEST
|
||||
unsigned int expected_failures = 97; // cv-qualifiers
|
||||
#else
|
||||
unsigned int expected_failures = 422; // cv-qualifiers
|
||||
#endif
|
||||
#elif defined(__GNUC__)
|
||||
unsigned int expected_failures = 1; // cv-qualified references
|
||||
#else
|
||||
unsigned int expected_failures = 0;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -1,166 +0,0 @@
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1999
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* This file provides some example of type_traits usage -
|
||||
* by "optimising" various algorithms:
|
||||
*
|
||||
* opt::destroy_array - an example of optimisation based upon omitted destructor calls
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/timer.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::cin;
|
||||
|
||||
namespace opt{
|
||||
|
||||
//
|
||||
// algorithm destroy_array:
|
||||
// The reverse of std::unitialized_copy, takes a block of
|
||||
// initialized memory and calls destructors on all objects therein.
|
||||
//
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <bool>
|
||||
struct array_destroyer
|
||||
{
|
||||
template <class T>
|
||||
static void destroy_array(T* i, T* j){ do_destroy_array(i, j); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct array_destroyer<true>
|
||||
{
|
||||
template <class T>
|
||||
static void destroy_array(T*, T*){}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void do_destroy_array(T* first, T* last)
|
||||
{
|
||||
while(first != last)
|
||||
{
|
||||
first->~T();
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
}; // namespace detail
|
||||
|
||||
template <class T>
|
||||
inline void destroy_array(T* p1, T* p2)
|
||||
{
|
||||
detail::array_destroyer<boost::has_trivial_destructor<T>::value>::destroy_array(p1, p2);
|
||||
}
|
||||
|
||||
//
|
||||
// unoptimised versions of destroy_array:
|
||||
//
|
||||
template <class T>
|
||||
void destroy_array1(T* first, T* last)
|
||||
{
|
||||
while(first != last)
|
||||
{
|
||||
first->~T();
|
||||
++first;
|
||||
}
|
||||
}
|
||||
template <class T>
|
||||
void destroy_array2(T* first, T* last)
|
||||
{
|
||||
for(; first != last; ++first) first->~T();
|
||||
}
|
||||
|
||||
} // namespace opt
|
||||
|
||||
//
|
||||
// define some global data:
|
||||
//
|
||||
const int array_size = 1000;
|
||||
int i_array[array_size] = {0,};
|
||||
const int ci_array[array_size] = {0,};
|
||||
char c_array[array_size] = {0,};
|
||||
const char cc_array[array_size] = { 0,};
|
||||
|
||||
const int iter_count = 1000000;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::timer t;
|
||||
double result;
|
||||
int i;
|
||||
//
|
||||
// test destroy_array,
|
||||
// compare destruction time of an array of ints
|
||||
// with unoptimised form.
|
||||
//
|
||||
cout << "Measuring times in micro-seconds per 1000 elements processed" << endl << endl;
|
||||
cout << "testing destroy_array...\n"
|
||||
"[Some compilers may be able to optimise the \"unoptimised\"\n versions as well as type_traits does.]" << endl;
|
||||
|
||||
// cache load:
|
||||
opt::destroy_array(i_array, i_array + array_size);
|
||||
|
||||
// time optimised version:
|
||||
t.restart();
|
||||
for(i = 0; i < iter_count; ++i)
|
||||
{
|
||||
opt::destroy_array(i_array, i_array + array_size);
|
||||
}
|
||||
result = t.elapsed();
|
||||
cout << "destroy_array<int>: " << result << endl;
|
||||
|
||||
// cache load:
|
||||
opt::destroy_array1(i_array, i_array + array_size);
|
||||
|
||||
// time unoptimised version #1:
|
||||
t.restart();
|
||||
for(i = 0; i < iter_count; ++i)
|
||||
{
|
||||
opt::destroy_array1(i_array, i_array + array_size);
|
||||
}
|
||||
result = t.elapsed();
|
||||
cout << "destroy_array<int>(unoptimised#1): " << result << endl;
|
||||
|
||||
// cache load:
|
||||
opt::destroy_array2(i_array, i_array + array_size);
|
||||
|
||||
// time unoptimised version #2:
|
||||
t.restart();
|
||||
for(i = 0; i < iter_count; ++i)
|
||||
{
|
||||
opt::destroy_array2(i_array, i_array + array_size);
|
||||
}
|
||||
result = t.elapsed();
|
||||
cout << "destroy_array<int>(unoptimised#2): " << result << endl << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
76
doc/Jamfile.v2
Normal file
76
doc/Jamfile.v2
Normal file
@ -0,0 +1,76 @@
|
||||
|
||||
# Copyright John Maddock 2005. Use, modification, and distribution are
|
||||
# subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import modules ;
|
||||
using quickbook ;
|
||||
using auto-index ;
|
||||
|
||||
path-constant boost-images : ../../../doc/src/images ;
|
||||
path-constant here : . ;
|
||||
|
||||
xml type_traits : type_traits.qbk ;
|
||||
boostbook standalone
|
||||
:
|
||||
type_traits
|
||||
:
|
||||
# Index generation:
|
||||
# Path for links to Boost:
|
||||
<xsl:param>boost.root=../../../..
|
||||
|
||||
# Some general style settings:
|
||||
<xsl:param>table.footnote.number.format=1
|
||||
<xsl:param>footnote.number.format=1
|
||||
|
||||
# HTML options first:
|
||||
# Use graphics not text for navigation:
|
||||
<xsl:param>navig.graphics=1
|
||||
# How far down we chunk nested sections, basically all of them:
|
||||
<xsl:param>chunk.section.depth=10
|
||||
# Don't put the first section on the same page as the TOC:
|
||||
<xsl:param>chunk.first.sections=1
|
||||
# How far down sections get TOC's
|
||||
<xsl:param>toc.section.depth=10
|
||||
# Max depth in each TOC:
|
||||
<xsl:param>toc.max.depth=4
|
||||
# How far down we go with TOC's
|
||||
<xsl:param>generate.section.toc.level=10
|
||||
|
||||
# PDF Options:
|
||||
# TOC Generation: this is needed for FOP-0.9 and later:
|
||||
<xsl:param>fop1.extensions=0
|
||||
<xsl:param>xep.extensions=1
|
||||
# TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
|
||||
<xsl:param>fop.extensions=0
|
||||
# No indent on body text:
|
||||
<xsl:param>body.start.indent=0pt
|
||||
# Margin size:
|
||||
<xsl:param>page.margin.inner=0.5in
|
||||
# Margin size:
|
||||
<xsl:param>page.margin.outer=0.5in
|
||||
# Paper type = A4
|
||||
<xsl:param>paper.type=A4
|
||||
# Yes, we want graphics for admonishments:
|
||||
<xsl:param>admon.graphics=1
|
||||
# Set this one for PDF generation *only*:
|
||||
# default pnd graphics are awful in PDF form,
|
||||
# better use SVG's instead:
|
||||
<format>pdf:<xsl:param>admon.graphics.extension=".svg"
|
||||
<format>pdf:<xsl:param>admon.graphics.path=$(boost-images)/
|
||||
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/type_traits/doc/html
|
||||
<format>pdf:<auto-index-internal>off
|
||||
<format>html:<auto-index-internal>on
|
||||
<auto-index-script>$(here)/index.idx
|
||||
<auto-index-prefix>$(here)/../../..
|
||||
<auto-index>on
|
||||
;
|
||||
|
||||
install pdfinstall : standalone/<format>pdf : <install-type>PDF <location>. <name>type_traits.pdf ;
|
||||
explicit pdfinstall ;
|
||||
|
||||
###############################################################################
|
||||
alias boostdoc ;
|
||||
explicit boostdoc ;
|
||||
alias boostrelease : standalone ;
|
||||
explicit boostrelease ;
|
41
doc/add_const.qbk
Normal file
41
doc/add_const.qbk
Normal file
@ -0,0 +1,41 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:add_const add_const]
|
||||
|
||||
template <class T>
|
||||
struct add_const
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template <class T> using add_const_t = typename add_const<T>::type; // C++11 and above
|
||||
|
||||
__type The same type as `T const` for all `T`.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
||||
__header ` #include <boost/type_traits/add_const.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[ [Expression] [Result Type]]
|
||||
|
||||
[[`add_const<int>::type`][`int const`]]
|
||||
|
||||
[[`add_const<int&>::type`] [`int&`]]
|
||||
|
||||
[[`add_const<int*>::type`] [`int* const`]]
|
||||
|
||||
[[`add_const<int const>::type`] [`int const`]]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
41
doc/add_cv.qbk
Normal file
41
doc/add_cv.qbk
Normal file
@ -0,0 +1,41 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:add_cv add_cv]
|
||||
|
||||
template <class T>
|
||||
struct add_cv
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template <class T> using add_cv_t = typename add_cv<T>::type; // C++11 and above
|
||||
|
||||
__type The same type as `T const volatile` for all `T`.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
||||
__header ` #include <boost/type_traits/add_cv.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[ [Expression] [Result Type]]
|
||||
|
||||
[[`add_cv<int>::type`][`int const volatile`]]
|
||||
|
||||
[[`add_cv<int&>::type`] [`int&`]]
|
||||
|
||||
[[`add_cv<int*>::type`] [`int* const volatile`]]
|
||||
|
||||
[[`add_cv<int const>::type`] [`int const volatile`]]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
47
doc/add_lvalue_reference.qbk
Normal file
47
doc/add_lvalue_reference.qbk
Normal file
@ -0,0 +1,47 @@
|
||||
[/
|
||||
Copyright 2010 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:add_lvalue_reference add_lvalue_reference]
|
||||
|
||||
template <class T>
|
||||
struct add_lvalue_reference
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template <class T> using add_lvalue_reference_t = typename add_lvalue_reference<T>::type; // C++11 and above
|
||||
|
||||
__type If `T` names an object or function type then the member typedef `type`
|
||||
shall name `T&`; otherwise, if `T` names a type ['rvalue reference to U] then
|
||||
the member typedef type shall name `U&`; otherwise, type shall name `T`.
|
||||
|
||||
__std_ref 20.7.6.2.
|
||||
|
||||
__header ` #include <boost/type_traits/add_lvalue_reference.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[ [Expression] [Result Type]]
|
||||
|
||||
[[`add_lvalue_reference<int>::type`][`int&`]]
|
||||
|
||||
[[`add_lvalue_reference<int const&>::type`] [`int const&`]]
|
||||
|
||||
[[`add_lvalue_reference<int*>::type`] [`int*&`]]
|
||||
|
||||
[[`add_lvalue_reference<int*&>::type`] [`int*&`]]
|
||||
|
||||
[[`add_lvalue_reference<int&&>::type`][`int&`]]
|
||||
|
||||
[[`add_lvalue_reference<void>::type`][`void`]]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
45
doc/add_pointer.qbk
Normal file
45
doc/add_pointer.qbk
Normal file
@ -0,0 +1,45 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:add_pointer add_pointer]
|
||||
|
||||
template <class T>
|
||||
struct add_pointer
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template <class T> using add_pointer_t = typename add_pointer<T>::type; // C++11 and above
|
||||
|
||||
__type The same type as `remove_reference<T>::type*`.
|
||||
|
||||
The rationale for this template
|
||||
is that it produces the same type as `decltype(&t)`,
|
||||
where `t` is an object of type `T`.
|
||||
|
||||
__std_ref 8.3.1.
|
||||
|
||||
__header ` #include <boost/type_traits/add_pointer.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[ [Expression] [Result Type]]
|
||||
|
||||
[[`add_pointer<int>::type`][`int*`]]
|
||||
|
||||
[[`add_pointer<int const&>::type`] [`int const*`]]
|
||||
|
||||
[[`add_pointer<int*>::type`] [`int**`]]
|
||||
|
||||
[[`add_pointer<int*&>::type`] [`int**`]]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
47
doc/add_reference.qbk
Normal file
47
doc/add_reference.qbk
Normal file
@ -0,0 +1,47 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:add_reference add_reference]
|
||||
|
||||
[note This trait has been made obsolete by __add_lvalue_reference and __add_rvalue_reference,
|
||||
and new code should use these new traits rather than __is_reference which is retained
|
||||
for backwards compatibility only.
|
||||
]
|
||||
|
||||
|
||||
template <class T>
|
||||
struct add_reference
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template <class T> using add_reference_t = typename add_reference<T>::type; // C++11 and above
|
||||
|
||||
__type If `T` is not a reference type then `T&`, otherwise `T`.
|
||||
|
||||
__std_ref 8.3.2.
|
||||
|
||||
__header ` #include <boost/type_traits/add_reference.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[ [Expression] [Result Type]]
|
||||
|
||||
[[`add_reference<int>::type`][`int&`]]
|
||||
|
||||
[[`add_reference<int const&>::type`] [`int const&`]]
|
||||
|
||||
[[`add_reference<int*>::type`] [`int*&`]]
|
||||
|
||||
[[`add_reference<int*&>::type`] [`int*&`]]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
49
doc/add_rvalue_reference.qbk
Normal file
49
doc/add_rvalue_reference.qbk
Normal file
@ -0,0 +1,49 @@
|
||||
[/
|
||||
Copyright 2010 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:add_rvalue_reference add_rvalue_reference]
|
||||
|
||||
template <class T>
|
||||
struct add_rvalue_reference
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template <class T> using add_rvalue_reference_t = typename add_rvalue_reference<T>::type; // C++11 and above
|
||||
|
||||
__type If `T` names an object or function type then the member typedef type
|
||||
shall name `T&&`; otherwise, type shall name `T`. ['\[Note: This rule reflects
|
||||
the semantics of reference collapsing. For example, when a type `T` names
|
||||
a type U&, the type `add_rvalue_reference<T>::type` is not an rvalue
|
||||
reference. -end note\]].
|
||||
|
||||
__std_ref 20.7.6.2.
|
||||
|
||||
__header ` #include <boost/type_traits/add_rvalue_reference.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[ [Expression] [Result Type]]
|
||||
|
||||
[[`add_rvalue_reference<int>::type`][`int&&`]]
|
||||
|
||||
[[`add_rvalue_reference<int const&>::type`] [`int const&`]]
|
||||
|
||||
[[`add_rvalue_reference<int*>::type`] [`int*&&`]]
|
||||
|
||||
[[`add_rvalue_reference<int*&>::type`] [`int*&`]]
|
||||
|
||||
[[`add_rvalue_reference<int&&>::type`][`int&&`]]
|
||||
|
||||
[[`add_rvalue_reference<void>::type`][`void`]]
|
||||
|
||||
]
|
||||
|
||||
__compat In the absence of rvalue-reference support this trait has no effect.
|
||||
|
||||
[endsect]
|
||||
|
41
doc/add_volatile.qbk
Normal file
41
doc/add_volatile.qbk
Normal file
@ -0,0 +1,41 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:add_volatile add_volatile]
|
||||
|
||||
template <class T>
|
||||
struct add_volatile
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template <class T> using add_volatile_t = typename add_volatile<T>::type; // C++11 and above
|
||||
|
||||
__type The same type as `T volatile` for all `T`.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
||||
__header ` #include <boost/type_traits/add_volatile.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[ [Expression] [Result Type]]
|
||||
|
||||
[[`add_volatile<int>::type`][`int volatile`]]
|
||||
|
||||
[[`add_volatile<int&>::type`] [`int&`]]
|
||||
|
||||
[[`add_volatile<int*>::type`] [`int* volatile`]]
|
||||
|
||||
[[`add_volatile<int const>::type`] [`int const volatile`]]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
54
doc/aligned_storage.qbk
Normal file
54
doc/aligned_storage.qbk
Normal file
@ -0,0 +1,54 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:aligned_storage aligned_storage]
|
||||
|
||||
template <std::size_t Size, std::size_t Align>
|
||||
struct aligned_storage
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
__type a built-in or POD type with size `Size` and an alignment
|
||||
that is a multiple of `Align`.
|
||||
|
||||
__header ` #include <boost/type_traits/aligned_storage.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
On the GCC and Visual C++ compilers (or compilers that are compatible with them), we support
|
||||
requests for types with alignments greater than any built in type (up to 128-bit alignment).
|
||||
Visual C++ users should note that such "extended" types can not be passed down the stack as
|
||||
by-value function arguments.
|
||||
|
||||
[important
|
||||
Visual C++ users should be aware that MSVC has an elastic definition of alignment, for
|
||||
example consider the following code:
|
||||
|
||||
``
|
||||
typedef boost::aligned_storage<8,8>::type align_t;
|
||||
assert(boost::alignment_of<align_t>::value % 8 == 0);
|
||||
align_t a;
|
||||
assert(((std::uintptr_t)&a % 8) == 0);
|
||||
char c = 0;
|
||||
align_t a1;
|
||||
assert(((std::uintptr_t)&a1 % 8) == 0);
|
||||
``
|
||||
|
||||
In this code the final assert will fail for a 32-bit build because variable `a1` is not
|
||||
aligned on an 8-byte boundary. Had we used the MSVC intrinsic `__alignof` in
|
||||
place of `alignment_of` or `std::aligned_storage` in place of `boost::aligned_storage`
|
||||
the result would have been no different. In MSVC alignment requirements/promises only
|
||||
really apply to variables on the heap, not on the stack.
|
||||
|
||||
Further, although MSVC has a mechanism for generating new types with arbitrary alignment
|
||||
requirements, such types cannot be passed as function arguments on the program stack.
|
||||
Therefore had `boost::aligned_storage<8,8>::type` been a type declared with
|
||||
`__declspec(align(8))` we would break a great deal of existing code that relies on
|
||||
being able to pass such types through the program stack.
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
55
doc/alignment_of.qbk
Normal file
55
doc/alignment_of.qbk
Normal file
@ -0,0 +1,55 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:alignment_of alignment_of]
|
||||
template <class T>
|
||||
struct alignment_of : public __integral_constant<std::size_t, ALIGNOF(T)> {};
|
||||
|
||||
__inherit Class template `alignment_of` inherits from
|
||||
`__integral_constant<std::size_t, ALIGNOF(T)>`, where `ALIGNOF(T)` is the
|
||||
alignment of type T.
|
||||
|
||||
['Note: strictly speaking you should only rely on
|
||||
the value of `ALIGNOF(T)` being a multiple of the true alignment of T, although
|
||||
in practice it does compute the correct value in all the cases we know about.]
|
||||
|
||||
__header ` #include <boost/type_traits/alignment_of.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
__examples
|
||||
|
||||
[:`alignment_of<int>` inherits from `__integral_constant<std::size_t, ALIGNOF(int)>`.]
|
||||
|
||||
[:`alignment_of<char>::type` is the type `__integral_constant<std::size_t, ALIGNOF(char)>`.]
|
||||
|
||||
[:`alignment_of<double>::value` is an integral constant
|
||||
expression with value `ALIGNOF(double)`.]
|
||||
|
||||
[:`alignment_of<T>::value_type` is the type `std::size_t`.]
|
||||
|
||||
[important
|
||||
Visual C++ users should note that MSVC has varying definitions of "alignment".
|
||||
For example consider the following code:
|
||||
|
||||
``
|
||||
typedef long long align_t;
|
||||
assert(boost::alignment_of<align_t>::value % 8 == 0);
|
||||
align_t a;
|
||||
assert(((std::uintptr_t)&a % 8) == 0);
|
||||
char c = 0;
|
||||
align_t a1;
|
||||
assert(((std::uintptr_t)&a1 % 8) == 0);
|
||||
``
|
||||
|
||||
In this code, even though `boost::alignment_of<align_t>` reports that `align_t` has 8-byte
|
||||
alignment, the final assert will fail for a 32-bit build because `a1` is not aligned on an
|
||||
8 byte boundary. Note that had we used the MSVC intrinsic `__alignof` in place of `boost::alignment_of`
|
||||
we would still get the same result. In fact for MSVC alignment requirements (and promises) only really
|
||||
apply to dynamic storage, and not the stack.
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
24
doc/alignment_traits.qbk
Normal file
24
doc/alignment_traits.qbk
Normal file
@ -0,0 +1,24 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:alignment Synthesizing Types with Specific Alignments]
|
||||
|
||||
Some low level memory management routines need to synthesize a POD type with
|
||||
specific alignment properties. The template `__type_with_alignment` finds the smallest
|
||||
type with a specified alignment, while template `__aligned_storage` creates a type
|
||||
with a specific size and alignment.
|
||||
|
||||
[*Synopsis]
|
||||
|
||||
template <std::size_t Align>
|
||||
struct __type_with_alignment;
|
||||
|
||||
template <std::size_t Size, std::size_t Align>
|
||||
struct __aligned_storage;
|
||||
|
||||
[endsect]
|
||||
|
322
doc/background.qbk
Normal file
322
doc/background.qbk
Normal file
@ -0,0 +1,322 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:background Background and Tutorial]
|
||||
|
||||
The following is an updated version of the article "C++ Type traits"
|
||||
by John Maddock and Steve Cleary that appeared in the October 2000
|
||||
issue of [@http://www.ddj.com Dr Dobb's Journal].
|
||||
|
||||
Generic programming (writing code which works with any data type meeting a
|
||||
set of requirements) has become the method of choice for providing reusable code.
|
||||
However, there are times in generic programming when "generic" just isn't
|
||||
good enough - sometimes the differences between types are too large for an
|
||||
efficient generic implementation. This is when the traits technique
|
||||
becomes important - by encapsulating those properties that need to be
|
||||
considered on a type by type basis inside a traits class, we can
|
||||
minimize the amount of code that has to differ from one type to another,
|
||||
and maximize the amount of generic code.
|
||||
|
||||
Consider an example: when working with character strings, one common operation is
|
||||
to determine the length of a null terminated string. Clearly it's possible to
|
||||
write generic code that can do this, but it turns out that there are much more
|
||||
efficient methods available: for example, the C library functions `strlen` and
|
||||
`wcslen` are usually written in assembler, and with suitable hardware support
|
||||
can be considerably faster than a generic version written in C++.
|
||||
The authors of the C++ standard library realized this, and abstracted the
|
||||
properties of `char` and `wchar_t` into the class `char_traits`. Generic code
|
||||
that works with character strings can simply use `char_traits<>::length` to
|
||||
determine the length of a null terminated string, safe in the knowledge
|
||||
that specializations of `char_traits` will use the most appropriate method
|
||||
available to them.
|
||||
|
||||
[h4 Type Traits]
|
||||
|
||||
Class `char_traits` is a classic example of a collection of type specific
|
||||
properties wrapped up in a single class - what Nathan Myers termed a
|
||||
/baggage class/[link background.references \[1\]]. In the Boost type-traits library, we[link background.references \[2\]] have written a
|
||||
set of very specific traits classes, each of which encapsulate a single trait
|
||||
from the C++ type system; for example, is a type a pointer or a reference type?
|
||||
Or does a type have a trivial constructor, or a const-qualifier?
|
||||
The type-traits classes share a unified design: each class inherits from
|
||||
the type __true_type if the type has the specified property and inherits from
|
||||
__false_type otherwise. As we will show, these classes can be used in
|
||||
generic programming to determine the properties of a given type and introduce
|
||||
optimizations that are appropriate for that case.
|
||||
|
||||
The type-traits library also contains a set of classes that perform a
|
||||
specific transformation on a type; for example, they can remove a
|
||||
top-level const or volatile qualifier from a type. Each class that
|
||||
performs a transformation defines a single typedef-member `type`
|
||||
that is the result of the transformation. All of the type-traits
|
||||
classes are defined inside namespace `boost`; for brevity, namespace-qualification
|
||||
is omitted in most of the code samples given.
|
||||
|
||||
[h4 Implementation]
|
||||
|
||||
There are far too many separate classes contained in the type-traits library
|
||||
to give a full implementation here - see the source code in the Boost library
|
||||
for the full details - however, most of the implementation is fairly repetitive
|
||||
anyway, so here we will just give you a flavor for how some of the classes are
|
||||
implemented. Beginning with possibly the simplest class in the library,
|
||||
`is_void<T>` inherits from `__true_type` only if `T` is `void`.
|
||||
|
||||
template <typename T>
|
||||
struct __is_void : public __false_type{};
|
||||
|
||||
template <>
|
||||
struct __is_void<void> : public __true_type{};
|
||||
|
||||
Here we define a primary version of the template class `__is_void`, and
|
||||
provide a full-specialization when `T` is `void`. While full specialization
|
||||
of a template class is an important technique, sometimes we need a
|
||||
solution that is halfway between a fully generic solution, and a full
|
||||
specialization. This is exactly the situation for which the standards committee
|
||||
defined partial template-class specialization. As an example, consider the
|
||||
class `boost::is_pointer<T>`: here we needed a primary version that handles
|
||||
all the cases where T is not a pointer, and a partial specialization to
|
||||
handle all the cases where T is a pointer:
|
||||
|
||||
template <typename T>
|
||||
struct __is_pointer : public __false_type{};
|
||||
|
||||
template <typename T>
|
||||
struct __is_pointer<T*> : public __true_type{};
|
||||
|
||||
The syntax for partial specialization is somewhat arcane and could easily
|
||||
occupy an article in its own right; like full specialization, in order to
|
||||
write a partial specialization for a class, you must first declare the
|
||||
primary template. The partial specialization contains an extra <...> after the
|
||||
class name that contains the partial specialization parameters; these define
|
||||
the types that will bind to that partial specialization rather than the
|
||||
default template. The rules for what can appear in a partial specialization
|
||||
are somewhat convoluted, but as a rule of thumb if you can legally write two
|
||||
function overloads of the form:
|
||||
|
||||
void foo(T);
|
||||
void foo(U);
|
||||
|
||||
Then you can also write a partial specialization of the form:
|
||||
|
||||
template <typename T>
|
||||
class c{ /*details*/ };
|
||||
|
||||
template <typename T>
|
||||
class c<U>{ /*details*/ };
|
||||
|
||||
This rule is by no means foolproof, but it is reasonably simple to remember
|
||||
and close enough to the actual rule to be useful for everyday use.
|
||||
|
||||
As a more complex example of partial specialization consider the class
|
||||
`remove_extent<T>`. This class defines a single typedef-member `type` that
|
||||
is the same type as T but with any top-level array bounds removed;
|
||||
this is an example of a traits class that performs a transformation on a type:
|
||||
|
||||
template <typename T>
|
||||
struct __remove_extent
|
||||
{ typedef T type; };
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
struct __remove_extent<T[N]>
|
||||
{ typedef T type; };
|
||||
|
||||
The aim of `__remove_extent` is this: imagine a generic algorithm that is
|
||||
passed an array type as a template parameter, `__remove_extent` provides a
|
||||
means of determining the underlying type of the array. For example
|
||||
`remove_extent<int[4][5]>::type` would evaluate to the type `int[5]`.
|
||||
This example also shows that the number of template parameters in a
|
||||
partial specialization does not have to match the number in the
|
||||
default template. However, the number of parameters that appear after the
|
||||
class name do have to match the number and type of the parameters in the
|
||||
default template.
|
||||
|
||||
[h4 Optimized copy]
|
||||
|
||||
As an example of how the type traits classes can be used, consider the
|
||||
standard library algorithm copy:
|
||||
|
||||
template<typename Iter1, typename Iter2>
|
||||
Iter2 copy(Iter1 first, Iter1 last, Iter2 out);
|
||||
|
||||
Obviously, there's no problem writing a generic version of copy that works
|
||||
for all iterator types `Iter1` and `Iter2`; however, there are some
|
||||
circumstances when the copy operation can best be performed by a call to
|
||||
`memcpy`. In order to implement copy in terms of `memcpy` all of the
|
||||
following conditions need to be met:
|
||||
|
||||
* Both of the iterator types `Iter1` and `Iter2` must be pointers.
|
||||
* Both `Iter1` and `Iter2` must point to the same type - excluding const and
|
||||
volatile-qualifiers.
|
||||
* The type pointed to by `Iter1` must have a trivial assignment operator.
|
||||
|
||||
By trivial assignment operator we mean that the type is either a scalar type[link background.references \[3\]] or:
|
||||
|
||||
* The type has no user defined assignment operator.
|
||||
* The type does not have any data members that are references.
|
||||
* All base classes, and all data member objects must have trivial assignment operators.
|
||||
|
||||
If all these conditions are met then a type can be copied using `memcpy`
|
||||
rather than using a compiler generated assignment operator. The type-traits
|
||||
library provides a class `__has_trivial_assign`, such that
|
||||
`has_trivial_assign<T>::value` is true only if T has a trivial assignment operator.
|
||||
This class "just works" for scalar types, but has to be explicitly
|
||||
specialised for class/struct types that also happen to have a trivial assignment
|
||||
operator. In other words if __has_trivial_assign gives the wrong answer,
|
||||
it will give the "safe" wrong answer - that trivial assignment is not allowable.
|
||||
|
||||
The code for an optimized version of copy that uses `memcpy` where appropriate is
|
||||
given in [link boost_typetraits.examples.copy the examples]. The code begins by defining a template
|
||||
function `do_copy` that performs a "slow but safe" copy. The last parameter passed
|
||||
to this function may be either a `__true_type` or a `__false_type`. Following that
|
||||
there is an overload of do_copy that uses `memcpy`: this time the iterators are required
|
||||
to actually be pointers to the same type, and the final parameter must be a
|
||||
`__true_type`. Finally, the version of `copy` calls `do_copy`, passing
|
||||
`__has_trivial_assign<value_type>()` as the final parameter: this will dispatch
|
||||
to the optimized version where appropriate, otherwise it will call the
|
||||
"slow but safe version".
|
||||
|
||||
[h4 Was it worth it?]
|
||||
|
||||
It has often been repeated in these columns that "premature optimization is the
|
||||
root of all evil" [link background.references \[4\]]. So the question must be asked: was our optimization
|
||||
premature? To put this in perspective the timings for our version of copy
|
||||
compared a conventional generic copy[link background.references \[5\]] are shown in table 1.
|
||||
|
||||
Clearly the optimization makes a difference in this case; but, to be fair,
|
||||
the timings are loaded to exclude cache miss effects - without this
|
||||
accurate comparison between algorithms becomes difficult. However, perhaps
|
||||
we can add a couple of caveats to the premature optimization rule:
|
||||
|
||||
*If you use the right algorithm for the job in the first place then optimization
|
||||
will not be required; in some cases, memcpy is the right algorithm.
|
||||
*If a component is going to be reused in many places by many people then
|
||||
optimizations may well be worthwhile where they would not be so for a single
|
||||
case - in other words, the likelihood that the optimization will be
|
||||
absolutely necessary somewhere, sometime is that much higher.
|
||||
Just as importantly the perceived value of the stock implementation will be
|
||||
higher: there is no point standardizing an algorithm if users reject it on
|
||||
the grounds that there are better, more heavily optimized versions available.
|
||||
|
||||
[table Time taken to copy 1000 elements using `copy<const T*, T*>` (times in micro-seconds)
|
||||
|
||||
[[Version] [T] [Time]]
|
||||
[["Optimized" copy] [char] [0.99]]
|
||||
[[Conventional copy] [char] [8.07]]
|
||||
[["Optimized" copy] [int] [2.52]]
|
||||
[[Conventional copy] [int] [8.02]]
|
||||
]
|
||||
|
||||
[h4 Pair of References]
|
||||
The optimized copy example shows how type traits may be used to perform
|
||||
optimization decisions at compile-time. Another important usage of type traits
|
||||
is to allow code to compile that otherwise would not do so unless excessive
|
||||
partial specialization is used. This is possible by delegating partial
|
||||
specialization to the type traits classes. Our example for this form of
|
||||
usage is a pair that can hold references [link background.references \[6\]].
|
||||
|
||||
First, let us examine the definition of `std::pair`, omitting the
|
||||
comparison operators, default constructor, and template copy constructor for
|
||||
simplicity:
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct pair
|
||||
{
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
|
||||
T1 first;
|
||||
T2 second;
|
||||
|
||||
pair(const T1 & nfirst, const T2 & nsecond)
|
||||
:first(nfirst), second(nsecond) { }
|
||||
};
|
||||
|
||||
Now, this "pair" cannot hold references as it currently stands, because the
|
||||
constructor would require taking a reference to a reference, which is
|
||||
currently illegal [link background.references \[7\]]. Let us consider what the constructor's parameters
|
||||
would have to be in order to allow "pair" to hold non-reference types,
|
||||
references, and constant references:
|
||||
|
||||
[table Required Constructor Argument Types
|
||||
[[Type of `T1`] [Type of parameter to initializing constructor]]
|
||||
[[T] [const T &]]
|
||||
[[T &] [T &]]
|
||||
[[const T &] [const T &]]
|
||||
]
|
||||
|
||||
A little familiarity with the type traits classes allows us to construct a
|
||||
single mapping that allows us to determine the type of parameter from the
|
||||
type of the contained class. The type traits classes provide a
|
||||
transformation __add_reference, which adds a reference to its type,
|
||||
unless it is already a reference.
|
||||
|
||||
[table Using add_reference to synthesize the correct constructor type
|
||||
[[Type of `T1`] [Type of `const T1`] [Type of `add_reference<const T1>::type`]]
|
||||
[[T] [const T] [const T &]]
|
||||
[[T &] [T & \[8\]] [T &]]
|
||||
[[const T &] [const T &] [const T &]]
|
||||
]
|
||||
|
||||
This allows us to build a primary template definition for `pair` that can
|
||||
contain non-reference types, reference types, and constant reference types:
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct pair
|
||||
{
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
|
||||
T1 first;
|
||||
T2 second;
|
||||
|
||||
pair(boost::__add_reference<const T1>::type nfirst,
|
||||
boost::__add_reference<const T2>::type nsecond)
|
||||
:first(nfirst), second(nsecond) { }
|
||||
};
|
||||
|
||||
Add back in the standard comparison operators, default constructor,
|
||||
and template copy constructor (which are all the same), and you have a
|
||||
`std::pair` that can hold reference types!
|
||||
|
||||
This same extension could have been done using partial template specialization
|
||||
of `pair`, but to specialize `pair` in this way would require three partial
|
||||
specializations, plus the primary template. Type traits allows us to
|
||||
define a single primary template that adjusts itself auto-magically to
|
||||
any of these partial specializations, instead of a brute-force partial
|
||||
specialization approach. Using type traits in this fashion allows
|
||||
programmers to delegate partial specialization to the type traits classes,
|
||||
resulting in code that is easier to maintain and easier to understand.
|
||||
|
||||
[h4 Conclusion]
|
||||
|
||||
We hope that in this article we have been able to give you some idea of
|
||||
what type-traits are all about. A more complete listing of the available
|
||||
classes are in the boost documentation, along with further examples using
|
||||
type traits. Templates have enabled C++ uses to take the advantage of the
|
||||
code reuse that generic programming brings; hopefully this article has
|
||||
shown that generic programming does not have to sink to the lowest common
|
||||
denominator, and that templates can be optimal as well as generic.
|
||||
|
||||
[h4 Acknowledgements]
|
||||
|
||||
The authors would like to thank Beman Dawes and Howard Hinnant for their
|
||||
helpful comments when preparing this article.
|
||||
|
||||
[h4 [#background.references]References]
|
||||
|
||||
# Nathan C. Myers, C++ Report, June 1995.
|
||||
# The type traits library is based upon contributions by Steve Cleary, Beman Dawes, Howard Hinnant and John Maddock: it can be found at www.boost.org.
|
||||
# A scalar type is an arithmetic type (i.e. a built-in integer or floating point type), an enumeration type, a pointer, a pointer to member, or a const- or volatile-qualified version of one of these types.
|
||||
# This quote is from Donald Knuth, ACM Computing Surveys, December 1974, pg 268.
|
||||
# The test code is available as part of the boost utility library (see algo_opt_examples.cpp), the code was compiled with gcc 2.95 with all optimisations turned on, tests were conducted on a 400MHz Pentium II machine running Microsoft Windows 98.
|
||||
# John Maddock and Howard Hinnant have submitted a "compressed_pair" library to Boost, which uses a technique similar to the one described here to hold references. Their pair also uses type traits to determine if any of the types are empty, and will derive instead of contain to conserve space -- hence the name "compressed".
|
||||
# This is actually an issue with the C++ Core Language Working Group (issue #106), submitted by Bjarne Stroustrup. The tentative resolution is to allow a "reference to a reference to T" to mean the same thing as a "reference to T", but only in template instantiation, in a method similar to multiple cv-qualifiers.
|
||||
# For those of you who are wondering why this shouldn't be const-qualified, remember that references are always implicitly constant (for example, you can't re-assign a reference). Remember also that "const T &" is something completely different. For this reason, cv-qualifiers on template type arguments that are references are ignored.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
218
doc/common_type.qbk
Normal file
218
doc/common_type.qbk
Normal file
@ -0,0 +1,218 @@
|
||||
[/
|
||||
Copyright 2008 Howard Hinnant
|
||||
Copyright 2008 Beman Dawes
|
||||
Copyright 2010 John Maddock
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[/===================================================================]
|
||||
[section:common_type common_type]
|
||||
[/===================================================================]
|
||||
|
||||
__header ` #include <boost/type_traits/common_type.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
namespace boost {
|
||||
template <class... T> struct common_type;
|
||||
template<class... T> using common_type_t = typename common_type<T...>::type; // C++11 and above
|
||||
}
|
||||
|
||||
|
||||
`common_type` is a traits class used to deduce a type common to a several types, useful as the return type of functions
|
||||
operating on multiple input types such as in mixed-mode arithmetic..
|
||||
|
||||
The nested typedef `::type` could be defined as follows:
|
||||
|
||||
template <class... T>
|
||||
struct common_type;
|
||||
|
||||
template <class T, class U, class... V>
|
||||
struct common_type<T, U, V...> {
|
||||
typedef typename common_type<typename common_type<T, U>::type, V...>::type type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct common_type<> {
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct common_type<T> {
|
||||
typedef typename __decay<T>::type type;
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
struct common_type<T, U> {
|
||||
typedef typename __decay<
|
||||
decltype( __declval<bool>()?
|
||||
__declval<typename __decay<T>::type>():
|
||||
__declval<typename __decay<U>::type>() )
|
||||
>::type type;
|
||||
};
|
||||
|
||||
All parameter types must be complete. This trait is permitted to be specialized by a user if at least one
|
||||
template parameter is a user-defined type. [*Note:] Such specializations are required when only explicit conversions
|
||||
are desired among the `common_type` arguments.
|
||||
|
||||
Note that when the compiler does not support variadic templates (and the macro `BOOST_NO_CXX11_VARIADIC_TEMPLATES` is defined)
|
||||
then the maximum number of template arguments is 9.
|
||||
|
||||
|
||||
[h4 Tutorial]
|
||||
|
||||
In a nutshell, `common_type` is a trait that takes 1 or more types, and returns a type which
|
||||
all of the types will convert to. The default definition demands this conversion be implicit.
|
||||
However the trait can be specialized for user-defined types which want to limit their inter-type conversions to explicit,
|
||||
and yet still want to interoperate with the `common_type` facility.
|
||||
|
||||
[*Example:]
|
||||
|
||||
template <class T, class U>
|
||||
complex<typename common_type<T, U>::type>
|
||||
operator+(complex<T>, complex<U>);
|
||||
|
||||
|
||||
In the above example, "mixed-mode" complex arithmetic is allowed. The return type is described by `common_type`.
|
||||
For example the resulting type of adding a `complex<float>` and `complex<double>` might be a `complex<double>`.
|
||||
|
||||
Here is how someone might produce a variadic comparison function:
|
||||
|
||||
template <class ...T>
|
||||
typename common_type<T...>::type
|
||||
min(T... t);
|
||||
|
||||
This is a very useful and broadly applicable utility.
|
||||
|
||||
[h4 How to get the common type of types with explicit conversions?]
|
||||
|
||||
Another choice for the author of the preceding operator could be
|
||||
|
||||
template <class T, class U>
|
||||
typename common_type<complex<T>, complex<U> >::type
|
||||
operator+(complex<T>, complex<U>);
|
||||
|
||||
As the default definition of `common_type` demands the conversion be implicit, we need to specialize the trait for complex types as follows.
|
||||
|
||||
template <class T, class U>
|
||||
struct common_type<complex<T>, complex<U> > {
|
||||
typedef complex< common_type<T, U> > type;
|
||||
};
|
||||
|
||||
[h4 How important is the order of the `common_type<>` template arguments?]
|
||||
|
||||
The order of the template parameters is important.
|
||||
|
||||
`common_type<A,B,C>::type` is not equivalent to `common_type<C,A,B>::type`, but to `common_type<common_type<A,B>::type, C>::type`.
|
||||
|
||||
Consider
|
||||
|
||||
struct A {};
|
||||
struct B {};
|
||||
struct C {
|
||||
C() {}
|
||||
C(A const&) {}
|
||||
C(B const&) {}
|
||||
C& operator=(C const&) {
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
The following doesn't compile
|
||||
|
||||
typedef boost::common_type<A, B, C>::type ABC; // Does not compile
|
||||
|
||||
while
|
||||
|
||||
typedef boost::common_type<C, A, B>::type ABC;
|
||||
|
||||
compiles.
|
||||
|
||||
Thus, as `common_type<A,B>::type` is undefined, `common_type<A,B,C>::type` is also undefined.
|
||||
|
||||
It is intended that clients who wish for `common_type<A, B>` to be well
|
||||
defined to define it themselves:
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template <>
|
||||
struct common_type<A, B> {typedef C type;};
|
||||
|
||||
}
|
||||
|
||||
Now this client can ask for `common_type<A, B, C>` (and get
|
||||
the same answer).
|
||||
|
||||
Clients wanting to ask `common_type<A, B, C>` in any order and get the same result need to add in addition:
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template <> struct common_type<B, A>
|
||||
: public common_type<A, B> {};
|
||||
|
||||
}
|
||||
|
||||
This is needed as the specialization of `common_type<A, B>` is not be used implicitly for `common_type<B, A>`.
|
||||
|
||||
[h4 Can the `common_type` of two types be a third type?]
|
||||
|
||||
Given the preceding example, one might expect `common_type<A,B>::type` to be `C` without any intervention from the user.
|
||||
But the default `common_type<>` implementation doesn't grant that. It is intended that clients who wish for `common_type<A, B>`
|
||||
to be well defined to define it themselves:
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template <>
|
||||
struct common_type<A, B> {typedef C type;};
|
||||
|
||||
template <> struct common_type<B, A>
|
||||
: public common_type<A, B> {};
|
||||
|
||||
}
|
||||
|
||||
Now this client can ask for `common_type<A, B>`.
|
||||
|
||||
[h4 How does `common_type` behave with pointers?]
|
||||
|
||||
Consider
|
||||
|
||||
struct C { }:
|
||||
struct B : C { };
|
||||
struct A : C { };
|
||||
|
||||
|
||||
Shouldn't `common_type<A*,B*>::type` be `C*`? I would say yes, but the default implementation will make it ill-formed.
|
||||
|
||||
The library could add a specialization for pointers, as
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template <typename A, typename B>
|
||||
struct common_type<A*, B*> {
|
||||
typedef common_type<A, B>* type;
|
||||
};
|
||||
}
|
||||
|
||||
But in the absence of a motivating use cases, we prefer not to add more than the standard specifies.
|
||||
|
||||
Of course the user can always make this specialization.
|
||||
|
||||
[h4 Can you explain the pros/cons of `common_type` against Boost.Typeof?]
|
||||
|
||||
Even if they appear to be close, `common_type` and `typeof` have
|
||||
different purposes. You use `typeof` to get the type of an expression, while
|
||||
you use `common_type` to set explicitly the type returned of a template
|
||||
function. Both are complementary, and indeed `common_type` is approximately equivalent to
|
||||
`decltype(__declval<bool>() ? __declval<T>() : __declval<U>())`.
|
||||
|
||||
`common_type` is also similar to `promote_args<class ...T>` in `boost/math/tools/promotion.hpp`,
|
||||
though it is not exactly the same as `promote_args` either. `common_type<T1, T2>::type` simply represents the result of some
|
||||
operation on `T1` and `T2`, and defaults to the type obtained by putting `T1` and `T2` into a conditional statement.
|
||||
|
||||
It is meant to be customizable (via specialization) if this default is not appropriate.
|
||||
|
||||
[endsect]
|
||||
|
23
doc/conditional.qbk
Normal file
23
doc/conditional.qbk
Normal file
@ -0,0 +1,23 @@
|
||||
[/
|
||||
Copyright 2010 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[/===================================================================]
|
||||
[section:conditional conditional]
|
||||
[/===================================================================]
|
||||
|
||||
|
||||
__header ` #include <boost/type_traits/conditional.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
namespace boost {
|
||||
template <bool B, class T, class U> struct __conditional;
|
||||
template <bool B, class T, class U> using conditional_t = typename conditional<B, T, U>::type; // C++11 and above
|
||||
}
|
||||
|
||||
If B is true, the member typedef type shall equal T. If B is false, the member typedef type shall equal U.
|
||||
|
||||
[endsect]
|
||||
|
36
doc/conjunction.qbk
Normal file
36
doc/conjunction.qbk
Normal file
@ -0,0 +1,36 @@
|
||||
[/
|
||||
Copyright 2020 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License,
|
||||
Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:conjunction conjunction]
|
||||
|
||||
template<class... T>
|
||||
struct conjunction;
|
||||
|
||||
__inherit Inherits from the first type `U` in the list for which
|
||||
`bool(U::value)` is `false`, or the last type in the list if there is no such
|
||||
type. If `sizeof...(T)` is `0` then inherits from `__true_type`.
|
||||
|
||||
__header `#include <boost/type_traits/conjunction.hpp>`
|
||||
|
||||
[all_compilers] In the absence of variadic-template support, `conjunction` has
|
||||
only 2 parameters.
|
||||
|
||||
__examples
|
||||
|
||||
[:Given: `template<int N> struct Int { static const int value = N };` ]
|
||||
|
||||
[:`conjunction<>` inherits from `__true_type`.]
|
||||
|
||||
[:`conjunction<Int<1> >` inherits from `Int<1>`.]
|
||||
|
||||
[:`conjunction<Int<1>, Int<2>, Int<3> >` inherits from `Int<3>`.]
|
||||
|
||||
[:`conjunction<Int<1>, Int<0>, Int<3> >` inherits from `Int<0>`.]
|
||||
|
||||
[endsect]
|
41
doc/copy_cv.qbk
Normal file
41
doc/copy_cv.qbk
Normal file
@ -0,0 +1,41 @@
|
||||
[/
|
||||
Copyright 2015 Peter Dimov.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:copy_cv copy_cv]
|
||||
|
||||
template <class T, class U>
|
||||
struct copy_cv
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template <class T, class U> using copy_cv_t = typename copy_cv<T, U>::type; // C++11 and above
|
||||
|
||||
__type [^T /cv/], where /cv/ are the cv-qualifiers of `U`.
|
||||
|
||||
__header ` #include <boost/type_traits/copy_cv.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[ [Expression] [Result Type]]
|
||||
|
||||
[[`copy_cv<int, void>::type`][`int`]]
|
||||
|
||||
[[`copy_cv<int const, void>::type`][`int const`]]
|
||||
|
||||
[[`copy_cv<int, void const>::type`][`int const`]]
|
||||
|
||||
[[`copy_cv<int volatile, void const>::type`][`int const volatile`]]
|
||||
|
||||
[[`copy_cv<int&, void const>::type`] [`int&`]]
|
||||
|
||||
[[`copy_cv<int*, void volatile>::type`] [`int* volatile`]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
65
doc/copy_cv_ref.qbk
Normal file
65
doc/copy_cv_ref.qbk
Normal file
@ -0,0 +1,65 @@
|
||||
[/
|
||||
Copyright 2019 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License,
|
||||
Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:copy_cv_ref copy_cv_ref]
|
||||
|
||||
template<class T, class U>
|
||||
struct copy_cv_ref
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template<class T, class U>
|
||||
using copy_cv_ref_t = typename copy_cv_ref<T, U>::type;
|
||||
|
||||
__type [^T /cvref/], where /cvref/ are the cvref-qualifiers of `U`.
|
||||
|
||||
__header `#include <boost/type_traits/copy_cv_ref.hpp>` or
|
||||
`#include <boost/type_traits.hpp>>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[[Expression] [Result Type]]
|
||||
|
||||
[[`copy_cv_ref<int, const char>::type`][`const int`]]
|
||||
|
||||
[[`copy_cv_ref<int, volatile char>::type`][`volatile int`]]
|
||||
|
||||
[[`copy_cv_ref<int, const volatile char>::type`][`const volatile int`]]
|
||||
|
||||
[[`copy_cv_ref<int, char&>::type`][`int&`]]
|
||||
|
||||
[[`copy_cv_ref<int, const char&>::type`][`const int&`]]
|
||||
|
||||
[[`copy_cv_ref<int, volatile char&>::type`][`volatile int&`]]
|
||||
|
||||
[[`copy_cv_ref<int, const volatile char&>::type`][`const volatile int&`]]
|
||||
|
||||
[[`copy_cv_ref<int, char&&>::type`][`int&&`]]
|
||||
|
||||
[[`copy_cv_ref<int, const char&&>::type`][`const int&&`]]
|
||||
|
||||
[[`copy_cv_ref<int, volatile char&&>::type`][`volatile int&&`]]
|
||||
|
||||
[[`copy_cv_ref<int, const volatile char&&>::type`][`const volatile int&&`]]
|
||||
|
||||
[[`copy_cv_ref<int&&, char&>::type`][`int&`]]
|
||||
|
||||
[[`copy_cv_ref<int&, const char>::type`][`int&`]]
|
||||
|
||||
[[`copy_cv_ref<int&, volatile char&>::type`][`int&`]]
|
||||
|
||||
[[`copy_cv_ref<int&, const volatile char&&>::type`][`int&`]]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers] The type alias `copy_cv_ref_t` is only available if the compiler
|
||||
supports template aliases.
|
||||
|
||||
[endsect]
|
53
doc/copy_reference.qbk
Normal file
53
doc/copy_reference.qbk
Normal file
@ -0,0 +1,53 @@
|
||||
[/
|
||||
Copyright 2019 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License,
|
||||
Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:copy_reference copy_reference_]
|
||||
|
||||
template<class T, class U>
|
||||
struct copy_reference
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template<class T, class U>
|
||||
using copy_reference_t = typename copy_reference<T, U>::type;
|
||||
|
||||
__type [^T /ref/], where /ref/ are the ref-qualifiers of `U`.
|
||||
|
||||
__header `#include <boost/type_traits/copy_reference.hpp>` or
|
||||
`#include <boost/type_traits.hpp>>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[[Expression] [Result Type]]
|
||||
|
||||
[[`copy_reference<int, char>::type`][`int`]]
|
||||
|
||||
[[`copy_reference<int, char&>::type`] [`int&`]]
|
||||
|
||||
[[`copy_reference<int, char&&>::type`] [`int&&`]]
|
||||
|
||||
[[`copy_reference<int&, char>::type`] [`int&`]]
|
||||
|
||||
[[`copy_reference<int&, char&>::type`] [`int&`]]
|
||||
|
||||
[[`copy_reference<int&, char&&>::type`] [`int&`]]
|
||||
|
||||
[[`copy_reference<int&&, char>::type`] [`int&&`]]
|
||||
|
||||
[[`copy_reference<int&&, char&>::type`] [`int&`]]
|
||||
|
||||
[[`copy_reference<int&&, char&&>::type`] [`int&&`]]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers] The type alias `copy_reference_t` is only available if the compiler
|
||||
supports template aliases.
|
||||
|
||||
[endsect]
|
42
doc/credits.qbk
Normal file
42
doc/credits.qbk
Normal file
@ -0,0 +1,42 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:credits Credits]
|
||||
|
||||
This documentation was pulled together by John Maddock, using
|
||||
[@../../../../doc/html/quickbook.html Boost.Quickbook]
|
||||
and [@../../../../doc/html/boostbook.html Boost.DocBook].
|
||||
|
||||
The original version of this library was created by Steve Cleary,
|
||||
Beman Dawes, Howard Hinnant, and John Maddock. John Maddock is the
|
||||
current maintainer of the library.
|
||||
|
||||
This version of type traits library is based on contributions by
|
||||
Adobe Systems Inc, David Abrahams, Steve Cleary,
|
||||
Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat Marcus,
|
||||
Itay Maman, John Maddock, Thorsten Ottosen, Robert Ramey, Jeremy Siek,
|
||||
Antony Polukhin and Glen Fernandes.
|
||||
|
||||
Mat Marcus and Jesse Jones invented, and
|
||||
[@http://opensource.adobe.com/project4/project.shtml published a paper describing],
|
||||
the partial specialization workarounds used in this library.
|
||||
|
||||
Aleksey Gurtovoy added MPL integration to the library.
|
||||
|
||||
The __is_convertible template is based on code originally devised by
|
||||
Andrei Alexandrescu, see
|
||||
"[@http://www.cuj.com/experts/1810/alexandr.htm?topic=experts
|
||||
Generic<Programming>: Mappings between Types and Values]".
|
||||
|
||||
The latest version of this library and documentation can be found at
|
||||
[@http://www.boost.org www.boost.org]. Bugs, suggestions and discussion
|
||||
should be directed to boost@lists.boost.org
|
||||
(see [@http://www.boost.org/more/mailing_lists.htm#main
|
||||
www.boost.org/more/mailing_lists.htm#main] for subscription details).
|
||||
|
||||
[endsect]
|
||||
|
44
doc/decay.qbk
Normal file
44
doc/decay.qbk
Normal file
@ -0,0 +1,44 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:decay decay]
|
||||
|
||||
template <class T>
|
||||
struct decay
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template <class T> using decay_t = typename decay<T>::type; // C++11 and above
|
||||
|
||||
__type Let `U` be the result of `remove_reference<T>::type`, then if `U` is
|
||||
an array type, the result is `remove_extent<U>::type*`, otherwise if `U` is a
|
||||
function type then the result is `U*`, otherwise the result is `remove_cv<U>::type`.
|
||||
|
||||
__std_ref 3.9.1.
|
||||
|
||||
__header ` #include <boost/type_traits/decay.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[ [Expression] [Result Type]]
|
||||
|
||||
[[`decay<int[2][3]>::type`][`int[3]*`]]
|
||||
|
||||
[[`decay<int(&)[2]>::type`] [`int*`]]
|
||||
|
||||
[[`decay<int(&)(double)>::type`] [`int(*)(double)`]]
|
||||
|
||||
[[`int(*)(double)`] [`int(*)(double)`]]
|
||||
[[`int(double)`] [`int(*)(double)`]]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
21
doc/declval.qbk
Normal file
21
doc/declval.qbk
Normal file
@ -0,0 +1,21 @@
|
||||
[/
|
||||
Copyright 2015 Peter Dimov.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:declval declval]
|
||||
|
||||
template <class T>
|
||||
typename add_rvalue_reference<T>::type declval() noexcept; // as unevaluated operand
|
||||
|
||||
__std_ref C++11 20.2.4 [declval].
|
||||
|
||||
__header ` #include <boost/type_traits/declval.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
The function template `declval` is used when a value of a certain type is required in
|
||||
a type computation context. For example, the type of the result of adding an `int` and
|
||||
a `float` can be obtained with the expression `decltype( declval<int>() + declval<float>() )`.
|
||||
|
||||
[endsect]
|
20
doc/decomposing_func.qbk
Normal file
20
doc/decomposing_func.qbk
Normal file
@ -0,0 +1,20 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:function Decomposing Function Types]
|
||||
|
||||
The class template __function_traits extracts information from function types
|
||||
(see also __is_function). This traits class allows you to tell how many arguments
|
||||
a function takes, what those argument types are, and what the return type is.
|
||||
|
||||
[*Synopsis]
|
||||
|
||||
template <std::size_t Align>
|
||||
struct __function_traits;
|
||||
|
||||
[endsect]
|
||||
|
40
doc/detected.qbk
Normal file
40
doc/detected.qbk
Normal file
@ -0,0 +1,40 @@
|
||||
[/
|
||||
Copyright 2018 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License,
|
||||
Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:detected detected]
|
||||
|
||||
template<template<class...> class Op, class... Args>
|
||||
using detected_t = __below;
|
||||
|
||||
__alias `Op<Args...>` if it is a valid template-id, otherwise
|
||||
`boost::nonesuch`.
|
||||
|
||||
__std_paper [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4502.pdf N4502]
|
||||
|
||||
__compat Requires C++11 variadic templates and C++11 template aliases.
|
||||
|
||||
__header `#include <boost/type_traits/detected.hpp>`
|
||||
|
||||
__examples
|
||||
|
||||
Suppose you wish to determine whether a type has a `size()` const-member function, then given the meta-functions:
|
||||
|
||||
template <class T>
|
||||
using size_member_tester = decltype(std::declval<const T&>().size());
|
||||
|
||||
template <class T>
|
||||
using size_member_t = boost::detected_t<size_member_tester, T >;
|
||||
|
||||
|
||||
Then the type `size_member_t<T>` is an alias for `size_member_tester<T>` if the operation is valid, and an alias for
|
||||
`boost::nonesuch` otherwise.
|
||||
|
||||
See also: __is_detected, __is_detected_convertible, __is_detected_exact.
|
||||
|
||||
[endsect]
|
45
doc/detected_or.qbk
Normal file
45
doc/detected_or.qbk
Normal file
@ -0,0 +1,45 @@
|
||||
[/
|
||||
Copyright 2018 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License,
|
||||
Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:detected_or detected_or]
|
||||
|
||||
template<class Default, template<class...> class Op, class... Args>
|
||||
using detected_or = __below;
|
||||
|
||||
template<class Default, template<class...> class Op, class... Args>
|
||||
using detected_or_t = typename detected_or<Default, Op, Args...>::type;
|
||||
|
||||
__alias An unspecified type with two public member type definitions:
|
||||
|
||||
* `value_t` is __true_type if `Op<Args...>` is a valid template-id, otherwise
|
||||
__false_type
|
||||
* `type` is `Op<Args...>` if it is a valid template-id, otherwise `Default`
|
||||
|
||||
__std_paper [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4502.pdf N4502]
|
||||
|
||||
__compat Requires C++11 variadic templates and C++11 template aliases.
|
||||
|
||||
__header `#include <boost/type_traits/detected_or.hpp>`
|
||||
|
||||
__examples
|
||||
|
||||
Suppose we wish to declare a type that represents the difference between two values of type T, it should be
|
||||
T::difference_type if such a type exists, or std::ptrdiff_t otherwise:
|
||||
|
||||
template<class T>
|
||||
using difference_t = typename T::difference_type;
|
||||
|
||||
template<class T>
|
||||
using difference_type = boost::detected_or_t<std::ptrdiff_t, difference_t, T>;
|
||||
|
||||
Now the type `difference_type<T>` gives us what we need.
|
||||
|
||||
See also: __is_detected, __is_detected_convertible, __is_detected_exact.
|
||||
|
||||
[endsect]
|
36
doc/disjunction.qbk
Normal file
36
doc/disjunction.qbk
Normal file
@ -0,0 +1,36 @@
|
||||
[/
|
||||
Copyright 2020 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License,
|
||||
Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:disjunction disjunction]
|
||||
|
||||
template<class... T>
|
||||
struct disjunction;
|
||||
|
||||
__inherit Inherits from the first type `U` in the list for which
|
||||
`bool(U::value)` is `true`, or the last type in the list if there is no such
|
||||
type. If `sizeof...(T)` is `0` then inherits from `__false_type`.
|
||||
|
||||
__header `#include <boost/type_traits/disjunction.hpp>`
|
||||
|
||||
[all_compilers] In the absence of variadic-template support, `disjunction` has
|
||||
only 2 parameters.
|
||||
|
||||
__examples
|
||||
|
||||
[:Given: `template<int N> struct Int { static const int value = N };` ]
|
||||
|
||||
[:`disjunction<>` inherits from `__false_type`.]
|
||||
|
||||
[:`disjunction<Int<1> >` inherits from `Int<1>`.]
|
||||
|
||||
[:`disjunction<Int<1>, Int<2>, Int<3> >` inherits from `Int<1>`.]
|
||||
|
||||
[:`disjunction<Int<0>, Int<2>, Int<3> >` inherits from `Int<2>`.]
|
||||
|
||||
[endsect]
|
48
doc/enable_if.qbk
Normal file
48
doc/enable_if.qbk
Normal file
@ -0,0 +1,48 @@
|
||||
[/
|
||||
Copyright 2018 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License,
|
||||
Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||
or copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:enable_if enable_if_]
|
||||
|
||||
template<bool B, class T = void>
|
||||
struct enable_if_;
|
||||
|
||||
template<bool B, class T = void>
|
||||
using enable_if_t = typename enable_if_<B, T>::type;
|
||||
|
||||
__type If `B` is true, then the member `type` is defined to be `T`. Otherwise
|
||||
there is no member `type`.
|
||||
|
||||
__header `#include <boost/type_traits/enable_if.hpp>`
|
||||
|
||||
[note The trait has the name `enable_if_` (with a trailing underscore) but
|
||||
behaves like `std::enable_if` or `boost::enable_if_c`. The existing trait
|
||||
with the name `boost::enable_if` has a different interface.]
|
||||
|
||||
__examples
|
||||
|
||||
The following function can be used to destroy each element of an array and
|
||||
specially handle arrays of trivially destructible types.
|
||||
|
||||
template<class T>
|
||||
typename boost::enable_if_<!boost::has_trivial_destructor<T>::value>::type
|
||||
destroy(T* ptr, std::size_t size)
|
||||
{
|
||||
while (size > 0) {
|
||||
ptr[--size].~T();
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
typename boost::enable_if_<boost::has_trivial_destructor<T>::value>::type
|
||||
destroy(T*, std::size_t) { }
|
||||
|
||||
[all_compilers] The type alias `enable_if_t` is only available if the compiler
|
||||
supports template aliases.
|
||||
|
||||
[endsect]
|
237
doc/examples.qbk
Normal file
237
doc/examples.qbk
Normal file
@ -0,0 +1,237 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:examples Examples]
|
||||
|
||||
[section:copy An Optimized Version of std::copy]
|
||||
|
||||
Demonstrates a version of `std::copy` that uses `__has_trivial_assign` to
|
||||
determine whether to use `memcpy` to optimise the copy operation
|
||||
(see [@../../examples/copy_example.cpp copy_example.cpp]):
|
||||
|
||||
//
|
||||
// opt::copy
|
||||
// same semantics as std::copy
|
||||
// calls memcpy where appropriate.
|
||||
//
|
||||
|
||||
namespace detail{
|
||||
|
||||
template<typename I1, typename I2, bool b>
|
||||
I2 copy_imp(I1 first, I1 last, I2 out, const boost::__integral_constant<bool, b>&)
|
||||
{
|
||||
while(first != last)
|
||||
{
|
||||
*out = *first;
|
||||
++out;
|
||||
++first;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* copy_imp(const T* first, const T* last, T* out, const boost::__true_type&)
|
||||
{
|
||||
memmove(out, first, (last-first)*sizeof(T));
|
||||
return out+(last-first);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
template<typename I1, typename I2>
|
||||
inline I2 copy(I1 first, I1 last, I2 out)
|
||||
{
|
||||
//
|
||||
// We can copy with memcpy if T has a trivial assignment operator,
|
||||
// and if the iterator arguments are actually pointers (this last
|
||||
// requirement we detect with overload resolution):
|
||||
//
|
||||
typedef typename std::iterator_traits<I1>::value_type value_type;
|
||||
return detail::copy_imp(first, last, out, boost::__has_trivial_assign<value_type>());
|
||||
}
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:fill An Optimised Version of std::fill]
|
||||
|
||||
Demonstrates a version of `std::fill` that uses `__has_trivial_assign` to
|
||||
determine whether to use `memset` to optimise the fill operation
|
||||
(see [@../../examples/fill_example.cpp fill_example.cpp]):
|
||||
|
||||
//
|
||||
// fill
|
||||
// same as std::fill, but uses memset where appropriate
|
||||
//
|
||||
namespace detail{
|
||||
|
||||
template <typename I, typename T, bool b>
|
||||
void do_fill(I first, I last, const T& val, const boost::__integral_constant<bool, b>&)
|
||||
{
|
||||
while(first != last)
|
||||
{
|
||||
*first = val;
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void do_fill(T* first, T* last, const T& val, const boost::__true_type&)
|
||||
{
|
||||
std::memset(first, val, last-first);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template <class I, class T>
|
||||
inline void fill(I first, I last, const T& val)
|
||||
{
|
||||
//
|
||||
// We can do an optimised fill if T has a trivial assignment
|
||||
// operator and if it's size is one:
|
||||
//
|
||||
typedef boost::__integral_constant<bool,
|
||||
::boost::__has_trivial_assign<T>::value && (sizeof(T) == 1)> truth_type;
|
||||
detail::do_fill(first, last, val, truth_type());
|
||||
}
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:destruct An Example that Omits Destructor Calls For Types with Trivial Destructors]
|
||||
|
||||
Demonstrates a simple algorithm that uses `__has_trivial_destruct` to
|
||||
determine whether to destructors need to be called
|
||||
(see [@../../examples/trivial_destructor_example.cpp trivial_destructor_example.cpp]):
|
||||
|
||||
//
|
||||
// algorithm destroy_array:
|
||||
// The reverse of std::unitialized_copy, takes a block of
|
||||
// initialized memory and calls destructors on all objects therein.
|
||||
//
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <class T>
|
||||
void do_destroy_array(T* first, T* last, const boost::__false_type&)
|
||||
{
|
||||
while(first != last)
|
||||
{
|
||||
first->~T();
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void do_destroy_array(T* first, T* last, const boost::__true_type&)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class T>
|
||||
inline void destroy_array(T* p1, T* p2)
|
||||
{
|
||||
detail::do_destroy_array(p1, p2, ::boost::__has_trivial_destructor<T>());
|
||||
}
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:iter An improved Version of std::iter_swap]
|
||||
|
||||
Demonstrates a version of `std::iter_swap` that use type traits to
|
||||
determine whether an it's arguments are proxy iterators or not,
|
||||
if they're not then it just does a `std::swap` of it's dereferenced
|
||||
arguments (the
|
||||
same as `std::iter_swap` does), however if they are proxy iterators
|
||||
then takes special care over the swap to ensure that the algorithm
|
||||
works correctly for both proxy iterators, and even iterators of
|
||||
different types
|
||||
(see [@../../examples/iter_swap_example.cpp iter_swap_example.cpp]):
|
||||
|
||||
//
|
||||
// iter_swap:
|
||||
// tests whether iterator is a proxy iterator or not, and
|
||||
// uses optimal form accordingly:
|
||||
//
|
||||
namespace detail{
|
||||
|
||||
template <typename I>
|
||||
static void do_swap(I one, I two, const boost::__false_type&)
|
||||
{
|
||||
typedef typename std::iterator_traits<I>::value_type v_t;
|
||||
v_t v = *one;
|
||||
*one = *two;
|
||||
*two = v;
|
||||
}
|
||||
template <typename I>
|
||||
static void do_swap(I one, I two, const boost::__true_type&)
|
||||
{
|
||||
using std::swap;
|
||||
swap(*one, *two);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template <typename I1, typename I2>
|
||||
inline void iter_swap(I1 one, I2 two)
|
||||
{
|
||||
//
|
||||
// See is both arguments are non-proxying iterators,
|
||||
// and if both iterator the same type:
|
||||
//
|
||||
typedef typename std::iterator_traits<I1>::reference r1_t;
|
||||
typedef typename std::iterator_traits<I2>::reference r2_t;
|
||||
|
||||
typedef boost::__integral_constant<bool,
|
||||
::boost::__is_reference<r1_t>::value
|
||||
&& ::boost::__is_reference<r2_t>::value
|
||||
&& ::boost::__is_same<r1_t, r2_t>::value> truth_type;
|
||||
|
||||
detail::do_swap(one, two, truth_type());
|
||||
}
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:to_double Convert Numeric Types and Enums to double]
|
||||
|
||||
Demonstrates a conversion of
|
||||
[@../../../../libs/numeric/conversion/doc/html/boost_numericconversion/definitions.html#boost_numericconversion.definitions.numeric_types
|
||||
Numeric Types]
|
||||
and enum types to double:
|
||||
|
||||
template<class T>
|
||||
inline double to_double(T const& value)
|
||||
{
|
||||
typedef typename boost::promote<T>::type promoted;
|
||||
return boost::numeric::converter<double,promoted>::convert(value);
|
||||
}
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:improved_min Improving std::min with common_type]
|
||||
|
||||
An improved `std::min` function could be written like this:
|
||||
|
||||
template <class T, class U>
|
||||
typename __common_type<T, U>::type min(T t, U u)
|
||||
{
|
||||
return t < u ? t : u;
|
||||
}
|
||||
|
||||
And now expressions such as:
|
||||
|
||||
min(1, 2.0)
|
||||
|
||||
will actually compile and return the correct type!
|
||||
|
||||
[endsect]
|
||||
[endsect]
|
||||
|
50
doc/extent.qbk
Normal file
50
doc/extent.qbk
Normal file
@ -0,0 +1,50 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:extent extent]
|
||||
template <class T, std::size_t N = 0>
|
||||
struct extent : public __integral_constant<std::size_t, EXTENT(T,N)> {};
|
||||
|
||||
__inherit Class template extent inherits from `__integral_constant<std::size_t, EXTENT(T,N)>`,
|
||||
where `EXTENT(T,N)` is the number of elements in the N'th array dimension of type `T`.
|
||||
|
||||
If `T` is not a (built-in) array type, or if `N > __rank<T>::value`, or if the N'th array bound
|
||||
is incomplete, then `EXTENT(T,N)` is zero.
|
||||
|
||||
__header ` #include <boost/type_traits/extent.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
__examples
|
||||
|
||||
[:`extent<int[1]>` inherits from `__integral_constant<std::size_t, 1>`.]
|
||||
|
||||
[:`extent<double[2][3][4], 0>::type` is the type `__integral_constant<std::size_t, 2>`.]
|
||||
|
||||
[:`extent<double[2][3][4], 1>::type` is the type `__integral_constant<std::size_t, 3>`.]
|
||||
|
||||
[:`extent<double[2][3][4], 2>::type` is the type `__integral_constant<std::size_t, 4>`.]
|
||||
|
||||
[:`extent<int[4]>::value` is an integral constant
|
||||
expression that evaluates to /4/.]
|
||||
|
||||
[:`extent<int[][2]>::value` is an integral constant
|
||||
expression that evaluates to /0/.]
|
||||
|
||||
[:`extent<int[][2], 1>::value` is an integral constant
|
||||
expression that evaluates to /2/.]
|
||||
|
||||
[:`extent<int*>::value` is an integral constant
|
||||
expression that evaluates to /0/.]
|
||||
|
||||
[:`extent<boost::array<int, 3> >::value` is an integral constant
|
||||
expression that evaluates to /0/: `boost::array` is a class type and [*not an array type]!]
|
||||
|
||||
[:`extent<T>::value_type` is the type `std::size_t`.]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
41
doc/floating_point_promotion.qbk
Normal file
41
doc/floating_point_promotion.qbk
Normal file
@ -0,0 +1,41 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:floating_point_promotion floating_point_promotion]
|
||||
|
||||
template <class T>
|
||||
struct floating_point_promotion
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template <class T> using floating_point_promotion_t = typename floating_point_promotion<T>::type; // C++11 and above
|
||||
|
||||
__type If floating point promotion can be applied to an rvalue of type `T`,
|
||||
then applies floating point promotion to `T` and keeps cv-qualifiers of `T`,
|
||||
otherwise leaves `T` unchanged.
|
||||
|
||||
__std_ref 4.6.
|
||||
|
||||
__header ` #include <boost/type_traits/floating_point_promotion.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
|
||||
[ [Expression] [Result Type]]
|
||||
|
||||
[[`floating_point_promotion<float const>::type`][`double const`]]
|
||||
|
||||
[[`floating_point_promotion<float&>::type`][`float&`]]
|
||||
|
||||
[[`floating_point_promotion<short>::type`][`short`]]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
58
doc/function_traits.qbk
Normal file
58
doc/function_traits.qbk
Normal file
@ -0,0 +1,58 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:function_traits function_traits]
|
||||
[def __argN '''arg<replaceable>N</replaceable>_type''']
|
||||
|
||||
template <class F>
|
||||
struct function_traits
|
||||
{
|
||||
static const std::size_t arity = __below;
|
||||
typedef __below result_type;
|
||||
typedef __below __argN;
|
||||
};
|
||||
|
||||
The class template function_traits will only compile if:
|
||||
|
||||
* The compiler supports partial specialization of class templates.
|
||||
* The template argument `F` is a /function type/, note that this ['[*is not]]
|
||||
the same thing as a /pointer to a function/.
|
||||
|
||||
[tip
|
||||
function_traits is intended to introspect only C++ functions of the
|
||||
form R (), R( A1 ), R ( A1, ... etc. ) and not function pointers or
|
||||
class member functions. To convert a function pointer type to a suitable
|
||||
type use __remove_pointer.]
|
||||
|
||||
[table Function Traits Members
|
||||
[[Member] [Description]]
|
||||
[[`function_traits<F>::arity`]
|
||||
[An integral constant expression that gives the number of arguments accepted by the function type `F`.]]
|
||||
[[`function_traits<F>::result_type`]
|
||||
[The type returned by function type `F`.]]
|
||||
[[`function_traits<F>::__argN`]
|
||||
[The '''<replaceable>N</replaceable>th''' argument type of function type `F`, where `1 <= N <= arity` of `F`.]]
|
||||
]
|
||||
|
||||
[table Examples
|
||||
[[Expression] [Result]]
|
||||
[[`function_traits<void (void)>::arity`] [An integral constant expression that has the value 0.]]
|
||||
[[`function_traits<long (int)>::arity`] [An integral constant expression that has the value 1.]]
|
||||
[[`function_traits<long (int, long, double, void*)>::arity`] [An integral constant expression that has the value 4.]]
|
||||
[[`function_traits<void (void)>::result_type`] [The type `void`.]]
|
||||
[[`function_traits<long (int)>::result_type`] [The type `long`.]]
|
||||
[[`function_traits<long (int)>::arg1_type`] [The type `int`.]]
|
||||
[[`function_traits<long (int, long, double, void*)>::arg4_type`] [The type `void*`.]]
|
||||
[[`function_traits<long (int, long, double, void*)>::arg5_type`] [A compiler error: there is no `arg5_type` since there are only four arguments.]]
|
||||
[[`function_traits<long (*)(void)>::arity`] [A compiler error: argument type is a /function pointer/, and not a /function type/.]]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
52
doc/has_bit_and.qbk
Normal file
52
doc/has_bit_and.qbk
Normal file
@ -0,0 +1,52 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_bit_and has_bit_and]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_bit_and : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs&rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs&rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator&`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs&rhs); // is valid if has_bit_and<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_bit_and.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_bit_and<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_bit_and<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_bit_and<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_bit_and<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_bit_and<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_bit_and<const int, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_bit_and<int, double, bool>` inherits from `__false_type`.]
|
||||
[:`has_bit_and<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
[binary_operator_known_issues has_bit_and..&..A..contains<T>..const ]
|
||||
|
||||
[endsect]
|
||||
|
52
doc/has_bit_and_assign.qbk
Normal file
52
doc/has_bit_and_assign.qbk
Normal file
@ -0,0 +1,52 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_bit_and_assign has_bit_and_assign]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_bit_and_assign : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs&=rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs&=rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator&=`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs&=rhs); // is valid if has_bit_and_assign<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_bit_and_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_bit_and_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_bit_and_assign<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_bit_and_assign<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_bit_and_assign<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_bit_and_assign<int, int, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_bit_and_assign<const int, int>` inherits from `__false_type`.]
|
||||
[:`has_bit_and_assign<int, double, bool>` inherits from `__false_type`.]
|
||||
[:`has_bit_and_assign<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_bit_and_assign..&=..A&..contains<T>&..[/Nothing]]
|
||||
|
||||
[endsect]
|
||||
|
52
doc/has_bit_or.qbk
Normal file
52
doc/has_bit_or.qbk
Normal file
@ -0,0 +1,52 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_bit_or has_bit_or]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_bit_or : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs|rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs|rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator|`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs|rhs); // is valid if has_bit_or<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_bit_or.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_bit_or<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_bit_or<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_bit_or<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_bit_or<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_bit_or<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_bit_or<const int, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_bit_or<int, double, bool>` inherits from `__false_type`.]
|
||||
[:`has_bit_or<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_bit_or..|..A..contains<T>..const ]
|
||||
|
||||
[endsect]
|
||||
|
52
doc/has_bit_or_assign.qbk
Normal file
52
doc/has_bit_or_assign.qbk
Normal file
@ -0,0 +1,52 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_bit_or_assign has_bit_or_assign]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_bit_or_assign : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs|=rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs|=rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator|=`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs|=rhs); // is valid if has_bit_or_assign<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_bit_or_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_bit_or_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_bit_or_assign<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_bit_or_assign<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_bit_or_assign<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_bit_or_assign<int, int, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_bit_or_assign<const int, int>` inherits from `__false_type`.]
|
||||
[:`has_bit_or_assign<int, double, bool>` inherits from `__false_type`.]
|
||||
[:`has_bit_or_assign<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_bit_or_assign..|=..A&..contains<T>&..[/Nothing]]
|
||||
|
||||
[endsect]
|
||||
|
52
doc/has_bit_xor.qbk
Normal file
52
doc/has_bit_xor.qbk
Normal file
@ -0,0 +1,52 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_bit_xor has_bit_xor]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_bit_xor : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs^rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs^rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator^`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs^rhs); // is valid if has_bit_xor<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_bit_xor.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_bit_xor<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_bit_xor<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_bit_xor<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_bit_xor<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_bit_xor<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_bit_xor<const int, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_bit_xor<int, double, bool>` inherits from `__false_type`.]
|
||||
[:`has_bit_xor<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_bit_xor..^..A..contains<T>..const ]
|
||||
|
||||
[endsect]
|
||||
|
52
doc/has_bit_xor_assign.qbk
Normal file
52
doc/has_bit_xor_assign.qbk
Normal file
@ -0,0 +1,52 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_bit_xor_assign has_bit_xor_assign]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_bit_xor_assign : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs^=rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs^=rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator^=`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs^=rhs); // is valid if has_bit_xor_assign<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_bit_xor_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_bit_xor_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_bit_xor_assign<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_bit_xor_assign<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_bit_xor_assign<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_bit_xor_assign<int, int, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_bit_xor_assign<const int, int>` inherits from `__false_type`.]
|
||||
[:`has_bit_xor_assign<int, double, bool>` inherits from `__false_type`.]
|
||||
[:`has_bit_xor_assign<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_bit_xor_assign..^=..A&..contains<T>&..[/Nothing]]
|
||||
|
||||
[endsect]
|
||||
|
111
doc/has_complement.qbk
Normal file
111
doc/has_complement.qbk
Normal file
@ -0,0 +1,111 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_complement has_complement]
|
||||
template <class Rhs, class Ret=dont_care>
|
||||
struct has_complement : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `rhs` of type `Rhs` can be used in expression `~rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `~rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of prefix `operator~`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Rhs rhs;
|
||||
f(~rhs); // is valid if has_complement<Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_complement.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_complement<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_complement<Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_complement<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_complement<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_complement<int, int>` inherits from `__true_type`.]
|
||||
[:`has_complement<int, long>` inherits from `__true_type`.]
|
||||
[:`has_complement<const int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_complement<int*>` inherits from `__false_type`.]
|
||||
[:`has_complement<double, double>` inherits from `__false_type`.]
|
||||
[:`has_complement<double, int>` inherits from `__false_type`.]
|
||||
[:`has_complement<int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether prefix `operator~` is public or not:
|
||||
if `operator~` is defined as a private member of `Rhs` then
|
||||
instantiating `has_complement<Rhs>` will produce a compiler error.
|
||||
For this reason `has_complement` cannot be used to determine whether a type has a public `operator~` or not.
|
||||
``
|
||||
struct A { private: void operator~(); };
|
||||
boost::has_complement<A>::value; // error: A::operator~() is private
|
||||
``
|
||||
|
||||
* There is an issue if the operator exists only for type `A` and `B` is
|
||||
convertible to `A`. In this case, the compiler will report an ambiguous overload.
|
||||
``
|
||||
struct A { };
|
||||
void operator~(const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_complement<A>::value; // this is fine
|
||||
boost::has_complement<B>::value; // error: ambiguous overload
|
||||
``
|
||||
|
||||
* There is an issue when applying this trait to template classes.
|
||||
If `operator~` is defined but does not bind for a given template type,
|
||||
it is still detected by the trait which returns `true` instead of `false`.
|
||||
Example:
|
||||
``
|
||||
#include <boost/type_traits/has_complement.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator~(const contains<T> &rhs) {
|
||||
return f(rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_complement< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
~g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_complement< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
~b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[prefix_operator_known_issues has_complement..~]
|
||||
|
||||
[endsect]
|
||||
|
112
doc/has_dereference.qbk
Normal file
112
doc/has_dereference.qbk
Normal file
@ -0,0 +1,112 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_dereference has_dereference]
|
||||
template <class Rhs, class Ret=dont_care>
|
||||
struct has_dereference : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `rhs` of type `Rhs` can be used in expression `*rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `*rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of prefix `operator*`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Rhs rhs;
|
||||
f(*rhs); // is valid if has_dereference<Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_dereference.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_dereference<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_dereference<Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_dereference<int*>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_dereference<long*>` inherits from `__true_type`.]
|
||||
|
||||
|
||||
[:`has_dereference<int*, int>` inherits from `__true_type`.]
|
||||
[:`has_dereference<int*, const int>` inherits from `__true_type`.]
|
||||
[:`has_dereference<int const *>` inherits from `__true_type`.]
|
||||
[:`has_dereference<int * const>` inherits from `__true_type`.]
|
||||
[:`has_dereference<int const * const>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_dereference<int>` inherits from `__false_type`.]
|
||||
[:`has_dereference<double>` inherits from `__false_type`.]
|
||||
[:`has_dereference<void*>` inherits from `__false_type`.]
|
||||
[:`has_dereference<const int*, int&>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether prefix `operator*` is public or not:
|
||||
if `operator*` is defined as a private member of `Rhs` then
|
||||
instantiating `has_dereference<Rhs>` will produce a compiler error.
|
||||
For this reason `has_dereference` cannot be used to determine whether a type has a public `operator*` or not.
|
||||
``
|
||||
struct A { private: void operator*(); };
|
||||
boost::has_dereference<A>::value; // error: A::operator*() is private
|
||||
``
|
||||
|
||||
* There is an issue if the operator exists only for type `A` and `B` is
|
||||
convertible to `A`. In this case, the compiler will report an ambiguous overload.
|
||||
``
|
||||
struct A { };
|
||||
void operator*(const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_dereference<A>::value; // this is fine
|
||||
boost::has_dereference<B>::value; // error: ambiguous overload
|
||||
``
|
||||
|
||||
* There is an issue when applying this trait to template classes.
|
||||
If `operator*` is defined but does not bind for a given template type,
|
||||
it is still detected by the trait which returns `true` instead of `false`.
|
||||
Example:
|
||||
``
|
||||
#include <boost/type_traits/has_dereference.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator*(const contains<T> &rhs) {
|
||||
return f(rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_dereference< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
*g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_dereference< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
*b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
54
doc/has_divides.qbk
Normal file
54
doc/has_divides.qbk
Normal file
@ -0,0 +1,54 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_divides has_divides]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_divides : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs/rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs/rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator/`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs/rhs); // is valid if has_divides<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_divides.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_divides<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_divides<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_divides<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_divides<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_divides<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_divides<int, int, long>` inherits from `__true_type`.]
|
||||
[:`has_divides<int, double, double>` inherits from `__true_type`.]
|
||||
[:`has_divides<int, double, int>` inherits from `__true_type`.]
|
||||
[:`has_divides<const int, int>::value` inherits from `__true_type`.]
|
||||
|
||||
[:`has_divides<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_divides../..A..contains<T>..const ]
|
||||
|
||||
[endsect]
|
||||
|
54
doc/has_divides_assign.qbk
Normal file
54
doc/has_divides_assign.qbk
Normal file
@ -0,0 +1,54 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_divides_assign has_divides_assign]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_divides_assign : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs/=rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs/=rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator/=`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs/=rhs); // is valid if has_divides_assign<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_divides_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_divides_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_divides_assign<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_divides_assign<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_divides_assign<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_divides_assign<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_divides_assign<int, int, long>` inherits from `__true_type`.]
|
||||
[:`has_divides_assign<int, double, double>` inherits from `__true_type`.]
|
||||
[:`has_divides_assign<int, double, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_divides_assign<const int, int>::value` inherits from `__false_type`.]
|
||||
[:`has_divides_assign<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_divides_assign../=..A&..contains<T>&..[/Nothing]]
|
||||
|
||||
[endsect]
|
||||
|
54
doc/has_equal_to.qbk
Normal file
54
doc/has_equal_to.qbk
Normal file
@ -0,0 +1,54 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_equal_to has_equal_to]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_equal_to : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs==rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs==rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator==`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs==rhs); // is valid if has_equal_to<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_equal_to.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_equal_to<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_equal_to<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_equal_to<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_equal_to<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_equal_to<int, int, bool>` inherits from `__true_type`.]
|
||||
[:`has_equal_to<int, double, bool>` inherits from `__true_type`.]
|
||||
[:`has_equal_to<const int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_equal_to<int*, int>` inherits from `__false_type`.]
|
||||
[:`has_equal_to<int*, double*>` inherits from `__false_type`.]
|
||||
[:`has_equal_to<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_equal_to..==..bool..bool..const ]
|
||||
|
||||
[endsect]
|
||||
|
54
doc/has_greater.qbk
Normal file
54
doc/has_greater.qbk
Normal file
@ -0,0 +1,54 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_greater has_greater]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_greater : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs>rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs>rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator>`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs>rhs); // is valid if has_greater<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_greater.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_greater<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_greater<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_greater<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_greater<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_greater<int, int, bool>` inherits from `__true_type`.]
|
||||
[:`has_greater<int, double, bool>` inherits from `__true_type`.]
|
||||
[:`has_greater<const int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_greater<int*, int>` inherits from `__false_type`.]
|
||||
[:`has_greater<int*, double*>` inherits from `__false_type`.]
|
||||
[:`has_greater<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_greater..>..bool..bool..const ]
|
||||
|
||||
[endsect]
|
||||
|
54
doc/has_greater_equal.qbk
Normal file
54
doc/has_greater_equal.qbk
Normal file
@ -0,0 +1,54 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_greater_equal has_greater_equal]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_greater_equal : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs>=rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs>=rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator>=`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs>=rhs); // is valid if has_greater_equal<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_greater_equal.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_greater_equal<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_greater_equal<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_greater_equal<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_greater_equal<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_greater_equal<int, int, bool>` inherits from `__true_type`.]
|
||||
[:`has_greater_equal<int, double, bool>` inherits from `__true_type`.]
|
||||
[:`has_greater_equal<const int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_greater_equal<int*, int>` inherits from `__false_type`.]
|
||||
[:`has_greater_equal<int*, double*>` inherits from `__false_type`.]
|
||||
[:`has_greater_equal<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_greater_equal..>=..bool..bool..const ]
|
||||
|
||||
[endsect]
|
||||
|
55
doc/has_left_shift.qbk
Normal file
55
doc/has_left_shift.qbk
Normal file
@ -0,0 +1,55 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_left_shift has_left_shift]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_left_shift : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs<<rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs<<rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator<<`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs<<rhs); // is valid if has_left_shift<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_left_shift.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_left_shift<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_left_shift<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_left_shift<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_left_shift<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_left_shift<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_left_shift<const int, int>` inherits from `__true_type`.]
|
||||
[:`has_left_shift<std::ostream, int>` inherits from `__true_type`.]
|
||||
[:`has_left_shift<std::ostream, char*, std::ostream>` inherits from `__true_type`.]
|
||||
[:`has_left_shift<std::ostream, std::string>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_left_shift<int, double, bool>` inherits from `__false_type`.]
|
||||
[:`has_left_shift<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_left_shift..<<..A..contains<T>..const ]
|
||||
|
||||
[endsect]
|
||||
|
52
doc/has_left_shift_assign.qbk
Normal file
52
doc/has_left_shift_assign.qbk
Normal file
@ -0,0 +1,52 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_left_shift_assign has_left_shift_assign]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_left_shift_assign : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs<<=rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs<<=rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator<<=`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs<<=rhs); // is valid if has_left_shift_assign<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_left_shift_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_left_shift_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_left_shift_assign<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_left_shift_assign<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_left_shift_assign<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_left_shift_assign<int, int, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_left_shift_assign<const int, int>` inherits from `__false_type`.]
|
||||
[:`has_left_shift_assign<int, double, bool>` inherits from `__false_type`.]
|
||||
[:`has_left_shift_assign<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_left_shift_assign..<<=..A&..contains<T>&..[/]]
|
||||
|
||||
[endsect]
|
||||
|
54
doc/has_less.qbk
Normal file
54
doc/has_less.qbk
Normal file
@ -0,0 +1,54 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_less has_less]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_less : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs<rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs<rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator<`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs<rhs); // is valid if has_less<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_less.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_less<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_less<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_less<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_less<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_less<int, int, bool>` inherits from `__true_type`.]
|
||||
[:`has_less<int, double, bool>` inherits from `__true_type`.]
|
||||
[:`has_less<const int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_less<int*, int>` inherits from `__false_type`.]
|
||||
[:`has_less<int*, double*>` inherits from `__false_type`.]
|
||||
[:`has_less<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_less..<..bool..bool..const ]
|
||||
|
||||
[endsect]
|
||||
|
54
doc/has_less_equal.qbk
Normal file
54
doc/has_less_equal.qbk
Normal file
@ -0,0 +1,54 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_less_equal has_less_equal]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_less_equal : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs<=rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs<=rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator<=`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs<=rhs); // is valid if has_less_equal<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_less_equal.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_less_equal<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_less_equal<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_less_equal<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_less_equal<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_less_equal<int, int, bool>` inherits from `__true_type`.]
|
||||
[:`has_less_equal<int, double, bool>` inherits from `__true_type`.]
|
||||
[:`has_less_equal<const int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_less_equal<int*, int>` inherits from `__false_type`.]
|
||||
[:`has_less_equal<int*, double*>` inherits from `__false_type`.]
|
||||
[:`has_less_equal<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_less_equal..<=..bool..bool..const ]
|
||||
|
||||
[endsect]
|
||||
|
53
doc/has_logical_and.qbk
Normal file
53
doc/has_logical_and.qbk
Normal file
@ -0,0 +1,53 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_logical_and has_logical_and]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_logical_and : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs&&rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs&&rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator&&`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs&&rhs); // is valid if has_logical_and<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_logical_and.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_logical_and<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_logical_and<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_logical_and<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_logical_and<bool>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_logical_and<int, int, bool>` inherits from `__true_type`.]
|
||||
[:`has_logical_and<int, int, long>` inherits from `__true_type`.]
|
||||
[:`has_logical_and<int, double, bool>` inherits from `__true_type`.]
|
||||
[:`has_logical_and<const int, int>::value` inherits from `__true_type`.]
|
||||
|
||||
[:`has_logical_and<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
[binary_operator_known_issues has_logical_and..&&..bool..bool..const ]
|
||||
|
||||
|
||||
[endsect]
|
||||
|
108
doc/has_logical_not.qbk
Normal file
108
doc/has_logical_not.qbk
Normal file
@ -0,0 +1,108 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_logical_not has_logical_not]
|
||||
template <class Rhs, class Ret=dont_care>
|
||||
struct has_logical_not : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `rhs` of type `Rhs` can be used in expression `!rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `!rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of prefix `operator!`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Rhs rhs;
|
||||
f(!rhs); // is valid if has_logical_not<Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_logical_not.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_logical_not<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_logical_not<Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_logical_not<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_logical_not<bool>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_logical_not<int, bool>` inherits from `__true_type`.]
|
||||
[:`has_logical_not<int, long>` inherits from `__true_type`.]
|
||||
[:`has_logical_not<double, double>` inherits from `__true_type`.]
|
||||
[:`has_logical_not<double, bool>` inherits from `__true_type`.]
|
||||
[:`has_logical_not<const bool>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_logical_not<int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether prefix `operator!` is public or not:
|
||||
if `operator!` is defined as a private member of `Rhs` then
|
||||
instantiating `has_logical_not<Rhs>` will produce a compiler error.
|
||||
For this reason `has_logical_not` cannot be used to determine whether a type has a public `operator!` or not.
|
||||
``
|
||||
struct A { private: void operator!(); };
|
||||
boost::has_logical_not<A>::value; // error: A::operator!() is private
|
||||
``
|
||||
|
||||
* There is an issue if the operator exists only for type `A` and `B` is
|
||||
convertible to `A`. In this case, the compiler will report an ambiguous overload.
|
||||
``
|
||||
struct A { };
|
||||
void operator!(const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_logical_not<A>::value; // this is fine
|
||||
boost::has_logical_not<B>::value; // error: ambiguous overload
|
||||
``
|
||||
|
||||
* There is an issue when applying this trait to template classes.
|
||||
If `operator!` is defined but does not bind for a given template type,
|
||||
it is still detected by the trait which returns `true` instead of `false`.
|
||||
Example:
|
||||
``
|
||||
#include <boost/type_traits/has_logical_not.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator!(const contains<T> &rhs) {
|
||||
return f(rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_logical_not< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
!g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_logical_not< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
!b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
53
doc/has_logical_or.qbk
Normal file
53
doc/has_logical_or.qbk
Normal file
@ -0,0 +1,53 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_logical_or has_logical_or]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_logical_or : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs||rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs||rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator||`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs||rhs); // is valid if has_logical_or<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_logical_or.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_logical_or<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_logical_or<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_logical_or<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_logical_or<bool>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_logical_or<int, int, bool>` inherits from `__true_type`.]
|
||||
[:`has_logical_or<int, int, long>` inherits from `__true_type`.]
|
||||
[:`has_logical_or<int, double, bool>` inherits from `__true_type`.]
|
||||
[:`has_logical_or<const int, int>::value` inherits from `__true_type`.]
|
||||
|
||||
[:`has_logical_or<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_logical_or..||..bool..bool..const ]
|
||||
|
||||
[endsect]
|
||||
|
54
doc/has_minus.qbk
Normal file
54
doc/has_minus.qbk
Normal file
@ -0,0 +1,54 @@
|
||||
[/
|
||||
(C) Copyright 2009-2011 Frederic Bron.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:has_minus has_minus]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_minus : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs-rhs`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs-rhs` is convertible to `Ret`
|
||||
then inherits from __true_type,
|
||||
otherwise inherits from __false_type.
|
||||
|
||||
The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator-`.
|
||||
If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`.
|
||||
Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`:
|
||||
``
|
||||
void f(Ret);
|
||||
Lhs lhs;
|
||||
Rhs rhs;
|
||||
f(lhs-rhs); // is valid if has_minus<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_minus.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_minus<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_minus<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_minus<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_minus<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_minus<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_minus<int, int, long>` inherits from `__true_type`.]
|
||||
[:`has_minus<int, double, double>` inherits from `__true_type`.]
|
||||
[:`has_minus<int, double, int>` inherits from `__true_type`.]
|
||||
[:`has_minus<const int, int>::value` inherits from `__true_type`.]
|
||||
|
||||
[:`has_minus<int, int, std::string>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[binary_operator_known_issues has_minus..-..A..contains<T>..const ]
|
||||
|
||||
[endsect]
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user