Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 1 | |
| 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 Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 11 | #ifndef NDNBOOST_TT_IS_UNION_HPP_INCLUDED |
| 12 | #define NDNBOOST_TT_IS_UNION_HPP_INCLUDED |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 13 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 14 | #include <ndnboost/type_traits/remove_cv.hpp> |
| 15 | #include <ndnboost/type_traits/config.hpp> |
| 16 | #include <ndnboost/type_traits/intrinsics.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 17 | |
| 18 | // should be the last #include |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 19 | #include <ndnboost/type_traits/detail/bool_trait_def.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 20 | |
| 21 | namespace ndnboost { |
| 22 | |
| 23 | namespace detail { |
| 24 | #ifndef __GNUC__ |
| 25 | template <typename T> struct is_union_impl |
| 26 | { |
| 27 | typedef typename remove_cv<T>::type cvt; |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 28 | #ifdef NDNBOOST_IS_UNION |
| 29 | NDNBOOST_STATIC_CONSTANT(bool, value = NDNBOOST_IS_UNION(cvt)); |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 30 | #else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 31 | NDNBOOST_STATIC_CONSTANT(bool, value = false); |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 32 | #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 | // |
| 40 | template <typename T> struct is_union_impl |
| 41 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 42 | #ifdef NDNBOOST_IS_UNION |
| 43 | NDNBOOST_STATIC_CONSTANT(bool, value = NDNBOOST_IS_UNION(T)); |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 44 | #else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 45 | NDNBOOST_STATIC_CONSTANT(bool, value = false); |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 46 | #endif |
| 47 | }; |
| 48 | #endif |
| 49 | } // namespace detail |
| 50 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 51 | NDNBOOST_TT_AUX_BOOL_TRAIT_DEF1(is_union,T,::ndnboost::detail::is_union_impl<T>::value) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 52 | |
| 53 | } // namespace ndnboost |
| 54 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 55 | #include <ndnboost/type_traits/detail/bool_trait_undef.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 56 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 57 | #endif // NDNBOOST_TT_IS_UNION_HPP_INCLUDED |