~ubuntu-branches/ubuntu/wily/bombono-dvd/wily

« back to all changes in this revision

Viewing changes to libs/boost-lib/boost/type_traits/integral_constant.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-11-04 11:46:25 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20101104114625-8xfdhvhpsm51i0nu
Tags: upstream-0.8.0
ImportĀ upstreamĀ versionĀ 0.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#endif
20
20
struct integral_constant : public mpl::integral_c<T, val>
21
21
{
22
 
   //BOOST_STATIC_CONSTANT(T, value = val);
23
 
   //typedef T value_type;
24
22
   typedef integral_constant<T,val> type;
25
 
 
26
 
#if 0
27
 
   //
28
 
   // everything that follows now, is MPL-compatibility code:
29
 
   //
30
 
   typedef ::boost::mpl::integral_c_tag tag;
31
 
 
32
 
   // have to #ifdef here: some compilers don't like the 'val + 1' form (MSVC),
33
 
   // while some other don't like 'value + 1' (Borland), and some don't like
34
 
   // either
35
 
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243)
36
 
private:
37
 
   BOOST_STATIC_CONSTANT(T, next_value = BOOST_MPL_AUX_STATIC_CAST(T, (val + 1)));
38
 
   BOOST_STATIC_CONSTANT(T, prior_value = BOOST_MPL_AUX_STATIC_CAST(T, (val - 1)));
39
 
public:
40
 
   typedef integral_constant<T,next_value> next;
41
 
   typedef integral_constant<T,prior_value> prior;
42
 
#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \
43
 
   || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \
44
 
   || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800))
45
 
   typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (val + 1)) )> next;
46
 
   typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (val - 1)) )> prior;
47
 
#else
48
 
   typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (value + 1)) )> next;
49
 
   typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (value - 1)) )> prior;
50
 
#endif
51
 
 
52
 
   // enables uniform function call syntax for families of overloaded 
53
 
   // functions that return objects of both arithmetic ('int', 'long',
54
 
   // 'double', etc.) and wrapped integral types (for an example, see 
55
 
   // "mpl/example/power.cpp")
56
 
   operator T() const { return static_cast<T>(this->value); } 
57
 
#endif
58
23
};
59
24
 
60
25
template<> struct integral_constant<bool,true> : public mpl::true_ 
61
26
{
62
 
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
 
27
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
 
28
# pragma warning(push)
 
29
# pragma warning(disable:4097)
63
30
   typedef mpl::true_ base_;
64
31
   using base_::value;
 
32
# pragma warning(pop)
65
33
#endif
66
34
   typedef integral_constant<bool,true> type;
67
35
};
68
36
template<> struct integral_constant<bool,false> : public mpl::false_ 
69
37
{
70
 
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
 
38
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
 
39
# pragma warning(push)
 
40
# pragma warning(disable:4097)
71
41
   typedef mpl::false_ base_;
72
42
   using base_::value;
 
43
# pragma warning(pop)
73
44
#endif
74
45
   typedef integral_constant<bool,false> type;
75
46
};