1 |
|
---|
2 | #include <boost/config.hpp>
|
---|
3 |
|
---|
4 | #include <iostream>
|
---|
5 | #include <type_traits>
|
---|
6 |
|
---|
7 | struct A {
|
---|
8 | A();
|
---|
9 | };
|
---|
10 |
|
---|
11 | struct NA {
|
---|
12 | NA(int);
|
---|
13 | };
|
---|
14 |
|
---|
15 | #ifndef BOOST_NO_CXX11_HDR_TYPE_TRAITS
|
---|
16 | #pragma message("BOOST_NO_CXX11_HDR_TYPE_TRAITS NOT defined")
|
---|
17 | #else
|
---|
18 | #pragma message("BOOST_NO_CXX11_HDR_TYPE_TRAITS defined")
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | int main(int argc, char * argv[]){
|
---|
22 | static_assert(
|
---|
23 | std::is_default_constructible<A>::value,
|
---|
24 | "A is NOT default constructible"
|
---|
25 | );
|
---|
26 | static_assert(
|
---|
27 | ! std::is_default_constructible<NA>::value,
|
---|
28 | "NA IS default constructible"
|
---|
29 | );
|
---|
30 |
|
---|
31 | std::cout << std::boolalpha
|
---|
32 | << "A is default-constructible? "
|
---|
33 | << std::is_default_constructible<A>::value << '\n'
|
---|
34 | << "A is trivially default-constructible? "
|
---|
35 | << std::is_trivially_default_constructible<A>::value << '\n'
|
---|
36 | << "NA is default-constructible? "
|
---|
37 | << std::is_default_constructible<NA>::value << '\n'
|
---|
38 | << "NA is trivially default-constructible? "
|
---|
39 | << std::is_trivially_default_constructible<NA>::value << '\n'
|
---|
40 | ;
|
---|
41 | return 0;
|
---|
42 | }
|
---|