~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to boost/boost/type_traits/remove_const.hpp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
 
3
// Hinnant & John Maddock 2000.  Permission to copy, use, modify,
 
4
// sell and distribute this software is granted provided this
 
5
// copyright notice appears in all copies. This software is provided
 
6
// "as is" without express or implied warranty, and with no claim as
 
7
// to its suitability for any purpose.
 
8
//
 
9
// See http://www.boost.org for most recent version including documentation.
 
10
 
 
11
#ifndef BOOST_TT_REMOVE_CONST_HPP_INCLUDED
 
12
#define BOOST_TT_REMOVE_CONST_HPP_INCLUDED
 
13
 
 
14
#include "boost/type_traits/is_volatile.hpp"
 
15
#include "boost/type_traits/broken_compiler_spec.hpp"
 
16
#include "boost/type_traits/detail/cv_traits_impl.hpp"
 
17
#include "boost/config.hpp"
 
18
 
 
19
#include <cstddef>
 
20
 
 
21
// should be the last #include
 
22
#include "boost/type_traits/detail/type_trait_def.hpp"
 
23
 
 
24
namespace boost {
 
25
 
 
26
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
 
27
 
 
28
namespace detail {
 
29
 
 
30
template <typename T, bool is_vol>
 
31
struct remove_const_helper
 
32
{
 
33
    typedef T type;
 
34
};
 
35
 
 
36
template <typename T>
 
37
struct remove_const_helper<T, true>
 
38
{
 
39
    typedef T volatile type;
 
40
};
 
41
 
 
42
 
 
43
template <typename T>
 
44
struct remove_const_impl
 
45
{
 
46
    typedef typename remove_const_helper<
 
47
          typename cv_traits_imp<T*>::unqualified_type
 
48
        , ::boost::is_volatile<T>::value
 
49
        >::type type;
 
50
};
 
51
 
 
52
} // namespace detail
 
53
 
 
54
// * convert a type T to non-const type - remove_const<T>
 
55
 
 
56
BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename detail::remove_const_impl<T>::type)
 
57
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_const,T&,T&)
 
58
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T const[N],T type[N])
 
59
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T const volatile[N],T volatile type[N])
 
60
 
 
61
#else
 
62
 
 
63
BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename detail::remove_const_impl<T>::type)
 
64
 
 
65
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
 
66
 
 
67
} // namespace boost
 
68
 
 
69
#include "boost/type_traits/detail/type_trait_undef.hpp"
 
70
 
 
71
#endif // BOOST_TT_REMOVE_CONST_HPP_INCLUDED