forked from boostorg/type_traits
Compare commits
443 Commits
boost-1.46
...
boost-1.64
Author | SHA1 | Date | |
---|---|---|---|
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 | |||
5c40f50432 | |||
6b8890aec8 | |||
902217df24 | |||
c02516b25b | |||
459e0bb6a0 | |||
a865f64c2f | |||
19b82cc55b |
@ -4,28 +4,11 @@
|
||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import modules ;
|
||||
|
||||
path-constant here : . ;
|
||||
|
||||
if --enable-index in [ modules.peek : ARGV ]
|
||||
{
|
||||
ECHO "Building the type_traits docs with automatic index generation enabled." ;
|
||||
using auto-index ;
|
||||
project : requirements
|
||||
<auto-index>on <format>pdf:<auto-index-internal>off
|
||||
<format>html:<auto-index-internal>on
|
||||
<auto-index-script>$(here)/index.idx
|
||||
<auto-index-prefix>$(here)/../../..
|
||||
<quickbook-define>enable_index ;
|
||||
}
|
||||
else
|
||||
{
|
||||
ECHO "Building the type_traits docs with automatic index generation disabled. Try building with --enable-index." ;
|
||||
}
|
||||
|
||||
using quickbook ;
|
||||
using auto-index ;
|
||||
|
||||
path-constant boost-images : ../../../doc/src/images ;
|
||||
path-constant here : . ;
|
||||
|
||||
xml type_traits : type_traits.qbk ;
|
||||
boostbook standalone
|
||||
@ -76,13 +59,18 @@ boostbook standalone
|
||||
<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 html : ../../../doc/html/boostbook.css ;
|
||||
#install ../ : ../../../boost.png ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
install pdfinstall : standalone/<format>pdf : <install-type>PDF <location>. <name>type_traits.pdf ;
|
||||
explicit pdfinstall ;
|
||||
|
||||
###############################################################################
|
||||
alias boostdoc ;
|
||||
explicit boostdoc ;
|
||||
alias boostrelease : standalone ;
|
||||
explicit boostrelease ;
|
||||
|
@ -17,10 +17,6 @@ __type The same type as `T const` for all `T`.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T` except where __transform_workaround have been applied.
|
||||
|
||||
__header ` #include <boost/type_traits/add_const.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -37,5 +33,7 @@ __header ` #include <boost/type_traits/add_const.hpp>` or ` #include <boost/type
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -17,10 +17,6 @@ __type The same type as `T const volatile` for all `T`.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T` except where __transform_workaround have been applied.
|
||||
|
||||
__header ` #include <boost/type_traits/add_cv.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -37,5 +33,7 @@ __header ` #include <boost/type_traits/add_cv.hpp>` or ` #include <boost/type_tr
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -19,10 +19,6 @@ the member typedef type shall name `U&`; otherwise, type shall name `T`.
|
||||
|
||||
__std_ref 20.7.6.2.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T` except where __transform_workaround have been applied.
|
||||
|
||||
__header ` #include <boost/type_traits/add_lvalue_reference.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -43,5 +39,7 @@ __header ` #include <boost/type_traits/add_lvalue_reference.hpp>` or ` #include
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -16,15 +16,11 @@
|
||||
__type The same type as `remove_reference<T>::type*`.
|
||||
|
||||
The rationale for this template
|
||||
is that it produces the same type as `TYPEOF(&t)`,
|
||||
is that it produces the same type as `decltype(&t)`,
|
||||
where `t` is an object of type `T`.
|
||||
|
||||
__std_ref 8.3.1.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T` except where __transform_workaround have been applied.
|
||||
|
||||
__header ` #include <boost/type_traits/add_pointer.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -41,5 +37,7 @@ __header ` #include <boost/type_traits/add_pointer.hpp>` or ` #include <boost/ty
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -23,10 +23,6 @@ __type If `T` is not a reference type then `T&`, otherwise `T`.
|
||||
|
||||
__std_ref 8.3.2.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T` except where __transform_workaround have been applied.
|
||||
|
||||
__header ` #include <boost/type_traits/add_reference.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -43,5 +39,7 @@ __header ` #include <boost/type_traits/add_reference.hpp>` or ` #include <boost/
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -21,11 +21,6 @@ reference. -end note\]].
|
||||
|
||||
__std_ref 20.7.6.2.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
and rvalue references
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T`.
|
||||
|
||||
__header ` #include <boost/type_traits/add_rvalue_reference.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -46,5 +41,7 @@ __header ` #include <boost/type_traits/add_rvalue_reference.hpp>` or ` #include
|
||||
|
||||
]
|
||||
|
||||
__compat In the absence of rvalue-reference support this trait has no effect.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -17,10 +17,6 @@ __type The same type as `T volatile` for all `T`.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T` except where __transform_workaround have been applied.
|
||||
|
||||
__header ` #include <boost/type_traits/add_volatile.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -37,5 +33,7 @@ __header ` #include <boost/type_traits/add_volatile.hpp>` or ` #include <boost/t
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -18,5 +18,37 @@ 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]
|
||||
|
||||
|
@ -30,5 +30,26 @@ 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]
|
||||
|
||||
|
@ -11,83 +11,73 @@
|
||||
[section:common_type common_type]
|
||||
[/===================================================================]
|
||||
|
||||
[def __declval [@../../../utility/doc/html/declval.html declval]]
|
||||
|
||||
|
||||
`#include <boost/type_traits/common_type.hpp>`
|
||||
__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> struct common_type;
|
||||
}
|
||||
|
||||
|
||||
__common_type is a traits class used to deduce a type common to a several types, useful as the return type of functions
|
||||
`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>
|
||||
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 <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 T type;
|
||||
typedef typename __decay<T>::type type;
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
struct common_type<T, U> {
|
||||
typedef decltype(__declval<bool>() ? __declval<T>() : __declval<U>()) type;
|
||||
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.
|
||||
are desired among the `common_type` arguments.
|
||||
|
||||
Note that when the compiler does not support variadic templates (and the macro BOOST_NO_VARIADIC_TEMPLATES is defined)
|
||||
then the maximum number of template arguments is 3.
|
||||
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 Configuration macros]
|
||||
|
||||
When the compiler does not support static assertions then the user can select the way static assertions are reported. Define
|
||||
|
||||
* BOOST_COMMON_TYPE_USES_STATIC_ASSERT: define it if you want to use Boost.StaticAssert
|
||||
* BOOST_COMMON_TYPE_USES_MPL_ASSERT: define it if you want to use Boost.MPL static asertions
|
||||
|
||||
The default behavior is to use mpl assertions in this case, but setting BOOST_COMMON_TYPE_USES_STATIC_ASSERT may reduce
|
||||
compile times and header dependencies somewhat.
|
||||
|
||||
Depending on the static assertion used you will have an hint of the failing assertion either through the symbol or through the text.
|
||||
|
||||
When possible common_type is implemented using `decltype`. Otherwise when BOOST_COMMON_TYPE_DONT_USE_TYPEOF is not defined
|
||||
it uses Boost.TypeOf.
|
||||
|
||||
[h4 Tutorial]
|
||||
|
||||
In a nutshell, __common_type is a trait that takes 1 or more types, and returns a type which
|
||||
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.
|
||||
and yet still want to interoperate with the `common_type` facility.
|
||||
|
||||
[*Example:]
|
||||
|
||||
template <class T, class U>
|
||||
complex<typename __common_type<T, U>::type>
|
||||
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.
|
||||
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
|
||||
typename common_type<T...>::type
|
||||
min(T... t);
|
||||
|
||||
This is a very useful and broadly applicable utility.
|
||||
@ -97,17 +87,17 @@ This is a very useful and broadly applicable utility.
|
||||
Another choice for the author of the preceding operator could be
|
||||
|
||||
template <class T, class U>
|
||||
typename __common_type<complex<T>, complex<U> >::type
|
||||
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.
|
||||
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;
|
||||
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?]
|
||||
[h4 How important is the order of the `common_type<>` template arguments?]
|
||||
|
||||
The order of the template parameters is important.
|
||||
|
||||
@ -164,7 +154,7 @@ Clients wanting to ask `common_type<A, B, C>` in any order and get the same resu
|
||||
|
||||
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?]
|
||||
[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>`
|
||||
@ -183,7 +173,7 @@ to be well defined to define it themselves:
|
||||
|
||||
Now this client can ask for `common_type<A, B>`.
|
||||
|
||||
[h4 How common_type behaves with pointers?]
|
||||
[h4 How does `common_type` behave with pointers?]
|
||||
|
||||
Consider
|
||||
|
||||
@ -209,17 +199,17 @@ But in the absence of a motivating use cases, we prefer not to add more than the
|
||||
|
||||
Of course the user can always make this specialization.
|
||||
|
||||
[h4 Can you explain the pros/cons of common_type against Boost.Typeof?]
|
||||
[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
|
||||
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 equivalent to
|
||||
`decltype(__declval<bool>() ? __declval<T>() : __declval<U>())`
|
||||
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.
|
||||
`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.
|
||||
|
||||
|
@ -10,15 +10,13 @@
|
||||
[/===================================================================]
|
||||
|
||||
|
||||
`#include <boost/type_traits/conditional.hpp>`
|
||||
__header ` #include <boost/type_traits/conditional.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
namespace boost {
|
||||
template <bool B, class T, class U> struct __conditional;
|
||||
}
|
||||
|
||||
If B is true, the member typedef type shall equal T. If B is false, the member typedef type shall equal F.
|
||||
|
||||
This trait is really just an alias for `boost::mpl::if_c`.
|
||||
If B is true, the member typedef type shall equal T. If B is false, the member typedef type shall equal U.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
39
doc/copy_cv.qbk
Normal file
39
doc/copy_cv.qbk
Normal file
@ -0,0 +1,39 @@
|
||||
[/
|
||||
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;
|
||||
};
|
||||
|
||||
__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]
|
||||
|
@ -18,7 +18,8 @@ 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 and Jeremy Siek.
|
||||
Itay Maman, John Maddock, Thorsten Ottosen, Robert Ramey, Jeremy Siek
|
||||
and Antony Polukhin.
|
||||
|
||||
Mat Marcus and Jesse Jones invented, and
|
||||
[@http://opensource.adobe.com/project4/project.shtml published a paper describing],
|
||||
|
@ -31,10 +31,12 @@ __header ` #include <boost/type_traits/decay.hpp>` or ` #include <boost/type_tra
|
||||
|
||||
[[`decay<int(&)(double)>::type`] [`int(*)(double)`]]
|
||||
|
||||
[[`int(*)(double`] [`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]
|
@ -146,18 +146,18 @@ determine whether to destructors need to be called
|
||||
[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 proxying iterators or not,
|
||||
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 proxying iterators
|
||||
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 proxying iterators, and even iterators of
|
||||
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 proxying iterator or not, and
|
||||
// tests whether iterator is a proxy iterator or not, and
|
||||
// uses optimal form accordingly:
|
||||
//
|
||||
namespace detail{
|
||||
@ -221,7 +221,7 @@ and enum types to double:
|
||||
An improved `std::min` function could be written like this:
|
||||
|
||||
template <class T, class U>
|
||||
typename __common_type<T, U>::type min(T t, T u)
|
||||
typename __common_type<T, U>::type min(T t, U u)
|
||||
{
|
||||
return t < u ? t : u;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ __examples
|
||||
|
||||
[:`extent<double[2][3][4], 1>::type` is the type `__integral_constant<std::size_t, 3>`.]
|
||||
|
||||
[:`extent<double[2][3][4], 3>::type` is the type `__integral_constant<std::size_t, 4>`.]
|
||||
[:`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/.]
|
||||
@ -44,5 +44,7 @@ expression that evaluates to /0/: `boost::array` is a class type and [*not an ar
|
||||
|
||||
[:`extent<T>::value_type` is the type `std::size_t`.]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -33,5 +33,7 @@ __header ` #include <boost/type_traits/floating_point_promotion.hpp>` or ` #incl
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -52,5 +52,7 @@ type use __remove_pointer.]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
107
doc/has_bit_and.qbk
Normal file
107
doc/has_bit_and.qbk
Normal file
@ -0,0 +1,107 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator&` is public or not:
|
||||
if `operator&` is defined as a private member of `Lhs` then
|
||||
instantiating `has_bit_and<Lhs>` will produce a compiler error.
|
||||
For this reason `has_bit_and` cannot be used to determine whether a type has a public `operator&` or not.
|
||||
``
|
||||
struct A { private: void operator&(const A&); };
|
||||
boost::has_bit_and<A>::value; // error: A::operator&(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_bit_and<A>::value; // this is fine
|
||||
boost::has_bit_and<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_bit_and.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator&(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_bit_and< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g&g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_bit_and< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b&b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
107
doc/has_bit_and_assign.qbk
Normal file
107
doc/has_bit_and_assign.qbk
Normal file
@ -0,0 +1,107 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator&=` is public or not:
|
||||
if `operator&=` is defined as a private member of `Lhs` then
|
||||
instantiating `has_bit_and_assign<Lhs>` will produce a compiler error.
|
||||
For this reason `has_bit_and_assign` cannot be used to determine whether a type has a public `operator&=` or not.
|
||||
``
|
||||
struct A { private: void operator&=(const A&); };
|
||||
boost::has_bit_and_assign<A>::value; // error: A::operator&=(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_bit_and_assign<A>::value; // this is fine
|
||||
boost::has_bit_and_assign<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_bit_and_assign.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator&=(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_bit_and_assign< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g&=g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_bit_and_assign< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b&=b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
107
doc/has_bit_or.qbk
Normal file
107
doc/has_bit_or.qbk
Normal file
@ -0,0 +1,107 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator|` is public or not:
|
||||
if `operator|` is defined as a private member of `Lhs` then
|
||||
instantiating `has_bit_or<Lhs>` will produce a compiler error.
|
||||
For this reason `has_bit_or` cannot be used to determine whether a type has a public `operator|` or not.
|
||||
``
|
||||
struct A { private: void operator|(const A&); };
|
||||
boost::has_bit_or<A>::value; // error: A::operator|(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_bit_or<A>::value; // this is fine
|
||||
boost::has_bit_or<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_bit_or.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator|(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_bit_or< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g|g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_bit_or< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b|b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
107
doc/has_bit_or_assign.qbk
Normal file
107
doc/has_bit_or_assign.qbk
Normal file
@ -0,0 +1,107 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator|=` is public or not:
|
||||
if `operator|=` is defined as a private member of `Lhs` then
|
||||
instantiating `has_bit_or_assign<Lhs>` will produce a compiler error.
|
||||
For this reason `has_bit_or_assign` cannot be used to determine whether a type has a public `operator|=` or not.
|
||||
``
|
||||
struct A { private: void operator|=(const A&); };
|
||||
boost::has_bit_or_assign<A>::value; // error: A::operator|=(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_bit_or_assign<A>::value; // this is fine
|
||||
boost::has_bit_or_assign<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_bit_or_assign.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator|=(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_bit_or_assign< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g|=g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_bit_or_assign< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b|=b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
107
doc/has_bit_xor.qbk
Normal file
107
doc/has_bit_xor.qbk
Normal file
@ -0,0 +1,107 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator^` is public or not:
|
||||
if `operator^` is defined as a private member of `Lhs` then
|
||||
instantiating `has_bit_xor<Lhs>` will produce a compiler error.
|
||||
For this reason `has_bit_xor` cannot be used to determine whether a type has a public `operator^` or not.
|
||||
``
|
||||
struct A { private: void operator^(const A&); };
|
||||
boost::has_bit_xor<A>::value; // error: A::operator^(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_bit_xor<A>::value; // this is fine
|
||||
boost::has_bit_xor<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_bit_xor.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator^(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_bit_xor< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g^g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_bit_xor< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b^b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
107
doc/has_bit_xor_assign.qbk
Normal file
107
doc/has_bit_xor_assign.qbk
Normal file
@ -0,0 +1,107 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator^=` is public or not:
|
||||
if `operator^=` is defined as a private member of `Lhs` then
|
||||
instantiating `has_bit_xor_assign<Lhs>` will produce a compiler error.
|
||||
For this reason `has_bit_xor_assign` cannot be used to determine whether a type has a public `operator^=` or not.
|
||||
``
|
||||
struct A { private: void operator^=(const A&); };
|
||||
boost::has_bit_xor_assign<A>::value; // error: A::operator^=(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_bit_xor_assign<A>::value; // this is fine
|
||||
boost::has_bit_xor_assign<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_bit_xor_assign.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator^=(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_bit_xor_assign< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g^=g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_bit_xor_assign< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b^=b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
109
doc/has_complement.qbk
Normal file
109
doc/has_complement.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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
|
||||
|
||||
[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]
|
||||
|
109
doc/has_divides.qbk
Normal file
109
doc/has_divides.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator/` is public or not:
|
||||
if `operator/` is defined as a private member of `Lhs` then
|
||||
instantiating `has_divides<Lhs>` will produce a compiler error.
|
||||
For this reason `has_divides` cannot be used to determine whether a type has a public `operator/` or not.
|
||||
``
|
||||
struct A { private: void operator/(const A&); };
|
||||
boost::has_divides<A>::value; // error: A::operator/(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_divides<A>::value; // this is fine
|
||||
boost::has_divides<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_divides.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator/(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_divides< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g/g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_divides< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b/b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
109
doc/has_divides_assign.qbk
Normal file
109
doc/has_divides_assign.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator/=` is public or not:
|
||||
if `operator/=` is defined as a private member of `Lhs` then
|
||||
instantiating `has_divides_assign<Lhs>` will produce a compiler error.
|
||||
For this reason `has_divides_assign` cannot be used to determine whether a type has a public `operator/=` or not.
|
||||
``
|
||||
struct A { private: void operator/=(const A&); };
|
||||
boost::has_divides_assign<A>::value; // error: A::operator/=(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_divides_assign<A>::value; // this is fine
|
||||
boost::has_divides_assign<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_divides_assign.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator/=(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_divides_assign< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g/=g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_divides_assign< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b/=b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
109
doc/has_equal_to.qbk
Normal file
109
doc/has_equal_to.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator==` is public or not:
|
||||
if `operator==` is defined as a private member of `Lhs` then
|
||||
instantiating `has_equal_to<Lhs>` will produce a compiler error.
|
||||
For this reason `has_equal_to` cannot be used to determine whether a type has a public `operator==` or not.
|
||||
``
|
||||
struct A { private: void operator==(const A&); };
|
||||
boost::has_equal_to<A>::value; // error: A::operator==(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_equal_to<A>::value; // this is fine
|
||||
boost::has_equal_to<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_equal_to.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator==(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_equal_to< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g==g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_equal_to< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b==b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
109
doc/has_greater.qbk
Normal file
109
doc/has_greater.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator>` is public or not:
|
||||
if `operator>` is defined as a private member of `Lhs` then
|
||||
instantiating `has_greater<Lhs>` will produce a compiler error.
|
||||
For this reason `has_greater` cannot be used to determine whether a type has a public `operator>` or not.
|
||||
``
|
||||
struct A { private: void operator>(const A&); };
|
||||
boost::has_greater<A>::value; // error: A::operator>(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_greater<A>::value; // this is fine
|
||||
boost::has_greater<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_greater.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator>(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_greater< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g>g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_greater< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b>b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
109
doc/has_greater_equal.qbk
Normal file
109
doc/has_greater_equal.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator>=` is public or not:
|
||||
if `operator>=` is defined as a private member of `Lhs` then
|
||||
instantiating `has_greater_equal<Lhs>` will produce a compiler error.
|
||||
For this reason `has_greater_equal` cannot be used to determine whether a type has a public `operator>=` or not.
|
||||
``
|
||||
struct A { private: void operator>=(const A&); };
|
||||
boost::has_greater_equal<A>::value; // error: A::operator>=(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_greater_equal<A>::value; // this is fine
|
||||
boost::has_greater_equal<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_greater_equal.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator>=(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_greater_equal< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g>=g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_greater_equal< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b>=b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
110
doc/has_left_shift.qbk
Normal file
110
doc/has_left_shift.qbk
Normal file
@ -0,0 +1,110 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator<<` is public or not:
|
||||
if `operator<<` is defined as a private member of `Lhs` then
|
||||
instantiating `has_left_shift<Lhs>` will produce a compiler error.
|
||||
For this reason `has_left_shift` cannot be used to determine whether a type has a public `operator<<` or not.
|
||||
``
|
||||
struct A { private: void operator<<(const A&); };
|
||||
boost::has_left_shift<A>::value; // error: A::operator<<(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_left_shift<A>::value; // this is fine
|
||||
boost::has_left_shift<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_left_shift.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator<<(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_left_shift< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g<<g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_left_shift< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b<<b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
107
doc/has_left_shift_assign.qbk
Normal file
107
doc/has_left_shift_assign.qbk
Normal file
@ -0,0 +1,107 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator<<=` is public or not:
|
||||
if `operator<<=` is defined as a private member of `Lhs` then
|
||||
instantiating `has_left_shift_assign<Lhs>` will produce a compiler error.
|
||||
For this reason `has_left_shift_assign` cannot be used to determine whether a type has a public `operator<<=` or not.
|
||||
``
|
||||
struct A { private: void operator<<=(const A&); };
|
||||
boost::has_left_shift_assign<A>::value; // error: A::operator<<=(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_left_shift_assign<A>::value; // this is fine
|
||||
boost::has_left_shift_assign<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_left_shift_assign.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator<<=(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_left_shift_assign< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g<<=g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_left_shift_assign< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b<<=b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
109
doc/has_less.qbk
Normal file
109
doc/has_less.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator<` is public or not:
|
||||
if `operator<` is defined as a private member of `Lhs` then
|
||||
instantiating `has_less<Lhs>` will produce a compiler error.
|
||||
For this reason `has_less` cannot be used to determine whether a type has a public `operator<` or not.
|
||||
``
|
||||
struct A { private: void operator<(const A&); };
|
||||
boost::has_less<A>::value; // error: A::operator<(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_less<A>::value; // this is fine
|
||||
boost::has_less<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_less.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator<(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_less< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g<g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_less< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b<b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
109
doc/has_less_equal.qbk
Normal file
109
doc/has_less_equal.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator<=` is public or not:
|
||||
if `operator<=` is defined as a private member of `Lhs` then
|
||||
instantiating `has_less_equal<Lhs>` will produce a compiler error.
|
||||
For this reason `has_less_equal` cannot be used to determine whether a type has a public `operator<=` or not.
|
||||
``
|
||||
struct A { private: void operator<=(const A&); };
|
||||
boost::has_less_equal<A>::value; // error: A::operator<=(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_less_equal<A>::value; // this is fine
|
||||
boost::has_less_equal<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_less_equal.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator<=(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_less_equal< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g<=g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_less_equal< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b<=b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
108
doc/has_logical_and.qbk
Normal file
108
doc/has_logical_and.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_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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator&&` is public or not:
|
||||
if `operator&&` is defined as a private member of `Lhs` then
|
||||
instantiating `has_logical_and<Lhs>` will produce a compiler error.
|
||||
For this reason `has_logical_and` cannot be used to determine whether a type has a public `operator&&` or not.
|
||||
``
|
||||
struct A { private: void operator&&(const A&); };
|
||||
boost::has_logical_and<A>::value; // error: A::operator&&(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_logical_and<A>::value; // this is fine
|
||||
boost::has_logical_and<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_and.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator&&(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_logical_and< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g&&g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_logical_and< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b&&b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[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]
|
||||
|
108
doc/has_logical_or.qbk
Normal file
108
doc/has_logical_or.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_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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator||` is public or not:
|
||||
if `operator||` is defined as a private member of `Lhs` then
|
||||
instantiating `has_logical_or<Lhs>` will produce a compiler error.
|
||||
For this reason `has_logical_or` cannot be used to determine whether a type has a public `operator||` or not.
|
||||
``
|
||||
struct A { private: void operator||(const A&); };
|
||||
boost::has_logical_or<A>::value; // error: A::operator||(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_logical_or<A>::value; // this is fine
|
||||
boost::has_logical_or<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_or.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator||(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_logical_or< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g||g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_logical_or< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b||b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
109
doc/has_minus.qbk
Normal file
109
doc/has_minus.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator-` is public or not:
|
||||
if `operator-` is defined as a private member of `Lhs` then
|
||||
instantiating `has_minus<Lhs>` will produce a compiler error.
|
||||
For this reason `has_minus` cannot be used to determine whether a type has a public `operator-` or not.
|
||||
``
|
||||
struct A { private: void operator-(const A&); };
|
||||
boost::has_minus<A>::value; // error: A::operator-(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_minus<A>::value; // this is fine
|
||||
boost::has_minus<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_minus.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator-(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_minus< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g-g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_minus< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b-b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
109
doc/has_minus_assign.qbk
Normal file
109
doc/has_minus_assign.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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_assign has_minus_assign]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_minus_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_minus_assign<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_minus_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_minus_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_minus_assign<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_minus_assign<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_minus_assign<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_minus_assign<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_minus_assign<int, int, long>` inherits from `__true_type`.]
|
||||
[:`has_minus_assign<int, double, double>` inherits from `__true_type`.]
|
||||
[:`has_minus_assign<int, double, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_minus_assign<const int, int>::value` inherits from `__false_type`.]
|
||||
[:`has_minus_assign<int, 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 binary `operator-=` is public or not:
|
||||
if `operator-=` is defined as a private member of `Lhs` then
|
||||
instantiating `has_minus_assign<Lhs>` will produce a compiler error.
|
||||
For this reason `has_minus_assign` cannot be used to determine whether a type has a public `operator-=` or not.
|
||||
``
|
||||
struct A { private: void operator-=(const A&); };
|
||||
boost::has_minus_assign<A>::value; // error: A::operator-=(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_minus_assign<A>::value; // this is fine
|
||||
boost::has_minus_assign<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_minus_assign.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator-=(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_minus_assign< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g-=g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_minus_assign< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b-=b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
107
doc/has_modulus.qbk
Normal file
107
doc/has_modulus.qbk
Normal file
@ -0,0 +1,107 @@
|
||||
[/
|
||||
(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_modulus has_modulus]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_modulus : 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_modulus<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_modulus.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_modulus<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_modulus<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_modulus<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_modulus<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_modulus<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_modulus<int, int, long>` inherits from `__true_type`.]
|
||||
[:`has_modulus<const int, int>::value` inherits from `__true_type`.]
|
||||
|
||||
[:`has_modulus<int, double>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator%` is public or not:
|
||||
if `operator%` is defined as a private member of `Lhs` then
|
||||
instantiating `has_modulus<Lhs>` will produce a compiler error.
|
||||
For this reason `has_modulus` cannot be used to determine whether a type has a public `operator%` or not.
|
||||
``
|
||||
struct A { private: void operator%(const A&); };
|
||||
boost::has_modulus<A>::value; // error: A::operator%(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_modulus<A>::value; // this is fine
|
||||
boost::has_modulus<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_modulus.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator%(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_modulus< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g%g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_modulus< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b%b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
107
doc/has_modulus_assign.qbk
Normal file
107
doc/has_modulus_assign.qbk
Normal file
@ -0,0 +1,107 @@
|
||||
[/
|
||||
(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_modulus_assign has_modulus_assign]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_modulus_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_modulus_assign<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_modulus_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_modulus_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_modulus_assign<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_modulus_assign<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_modulus_assign<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_modulus_assign<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_modulus_assign<int, int, long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_modulus_assign<const int, int>::value` inherits from `__false_type`.]
|
||||
[:`has_modulus_assign<int, double>` inherits from `__false_type`.]
|
||||
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator%=` is public or not:
|
||||
if `operator%=` is defined as a private member of `Lhs` then
|
||||
instantiating `has_modulus_assign<Lhs>` will produce a compiler error.
|
||||
For this reason `has_modulus_assign` cannot be used to determine whether a type has a public `operator%=` or not.
|
||||
``
|
||||
struct A { private: void operator%=(const A&); };
|
||||
boost::has_modulus_assign<A>::value; // error: A::operator%=(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_modulus_assign<A>::value; // this is fine
|
||||
boost::has_modulus_assign<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_modulus_assign.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator%=(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_modulus_assign< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g%=g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_modulus_assign< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b%=b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
109
doc/has_multiplies.qbk
Normal file
109
doc/has_multiplies.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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_multiplies has_multiplies]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_multiplies : 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_multiplies<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_multiplies.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_multiplies<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_multiplies<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_multiplies<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_multiplies<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_multiplies<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_multiplies<int, int, long>` inherits from `__true_type`.]
|
||||
[:`has_multiplies<int, double, double>` inherits from `__true_type`.]
|
||||
[:`has_multiplies<int, double, int>` inherits from `__true_type`.]
|
||||
[:`has_multiplies<const int, int>::value` inherits from `__true_type`.]
|
||||
|
||||
[:`has_multiplies<int, 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 binary `operator*` is public or not:
|
||||
if `operator*` is defined as a private member of `Lhs` then
|
||||
instantiating `has_multiplies<Lhs>` will produce a compiler error.
|
||||
For this reason `has_multiplies` cannot be used to determine whether a type has a public `operator*` or not.
|
||||
``
|
||||
struct A { private: void operator*(const A&); };
|
||||
boost::has_multiplies<A>::value; // error: A::operator*(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_multiplies<A>::value; // this is fine
|
||||
boost::has_multiplies<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_multiplies.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator*(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_multiplies< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g*g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_multiplies< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b*b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
109
doc/has_multiplies_assign.qbk
Normal file
109
doc/has_multiplies_assign.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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_multiplies_assign has_multiplies_assign]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_multiplies_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_multiplies_assign<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_multiplies_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_multiplies_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_multiplies_assign<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_multiplies_assign<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_multiplies_assign<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_multiplies_assign<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_multiplies_assign<int, int, long>` inherits from `__true_type`.]
|
||||
[:`has_multiplies_assign<int, double, double>` inherits from `__true_type`.]
|
||||
[:`has_multiplies_assign<int, double, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_multiplies_assign<const int, int>::value` inherits from `__false_type`.]
|
||||
[:`has_multiplies_assign<int, 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 binary `operator*=` is public or not:
|
||||
if `operator*=` is defined as a private member of `Lhs` then
|
||||
instantiating `has_multiplies_assign<Lhs>` will produce a compiler error.
|
||||
For this reason `has_multiplies_assign` cannot be used to determine whether a type has a public `operator*=` or not.
|
||||
``
|
||||
struct A { private: void operator*=(const A&); };
|
||||
boost::has_multiplies_assign<A>::value; // error: A::operator*=(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_multiplies_assign<A>::value; // this is fine
|
||||
boost::has_multiplies_assign<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_multiplies_assign.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator*=(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_multiplies_assign< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g*=g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_multiplies_assign< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b*=b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
108
doc/has_negate.qbk
Normal file
108
doc/has_negate.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_negate has_negate]
|
||||
template <class Rhs, class Ret=dont_care>
|
||||
struct has_negate : 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_negate<Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_negate.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_negate<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_negate<Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_negate<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_negate<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_negate<int, int>` inherits from `__true_type`.]
|
||||
[:`has_negate<int, long>` inherits from `__true_type`.]
|
||||
[:`has_negate<double, double>` inherits from `__true_type`.]
|
||||
[:`has_negate<double, int>` inherits from `__true_type`.]
|
||||
[:`has_negate<const int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_negate<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_negate<Rhs>` will produce a compiler error.
|
||||
For this reason `has_negate` cannot be used to determine whether a type has a public `operator-` or not.
|
||||
``
|
||||
struct A { private: void operator-(); };
|
||||
boost::has_negate<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_negate<A>::value; // this is fine
|
||||
boost::has_negate<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_negate.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_negate< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
-g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_negate< 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]
|
||||
|
@ -12,9 +12,7 @@
|
||||
__inherit If T is a (possibly cv-qualified) type with an overloaded new-operator
|
||||
then inherits from __true_type, otherwise inherits from __false_type.
|
||||
|
||||
__compat Not usable with compilers that do not support "substitution failure is not an error"
|
||||
(in which case BOOST_NO_SFINAE will be defined), also known to be broken with
|
||||
the Borland/Codegear compiler.
|
||||
[has_binary_operator_compat] Also known to be broken with the Borland/Codegear compilers.
|
||||
|
||||
__std_ref 12.5.
|
||||
|
||||
|
109
doc/has_not_equal_to.qbk
Normal file
109
doc/has_not_equal_to.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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_not_equal_to has_not_equal_to]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_not_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_not_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_not_equal_to.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_not_equal_to<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_not_equal_to<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_not_equal_to<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_not_equal_to<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_not_equal_to<int, int, bool>` inherits from `__true_type`.]
|
||||
[:`has_not_equal_to<int, double, bool>` inherits from `__true_type`.]
|
||||
[:`has_not_equal_to<const int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_not_equal_to<int*, int>` inherits from `__false_type`.]
|
||||
[:`has_not_equal_to<int*, double*>` inherits from `__false_type`.]
|
||||
[:`has_not_equal_to<int, 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 binary `operator!=` is public or not:
|
||||
if `operator!=` is defined as a private member of `Lhs` then
|
||||
instantiating `has_not_equal_to<Lhs>` will produce a compiler error.
|
||||
For this reason `has_not_equal_to` cannot be used to determine whether a type has a public `operator!=` or not.
|
||||
``
|
||||
struct A { private: void operator!=(const A&); };
|
||||
boost::has_not_equal_to<A>::value; // error: A::operator!=(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_not_equal_to<A>::value; // this is fine
|
||||
boost::has_not_equal_to<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_not_equal_to.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator!=(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_not_equal_to< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g!=g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_not_equal_to< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b!=b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
@ -14,14 +14,11 @@ __inherit If T is a (possibly cv-qualified) type with a non-throwing assignment-
|
||||
then inherits from __true_type, otherwise inherits from __false_type. Type `T`
|
||||
must be a complete type.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
`has_nothrow_assign` will never report that a class or struct has a
|
||||
non-throwing assignment-operator; this is always safe, if possibly sub-optimal.
|
||||
Currently (May 2005) only Visual C++ 8 has the necessary compiler support to ensure that this
|
||||
trait "just works".
|
||||
__compat Either requires C++11 `noexcept` and `decltype` or else some (unspecified) help from the compiler.
|
||||
Currently (June 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear and all recent GCC versions have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may test to see if the necessary support is available
|
||||
by checking to see if `defined(BOOST_HAS_NOTHROW_CONSTRUCTOR) || (!defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_NOEXCEPT))` is true.
|
||||
|
||||
__header ` #include <boost/type_traits/has_nothrow_assign.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
|
@ -19,14 +19,11 @@ must be a complete type.
|
||||
|
||||
These two traits are synonyms for each other.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
`has_nothrow_constructor` will never report that a class or struct has a
|
||||
non-throwing default-constructor; this is always safe, if possibly sub-optimal.
|
||||
Currently (May 2005) only Visual C++ 8 has the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works".
|
||||
__compat Either requires C++11 `noexcept` and `decltype` or else some (unspecified) help from the compiler.
|
||||
Currently (June 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear and all recent GCC versions have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may test to see if the necessary support is available
|
||||
by checking to see if `defined(BOOST_HAS_NOTHROW_CONSTRUCTOR) || (!defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_NOEXCEPT))` is true.
|
||||
|
||||
__header ` #include <boost/type_traits/has_nothrow_constructor.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
|
@ -19,14 +19,11 @@ must be a complete type.
|
||||
|
||||
These two traits are synonyms for each other.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
`has_nothrow_copy` will never report that a class or struct has a
|
||||
non-throwing copy-constructor; this is always safe, if possibly sub-optimal.
|
||||
Currently (May 2005) only Visual C++ 8 has the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works".
|
||||
__compat Either requires C++11 `noexcept` and `decltype` or else some (unspecified) help from the compiler.
|
||||
Currently (June 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear and all recent GCC versions have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may test to see if the necessary support is available
|
||||
by checking to see if `defined(BOOST_HAS_NOTHROW_COPY) || (!defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_NOEXCEPT))` is true.
|
||||
|
||||
__header ` #include <boost/type_traits/has_nothrow_copy.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
|
29
doc/has_nothrow_destruct.qbk
Normal file
29
doc/has_nothrow_destruct.qbk
Normal file
@ -0,0 +1,29 @@
|
||||
[/
|
||||
Copyright 2015 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:has_nothrow_destruct has_nothrow_destructor]
|
||||
|
||||
template <class T>
|
||||
struct has_nothrow_destructor : public __tof {};
|
||||
|
||||
__inherit If T is a (possibly cv-qualified) type with a non-throwing destructor
|
||||
then inherits from __true_type, otherwise inherits from __false_type. Type `T`
|
||||
must be a complete type.
|
||||
|
||||
__compat Either requires C++11 `noexcept` and `decltype` or else some (unspecified) help from the compiler.
|
||||
You may test to see if the necessary support is available
|
||||
by checking to see if `!defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_NOEXCEPT)` is true.
|
||||
|
||||
__header ` #include <boost/type_traits/has_nothrow_copy.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[note
|
||||
Note that destructors are assumed to be non-throwing unless they are explicitly marked otherwise with a `throw(something)` specification.
|
||||
This is in line with the C++11 standard.
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
109
doc/has_plus.qbk
Normal file
109
doc/has_plus.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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_plus has_plus]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_plus : 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_plus<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_plus.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_plus<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_plus<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_plus<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_plus<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_plus<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_plus<int, int, long>` inherits from `__true_type`.]
|
||||
[:`has_plus<int, double, double>` inherits from `__true_type`.]
|
||||
[:`has_plus<int, double, int>` inherits from `__true_type`.]
|
||||
[:`has_plus<const int, int>::value` inherits from `__true_type`.]
|
||||
|
||||
[:`has_plus<int, 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 binary `operator+` is public or not:
|
||||
if `operator+` is defined as a private member of `Lhs` then
|
||||
instantiating `has_plus<Lhs>` will produce a compiler error.
|
||||
For this reason `has_plus` cannot be used to determine whether a type has a public `operator+` or not.
|
||||
``
|
||||
struct A { private: void operator+(const A&); };
|
||||
boost::has_plus<A>::value; // error: A::operator+(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_plus<A>::value; // this is fine
|
||||
boost::has_plus<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_plus.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator+(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_plus< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g+g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_plus< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b+b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
109
doc/has_plus_assign.qbk
Normal file
109
doc/has_plus_assign.qbk
Normal file
@ -0,0 +1,109 @@
|
||||
[/
|
||||
(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_plus_assign has_plus_assign]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_plus_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_plus_assign<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_plus_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_plus_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_plus_assign<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_plus_assign<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_plus_assign<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_plus_assign<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_plus_assign<int, int, long>` inherits from `__true_type`.]
|
||||
[:`has_plus_assign<int, double, double>` inherits from `__true_type`.]
|
||||
[:`has_plus_assign<int, double, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_plus_assign<const int, int>::value` inherits from `__false_type`.]
|
||||
[:`has_plus_assign<int, 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 binary `operator+=` is public or not:
|
||||
if `operator+=` is defined as a private member of `Lhs` then
|
||||
instantiating `has_plus_assign<Lhs>` will produce a compiler error.
|
||||
For this reason `has_plus_assign` cannot be used to determine whether a type has a public `operator+=` or not.
|
||||
``
|
||||
struct A { private: void operator+=(const A&); };
|
||||
boost::has_plus_assign<A>::value; // error: A::operator+=(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_plus_assign<A>::value; // this is fine
|
||||
boost::has_plus_assign<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_plus_assign.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator+=(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_plus_assign< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g+=g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_plus_assign< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b+=b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
110
doc/has_post_decrement.qbk
Normal file
110
doc/has_post_decrement.qbk
Normal file
@ -0,0 +1,110 @@
|
||||
[/
|
||||
(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_post_decrement has_post_decrement]
|
||||
template <class Lhs, class Ret=dont_care>
|
||||
struct has_post_decrement : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` can be used in expression `lhs--`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs--` 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 postfix `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;
|
||||
f(lhs--); // is valid if has_post_decrement<Lhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_post_decrement.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_post_decrement<Lhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_post_decrement<Lhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_post_decrement<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_post_decrement<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_post_decrement<int, int>` inherits from `__true_type`.]
|
||||
[:`has_post_decrement<int, long>` inherits from `__true_type`.]
|
||||
[:`has_post_decrement<double, double>` inherits from `__true_type`.]
|
||||
[:`has_post_decrement<double, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_post_decrement<bool>` inherits from `__false_type`.]
|
||||
[:`has_post_decrement<const int>` inherits from `__false_type`.]
|
||||
[:`has_post_decrement<void*>` inherits from `__false_type`.]
|
||||
[:`has_post_decrement<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 postfix `operator--` is public or not:
|
||||
if `operator--` is defined as a private member of `Lhs` then
|
||||
instantiating `has_post_decrement<Lhs>` will produce a compiler error.
|
||||
For this reason `has_post_decrement` cannot be used to determine whether a type has a public `operator--` or not.
|
||||
``
|
||||
struct A { private: void operator--(int); };
|
||||
boost::has_post_decrement<A>::value; // error: A::operator--(int) 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&, int);
|
||||
struct B { operator A(); };
|
||||
boost::has_post_decrement<A>::value; // this is fine
|
||||
boost::has_post_decrement<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_post_decrement.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator--(const contains<T> &lhs, int) {
|
||||
return f(lhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_post_decrement< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g--; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_post_decrement< 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]
|
||||
|
110
doc/has_post_increment.qbk
Normal file
110
doc/has_post_increment.qbk
Normal file
@ -0,0 +1,110 @@
|
||||
[/
|
||||
(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_post_increment has_post_increment]
|
||||
template <class Lhs, class Ret=dont_care>
|
||||
struct has_post_increment : public __tof {};
|
||||
|
||||
__inherit
|
||||
If (i) `lhs` of type `Lhs` can be used in expression `lhs++`,
|
||||
and (ii) `Ret=dont_care` or the result of expression `lhs++` 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 postfix `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;
|
||||
f(lhs++); // is valid if has_post_increment<Lhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_post_increment.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_post_increment<Lhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_post_increment<Lhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_post_increment<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_post_increment<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_post_increment<int, int>` inherits from `__true_type`.]
|
||||
[:`has_post_increment<int, long>` inherits from `__true_type`.]
|
||||
[:`has_post_increment<double, double>` inherits from `__true_type`.]
|
||||
[:`has_post_increment<double, int>` inherits from `__true_type`.]
|
||||
[:`has_post_increment<bool>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_post_increment<const int>` inherits from `__false_type`.]
|
||||
[:`has_post_increment<void*>` inherits from `__false_type`.]
|
||||
[:`has_post_increment<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 postfix `operator++` is public or not:
|
||||
if `operator++` is defined as a private member of `Lhs` then
|
||||
instantiating `has_post_increment<Lhs>` will produce a compiler error.
|
||||
For this reason `has_post_increment` cannot be used to determine whether a type has a public `operator++` or not.
|
||||
``
|
||||
struct A { private: void operator++(int); };
|
||||
boost::has_post_increment<A>::value; // error: A::operator++(int) 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&, int);
|
||||
struct B { operator A(); };
|
||||
boost::has_post_increment<A>::value; // this is fine
|
||||
boost::has_post_increment<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_post_increment.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator++(const contains<T> &lhs, int) {
|
||||
return f(lhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_post_increment< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g++; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_post_increment< 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]
|
||||
|
110
doc/has_pre_decrement.qbk
Normal file
110
doc/has_pre_decrement.qbk
Normal file
@ -0,0 +1,110 @@
|
||||
[/
|
||||
(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_pre_decrement has_pre_decrement]
|
||||
template <class Rhs, class Ret=dont_care>
|
||||
struct has_pre_decrement : 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_pre_decrement<Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_pre_decrement.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_pre_decrement<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_pre_decrement<Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_pre_decrement<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_pre_decrement<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_pre_decrement<int, int>` inherits from `__true_type`.]
|
||||
[:`has_pre_decrement<int, long>` inherits from `__true_type`.]
|
||||
[:`has_pre_decrement<double, double>` inherits from `__true_type`.]
|
||||
[:`has_pre_decrement<double, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_pre_decrement<bool>` inherits from `__false_type`.]
|
||||
[:`has_pre_decrement<const int>` inherits from `__false_type`.]
|
||||
[:`has_pre_decrement<void*>` inherits from `__false_type`.]
|
||||
[:`has_pre_decrement<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_pre_decrement<Rhs>` will produce a compiler error.
|
||||
For this reason `has_pre_decrement` cannot be used to determine whether a type has a public `operator--` or not.
|
||||
``
|
||||
struct A { private: void operator--(); };
|
||||
boost::has_pre_decrement<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_pre_decrement<A>::value; // this is fine
|
||||
boost::has_pre_decrement<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_pre_decrement.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_pre_decrement< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
--g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_pre_decrement< 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]
|
||||
|
110
doc/has_pre_increment.qbk
Normal file
110
doc/has_pre_increment.qbk
Normal file
@ -0,0 +1,110 @@
|
||||
[/
|
||||
(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_pre_increment has_pre_increment]
|
||||
template <class Rhs, class Ret=dont_care>
|
||||
struct has_pre_increment : 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_pre_increment<Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_pre_increment.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_pre_increment<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_pre_increment<Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_pre_increment<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_pre_increment<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_pre_increment<int, int>` inherits from `__true_type`.]
|
||||
[:`has_pre_increment<int, long>` inherits from `__true_type`.]
|
||||
[:`has_pre_increment<double, double>` inherits from `__true_type`.]
|
||||
[:`has_pre_increment<double, int>` inherits from `__true_type`.]
|
||||
[:`has_pre_increment<bool>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_pre_increment<const int>` inherits from `__false_type`.]
|
||||
[:`has_pre_increment<void*>` inherits from `__false_type`.]
|
||||
[:`has_pre_increment<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_pre_increment<Rhs>` will produce a compiler error.
|
||||
For this reason `has_pre_increment` cannot be used to determine whether a type has a public `operator++` or not.
|
||||
``
|
||||
struct A { private: void operator++(); };
|
||||
boost::has_pre_increment<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_pre_increment<A>::value; // this is fine
|
||||
boost::has_pre_increment<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_pre_increment.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_pre_increment< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
++g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_pre_increment< 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]
|
||||
|
110
doc/has_right_shift.qbk
Normal file
110
doc/has_right_shift.qbk
Normal file
@ -0,0 +1,110 @@
|
||||
[/
|
||||
(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_right_shift has_right_shift]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_right_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_right_shift<Lhs, Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_right_shift.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_right_shift<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_right_shift<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_right_shift<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_right_shift<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_right_shift<int, int, int>` inherits from `__true_type`.]
|
||||
[:`has_right_shift<const int, int>` inherits from `__true_type`.]
|
||||
[:`has_right_shift<std::istream, int&>` inherits from `__true_type`.]
|
||||
[:`has_right_shift<std::istream, char*, std::ostream>` inherits from `__true_type`.]
|
||||
[:`has_right_shift<std::istream, std::string&>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_right_shift<int, double, bool>` inherits from `__false_type`.]
|
||||
[:`has_right_shift<int, 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 binary `operator>>` is public or not:
|
||||
if `operator>>` is defined as a private member of `Lhs` then
|
||||
instantiating `has_right_shift<Lhs>` will produce a compiler error.
|
||||
For this reason `has_right_shift` cannot be used to determine whether a type has a public `operator>>` or not.
|
||||
``
|
||||
struct A { private: void operator>>(const A&); };
|
||||
boost::has_right_shift<A>::value; // error: A::operator>>(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_right_shift<A>::value; // this is fine
|
||||
boost::has_right_shift<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_right_shift.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator>>(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_right_shift< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g>>g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_right_shift< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b>>b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
107
doc/has_right_shift_assign.qbk
Normal file
107
doc/has_right_shift_assign.qbk
Normal file
@ -0,0 +1,107 @@
|
||||
[/
|
||||
(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_right_shift_assign has_right_shift_assign]
|
||||
template <class Lhs, class Rhs=Lhs, class Ret=dont_care>
|
||||
struct has_right_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_right_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_right_shift_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_right_shift_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_right_shift_assign<Lhs, Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_right_shift_assign<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_right_shift_assign<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_right_shift_assign<int, int, int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_right_shift_assign<const int, int>` inherits from `__false_type`.]
|
||||
[:`has_right_shift_assign<int, double, bool>` inherits from `__false_type`.]
|
||||
[:`has_right_shift_assign<int, 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 binary `operator>>=` is public or not:
|
||||
if `operator>>=` is defined as a private member of `Lhs` then
|
||||
instantiating `has_right_shift_assign<Lhs>` will produce a compiler error.
|
||||
For this reason `has_right_shift_assign` cannot be used to determine whether a type has a public `operator>>=` or not.
|
||||
``
|
||||
struct A { private: void operator>>=(const A&); };
|
||||
boost::has_right_shift_assign<A>::value; // error: A::operator>>=(const A&) 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&, const A&);
|
||||
struct B { operator A(); };
|
||||
boost::has_right_shift_assign<A>::value; // this is fine
|
||||
boost::has_right_shift_assign<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_right_shift_assign.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <class T>
|
||||
struct contains { T data; };
|
||||
|
||||
template <class T>
|
||||
bool operator>>=(const contains<T> &lhs, const contains<T> &rhs) {
|
||||
return f(lhs.data, rhs.data);
|
||||
}
|
||||
|
||||
class bad { };
|
||||
class good { };
|
||||
bool f(const good&, const good&) { }
|
||||
|
||||
int main() {
|
||||
std::cout<<std::boolalpha;
|
||||
// works fine for contains<good>
|
||||
std::cout<<boost::has_right_shift_assign< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
g>>=g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_right_shift_assign< contains< bad > >::value<<'\n'; // true, should be false
|
||||
contains<bad> b;
|
||||
b>>=b; // compile time error
|
||||
return 0;
|
||||
}
|
||||
``
|
||||
|
||||
* `volatile` qualifier is not properly handled and would lead to undefined behavior
|
||||
|
||||
[endsect]
|
||||
|
@ -16,14 +16,16 @@ If a type has a trivial assignment-operator then the operator has the same effec
|
||||
as copying the bits of one object to the other:
|
||||
calls to the operator can be safely replaced with a call to `memcpy`.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
__compat Without some (as yet unspecified) help from the compiler,
|
||||
has_trivial_assign will never report that a user-defined class or struct has a
|
||||
trivial constructor; this is always safe, if possibly sub-optimal. Currently
|
||||
(May 2005) only MWCW 9 and Visual C++ 8 have the necessary compiler __intrinsics to detect
|
||||
user-defined classes with trivial constructors.
|
||||
trivial constructor; this is always safe, if possibly sub-optimal. In order to
|
||||
correctly handle deleted or private assignment operators, the compiler must also
|
||||
support C++11's `decltype`.
|
||||
Currently (May 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_TRIVIAL_ASSIGN` is defined.
|
||||
|
||||
|
||||
__std_ref 12.8p11.
|
||||
|
||||
|
@ -24,14 +24,16 @@ to omit a call to a single trivial-constructor call is of no benefit whatsoever.
|
||||
However, if loops and/or exception handling code can also be omitted, then some
|
||||
benefit in terms of code size and speed can be obtained.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
__compat Without some (as yet unspecified) help from the compiler,
|
||||
has_trivial_constructor will never report that a user-defined class or struct has a
|
||||
trivial constructor; this is always safe, if possibly sub-optimal. Currently
|
||||
(May 2005) only MWCW 9 and Visual C++ 8 have the necessary compiler __intrinsics to detect
|
||||
user-defined classes with trivial constructors.
|
||||
trivial constructor; this is always safe, if possibly sub-optimal.
|
||||
In addition, in order to correctly handle private or deleted default-constructors then
|
||||
C++11's `deltype` is required.
|
||||
Currently (May 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_TRIVIAL_CONSTRUCTOR` is defined.
|
||||
|
||||
|
||||
__std_ref 12.1p6.
|
||||
|
||||
|
@ -22,14 +22,16 @@ If a type has a trivial copy-constructor then the constructor has the same effec
|
||||
as copying the bits of one object to the other:
|
||||
calls to the constructor can be safely replaced with a call to `memcpy`.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
__compat Without some (as yet unspecified) help from the compiler,
|
||||
has_trivial_copy will never report that a user-defined class or struct has a
|
||||
trivial constructor; this is always safe, if possibly sub-optimal. Currently
|
||||
(May 2005) only MWCW 9 and Visual C++ 8 have the necessary compiler __intrinsics to detect
|
||||
user-defined classes with trivial constructors.
|
||||
trivial constructor; this is always safe, if possibly sub-optimal.
|
||||
In addition, in order to correctly handle deleted or private copy-constructors
|
||||
then C++11's `dectype` is required.
|
||||
Currently (May 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_TRIVIAL_COPY` is defined.
|
||||
|
||||
|
||||
__std_ref 12.8p6.
|
||||
|
||||
|
@ -18,14 +18,16 @@ to omit a call to a single trivial-constructor call is of no benefit whatsoever.
|
||||
However, if loops and/or exception handling code can also be omitted, then some
|
||||
benefit in terms of code size and speed can be obtained.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
__compat Without some (as yet unspecified) help from the compiler,
|
||||
has_trivial_destructor will never report that a user-defined class or struct has a
|
||||
trivial destructor; this is always safe, if possibly sub-optimal. Currently
|
||||
(May 2005) only MWCW 9 and Visual C++ 8 have the necessary compiler __intrinsics to detect
|
||||
user-defined classes with trivial constructors.
|
||||
trivial destructor; this is always safe, if possibly sub-optimal.
|
||||
In addition, in order to correctly handle deleted or private destructors then
|
||||
support for C++11's `decltype` is required.
|
||||
Currently (June 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_TRIVIAL_DESTRUCTOR` is defined.
|
||||
|
||||
|
||||
__std_ref 12.4p3.
|
||||
|
||||
|
48
doc/has_trivial_move_assign.qbk
Normal file
48
doc/has_trivial_move_assign.qbk
Normal file
@ -0,0 +1,48 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Copyright 2013 Antony Polukhin.
|
||||
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_trivial_move_assign has_trivial_move_assign]
|
||||
template <class T>
|
||||
struct has_trivial_move_assign : public __tof {};
|
||||
|
||||
__inherit If T is a (possibly cv-qualified) type with a trivial move assignment-operator
|
||||
then inherits from __true_type, otherwise inherits from __false_type.
|
||||
|
||||
If a type has a trivial move assignment-operator then the operator has the same effect
|
||||
as copying the bits of one object to the other:
|
||||
calls to the operator can be safely replaced with a call to `memcpy`.
|
||||
|
||||
__compat Without some (as yet unspecified) help from the compiler,
|
||||
has_trivial_move_assign will never report that a user-defined class or struct has a
|
||||
trivial move assign; this is always safe, if possibly sub-optimal.
|
||||
In addition, in order to correctly handle private or deleted move assignment
|
||||
operators then c++11's `decltype` is required.
|
||||
Currently (June 2015) compilers that have the necessary __intrinsics to ensure that this
|
||||
trait "just works" include Clang, GCC-5.1 and MSVC-12.0.
|
||||
You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_TRIVIAL_MOVE_ASSIGN` is defined.
|
||||
|
||||
|
||||
__header ` #include <boost/type_traits/has_trivial_move_assign.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_trivial_move_assign<int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_trivial_move_assign<char*>::type` is the type `__true_type`.]
|
||||
|
||||
[:`has_trivial_move_assign<int (*)(long)>::value` is an integral constant
|
||||
expression that evaluates to /true/.]
|
||||
|
||||
[:`has_trivial_move_assign<MyClass>::value` is an integral constant
|
||||
expression that evaluates to /false/.]
|
||||
|
||||
[:`has_trivial_move_assign<T>::value_type` is the type `bool`.]
|
||||
|
||||
[endsect]
|
||||
|
49
doc/has_trivial_move_constructor.qbk
Normal file
49
doc/has_trivial_move_constructor.qbk
Normal file
@ -0,0 +1,49 @@
|
||||
[/
|
||||
Copyright 2007 John Maddock.
|
||||
Copyright 2013 Antony Polukhin.
|
||||
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_trivial_move_constructor has_trivial_move_constructor]
|
||||
|
||||
template <class T>
|
||||
struct has_trivial_move_constructor : public __tof {};
|
||||
|
||||
__inherit If T is a (possibly cv-qualified) type with a trivial move-constructor
|
||||
then inherits from __true_type, otherwise inherits from __false_type.
|
||||
|
||||
If a type has a trivial move-constructor then the constructor has the same effect
|
||||
as copying the bits of one object to the other:
|
||||
calls to the constructor can be safely replaced with a call to `memcpy`.
|
||||
|
||||
__compat Without some (as yet unspecified) help from the compiler,
|
||||
has_trivial_move_constructor will never report that a user-defined class or struct has a
|
||||
trivial constructor; this is always safe, if possibly sub-optimal.
|
||||
In addition C++11's `decltype` is required to correctly support deleted or private
|
||||
move constructors.
|
||||
Currently (June 2015) compilers that have the necessary __intrinsics to ensure that this
|
||||
trait "just works" include Clang, GCC-5.1, and MSVC-12.0.
|
||||
You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR` is defined.
|
||||
|
||||
|
||||
__header ` #include <boost/type_traits/has_trivial_move_constructor.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_trivial_move_constructor<int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_trivial_move_constructor<char*>::type` is the type `__true_type`.]
|
||||
|
||||
[:`has_trivial_move_constructor<int (*)(long)>::value` is an integral constant
|
||||
expression that evaluates to /true/.]
|
||||
|
||||
[:`has_trivial_move_constructor<MyClass>::value` is an integral constant
|
||||
expression that evaluates to /false/.]
|
||||
|
||||
[:`has_trivial_move_constructor<T>::value_type` is the type `bool`.]
|
||||
|
||||
[endsect]
|
||||
|
108
doc/has_unary_minus.qbk
Normal file
108
doc/has_unary_minus.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_unary_minus has_unary_minus]
|
||||
template <class Rhs, class Ret=dont_care>
|
||||
struct has_unary_minus : 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_unary_minus<Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_unary_minus.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_unary_minus<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_unary_minus<Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_unary_minus<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_unary_minus<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_unary_minus<int, int>` inherits from `__true_type`.]
|
||||
[:`has_unary_minus<int, long>` inherits from `__true_type`.]
|
||||
[:`has_unary_minus<double, double>` inherits from `__true_type`.]
|
||||
[:`has_unary_minus<double, int>` inherits from `__true_type`.]
|
||||
[:`has_unary_minus<const int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_unary_minus<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_unary_minus<Rhs>` will produce a compiler error.
|
||||
For this reason `has_unary_minus` cannot be used to determine whether a type has a public `operator-` or not.
|
||||
``
|
||||
struct A { private: void operator-(); };
|
||||
boost::has_unary_minus<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_unary_minus<A>::value; // this is fine
|
||||
boost::has_unary_minus<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_unary_minus.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_unary_minus< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
-g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_unary_minus< 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]
|
||||
|
108
doc/has_unary_plus.qbk
Normal file
108
doc/has_unary_plus.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_unary_plus has_unary_plus]
|
||||
template <class Rhs, class Ret=dont_care>
|
||||
struct has_unary_plus : 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_unary_plus<Rhs, Ret>::value==true
|
||||
``
|
||||
If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_unary_plus.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_unary_plus<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
[:`has_unary_plus<Rhs, Ret>::value` is a `bool` integral constant expression.]
|
||||
[:`has_unary_plus<int>::value` is a `bool` integral constant expression that evaluates to `true`.]
|
||||
[:`has_unary_plus<long>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_unary_plus<int, int>` inherits from `__true_type`.]
|
||||
[:`has_unary_plus<int, long>` inherits from `__true_type`.]
|
||||
[:`has_unary_plus<double, double>` inherits from `__true_type`.]
|
||||
[:`has_unary_plus<double, int>` inherits from `__true_type`.]
|
||||
[:`has_unary_plus<const int>` inherits from `__true_type`.]
|
||||
|
||||
[:`has_unary_plus<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_unary_plus<Rhs>` will produce a compiler error.
|
||||
For this reason `has_unary_plus` cannot be used to determine whether a type has a public `operator+` or not.
|
||||
``
|
||||
struct A { private: void operator+(); };
|
||||
boost::has_unary_plus<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_unary_plus<A>::value; // this is fine
|
||||
boost::has_unary_plus<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_unary_plus.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_unary_plus< contains< good > >::value<<'\n'; // true
|
||||
contains<good> g;
|
||||
+g; // ok
|
||||
// does not work for contains<bad>
|
||||
std::cout<<boost::has_unary_plus< 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]
|
||||
|
@ -12,13 +12,16 @@
|
||||
__inherit If T is a (possibly cv-qualified) type with a virtual destructor
|
||||
then inherits from __true_type, otherwise inherits from __false_type.
|
||||
|
||||
__compat This trait is provided for completeness, since it's part of the
|
||||
Technical Report on C++ Library Extensions. However, there is currently no
|
||||
way to portably implement this trait. The default version provided
|
||||
__compat There is currently no
|
||||
way to portably implement this trait: the default version
|
||||
always inherits from __false_type, and has to be explicitly specialized for
|
||||
types with virtual destructors unless the compiler used has compiler __intrinsics
|
||||
that enable the trait to do the right thing: currently (May 2005) only Visual C++
|
||||
8 and GCC-4.3 have the necessary __intrinsics.
|
||||
that enable the trait to do the right thing:
|
||||
Currently (June 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, plus Codegear and Clang have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_VIRTUAL_DESTRUCTOR` is defined.
|
||||
|
||||
|
||||
__std_ref 12.4.
|
||||
|
||||
|
@ -7,6 +7,49 @@
|
||||
|
||||
[section:history History]
|
||||
|
||||
[h4 Boost 1.64.0]
|
||||
|
||||
* Added new trait __make_void.
|
||||
|
||||
[h4 Boost 1.60.0]
|
||||
|
||||
* Refactored traits to depend only on Boost.Config. Greatly simplified code to improve readability and remove workarounds for old compilers no longer supported.
|
||||
* Fix __decay to follow C++11 semantics, see [@https://svn.boost.org/trac/boost/ticket/7760 #7760].
|
||||
* Added a number of new traits __is_assignable, __is_default_constructible, __is_constructible and __is_destructible required to fix bugs in a number of other traits,
|
||||
see for example [@https://svn.boost.org/trac/boost/ticket/7760 #11324].
|
||||
|
||||
[h4 Boost 1.58.0]
|
||||
|
||||
* Fixed issue with CUDA on Clang compiler see [@https://svn.boost.org/trac/boost/ticket/10694 #10694].
|
||||
* Fixed __is_nothrow_move_assignable and __is_nothrow_move_constructible to work on VC12 and later.
|
||||
|
||||
[h4 Boost 1.57.0]
|
||||
|
||||
* Added new traits __is_copy_assignable and __is_final.
|
||||
* Misc fixes for newer versions of clang and msvc-14.
|
||||
|
||||
[h4 Boost 1.56.0]
|
||||
|
||||
* Fixed issues [@https://svn.boost.org/trac/boost/ticket/7317 #7317],
|
||||
[@https://svn.boost.org/trac/boost/ticket/9474 #9474].
|
||||
|
||||
|
||||
[h4 Boost 1.55.0]
|
||||
|
||||
* Added new trait __is_copy_constructible.
|
||||
|
||||
[h4 Boost 1.54.0]
|
||||
|
||||
* Added new traits __is_nothrow_move_assignable, __is_nothrow_move_constructible, __has_trivial_move_assign,
|
||||
__has_trivial_move_constructor.
|
||||
|
||||
[h4 Boost 1.47.0]
|
||||
|
||||
* [* Breaking change]: changed __is_convertible to C++0x behaviour when possible.
|
||||
* Fixed issues [@https://svn.boost.org/trac/boost/ticket/5271 #5271],
|
||||
[@https://svn.boost.org/trac/boost/ticket/4530 #4530].
|
||||
|
||||
|
||||
[h4 Boost 1.45.0]
|
||||
|
||||
* Added new traits __add_rvalue_reference, __add_lvalue_reference and __common_type.
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Background and Tutorial</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="intro.html" title="Introduction">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="intro.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="category.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_typetraits.background"></a><a class="link" href="background.html" title="Background and Tutorial">Background and Tutorial</a>
|
||||
</h2></div></div></div>
|
||||
@ -56,9 +55,10 @@
|
||||
terminated string, safe in the knowledge that specializations of <code class="computeroutput"><span class="identifier">char_traits</span></code> will use the most appropriate
|
||||
method available to them.
|
||||
</p>
|
||||
<a name="boost_typetraits.background.type_traits"></a><h5>
|
||||
<a name="id1005124"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.type_traits">Type Traits</a>
|
||||
<h5>
|
||||
<a name="boost_typetraits.background.h0"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.background.type_traits"></a></span><a class="link" href="background.html#boost_typetraits.background.type_traits">Type
|
||||
Traits</a>
|
||||
</h5>
|
||||
<p>
|
||||
Class <code class="computeroutput"><span class="identifier">char_traits</span></code> is a classic
|
||||
@ -84,9 +84,9 @@
|
||||
for brevity, namespace-qualification is omitted in most of the code samples
|
||||
given.
|
||||
</p>
|
||||
<a name="boost_typetraits.background.implementation"></a><h5>
|
||||
<a name="id1005188"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.implementation">Implementation</a>
|
||||
<h5>
|
||||
<a name="boost_typetraits.background.h1"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.background.implementation"></a></span><a class="link" href="background.html#boost_typetraits.background.implementation">Implementation</a>
|
||||
</h5>
|
||||
<p>
|
||||
There are far too many separate classes contained in the type-traits library
|
||||
@ -98,10 +98,10 @@
|
||||
from <code class="computeroutput"><a class="link" href="reference/integral_constant.html" title="integral_constant">true_type</a></code>
|
||||
only if <code class="computeroutput"><span class="identifier">T</span></code> is <code class="computeroutput"><span class="keyword">void</span></code>.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="reference/is_void.html" title="is_void">is_void</a> <span class="special">:</span> <span class="keyword">public</span> <a class="link" href="reference/integral_constant.html" title="integral_constant">false_type</a><span class="special">{};</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><></span>
|
||||
<span class="keyword">template</span> <span class="special"><></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="reference/is_void.html" title="is_void">is_void</a><span class="special"><</span><span class="keyword">void</span><span class="special">></span> <span class="special">:</span> <span class="keyword">public</span> <a class="link" href="reference/integral_constant.html" title="integral_constant">true_type</a><span class="special">{};</span>
|
||||
</pre>
|
||||
<p>
|
||||
@ -116,10 +116,10 @@
|
||||
a pointer, and a partial specialization to handle all the cases where T is
|
||||
a pointer:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="reference/is_pointer.html" title="is_pointer">is_pointer</a> <span class="special">:</span> <span class="keyword">public</span> <a class="link" href="reference/integral_constant.html" title="integral_constant">false_type</a><span class="special">{};</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="reference/is_pointer.html" title="is_pointer">is_pointer</a><span class="special"><</span><span class="identifier">T</span><span class="special">*></span> <span class="special">:</span> <span class="keyword">public</span> <a class="link" href="reference/integral_constant.html" title="integral_constant">true_type</a><span class="special">{};</span>
|
||||
</pre>
|
||||
<p>
|
||||
@ -155,11 +155,11 @@
|
||||
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 class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="reference/remove_extent.html" title="remove_extent">remove_extent</a>
|
||||
<span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">T</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="reference/remove_extent.html" title="remove_extent">remove_extent</a><span class="special"><</span><span class="identifier">T</span><span class="special">[</span><span class="identifier">N</span><span class="special">]></span>
|
||||
<span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">T</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
|
||||
</pre>
|
||||
@ -174,9 +174,10 @@
|
||||
after the class name do have to match the number and type of the parameters
|
||||
in the default template.
|
||||
</p>
|
||||
<a name="boost_typetraits.background.optimized_copy"></a><h5>
|
||||
<a name="id1014129"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.optimized_copy">Optimized copy</a>
|
||||
<h5>
|
||||
<a name="boost_typetraits.background.h2"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.background.optimized_copy"></a></span><a class="link" href="background.html#boost_typetraits.background.optimized_copy">Optimized
|
||||
copy</a>
|
||||
</h5>
|
||||
<p>
|
||||
As an example of how the type traits classes can be used, consider the standard
|
||||
@ -194,16 +195,16 @@
|
||||
copy in terms of <code class="computeroutput"><span class="identifier">memcpy</span></code> all
|
||||
of the following conditions need to be met:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
Both of the iterator types <code class="computeroutput"><span class="identifier">Iter1</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">Iter2</span></code> must be pointers.
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
Both <code class="computeroutput"><span class="identifier">Iter1</span></code> and <code class="computeroutput"><span class="identifier">Iter2</span></code> must point to the same type - excluding
|
||||
const and volatile-qualifiers.
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
The type pointed to by <code class="computeroutput"><span class="identifier">Iter1</span></code>
|
||||
must have a trivial assignment operator.
|
||||
</li>
|
||||
@ -211,14 +212,14 @@
|
||||
<p>
|
||||
By trivial assignment operator we mean that the type is either a scalar type<a class="link" href="background.html#background.references">[3]</a> or:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
The type has no user defined assignment operator.
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
The type does not have any data members that are references.
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
All base classes, and all data member objects must have trivial assignment
|
||||
operators.
|
||||
</li>
|
||||
@ -239,17 +240,18 @@
|
||||
examples</a>. The code begins by defining a template function <code class="computeroutput"><span class="identifier">do_copy</span></code> that performs a "slow but safe"
|
||||
copy. The last parameter passed to this function may be either a <code class="computeroutput"><a class="link" href="reference/integral_constant.html" title="integral_constant">true_type</a></code>
|
||||
or a <code class="computeroutput"><a class="link" href="reference/integral_constant.html" title="integral_constant">false_type</a></code>.
|
||||
Following that there is an overload of do<span class="underline">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 `</span>_true_type<code class="computeroutput"><span class="special">.</span> <span class="identifier">Finally</span><span class="special">,</span> <span class="identifier">the</span> <span class="identifier">version</span>
|
||||
<span class="identifier">of</span> </code>copy<code class="computeroutput"> <span class="identifier">calls</span>
|
||||
</code>do<span class="underline">copy`, passing `</span>_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".
|
||||
Following that there is an overload of do_copy that uses <code class="computeroutput"><span class="identifier">memcpy</span></code>:
|
||||
this time the iterators are required to actually be pointers to the same type,
|
||||
and the final parameter must be a <code class="computeroutput"><a class="link" href="reference/integral_constant.html" title="integral_constant">true_type</a></code>.
|
||||
Finally, the version of <code class="computeroutput"><span class="identifier">copy</span></code>
|
||||
calls <code class="computeroutput"><span class="identifier">do_copy</span></code>, passing <code class="computeroutput"><a class="link" href="reference/has_trivial_assign.html" title="has_trivial_assign">has_trivial_assign</a><span class="special"><</span><span class="identifier">value_type</span><span class="special">>()</span></code> as the final parameter: this will dispatch
|
||||
to the optimized version where appropriate, otherwise it will call the "slow
|
||||
but safe version".
|
||||
</p>
|
||||
<a name="boost_typetraits.background.was_it_worth_it_"></a><h5>
|
||||
<a name="id1014495"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.was_it_worth_it_">Was it worth it?</a>
|
||||
<h5>
|
||||
<a name="boost_typetraits.background.h3"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.background.was_it_worth_it_"></a></span><a class="link" href="background.html#boost_typetraits.background.was_it_worth_it_">Was
|
||||
it worth it?</a>
|
||||
</h5>
|
||||
<p>
|
||||
It has often been repeated in these columns that "premature optimization
|
||||
@ -265,12 +267,12 @@
|
||||
comparison between algorithms becomes difficult. However, perhaps we can add
|
||||
a couple of caveats to the premature optimization rule:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
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.
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
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
|
||||
@ -379,9 +381,10 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break"><a name="boost_typetraits.background.pair_of_references"></a><h5>
|
||||
<a name="id1014691"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.pair_of_references">Pair of References</a>
|
||||
<br class="table-break"><h5>
|
||||
<a name="boost_typetraits.background.h4"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.background.pair_of_references"></a></span><a class="link" href="background.html#boost_typetraits.background.pair_of_references">Pair
|
||||
of References</a>
|
||||
</h5>
|
||||
<p>
|
||||
The optimized copy example shows how type traits may be used to perform optimization
|
||||
@ -396,8 +399,8 @@
|
||||
the comparison operators, default constructor, and template copy constructor
|
||||
for simplicity:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">pair</span>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">pair</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">T1</span> <span class="identifier">first_type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">T2</span> <span class="identifier">second_type</span><span class="special">;</span>
|
||||
@ -567,8 +570,8 @@
|
||||
that can contain non-reference types, reference types, and constant reference
|
||||
types:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">pair</span>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">pair</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">T1</span> <span class="identifier">first_type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">T2</span> <span class="identifier">second_type</span><span class="special">;</span>
|
||||
@ -597,9 +600,9 @@
|
||||
partial specialization to the type traits classes, resulting in code that is
|
||||
easier to maintain and easier to understand.
|
||||
</p>
|
||||
<a name="boost_typetraits.background.conclusion"></a><h5>
|
||||
<a name="id1015535"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.conclusion">Conclusion</a>
|
||||
<h5>
|
||||
<a name="boost_typetraits.background.h5"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.background.conclusion"></a></span><a class="link" href="background.html#boost_typetraits.background.conclusion">Conclusion</a>
|
||||
</h5>
|
||||
<p>
|
||||
We hope that in this article we have been able to give you some idea of what
|
||||
@ -610,56 +613,56 @@
|
||||
does not have to sink to the lowest common denominator, and that templates
|
||||
can be optimal as well as generic.
|
||||
</p>
|
||||
<a name="boost_typetraits.background.acknowledgements"></a><h5>
|
||||
<a name="id1015552"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background.acknowledgements">Acknowledgements</a>
|
||||
<h5>
|
||||
<a name="boost_typetraits.background.h6"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.background.acknowledgements"></a></span><a class="link" href="background.html#boost_typetraits.background.acknowledgements">Acknowledgements</a>
|
||||
</h5>
|
||||
<p>
|
||||
The authors would like to thank Beman Dawes and Howard Hinnant for their helpful
|
||||
comments when preparing this article.
|
||||
</p>
|
||||
<a name="boost_typetraits.background._anchor_id__background_references____references"></a><h5>
|
||||
<a name="id1015569"></a>
|
||||
<a class="link" href="background.html#boost_typetraits.background._anchor_id__background_references____references"><a name="background.references"></a> References</a>
|
||||
<h5>
|
||||
<a name="boost_typetraits.background.h7"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.background._anchor_id__background_references___references"></a></span><a class="link" href="background.html#boost_typetraits.background._anchor_id__background_references___references">References</a>
|
||||
</h5>
|
||||
<div class="orderedlist"><ol type="1">
|
||||
<li>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
Nathan C. Myers, C++ Report, June 1995.
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
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>
|
||||
<li class="listitem">
|
||||
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>
|
||||
<li class="listitem">
|
||||
This quote is from Donald Knuth, ACM Computing Surveys, December 1974,
|
||||
pg 268.
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
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>
|
||||
<li class="listitem">
|
||||
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>
|
||||
<li class="listitem">
|
||||
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>
|
||||
<li class="listitem">
|
||||
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 &"
|
||||
@ -670,10 +673,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Type Traits by Category</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="background.html" title="Background and Tutorial">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="background.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="category/value_traits.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_typetraits.category"></a><a class="link" href="category.html" title="Type Traits by Category">Type Traits by Category</a>
|
||||
</h2></div></div></div>
|
||||
@ -37,6 +36,8 @@
|
||||
Type Properties</a></span></dt>
|
||||
<dt><span class="section"><a href="category/value_traits/relate.html">Relationships
|
||||
Between Two Types</a></span></dt>
|
||||
<dt><span class="section"><a href="category/value_traits/operators.html">Operator
|
||||
Type Traits</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="category/transform.html">Type Traits that
|
||||
Transform One Type to Another</a></span></dt>
|
||||
@ -48,10 +49,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Synthesizing Types with Specific Alignments</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../category.html" title="Type Traits by Category">
|
||||
<link rel="prev" href="transform.html" title="Type Traits that Transform One Type to Another">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="transform.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../category.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="function.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.category.alignment"></a><a class="link" href="alignment.html" title="Synthesizing Types with Specific Alignments">Synthesizing Types
|
||||
with Specific Alignments</a>
|
||||
@ -46,10 +45,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Decomposing Function Types</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../category.html" title="Type Traits by Category">
|
||||
<link rel="prev" href="alignment.html" title="Synthesizing Types with Specific Alignments">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="alignment.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../category.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../user_defined.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.category.function"></a><a class="link" href="function.html" title="Decomposing Function Types">Decomposing Function
|
||||
Types</a>
|
||||
@ -43,10 +42,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,13 +1,12 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Type Traits that Transform One Type to Another</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../category.html" title="Type Traits by Category">
|
||||
<link rel="prev" href="value_traits/relate.html" title="Relationships Between Two Types">
|
||||
<link rel="prev" href="value_traits/operators.html" title="Operator Type Traits">
|
||||
<link rel="next" href="alignment.html" title="Synthesizing Types with Specific Alignments">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@ -21,9 +20,9 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="value_traits/relate.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../category.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="alignment.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="value_traits/operators.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../category.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="alignment.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.category.transform"></a><a class="link" href="transform.html" title="Type Traits that Transform One Type to Another">Type Traits that
|
||||
Transform One Type to Another</a>
|
||||
@ -64,6 +63,9 @@
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span><span class="special">...</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/common_type.html" title="common_type">common_type</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/copy_cv.html" title="copy_cv">copy_cv</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/decay.html" title="decay">decay</a><span class="special">;</span>
|
||||
|
||||
@ -102,70 +104,18 @@
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/remove_volatile.html" title="remove_volatile">remove_volatile</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/type_identity.html" title="type_identity">type_identity</a><span class="special">;</span>
|
||||
</pre>
|
||||
<a name="boost_typetraits.category.transform.broken_compiler_workarounds_"></a><h5>
|
||||
<a name="id1020176"></a>
|
||||
<a class="link" href="transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">Broken
|
||||
Compiler Workarounds:</a>
|
||||
</h5>
|
||||
<p>
|
||||
For all of these templates support for partial specialization of class templates
|
||||
is required to correctly implement the transformation. On the other hand,
|
||||
practice shows that many of the templates from this category are very useful,
|
||||
and often essential for implementing some generic libraries. Lack of these
|
||||
templates is often one of the major limiting factors in porting those libraries
|
||||
to compilers that do not yet support this language feature. As some of these
|
||||
compilers are going to be around for a while, and at least one of them is
|
||||
very wide-spread, it was decided that the library should provide workarounds
|
||||
where possible.
|
||||
</p>
|
||||
<p>
|
||||
The basic idea behind the workaround is to manually define full specializations
|
||||
of all type transformation templates for all fundamental types, and all their
|
||||
1st and 2nd rank cv-[un]qualified derivative pointer types, and to provide
|
||||
a user-level macro that will define all the explicit specializations needed
|
||||
for any user-defined type T.
|
||||
</p>
|
||||
<p>
|
||||
The first part guarantees the successful compilation of something like this:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span><span class="special">,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span><span class="special">&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span><span class="special">,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span><span class="special">&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">volatile</span><span class="special">,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">volatile</span><span class="special">&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span><span class="special">*,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span><span class="special">*&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span><span class="special">*,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span><span class="special">*&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">*</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">*</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">*</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">*</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
</pre>
|
||||
<p>
|
||||
and the second part provides the library's users with a mechanism to make
|
||||
the above code work not only for <code class="computeroutput"><span class="keyword">char</span></code>,
|
||||
<code class="computeroutput"><span class="keyword">int</span></code> or other built-in type,
|
||||
but for their own types as well:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">myspace</span><span class="special">{</span>
|
||||
<span class="keyword">struct</span> <span class="identifier">MyClass</span> <span class="special">{};</span>
|
||||
<span class="special">}</span>
|
||||
<span class="comment">// declare this at global scope:
|
||||
</span><span class="identifier">BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</span><span class="special">(</span><span class="identifier">myspace</span><span class="special">::</span><span class="identifier">MyClass</span><span class="special">)</span>
|
||||
<span class="comment">// transformations on myspace::MyClass now work:
|
||||
</span><span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="identifier">myspace</span><span class="special">::</span><span class="identifier">MyClass</span><span class="special">,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="identifier">myspace</span><span class="special">::</span><span class="identifier">MyClass</span><span class="special">&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="identifier">myspace</span><span class="special">::</span><span class="identifier">MyClass</span><span class="special">,</span> <span class="identifier">remove_const</span><span class="special"><</span><span class="identifier">myspace</span><span class="special">::</span><span class="identifier">MyClass</span> <span class="keyword">const</span><span class="special">>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="comment">// etc.
|
||||
</span></pre>
|
||||
<p>
|
||||
Note that the macro BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION evaluates
|
||||
to nothing on those compilers that <span class="bold"><strong>do</strong></span> support
|
||||
partial specialization.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
@ -173,7 +123,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="value_traits/relate.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../category.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="alignment.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="value_traits/operators.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../category.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="alignment.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Type Traits that Describe the Properties of a Type</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../category.html" title="Type Traits by Category">
|
||||
<link rel="prev" href="../category.html" title="Type Traits by Category">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../category.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../category.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="value_traits/primary.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.category.value_traits"></a><a class="link" href="value_traits.html" title="Type Traits that Describe the Properties of a Type">Type Traits that
|
||||
Describe the Properties of a Type</a>
|
||||
@ -35,6 +34,8 @@
|
||||
Type Properties</a></span></dt>
|
||||
<dt><span class="section"><a href="value_traits/relate.html">Relationships
|
||||
Between Two Types</a></span></dt>
|
||||
<dt><span class="section"><a href="value_traits/operators.html">Operator
|
||||
Type Traits</a></span></dt>
|
||||
</dl></div>
|
||||
<p>
|
||||
These traits are all <span class="emphasis"><em>value traits</em></span>, which is to say the
|
||||
@ -49,10 +50,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
1441
doc/html/boost_typetraits/category/value_traits/operators.html
Normal file
1441
doc/html/boost_typetraits/category/value_traits/operators.html
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Categorizing a Type</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../value_traits.html" title="Type Traits that Describe the Properties of a Type">
|
||||
<link rel="prev" href="../value_traits.html" title="Type Traits that Describe the Properties of a Type">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../value_traits.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../value_traits.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="properties.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_typetraits.category.value_traits.primary"></a><a class="link" href="primary.html" title="Categorizing a Type">Categorizing
|
||||
a Type</a>
|
||||
@ -51,43 +50,43 @@
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_array.html" title="is_array">is_array</a><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_class.html" title="is_class">is_class</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_complex.html" title="is_complex">is_complex</a><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_enum.html" title="is_enum">is_enum</a><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_floating_point.html" title="is_floating_point">is_floating_point</a><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_function.html" title="is_function">is_function</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_integral.html" title="is_integral">is_integral</a><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_member_function_pointer.html" title="is_member_function_pointer">is_member_function_pointer</a><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_member_object_pointer.html" title="is_member_object_pointer">is_member_object_pointer</a><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_pointer.html" title="is_pointer">is_pointer</a><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_lvalue_reference.html" title="is_lvalue_reference">is_lvalue_reference</a><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_rvalue_reference.html" title="is_rvalue_reference">is_rvalue_reference</a><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_union.html" title="is_union">is_union</a><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_void.html" title="is_void">is_void</a><span class="special">;</span>
|
||||
</pre>
|
||||
@ -113,17 +112,18 @@
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_reference.html" title="is_reference">is_reference</a><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_scalar.html" title="is_scalar">is_scalar</a><span class="special">;</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>General Type Properties</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../value_traits.html" title="Type Traits that Describe the Properties of a Type">
|
||||
<link rel="prev" href="primary.html" title="Categorizing a Type">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="primary.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../value_traits.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="relate.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_typetraits.category.value_traits.properties"></a><a class="link" href="properties.html" title="General Type Properties">General
|
||||
Type Properties</a>
|
||||
@ -55,6 +54,9 @@
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/has_nothrow_copy.html" title="has_nothrow_copy">has_nothrow_copy_constructor</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/has_nothrow_destruct.html" title="has_nothrow_destructor">has_nothrow_destructor</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/has_trivial_assign.html" title="has_trivial_assign">has_trivial_assign</a><span class="special">;</span>
|
||||
|
||||
@ -79,12 +81,33 @@
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_abstract.html" title="is_abstract">is_abstract</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_assignable.html" title="is_assignable">is_assignable</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_copy_constructible.html" title="is_copy_constructible">is_copy_constructible</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_copy_assignable.html" title="is_copy_assignable">is_copy_assignable</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> <span class="identifier">Args</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_constructible.html" title="is_constructible">is_constructible</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_default_constructible.html" title="is_default_constructible">is_default_constructible</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_destructible.html" title="is_destructible">is_destructible</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_const.html" title="is_const">is_const</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_empty.html" title="is_empty">is_empty</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_final.html" title="is_final">is_final</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_stateless.html" title="is_stateless">is_stateless</a><span class="special">;</span>
|
||||
|
||||
@ -112,10 +135,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,14 +1,13 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Relationships Between Two Types</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../value_traits.html" title="Type Traits that Describe the Properties of a Type">
|
||||
<link rel="prev" href="properties.html" title="General Type Properties">
|
||||
<link rel="next" href="../transform.html" title="Type Traits that Transform One Type to Another">
|
||||
<link rel="next" href="operators.html" title="Operator Type Traits">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
@ -21,9 +20,9 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="properties.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../value_traits.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../transform.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="properties.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../value_traits.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="operators.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_typetraits.category.value_traits.relate"></a><a class="link" href="relate.html" title="Relationships Between Two Types">Relationships
|
||||
Between Two Types</a>
|
||||
@ -50,10 +49,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
@ -61,7 +61,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="properties.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../value_traits.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../transform.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="properties.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../value_traits.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="operators.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Credits</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="history.html" title="History">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="history.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../index/s11.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_typetraits.credits"></a><a class="link" href="credits.html" title="Credits">Credits</a>
|
||||
</h2></div></div></div>
|
||||
@ -40,7 +39,7 @@
|
||||
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 and Jeremy Siek.
|
||||
Ramey, Jeremy Siek and Antony Polukhin.
|
||||
</p>
|
||||
<p>
|
||||
Mat Marcus and Jesse Jones invented, and <a href="http://opensource.adobe.com/project4/project.shtml" target="_top">published
|
||||
@ -63,10 +62,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Examples</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="mpl.html" title="MPL Interoperability">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="mpl.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="examples/copy.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_typetraits.examples"></a><a class="link" href="examples.html" title="Examples">Examples</a>
|
||||
</h2></div></div></div>
|
||||
@ -44,10 +43,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>An Optimized Version of std::copy</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="../examples.html" title="Examples">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../examples.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="fill.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.examples.copy"></a><a class="link" href="copy.html" title="An Optimized Version of std::copy">An Optimized Version
|
||||
of std::copy</a>
|
||||
@ -34,12 +33,12 @@
|
||||
to determine whether to use <code class="computeroutput"><span class="identifier">memcpy</span></code>
|
||||
to optimise the copy operation (see <a href="../../../../examples/copy_example.cpp" target="_top">copy_example.cpp</a>):
|
||||
</p>
|
||||
<pre class="programlisting"><span class="comment">//
|
||||
</span><span class="comment">// opt::copy
|
||||
</span><span class="comment">// same semantics as std::copy
|
||||
</span><span class="comment">// calls memcpy where appropriate.
|
||||
</span><span class="comment">//
|
||||
</span>
|
||||
<pre class="programlisting"><span class="comment">//</span>
|
||||
<span class="comment">// opt::copy</span>
|
||||
<span class="comment">// same semantics as std::copy</span>
|
||||
<span class="comment">// calls memcpy where appropriate.</span>
|
||||
<span class="comment">//</span>
|
||||
|
||||
<span class="keyword">namespace</span> <span class="identifier">detail</span><span class="special">{</span>
|
||||
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">I1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">I2</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">b</span><span class="special">></span>
|
||||
@ -67,22 +66,23 @@
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">I1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">I2</span><span class="special">></span>
|
||||
<span class="keyword">inline</span> <span class="identifier">I2</span> <span class="identifier">copy</span><span class="special">(</span><span class="identifier">I1</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">I1</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">I2</span> <span class="identifier">out</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">//
|
||||
</span> <span class="comment">// We can copy with memcpy if T has a trivial assignment operator,
|
||||
</span> <span class="comment">// and if the iterator arguments are actually pointers (this last
|
||||
</span> <span class="comment">// requirement we detect with overload resolution):
|
||||
</span> <span class="comment">//
|
||||
</span> <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">iterator_traits</span><span class="special"><</span><span class="identifier">I1</span><span class="special">>::</span><span class="identifier">value_type</span> <span class="identifier">value_type</span><span class="special">;</span>
|
||||
<span class="comment">//</span>
|
||||
<span class="comment">// We can copy with memcpy if T has a trivial assignment operator,</span>
|
||||
<span class="comment">// and if the iterator arguments are actually pointers (this last</span>
|
||||
<span class="comment">// requirement we detect with overload resolution):</span>
|
||||
<span class="comment">//</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">iterator_traits</span><span class="special"><</span><span class="identifier">I1</span><span class="special">>::</span><span class="identifier">value_type</span> <span class="identifier">value_type</span><span class="special">;</span>
|
||||
<span class="keyword">return</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">copy_imp</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">out</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><a class="link" href="../reference/has_trivial_assign.html" title="has_trivial_assign">has_trivial_assign</a><span class="special"><</span><span class="identifier">value_type</span><span class="special">>());</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>An Example that Omits Destructor Calls For Types with Trivial Destructors</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="fill.html" title="An Optimised Version of std::fill">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="fill.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="iter.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.examples.destruct"></a><a class="link" href="destruct.html" title="An Example that Omits Destructor Calls For Types with Trivial Destructors">An Example that Omits
|
||||
Destructor Calls For Types with Trivial Destructors</a>
|
||||
@ -32,12 +31,12 @@
|
||||
Demonstrates a simple algorithm that uses <code class="computeroutput"><span class="identifier">__has_trivial_destruct</span></code>
|
||||
to determine whether to destructors need to be called (see <a href="../../../../examples/trivial_destructor_example.cpp" target="_top">trivial_destructor_example.cpp</a>):
|
||||
</p>
|
||||
<pre class="programlisting"><span class="comment">//
|
||||
</span><span class="comment">// algorithm destroy_array:
|
||||
</span><span class="comment">// The reverse of std::unitialized_copy, takes a block of
|
||||
</span><span class="comment">// initialized memory and calls destructors on all objects therein.
|
||||
</span><span class="comment">//
|
||||
</span>
|
||||
<pre class="programlisting"><span class="comment">//</span>
|
||||
<span class="comment">// algorithm destroy_array:</span>
|
||||
<span class="comment">// The reverse of std::unitialized_copy, takes a block of</span>
|
||||
<span class="comment">// initialized memory and calls destructors on all objects therein.</span>
|
||||
<span class="comment">//</span>
|
||||
|
||||
<span class="keyword">namespace</span> <span class="identifier">detail</span><span class="special">{</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
@ -55,8 +54,8 @@
|
||||
<span class="special">{</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="special">}</span> <span class="comment">// namespace detail
|
||||
</span>
|
||||
<span class="special">}</span> <span class="comment">// namespace detail</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">inline</span> <span class="keyword">void</span> <span class="identifier">destroy_array</span><span class="special">(</span><span class="identifier">T</span><span class="special">*</span> <span class="identifier">p1</span><span class="special">,</span> <span class="identifier">T</span><span class="special">*</span> <span class="identifier">p2</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
@ -66,10 +65,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>An Optimised Version of std::fill</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="copy.html" title="An Optimized Version of std::copy">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="copy.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="destruct.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.examples.fill"></a><a class="link" href="fill.html" title="An Optimised Version of std::fill">An Optimised Version
|
||||
of std::fill</a>
|
||||
@ -34,11 +33,11 @@
|
||||
to determine whether to use <code class="computeroutput"><span class="identifier">memset</span></code>
|
||||
to optimise the fill operation (see <a href="../../../../examples/fill_example.cpp" target="_top">fill_example.cpp</a>):
|
||||
</p>
|
||||
<pre class="programlisting"><span class="comment">//
|
||||
</span><span class="comment">// fill
|
||||
</span><span class="comment">// same as std::fill, but uses memset where appropriate
|
||||
</span><span class="comment">//
|
||||
</span><span class="keyword">namespace</span> <span class="identifier">detail</span><span class="special">{</span>
|
||||
<pre class="programlisting"><span class="comment">//</span>
|
||||
<span class="comment">// fill</span>
|
||||
<span class="comment">// same as std::fill, but uses memset where appropriate</span>
|
||||
<span class="comment">//</span>
|
||||
<span class="keyword">namespace</span> <span class="identifier">detail</span><span class="special">{</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">I</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">b</span><span class="special">></span>
|
||||
<span class="keyword">void</span> <span class="identifier">do_fill</span><span class="special">(</span><span class="identifier">I</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">I</span> <span class="identifier">last</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">val</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><a class="link" href="../reference/integral_constant.html" title="integral_constant">integral_constant</a><span class="special"><</span><span class="keyword">bool</span><span class="special">,</span> <span class="identifier">b</span><span class="special">>&)</span>
|
||||
@ -61,11 +60,11 @@
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">I</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">inline</span> <span class="keyword">void</span> <span class="identifier">fill</span><span class="special">(</span><span class="identifier">I</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">I</span> <span class="identifier">last</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">val</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">//
|
||||
</span> <span class="comment">// We can do an optimised fill if T has a trivial assignment
|
||||
</span> <span class="comment">// operator and if it's size is one:
|
||||
</span> <span class="comment">//
|
||||
</span> <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><a class="link" href="../reference/integral_constant.html" title="integral_constant">integral_constant</a><span class="special"><</span><span class="keyword">bool</span><span class="special">,</span>
|
||||
<span class="comment">//</span>
|
||||
<span class="comment">// We can do an optimised fill if T has a trivial assignment </span>
|
||||
<span class="comment">// operator and if it's size is one:</span>
|
||||
<span class="comment">//</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><a class="link" href="../reference/integral_constant.html" title="integral_constant">integral_constant</a><span class="special"><</span><span class="keyword">bool</span><span class="special">,</span>
|
||||
<span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><a class="link" href="../reference/has_trivial_assign.html" title="has_trivial_assign">has_trivial_assign</a><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">value</span> <span class="special">&&</span> <span class="special">(</span><span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span> <span class="special">==</span> <span class="number">1</span><span class="special">)></span> <span class="identifier">truth_type</span><span class="special">;</span>
|
||||
<span class="identifier">detail</span><span class="special">::</span><span class="identifier">do_fill</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">val</span><span class="special">,</span> <span class="identifier">truth_type</span><span class="special">());</span>
|
||||
<span class="special">}</span>
|
||||
@ -73,10 +72,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Improving std::min with common_type</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="to_double.html" title="Convert Numeric Types and Enums to double">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="to_double.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.examples.improved_min"></a><a class="link" href="improved_min.html" title="Improving std::min with common_type">Improving std::min
|
||||
with common_type</a>
|
||||
@ -32,7 +31,7 @@
|
||||
An improved <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">min</span></code> function could be written like this:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">></span>
|
||||
<span class="keyword">typename</span> <a class="link" href="../reference/common_type.html" title="common_type">common_type</a><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">min</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">T</span> <span class="identifier">u</span><span class="special">)</span>
|
||||
<span class="keyword">typename</span> <a class="link" href="../reference/common_type.html" title="common_type">common_type</a><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">min</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">U</span> <span class="identifier">u</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">return</span> <span class="identifier">t</span> <span class="special"><</span> <span class="identifier">u</span> <span class="special">?</span> <span class="identifier">t</span> <span class="special">:</span> <span class="identifier">u</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
@ -48,10 +47,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>An improved Version of std::iter_swap</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="destruct.html" title="An Example that Omits Destructor Calls For Types with Trivial Destructors">
|
||||
@ -23,26 +22,26 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="destruct.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="to_double.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.examples.iter"></a><a class="link" href="iter.html" title="An improved Version of std::iter_swap">An improved Version of
|
||||
std::iter_swap</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
Demonstrates a version of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">iter_swap</span></code>
|
||||
that use type traits to determine whether an it's arguments are proxying
|
||||
iterators or not, if they're not then it just does a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">swap</span></code>
|
||||
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 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">swap</span></code>
|
||||
of it's dereferenced arguments (the same as <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">iter_swap</span></code>
|
||||
does), however if they are proxying iterators then takes special care over
|
||||
the swap to ensure that the algorithm works correctly for both proxying iterators,
|
||||
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 <a href="../../../../examples/iter_swap_example.cpp" target="_top">iter_swap_example.cpp</a>):
|
||||
</p>
|
||||
<pre class="programlisting"><span class="comment">//
|
||||
</span><span class="comment">// iter_swap:
|
||||
</span><span class="comment">// tests whether iterator is a proxying iterator or not, and
|
||||
</span><span class="comment">// uses optimal form accordingly:
|
||||
</span><span class="comment">//
|
||||
</span><span class="keyword">namespace</span> <span class="identifier">detail</span><span class="special">{</span>
|
||||
<pre class="programlisting"><span class="comment">//</span>
|
||||
<span class="comment">// iter_swap:</span>
|
||||
<span class="comment">// tests whether iterator is a proxy iterator or not, and</span>
|
||||
<span class="comment">// uses optimal form accordingly:</span>
|
||||
<span class="comment">//</span>
|
||||
<span class="keyword">namespace</span> <span class="identifier">detail</span><span class="special">{</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">I</span><span class="special">></span>
|
||||
<span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">do_swap</span><span class="special">(</span><span class="identifier">I</span> <span class="identifier">one</span><span class="special">,</span> <span class="identifier">I</span> <span class="identifier">two</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><a class="link" href="../reference/integral_constant.html" title="integral_constant">false_type</a><span class="special">&)</span>
|
||||
@ -64,11 +63,11 @@
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">I1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">I2</span><span class="special">></span>
|
||||
<span class="keyword">inline</span> <span class="keyword">void</span> <span class="identifier">iter_swap</span><span class="special">(</span><span class="identifier">I1</span> <span class="identifier">one</span><span class="special">,</span> <span class="identifier">I2</span> <span class="identifier">two</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">//
|
||||
</span> <span class="comment">// See is both arguments are non-proxying iterators,
|
||||
</span> <span class="comment">// and if both iterator the same type:
|
||||
</span> <span class="comment">//
|
||||
</span> <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">iterator_traits</span><span class="special"><</span><span class="identifier">I1</span><span class="special">>::</span><span class="identifier">reference</span> <span class="identifier">r1_t</span><span class="special">;</span>
|
||||
<span class="comment">//</span>
|
||||
<span class="comment">// See is both arguments are non-proxying iterators, </span>
|
||||
<span class="comment">// and if both iterator the same type:</span>
|
||||
<span class="comment">//</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">iterator_traits</span><span class="special"><</span><span class="identifier">I1</span><span class="special">>::</span><span class="identifier">reference</span> <span class="identifier">r1_t</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">iterator_traits</span><span class="special"><</span><span class="identifier">I2</span><span class="special">>::</span><span class="identifier">reference</span> <span class="identifier">r2_t</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><a class="link" href="../reference/integral_constant.html" title="integral_constant">integral_constant</a><span class="special"><</span><span class="keyword">bool</span><span class="special">,</span>
|
||||
@ -82,10 +81,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Convert Numeric Types and Enums to double</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="iter.html" title="An improved Version of std::iter_swap">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="iter.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="improved_min.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.examples.to_double"></a><a class="link" href="to_double.html" title="Convert Numeric Types and Enums to double">Convert Numeric
|
||||
Types and Enums to double</a>
|
||||
@ -42,10 +41,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>History</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="reference/type_with_alignment.html" title="type_with_alignment">
|
||||
@ -23,56 +22,163 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="reference/type_with_alignment.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="credits.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_typetraits.history"></a><a class="link" href="history.html" title="History">History</a>
|
||||
</h2></div></div></div>
|
||||
<a name="boost_typetraits.history.boost_1_45_0"></a><h5>
|
||||
<a name="id1077080"></a>
|
||||
<a class="link" href="history.html#boost_typetraits.history.boost_1_45_0">Boost 1.45.0</a>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h0"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_64_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_64_0">Boost
|
||||
1.64.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
|
||||
Added new trait <a class="link" href="reference/make_void.html" title="make_void">make_void</a>.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h1"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_60_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_60_0">Boost
|
||||
1.60.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
Refactored traits to depend only on Boost.Config. Greatly simplified code
|
||||
to improve readability and remove workarounds for old compilers no longer
|
||||
supported.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Fix <a class="link" href="reference/decay.html" title="decay">decay</a> to follow
|
||||
C++11 semantics, see <a href="https://svn.boost.org/trac/boost/ticket/7760" target="_top">#7760</a>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Added a number of new traits <a class="link" href="reference/is_assignable.html" title="is_assignable">is_assignable</a>,
|
||||
<a class="link" href="reference/is_default_constructible.html" title="is_default_constructible">is_default_constructible</a>,
|
||||
<a class="link" href="reference/is_constructible.html" title="is_constructible">is_constructible</a>
|
||||
and <a class="link" href="reference/is_destructible.html" title="is_destructible">is_destructible</a>
|
||||
required to fix bugs in a number of other traits, see for example <a href="https://svn.boost.org/trac/boost/ticket/7760" target="_top">#11324</a>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h2"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_58_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_58_0">Boost
|
||||
1.58.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
Fixed issue with CUDA on Clang compiler see <a href="https://svn.boost.org/trac/boost/ticket/10694" target="_top">#10694</a>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Fixed <a class="link" href="reference/is_nothrow_move_assignable.html" title="is_nothrow_move_assignable">is_nothrow_move_assignable</a>
|
||||
and <a class="link" href="reference/is_nothrow_move_constructible.html" title="is_nothrow_move_constructible">is_nothrow_move_constructible</a>
|
||||
to work on VC12 and later.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h3"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_57_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_57_0">Boost
|
||||
1.57.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
Added new traits <a class="link" href="reference/is_copy_assignable.html" title="is_copy_assignable">is_copy_assignable</a>
|
||||
and <a class="link" href="reference/is_final.html" title="is_final">is_final</a>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Misc fixes for newer versions of clang and msvc-14.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h4"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_56_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_56_0">Boost
|
||||
1.56.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
|
||||
Fixed issues <a href="https://svn.boost.org/trac/boost/ticket/7317" target="_top">#7317</a>,
|
||||
<a href="https://svn.boost.org/trac/boost/ticket/9474" target="_top">#9474</a>.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h5"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_55_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_55_0">Boost
|
||||
1.55.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
|
||||
Added new trait <a class="link" href="reference/is_copy_constructible.html" title="is_copy_constructible">is_copy_constructible</a>.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h6"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_54_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_54_0">Boost
|
||||
1.54.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
|
||||
Added new traits <a class="link" href="reference/is_nothrow_move_assignable.html" title="is_nothrow_move_assignable">is_nothrow_move_assignable</a>,
|
||||
<a class="link" href="reference/is_nothrow_move_constructible.html" title="is_nothrow_move_constructible">is_nothrow_move_constructible</a>,
|
||||
<a class="link" href="reference/has_trivial_move_assign.html" title="has_trivial_move_assign">has_trivial_move_assign</a>,
|
||||
<a class="link" href="reference/has_trivial_move_constructor.html" title="has_trivial_move_constructor">has_trivial_move_constructor</a>.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h7"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_47_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_47_0">Boost
|
||||
1.47.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
<span class="bold"><strong>Breaking change</strong></span>: changed <a class="link" href="reference/is_convertible.html" title="is_convertible">is_convertible</a>
|
||||
to C++0x behaviour when possible.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Fixed issues <a href="https://svn.boost.org/trac/boost/ticket/5271" target="_top">#5271</a>,
|
||||
<a href="https://svn.boost.org/trac/boost/ticket/4530" target="_top">#4530</a>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h8"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_45_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_45_0">Boost
|
||||
1.45.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
Added new traits <a class="link" href="reference/add_rvalue_reference.html" title="add_rvalue_reference">add_rvalue_reference</a>,
|
||||
<a class="link" href="reference/add_lvalue_reference.html" title="add_lvalue_reference">add_lvalue_reference</a>
|
||||
and <a class="link" href="reference/common_type.html" title="common_type">common_type</a>.
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
Minor fixes to <a class="link" href="reference/is_signed.html" title="is_signed">is_signed</a>,
|
||||
<a class="link" href="reference/is_unsigned.html" title="is_unsigned">is_unsigned</a>
|
||||
and <a class="link" href="reference/is_virtual_base_of.html" title="is_virtual_base_of">is_virtual_base_of</a>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_typetraits.history.boost_1_44_0"></a><h5>
|
||||
<a name="id1077140"></a>
|
||||
<a class="link" href="history.html#boost_typetraits.history.boost_1_44_0">Boost 1.44.0</a>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h9"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_44_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_44_0">Boost
|
||||
1.44.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
Added support for rvalue references throughout the library, plus two new
|
||||
traits classes <a class="link" href="reference/is_rvalue_reference.html" title="is_rvalue_reference">is_rvalue_reference</a>
|
||||
and <a class="link" href="reference/is_lvalue_reference.html" title="is_lvalue_reference">is_lvalue_reference</a>.
|
||||
Fixes <a href="https://svn.boost.org/trac/boost/ticket/4407" target="_top">#4407</a>
|
||||
and <a href="https://svn.boost.org/trac/boost/ticket/3804" target="_top">#3804</a>.
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
Fixed ticket <a href="https://svn.boost.org/trac/boost/ticket/3621" target="_top">#3621</a>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_typetraits.history.boost_1_42_0"></a><h5>
|
||||
<a name="id1077195"></a>
|
||||
<a class="link" href="history.html#boost_typetraits.history.boost_1_42_0">Boost 1.42.0</a>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h10"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_42_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_42_0">Boost
|
||||
1.42.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul type="disc"><li>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
|
||||
Fixed issue <a href="https://svn.boost.org/trac/boost/ticket/3704" target="_top">#3704</a>.
|
||||
</li></ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Support for Compiler Intrinsics</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="user_defined.html" title="User Defined Specializations">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="user_defined.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="mpl.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_typetraits.intrinsics"></a><a class="link" href="intrinsics.html" title="Support for Compiler Intrinsics">Support for Compiler Intrinsics</a>
|
||||
</h2></div></div></div>
|
||||
@ -31,42 +30,57 @@
|
||||
There are some traits that can not be implemented within the current C++ language:
|
||||
to make these traits "just work" with user defined types, some kind
|
||||
of additional help from the compiler is required. Currently (April 2008) Visual
|
||||
C++ 8 and 9, GNU GCC 4.3 and MWCW 9 provide the necessary intrinsics, and other
|
||||
compilers will no doubt follow in due course.
|
||||
C++ 8 and 9, GNU GCC 4.3 and MWCW 9 provide at least some of the the necessary
|
||||
intrinsics, and other compilers will no doubt follow in due course.
|
||||
</p>
|
||||
<p>
|
||||
The Following traits classes always need compiler support to do the right thing
|
||||
for all types (but all have safe fallback positions if this support is unavailable):
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_final.html" title="is_final">is_final</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_union.html" title="is_union">is_union</a>
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_pod.html" title="is_pod">is_pod</a>
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_nothrow_move_assignable.html" title="is_nothrow_move_assignable">is_nothrow_move_assignable</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_nothrow_move_constructible.html" title="is_nothrow_move_constructible">is_nothrow_move_constructible</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/has_trivial_constructor.html" title="has_trivial_constructor">has_trivial_constructor</a>
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/has_trivial_copy.html" title="has_trivial_copy">has_trivial_copy</a>
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/has_trivial_move_constructor.html" title="has_trivial_move_constructor">has_trivial_move_constructor</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/has_trivial_assign.html" title="has_trivial_assign">has_trivial_assign</a>
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/has_trivial_move_assign.html" title="has_trivial_move_assign">has_trivial_move_assign</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/has_trivial_destructor.html" title="has_trivial_destructor">has_trivial_destructor</a>
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/has_nothrow_constructor.html" title="has_nothrow_constructor">has_nothrow_constructor</a>
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/has_nothrow_copy.html" title="has_nothrow_copy">has_nothrow_copy</a>
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/has_nothrow_assign.html" title="has_nothrow_assign">has_nothrow_assign</a>
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/has_virtual_destructor.html" title="has_virtual_destructor">has_virtual_destructor</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
@ -75,22 +89,25 @@
|
||||
although in practice, the implementations do in fact do the right thing on
|
||||
all the compilers we know about:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_empty.html" title="is_empty">is_empty</a>
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_polymorphic.html" title="is_polymorphic">is_polymorphic</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_virtual_base_of.html" title="is_virtual_base_of">is_virtual_base_of</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The following traits classes are dependent on one or more of the above:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_class.html" title="is_class">is_class</a>
|
||||
</li>
|
||||
<li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_stateless.html" title="is_stateless">is_stateless</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
@ -100,7 +117,7 @@
|
||||
of the following macros:
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="boost_typetraits.intrinsics.macros_for_compiler_intrinsics"></a><p class="title"><b>Table 1.4. Macros for Compiler Intrinsics</b></p>
|
||||
<a name="boost_typetraits.intrinsics.macros_for_compiler_intrinsics"></a><p class="title"><b>Table 1.9. Macros for Compiler Intrinsics</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Macros for Compiler Intrinsics">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -109,147 +126,17 @@
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
BOOST_IS_UNION(T)
|
||||
BOOST_ALIGNMENT_OF(T)
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Should evaluate to true if T is a union type
|
||||
Should evaluate to the alignment requirements of type T
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_POD(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T is a POD type
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_EMPTY(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T is an empty struct or union
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if the default constructor for T is trivial
|
||||
(i.e. has no effect)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_COPY(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial copy constructor (and
|
||||
can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial assignment operator (and
|
||||
can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_DESTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial destructor (i.e. ~T()
|
||||
has no effect)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_NOTHROW_CONSTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if <code class="computeroutput"><span class="identifier">T</span>
|
||||
<span class="identifier">x</span><span class="special">;</span></code>
|
||||
can not throw
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_NOTHROW_COPY(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if <code class="computeroutput"><span class="identifier">T</span><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code> can not throw
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_NOTHROW_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if <code class="computeroutput"><span class="identifier">T</span>
|
||||
<span class="identifier">t</span><span class="special">,</span>
|
||||
<span class="identifier">u</span><span class="special">;</span>
|
||||
<span class="identifier">t</span> <span class="special">=</span>
|
||||
<span class="identifier">u</span></code> can not throw
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_VIRTUAL_DESTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true T has a virtual destructor
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_ABSTRACT(T)
|
||||
@ -298,6 +185,18 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_EMPTY(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T is an empty struct or union
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_ENUM(T)
|
||||
@ -310,6 +209,43 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_FINAL(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T is a class type declared with the final
|
||||
specifier
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_NOTHROW_MOVE_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true T has a non-throwing move assign operator.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true T has a non-throwing move constructor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_POLYMORPHIC(T)
|
||||
@ -324,12 +260,156 @@
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_ALIGNMENT_OF(T)
|
||||
BOOST_IS_POD(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to the alignment requirements of type T.
|
||||
Should evaluate to true if T is a POD type
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_UNION(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T is a union type
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_NOTHROW_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if <code class="computeroutput"><span class="identifier">T</span>
|
||||
<span class="identifier">t</span><span class="special">,</span>
|
||||
<span class="identifier">u</span><span class="special">;</span>
|
||||
<span class="identifier">t</span> <span class="special">=</span>
|
||||
<span class="identifier">u</span></code> can not throw
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_NOTHROW_CONSTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if <code class="computeroutput"><span class="identifier">T</span>
|
||||
<span class="identifier">x</span><span class="special">;</span></code>
|
||||
can not throw
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_NOTHROW_COPY(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if <code class="computeroutput"><span class="identifier">T</span><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code> can not throw
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial assignment operator (and
|
||||
can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if the default constructor for T is trivial
|
||||
(i.e. has no effect)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_COPY(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial copy constructor (and
|
||||
can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_DESTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial destructor (i.e. ~T()
|
||||
has no effect)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial move constructor (and
|
||||
can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial move assignment operator
|
||||
(and can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_VIRTUAL_DESTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true T has a virtual destructor
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -340,10 +420,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Introduction</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="background.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_typetraits.intro"></a><a class="link" href="intro.html" title="Introduction">Introduction</a>
|
||||
</h2></div></div></div>
|
||||
@ -49,10 +48,11 @@
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>MPL Interoperability</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="intrinsics.html" title="Support for Compiler Intrinsics">
|
||||
@ -23,33 +22,31 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="intrinsics.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="examples.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_typetraits.mpl"></a><a class="link" href="mpl.html" title="MPL Interoperability">MPL Interoperability</a>
|
||||
</h2></div></div></div>
|
||||
<p>
|
||||
All the value based traits in this library conform to MPL's requirements for
|
||||
an <a href="../../../../../libs/mpl/doc/refmanual/integral-constant.html" target="_top">Integral
|
||||
Constant type</a>: that includes a number of rather intrusive workarounds
|
||||
for broken compilers.
|
||||
Constant type</a>.
|
||||
</p>
|
||||
<p>
|
||||
Purely as an implementation detail, this means that <code class="computeroutput"><a class="link" href="reference/integral_constant.html" title="integral_constant">true_type</a></code>
|
||||
inherits from <a href="../../../../../libs/mpl/doc/refmanual/bool.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code></a>,
|
||||
<code class="computeroutput"><a class="link" href="reference/integral_constant.html" title="integral_constant">false_type</a></code>
|
||||
inherits from <a href="../../../../../libs/mpl/doc/refmanual/bool.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span></code></a>,
|
||||
and <code class="computeroutput"><a class="link" href="reference/integral_constant.html" title="integral_constant">integral_constant</a><span class="special"><</span><span class="identifier">T</span><span class="special">,</span>
|
||||
<span class="identifier">v</span><span class="special">></span></code>
|
||||
inherits from <a href="../../../../../libs/mpl/doc/refmanual/integral-c.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">integral_c</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span><span class="identifier">v</span><span class="special">></span></code></a>
|
||||
(provided <code class="computeroutput"><span class="identifier">T</span></code> is not <code class="computeroutput"><span class="keyword">bool</span></code>)
|
||||
Please note that these types no longer inherit from <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code> or
|
||||
<code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span></code> etc, and the library will no longer
|
||||
implicitly include any MPL header. However there is an implicit conversion
|
||||
from <code class="computeroutput"><span class="identifier">integral_constant</span></code> to the
|
||||
corresponding MPL types, therefore tag-dispatching that uses MPL types in function
|
||||
overloads will still work as before.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Alphabetical Reference</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="examples/improved_min.html" title="Improving std::min with common_type">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="examples/improved_min.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="reference/add_const.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_typetraits.reference"></a><a class="link" href="reference.html" title="Alphabetical Reference">Alphabetical Reference</a>
|
||||
</h2></div></div></div>
|
||||
@ -39,36 +38,86 @@
|
||||
<dt><span class="section"><a href="reference/alignment_of.html">alignment_of</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/conditional.html">conditional</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/common_type.html">common_type</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/copy_cv.html">copy_cv</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/decay.html">decay</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/declval.html">declval</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/extent.html">extent</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/floating_point_promotion.html">floating_point_promotion</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/function_traits.html">function_traits</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_bit_and.html">has_bit_and</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_bit_and_assign.html">has_bit_and_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_bit_or.html">has_bit_or</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_bit_or_assign.html">has_bit_or_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_bit_xor.html">has_bit_xor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_bit_xor_assign.html">has_bit_xor_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_complement.html">has_complement</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_dereference.html">has_dereference</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_divides.html">has_divides</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_divides_assign.html">has_divides_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_equal_to.html">has_equal_to</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_greater.html">has_greater</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_greater_equal.html">has_greater_equal</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_left_shift.html">has_left_shift</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_left_shift_assign.html">has_left_shift_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_less.html">has_less</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_less_equal.html">has_less_equal</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_logical_and.html">has_logical_and</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_logical_not.html">has_logical_not</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_logical_or.html">has_logical_or</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_minus.html">has_minus</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_minus_assign.html">has_minus_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_modulus.html">has_modulus</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_modulus_assign.html">has_modulus_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_multiplies.html">has_multiplies</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_multiplies_assign.html">has_multiplies_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_negate.html">has_negate</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_new_operator.html">has_new_operator</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_not_equal_to.html">has_not_equal_to</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_nothrow_assign.html">has_nothrow_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_nothrow_constructor.html">has_nothrow_constructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_nothrow_copy.html">has_nothrow_copy</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_nothrow_destruct.html">has_nothrow_destructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_nothrow_cp_cons.html">has_nothrow_copy_constructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_no_throw_def_cons.html">has_nothrow_default_constructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_plus.html">has_plus</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_plus_assign.html">has_plus_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_post_decrement.html">has_post_decrement</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_post_increment.html">has_post_increment</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_pre_decrement.html">has_pre_decrement</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_pre_increment.html">has_pre_increment</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_right_shift.html">has_right_shift</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_right_shift_assign.html">has_right_shift_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_trivial_assign.html">has_trivial_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_trivial_constructor.html">has_trivial_constructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_trivial_copy.html">has_trivial_copy</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_trivial_cp_cons.html">has_trivial_copy_constructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_trivial_def_cons.html">has_trivial_default_constructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_trivial_destructor.html">has_trivial_destructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_trivial_move_assign.html">has_trivial_move_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_trivial_move_constructor.html">has_trivial_move_constructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_unary_minus.html">has_unary_minus</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_unary_plus.html">has_unary_plus</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_virtual_destructor.html">has_virtual_destructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/integral_constant.html">integral_constant</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/integral_promotion.html">integral_promotion</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_abstract.html">is_abstract</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_arithmetic.html">is_arithmetic</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_array.html">is_array</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_assignable.html">is_assignable</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_base_of.html">is_base_of</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_class.html">is_class</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_complex.html">is_complex</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_compound.html">is_compound</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_const.html">is_const</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_constructible.html">is_constructible</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_convertible.html">is_convertible</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_copy_assignable.html">is_copy_assignable</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_copy_constructible.html">is_copy_constructible</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_default_constructible.html">is_default_constructible</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_destructible.html">is_destructible</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_empty.html">is_empty</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_enum.html">is_enum</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_final.html">is_final</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_floating_point.html">is_floating_point</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_function.html">is_function</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_fundamental.html">is_fundamental</a></span></dt>
|
||||
@ -77,6 +126,8 @@
|
||||
<dt><span class="section"><a href="reference/is_member_function_pointer.html">is_member_function_pointer</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_member_object_pointer.html">is_member_object_pointer</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_member_pointer.html">is_member_pointer</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_nothrow_move_assignable.html">is_nothrow_move_assignable</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_nothrow_move_constructible.html">is_nothrow_move_constructible</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_object.html">is_object</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_pod.html">is_pod</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_pointer.html">is_pointer</a></span></dt>
|
||||
@ -94,6 +145,7 @@
|
||||
<dt><span class="section"><a href="reference/is_volatile.html">is_volatile</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/make_signed.html">make_signed</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/make_unsigned.html">make_unsigned</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/make_void.html">make_void</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/promote.html">promote</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/rank.html">rank</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/remove_all_extents.html">remove_all_extents</a></span></dt>
|
||||
@ -103,15 +155,17 @@
|
||||
<dt><span class="section"><a href="reference/remove_pointer.html">remove_pointer</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/remove_reference.html">remove_reference</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/remove_volatile.html">remove_volatile</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/type_identity.html">type_identity</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/type_with_alignment.html">type_with_alignment</a></span></dt>
|
||||
</dl></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>add_const</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="../reference.html" title="Alphabetical Reference">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../reference.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="add_cv.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.reference.add_const"></a><a class="link" href="add_const.html" title="add_const">add_const</a>
|
||||
</h3></div></div></div>
|
||||
@ -40,21 +39,13 @@
|
||||
<p>
|
||||
<span class="bold"><strong>C++ Standard Reference:</strong></span> 3.9.3.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial specialization of class-templates then this template
|
||||
will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
|
||||
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
except where <a class="link" href="../category/transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
|
||||
workarounds</a> have been applied.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_const</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="boost_typetraits.reference.add_const.examples"></a><p class="title"><b>Table 1.5. Examples</b></p>
|
||||
<a name="boost_typetraits.reference.add_const.examples"></a><p class="title"><b>Table 1.10. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -125,14 +116,18 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
<br class="table-break"><p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> All current compilers
|
||||
are supported by this trait.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>add_cv</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_const.html" title="add_const">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="add_const.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="add_lvalue_reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.reference.add_cv"></a><a class="link" href="add_cv.html" title="add_cv">add_cv</a>
|
||||
</h3></div></div></div>
|
||||
@ -41,21 +40,13 @@
|
||||
<p>
|
||||
<span class="bold"><strong>C++ Standard Reference:</strong></span> 3.9.3.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial specialization of class-templates then this template
|
||||
will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
|
||||
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
except where <a class="link" href="../category/transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
|
||||
workarounds</a> have been applied.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_cv</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="boost_typetraits.reference.add_cv.examples"></a><p class="title"><b>Table 1.6. Examples</b></p>
|
||||
<a name="boost_typetraits.reference.add_cv.examples"></a><p class="title"><b>Table 1.11. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -128,14 +119,18 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
<br class="table-break"><p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> All current compilers
|
||||
are supported by this trait.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>add_lvalue_reference</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_cv.html" title="add_cv">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="add_cv.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="add_pointer.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.reference.add_lvalue_reference"></a><a class="link" href="add_lvalue_reference.html" title="add_lvalue_reference">add_lvalue_reference</a>
|
||||
</h3></div></div></div>
|
||||
@ -45,21 +44,13 @@
|
||||
<p>
|
||||
<span class="bold"><strong>C++ Standard Reference:</strong></span> 20.7.6.2.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial specialization of class-templates then this template
|
||||
will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
|
||||
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
except where <a class="link" href="../category/transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
|
||||
workarounds</a> have been applied.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_lvalue_reference</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="boost_typetraits.reference.add_lvalue_reference.examples"></a><p class="title"><b>Table 1.7. Examples</b></p>
|
||||
<a name="boost_typetraits.reference.add_lvalue_reference.examples"></a><p class="title"><b>Table 1.12. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -154,14 +145,18 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
<br class="table-break"><p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> All current compilers
|
||||
are supported by this trait.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>add_pointer</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_lvalue_reference.html" title="add_lvalue_reference">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="add_lvalue_reference.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="add_reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.reference.add_pointer"></a><a class="link" href="add_pointer.html" title="add_pointer">add_pointer</a>
|
||||
</h3></div></div></div>
|
||||
@ -37,27 +36,19 @@
|
||||
<span class="bold"><strong>type:</strong></span> The same type as <code class="computeroutput"><span class="identifier">remove_reference</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">type</span><span class="special">*</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
The rationale for this template is that it produces the same type as <code class="computeroutput"><span class="identifier">TYPEOF</span><span class="special">(&</span><span class="identifier">t</span><span class="special">)</span></code>, where
|
||||
The rationale for this template is that it produces the same type as <code class="computeroutput"><span class="keyword">decltype</span><span class="special">(&</span><span class="identifier">t</span><span class="special">)</span></code>, where
|
||||
<code class="computeroutput"><span class="identifier">t</span></code> is an object of type <code class="computeroutput"><span class="identifier">T</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>C++ Standard Reference:</strong></span> 8.3.1.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial specialization of class-templates then this template
|
||||
will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
|
||||
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
except where <a class="link" href="../category/transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
|
||||
workarounds</a> have been applied.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_pointer</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="boost_typetraits.reference.add_pointer.examples"></a><p class="title"><b>Table 1.8. Examples</b></p>
|
||||
<a name="boost_typetraits.reference.add_pointer.examples"></a><p class="title"><b>Table 1.13. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -127,14 +118,18 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
<br class="table-break"><p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> All current compilers
|
||||
are supported by this trait.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>add_reference</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_pointer.html" title="add_pointer">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="add_pointer.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="add_rvalue_reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.reference.add_reference"></a><a class="link" href="add_reference.html" title="add_reference">add_reference</a>
|
||||
</h3></div></div></div>
|
||||
@ -52,21 +51,13 @@
|
||||
<p>
|
||||
<span class="bold"><strong>C++ Standard Reference:</strong></span> 8.3.2.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial specialization of class-templates then this template
|
||||
will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
|
||||
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
except where <a class="link" href="../category/transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
|
||||
workarounds</a> have been applied.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_reference</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="boost_typetraits.reference.add_reference.examples"></a><p class="title"><b>Table 1.9. Examples</b></p>
|
||||
<a name="boost_typetraits.reference.add_reference.examples"></a><p class="title"><b>Table 1.14. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -136,14 +127,18 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
<br class="table-break"><p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> All current compilers
|
||||
are supported by this trait.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>add_rvalue_reference</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_reference.html" title="add_reference">
|
||||
@ -23,7 +22,7 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="add_reference.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="add_volatile.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_typetraits.reference.add_rvalue_reference"></a><a class="link" href="add_rvalue_reference.html" title="add_rvalue_reference">add_rvalue_reference</a>
|
||||
</h3></div></div></div>
|
||||
@ -45,19 +44,13 @@
|
||||
<p>
|
||||
<span class="bold"><strong>C++ Standard Reference:</strong></span> 20.7.6.2.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial specialization of class-templates and rvalue references
|
||||
then this template will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
|
||||
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_rvalue_reference</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="boost_typetraits.reference.add_rvalue_reference.examples"></a><p class="title"><b>Table 1.10. Examples</b></p>
|
||||
<a name="boost_typetraits.reference.add_rvalue_reference.examples"></a><p class="title"><b>Table 1.15. Examples</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Examples">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -152,14 +145,18 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
<br class="table-break"><p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> In the absence of
|
||||
rvalue-reference support this trait has no effect.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2006 Adobe Systems Inc, David Abrahams,
|
||||
Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
|
||||
Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
|
||||
Ramey and Jeremy Siek<p>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2000, 2011 Adobe Systems Inc, David Abrahams,
|
||||
Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
|
||||
Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
|
||||
Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
|
||||
Watanabe<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user