Howard Hinnant | 1468b66 | 2010-11-19 22:17:28 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // type_traits |
| 11 | |
| 12 | // template <class T, class... Args> |
| 13 | // struct is_trivially_constructible; |
| 14 | |
| 15 | #include <type_traits> |
| 16 | |
Marshall Clow | 933afa9 | 2013-07-04 00:10:01 +0000 | [diff] [blame] | 17 | template <class T> |
| 18 | void test_is_trivially_constructible() |
| 19 | { |
| 20 | static_assert(( std::is_trivially_constructible<T>::value), ""); |
| 21 | } |
| 22 | |
| 23 | template <class T, class A0> |
| 24 | void test_is_trivially_constructible() |
| 25 | { |
| 26 | static_assert(( std::is_trivially_constructible<T, A0>::value), ""); |
| 27 | } |
| 28 | |
| 29 | template <class T> |
| 30 | void test_is_not_trivially_constructible() |
| 31 | { |
| 32 | static_assert((!std::is_trivially_constructible<T>::value), ""); |
| 33 | } |
| 34 | |
| 35 | template <class T, class A0> |
| 36 | void test_is_not_trivially_constructible() |
| 37 | { |
| 38 | static_assert((!std::is_trivially_constructible<T, A0>::value), ""); |
| 39 | } |
| 40 | |
| 41 | template <class T, class A0, class A1> |
| 42 | void test_is_not_trivially_constructible() |
| 43 | { |
| 44 | static_assert((!std::is_trivially_constructible<T, A0, A1>::value), ""); |
| 45 | } |
| 46 | |
Howard Hinnant | 1468b66 | 2010-11-19 22:17:28 +0000 | [diff] [blame] | 47 | struct A |
| 48 | { |
| 49 | explicit A(int); |
| 50 | A(int, double); |
| 51 | }; |
| 52 | |
| 53 | int main() |
| 54 | { |
Marshall Clow | 933afa9 | 2013-07-04 00:10:01 +0000 | [diff] [blame] | 55 | test_is_trivially_constructible<int> (); |
| 56 | test_is_trivially_constructible<int, const int&> (); |
| 57 | |
| 58 | test_is_not_trivially_constructible<A, int> (); |
| 59 | test_is_not_trivially_constructible<A, int, double> (); |
| 60 | test_is_not_trivially_constructible<A> (); |
Howard Hinnant | 1468b66 | 2010-11-19 22:17:28 +0000 | [diff] [blame] | 61 | } |