aboutsummaryrefslogtreecommitdiff
path: root/cutl/details/boost/type_traits/msvc/typeof.hpp
blob: 942166c54d8902377715438cb3ecf933f666c656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (C) 2004 Peder Holt
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_TYPETRAITS_MSVC_TYPEOF_HPP
#define BOOST_TYPETRAITS_MSVC_TYPEOF_HPP

#include <cutl/details/boost/config.hpp>
#include <cutl/details/boost/detail/workaround.hpp>

namespace cutl_details_boost { namespace detail {
# if BOOST_WORKAROUND(BOOST_MSVC,==1300)
        template<typename ID>
        struct msvc_extract_type
        {
            template<bool>
            struct id2type_impl;

            typedef id2type_impl<true> id2type;
        };

        template<typename T, typename ID>
        struct msvc_register_type : public msvc_extract_type<ID>
        {
            template<>
            struct id2type_impl<true>  //VC7.0 specific bugfeature
            {
                typedef T type;
            };
        };
# else 
        template<typename ID>
        struct msvc_extract_type
        {
            struct id2type;
        };

        template<typename T, typename ID>
        struct msvc_register_type : public msvc_extract_type<ID>
        {
            typedef msvc_extract_type<ID> base_type;
            struct base_type::id2type // This uses nice VC6.5 and VC7.1 bugfeature
            {
                typedef T type;
            };
        };
# endif
}}

#endif //BOOST_TYPETRAITS_MSVC_TYPEOF_IMPL_HPP