blob: 14b4bd744ed645aa0a0457a0f52638648899604a [file] [log] [blame]
Jeff Thompsonf7d49942013-08-01 16:47:40 -07001
2// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
3// Hinnant & John Maddock 2000.
4// Use, modification and distribution are subject to the Boost Software License,
5// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt).
7//
8// See http://www.boost.org/libs/type_traits for most recent version including documentation.
9
10
Jeff Thompson3d613fd2013-10-15 15:39:04 -070011#ifndef NDNBOOST_TT_IS_UNION_HPP_INCLUDED
12#define NDNBOOST_TT_IS_UNION_HPP_INCLUDED
Jeff Thompsonf7d49942013-08-01 16:47:40 -070013
Jeff Thompson2277ce52013-08-01 17:34:11 -070014#include <ndnboost/type_traits/remove_cv.hpp>
15#include <ndnboost/type_traits/config.hpp>
16#include <ndnboost/type_traits/intrinsics.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070017
18// should be the last #include
Jeff Thompson2277ce52013-08-01 17:34:11 -070019#include <ndnboost/type_traits/detail/bool_trait_def.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070020
21namespace ndnboost {
22
23namespace detail {
24#ifndef __GNUC__
25template <typename T> struct is_union_impl
26{
27 typedef typename remove_cv<T>::type cvt;
Jeff Thompson3d613fd2013-10-15 15:39:04 -070028#ifdef NDNBOOST_IS_UNION
29 NDNBOOST_STATIC_CONSTANT(bool, value = NDNBOOST_IS_UNION(cvt));
Jeff Thompsonf7d49942013-08-01 16:47:40 -070030#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070031 NDNBOOST_STATIC_CONSTANT(bool, value = false);
Jeff Thompsonf7d49942013-08-01 16:47:40 -070032#endif
33};
34#else
35//
36// using remove_cv here generates a whole load of needless
37// warnings with gcc, since it doesn't do any good with gcc
38// in any case (at least at present), just remove it:
39//
40template <typename T> struct is_union_impl
41{
Jeff Thompson3d613fd2013-10-15 15:39:04 -070042#ifdef NDNBOOST_IS_UNION
43 NDNBOOST_STATIC_CONSTANT(bool, value = NDNBOOST_IS_UNION(T));
Jeff Thompsonf7d49942013-08-01 16:47:40 -070044#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070045 NDNBOOST_STATIC_CONSTANT(bool, value = false);
Jeff Thompsonf7d49942013-08-01 16:47:40 -070046#endif
47};
48#endif
49} // namespace detail
50
Jeff Thompson3d613fd2013-10-15 15:39:04 -070051NDNBOOST_TT_AUX_BOOL_TRAIT_DEF1(is_union,T,::ndnboost::detail::is_union_impl<T>::value)
Jeff Thompsonf7d49942013-08-01 16:47:40 -070052
53} // namespace ndnboost
54
Jeff Thompson2277ce52013-08-01 17:34:11 -070055#include <ndnboost/type_traits/detail/bool_trait_undef.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070056
Jeff Thompson3d613fd2013-10-15 15:39:04 -070057#endif // NDNBOOST_TT_IS_UNION_HPP_INCLUDED