is_final.qbk 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. [/
  2. Copyright (c) 2014 Agustin Berge
  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. [section:is_final is_final]
  8. template <class T>
  9. struct is_final : public __tof {};
  10. __inherit If T is a (possibly cv-qualified) class type declared with the final
  11. specifier type then inherits from __true_type, otherwise inherits from __false_type.
  12. Currently requires some kind of compiler support.
  13. __std_ref 9p3.
  14. __compat Without (some as yet unspecified) help from the compiler, we cannot detect
  15. class types declared with the final specifier using only standard C++,
  16. as a result this type will never inherit from __true_type, unless the user explicitly
  17. specializes the template for their user-defined final class types, or unless the compiler
  18. supplies some unspecified intrinsic that implements this functionality.
  19. Currently (June 2015) compilers more recent than GCC-4.7, Oracle-12.4, and Clang
  20. have the necessary compiler __intrinsics to ensure that this
  21. trait "just works". You may also test to see if the necessary __intrinsics are available
  22. by checking to see if the macro `BOOST_IS_FINAL` is defined.
  23. __header ` #include <boost/type_traits/is_final.hpp>` or ` #include <boost/type_traits.hpp>`
  24. __examples
  25. Given `struct my_final final {};` then:
  26. [:`is_final<my_final>` inherits from `__true_type`.]
  27. [:`is_final<const my_final>::type` is the type `__true_type`.]
  28. [:`is_final<my_final>::value` is an integral constant
  29. expression that evaluates to /true/.]
  30. [:`is_final<my_final*>::value` is an integral constant
  31. expression that evaluates to /false/.]
  32. [:`is_final<T>::value_type` is the type `bool`.]
  33. [endsect]