]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/core/doc/is_same.qbk
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / core / doc / is_same.qbk
1 [/
2 Copyright 2014 Peter Dimov
3
4 Distributed under the Boost Software License, Version 1.0.
5
6 See accompanying file LICENSE_1_0.txt
7 or copy at http://boost.org/LICENSE_1_0.txt
8 ]
9
10 [section:is_same is_same]
11
12 [simplesect Authors]
13
14 * Peter Dimov
15
16 [endsimplesect]
17
18 [section Header <boost/core/is_same.hpp>]
19
20 The header `<boost/core/is_same.hpp>` defines the class template
21 `boost::core::is_same<T1,T2>`. It defines a nested integral constant
22 `value` which is `true` when `T1` and `T2` are the same type, and
23 `false` when they are not.
24
25 In tandem with `BOOST_TEST_TRAIT_TRUE` and `BOOST_TEST_TRAIT_FALSE`,
26 `is_same` is useful for writing tests for traits classes that have
27 to define specific nested types.
28
29 [section Synopsis]
30
31 ``
32 namespace boost
33 {
34
35 namespace core
36 {
37 template<class T1, class T2> struct is_same;
38 }
39
40 }
41 ``
42
43 [endsect]
44
45 [section Example]
46
47 ``
48 #include <boost/core/lightweight_test_trait.hpp>
49 #include <boost/core/is_same.hpp>
50
51 template<class T> struct X
52 {
53 typedef T& type;
54 };
55
56 using boost::core::is_same;
57
58 int main()
59 {
60 BOOST_TEST_TRAIT_TRUE(( is_same<X<int>::type, int&> ));
61 return boost::report_errors();
62 }
63 ``
64
65 [endsect]
66
67 [endsect]
68
69 [endsect]