Brian Silverman | 4a2409e | 2018-08-04 23:24:02 -0700 | [diff] [blame^] | 1 | [/ |
| 2 | Copyright 2018 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_complete is_complete] |
| 9 | |
| 10 | template <class T> |
| 11 | struct is_complete : public __tof {}; |
| 12 | |
| 13 | __inherit If `T` is a complete type then inherits from __true_type, |
| 14 | otherwise inherits from __false_type. |
| 15 | |
| 16 | [important This trait is designed for one use only: to trigger a hard error (via a `static_assert`) when a template |
| 17 | is accidentally instantiated on an incomplete type. Any other use case will cause ODR violations as the "completeness" |
| 18 | of type `T` may vary at different points in the current translation unit, as well as across translations units. |
| 19 | ['[*In particular this trait should never ever be used to change code paths depending on the completeness of a type]].] |
| 20 | |
| 21 | __header ` #include <boost/type_traits/is_complete.hpp>` or ` #include <boost/type_traits.hpp>` |
| 22 | |
| 23 | __compat Requires C++11 SFINAE-expressions to function fully. The macro `BOOST_TT_HAS_WORKING_IS_COMPLETE` is defined |
| 24 | when the trait is fully functional. |
| 25 | |
| 26 | [endsect] |
| 27 | |
| 28 | |
| 29 | |