1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- [/
- Copyright (c) 2014 Agustin Berge
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
- ]
- [section:is_final is_final]
- template <class T>
- struct is_final : public __tof {};
- __inherit If T is a (possibly cv-qualified) class type declared with the final
- specifier type then inherits from __true_type, otherwise inherits from __false_type.
- Currently requires some kind of compiler support.
- __std_ref 9p3.
- __compat Without (some as yet unspecified) help from the compiler, we cannot detect
- class types declared with the final specifier using only standard C++,
- as a result this type will never inherit from __true_type, unless the user explicitly
- specializes the template for their user-defined final class types, or unless the compiler
- supplies some unspecified intrinsic that implements this functionality.
- Currently (June 2015) compilers more recent than GCC-4.7, Oracle-12.4, and Clang
- have the necessary compiler __intrinsics to ensure that this
- trait "just works". You may also test to see if the necessary __intrinsics are available
- by checking to see if the macro `BOOST_IS_FINAL` is defined.
- __header ` #include <boost/type_traits/is_final.hpp>` or ` #include <boost/type_traits.hpp>`
- __examples
- Given `struct my_final final {};` then:
- [:`is_final<my_final>` inherits from `__true_type`.]
- [:`is_final<const my_final>::type` is the type `__true_type`.]
- [:`is_final<my_final>::value` is an integral constant
- expression that evaluates to /true/.]
- [:`is_final<my_final*>::value` is an integral constant
- expression that evaluates to /false/.]
- [:`is_final<T>::value_type` is the type `bool`.]
- [endsect]
|