Brian Silverman | 4a2409e | 2018-08-04 23:24:02 -0700 | [diff] [blame^] | 1 | [/ |
| 2 | Copyright 2007 John Maddock. |
| 3 | Distributed under the Boost Software License, Version 1.0. |
| 4 | (See accompanying file LICENSE_1_0.txt or copy at |
| 5 | http://www.boost.org/LICENSE_1_0.txt). |
| 6 | ] |
| 7 | |
| 8 | [section:is_same is_same] |
| 9 | template <class T, class U> |
| 10 | struct is_same : public __tof {}; |
| 11 | |
| 12 | __inherit If T and U are the same types then inherits from |
| 13 | __true_type, otherwise inherits from __false_type. |
| 14 | |
| 15 | __header ` #include <boost/type_traits/is_same.hpp>` or ` #include <boost/type_traits.hpp>` |
| 16 | |
| 17 | [all_compilers] |
| 18 | |
| 19 | |
| 20 | __examples |
| 21 | |
| 22 | [:`is_same<int, int>` inherits from `__true_type`.] |
| 23 | |
| 24 | [:`is_same<int, int>::type` is the type `__true_type`.] |
| 25 | |
| 26 | [:`is_same<int, int>::value` is an integral constant |
| 27 | expression that evaluates to /true/.] |
| 28 | |
| 29 | [:`is_same<int const, int>::value` is an integral constant |
| 30 | expression that evaluates to /false/.] |
| 31 | |
| 32 | [:`is_same<int&, int>::value` is an integral constant |
| 33 | expression that evaluates to /false/.] |
| 34 | |
| 35 | [:`is_same<T, T>::value_type` is the type `bool`.] |
| 36 | |
| 37 | [endsect] |
| 38 | |
| 39 | |