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

« back to all changes in this revision

Viewing changes to boost/boost/type_traits/add_pointer.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 Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
 
3
// Permission to copy, use, modify, sell and distribute this software is 
 
4
// granted provided this copyright notice appears in all copies. This software 
 
5
// is provided "as is" without express or implied warranty, and with no claim 
 
6
// as to its suitability for any purpose.
 
7
//
 
8
// See http://www.boost.org for most recent version including documentation.
 
9
 
 
10
#ifndef BOOST_TT_ADD_POINTER_HPP_INCLUDED
 
11
#define BOOST_TT_ADD_POINTER_HPP_INCLUDED
 
12
 
 
13
#include "boost/type_traits/remove_reference.hpp"
 
14
 
 
15
// should be the last #include
 
16
#include "boost/type_traits/detail/type_trait_def.hpp"
 
17
 
 
18
namespace boost {
 
19
 
 
20
namespace detail {
 
21
 
 
22
#ifdef __BORLANDC__
 
23
//
 
24
// For some reason this implementation stops Borlands compiler
 
25
// from dropping cv-qualifiers, it still fails with references
 
26
// to arrays for some reason though (shrug...) (JM 20021104)
 
27
//
 
28
template <typename T>
 
29
struct add_pointer_impl
 
30
{
 
31
    typedef T* type;
 
32
};
 
33
template <typename T>
 
34
struct add_pointer_impl<T&>
 
35
{
 
36
    typedef T* type;
 
37
};
 
38
template <typename T>
 
39
struct add_pointer_impl<T&const>
 
40
{
 
41
    typedef T* type;
 
42
};
 
43
template <typename T>
 
44
struct add_pointer_impl<T&volatile>
 
45
{
 
46
    typedef T* type;
 
47
};
 
48
template <typename T>
 
49
struct add_pointer_impl<T&const volatile>
 
50
{
 
51
    typedef T* type;
 
52
};
 
53
 
 
54
#else
 
55
 
 
56
template <typename T>
 
57
struct add_pointer_impl
 
58
{
 
59
    typedef typename remove_reference<T>::type no_ref_type;
 
60
    typedef no_ref_type* type;
 
61
};
 
62
 
 
63
#endif
 
64
 
 
65
} // namespace detail
 
66
 
 
67
BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_pointer,T,typename detail::add_pointer_impl<T>::type)
 
68
 
 
69
} // namespace boost
 
70
 
 
71
#include "boost/type_traits/detail/type_trait_undef.hpp"
 
72
 
 
73
#endif // BOOST_TT_ADD_POINTER_HPP_INCLUDED