Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 1 | // Copyright (C) 2004 Peder Holt |
| 2 | // Use, modification and distribution is subject to the Boost Software |
| 3 | // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) |
| 4 | |
| 5 | #ifndef BOOST_TYPETRAITS_MSVC_TYPEOF_HPP |
| 6 | #define BOOST_TYPETRAITS_MSVC_TYPEOF_HPP |
| 7 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 8 | #include <ndnboost/config.hpp> |
| 9 | #include <ndnboost/detail/workaround.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 10 | |
| 11 | namespace ndnboost { namespace detail { |
| 12 | # if BOOST_WORKAROUND(BOOST_MSVC,==1300) |
| 13 | template<typename ID> |
| 14 | struct msvc_extract_type |
| 15 | { |
| 16 | template<bool> |
| 17 | struct id2type_impl; |
| 18 | |
| 19 | typedef id2type_impl<true> id2type; |
| 20 | }; |
| 21 | |
| 22 | template<typename T, typename ID> |
| 23 | struct msvc_register_type : public msvc_extract_type<ID> |
| 24 | { |
| 25 | template<> |
| 26 | struct id2type_impl<true> //VC7.0 specific bugfeature |
| 27 | { |
| 28 | typedef T type; |
| 29 | }; |
| 30 | }; |
| 31 | # else |
| 32 | template<typename ID> |
| 33 | struct msvc_extract_type |
| 34 | { |
| 35 | struct id2type; |
| 36 | }; |
| 37 | |
| 38 | template<typename T, typename ID> |
| 39 | struct msvc_register_type : public msvc_extract_type<ID> |
| 40 | { |
| 41 | typedef msvc_extract_type<ID> base_type; |
| 42 | struct base_type::id2type // This uses nice VC6.5 and VC7.1 bugfeature |
| 43 | { |
| 44 | typedef T type; |
| 45 | }; |
| 46 | }; |
| 47 | # endif |
| 48 | }} |
| 49 | |
| 50 | #endif //BOOST_TYPETRAITS_MSVC_TYPEOF_IMPL_HPP |