Line | |
---|
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 | |
---|
8 | #include <boost/config.hpp> |
---|
9 | #include <boost/detail/workaround.hpp> |
---|
10 | |
---|
11 | namespace boost { 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 : 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 : 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 |
---|
Note: See
TracBrowser
for help on using the repository browser.