blob: 0227fe86a12b9cae3d01ad7cc2cde5b260788be6 [file] [log] [blame]
[/
Copyright 2007 John Maddock.
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_union is_union]
template <class T>
struct is_union : public __tof {};
__inherit If T is a (possibly cv-qualified) union type then inherits from __true_type,
otherwise inherits from __false_type. Currently requires some kind of compiler
support, otherwise unions are identified as classes.
__std_ref 3.9.2 and 9.5.
__compat Without (some as yet unspecified) help from the
compiler, we cannot distinguish between union and class types 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 union types, or unless the compiler
supplies some unspecified intrinsic that implements this functionality. Currently
(May 2005) only Visual C++ 8 has the necessary compiler __intrinsics to make this
trait "just work" without user intervention.
__header ` #include <boost/type_traits/is_union.hpp>` or ` #include <boost/type_traits.hpp>`
__examples
[:`is_union<void>` inherits from `__true_type`.]
[:`is_union<const void>::type` is the type `__true_type`.]
[:`is_union<void>::value` is an integral constant
expression that evaluates to /true/.]
[:`is_union<void*>::value` is an integral constant
expression that evaluates to /false/.]
[:`is_union<T>::value_type` is the type `bool`.]
[endsect]