fixed permissions for stlplus files
[chaz/yoink] / src / Moof / stlplus / containers_fixes.hpp
1 #ifndef STLPLUS_CONTAINERS_FIXES
2 #define STLPLUS_CONTAINERS_FIXES
3 ////////////////////////////////////////////////////////////////////////////////
4
5 // Author: Andy Rushton
6 // Copyright: (c) Southampton University 1999-2004
7 // (c) Andy Rushton 2004-2009
8 // License: BSD License, see ../docs/license.html
9
10 // Contains work arounds for OS or Compiler specific problems with container
11 // templates
12
13 ////////////////////////////////////////////////////////////////////////////////
14
15 ////////////////////////////////////////////////////////////////////////////////
16 // Unnecessary compiler warnings
17 ////////////////////////////////////////////////////////////////////////////////
18
19 #ifdef _MSC_VER
20 // Microsoft Visual Studio
21 // shut up the following irritating warnings
22 // 4275 - VC6, exported class was derived from a class that was not exported
23 // 4786 - VC6, identifier string exceeded maximum allowable length and was truncated (only affects debugger)
24 // 4305 - VC6, identifier type was converted to a smaller type
25 // 4503 - VC6, decorated name was longer than the maximum the compiler allows (only affects debugger)
26 // 4309 - VC6, type conversion operation caused a constant to exceeded the space allocated for it
27 // 4290 - VC6, C++ exception specification ignored
28 // 4800 - VC6, forcing value to bool 'true' or 'false' (performance warning)
29 // 4355 - VC6, 'this' : used in base member initializer list
30 // 4675 - VC7.1, "change" in function overload resolution _might_ have altered program
31 // 4996 - VC8, 'xxxx' was declared deprecated
32 #pragma warning(disable: 4275 4786 4305 4503 4309 4290 4800 4355 4675 4996)
33 #endif
34
35 #ifdef __BORLANDC__
36 // Borland
37 // Shut up the following irritating warnings
38 // 8008 - Condition is always true.
39 // Whenever the compiler encounters a constant comparison that (due to
40 // the nature of the value being compared) is always true or false, it
41 // issues this warning and evaluates the condition at compile time.
42 // 8026 - Functions with exception specifications are not expanded inline
43 // 8027 - Functions with xxx are not expanded inline
44 // 8060 - Possibly incorrect assignment.
45 // This warning is generated when the compiler encounters an assignment
46 // operator as the main operator of a conditional expression (part of
47 // an if, while, or do-while statement). This is usually a
48 // typographical error for the equality operator.
49 // 8066 - Unreachable code.
50 // A break, continue, goto, or return statement was not followed by a
51 // label or the end of a loop or function. The compiler checks while,
52 // do, and for loops with a constant test condition, and attempts to
53 // recognize loops that can't fall through.
54 #pragma warn -8008
55 #pragma warn -8026
56 #pragma warn -8027
57 #pragma warn -8060
58 #pragma warn -8066
59 #endif
60
61 ////////////////////////////////////////////////////////////////////////////////
62 // Problems with the typename keyword
63 ////////////////////////////////////////////////////////////////////////////////
64
65 // There are problems with using the 'typename' keyword. Technically, if you
66 // use a type member of a template class (i.e. a type declared within the
67 // template class by a local typedef), you need to tell the compiler that it
68 // is a type name. This is because the compiler cannot work out whether a
69 // member is a type, a method or a data field at compile time. However,
70 // support for the typename keyword has traditionally been incomplete in both
71 // gcc and Visual Studio. I have used macros to try to resolve this issue. The
72 // macros add the keyword for compiler versions that require it and omit it
73 // for compiler versions that do not support it
74
75 // There are five places where typename keywords cause problems:
76 //
77 // 1) in a typedef where a template class's member type is being mapped onto
78 // a type definition within another template class or function
79 // e.g. template<typename T> fn () {
80 // typedef typename someclass<T>::member_type local_type;
81 // ^^^^^^^^
82 // 2) in a function parameter declaration, with similar rules to the above
83 // e.g. template<typename T> fn (typename someclass<T>::member_type)
84 // ^^^^^^^^
85 // 3) in instantiating a template, the parameter to the template, with similar rules to the above
86 // e.g. template_class<typename someclass<T>::member_type>
87 // ^^^^^^^^
88 // 4) Return expressions
89 // e.g. return typename ntree<T>::const_iterator(this,m_root);
90 // ^^^^^^^^
91 // 5) Creating temporary objects when passing arguments to a function or constructor
92 // e.g. return typename ntree<T>::const_prefix_iterator(typename ntree<T>::const_iterator(this,m_root));
93 // ^^^^^^^^
94 // Note that the typename keyword is only required when the type being referred to is a member of a template class
95 //
96 // So far it *seems* as if all compilers either require all of them or none of
97 // them, so this set of situations can be handled by a single macro
98
99 // default values, overridden for individual problem cases below
100 #define TYPENAME typename
101
102 // GCC
103 // - pre-version 3 didn't handle typename in any of these cases
104 // - version 3 onwards, typename is required for all three cases as per default
105 #ifdef __GNUC__
106 #if __GNUC__ < 3
107 #undef TYPENAME
108 #define TYPENAME
109 #endif
110 #endif
111
112 // Visual Studio
113 // - version 6 (compiler v.12) cannot handle typename in any of these cases
114 // - version 7 (.NET) (compiler v.13) requires a typename in a parameter specification but supports all
115 // - version 8 (2005) (compiler v.14) requires parameters and templates, supports all
116 #ifdef _MSC_VER
117 #if _MSC_VER < 1300
118 #undef TYPENAME
119 #define TYPENAME
120 #endif
121 #endif
122
123 // Borland
124 // - doesn't handle typename in 5.5, does in 5.82, not sure about other cases
125 #ifdef __BORLANDC__
126 #if __BORLANDC__ <= 0x550
127 #undef TYPENAME
128 #define TYPENAME
129 #endif
130 #endif
131
132 ////////////////////////////////////////////////////////////////////////////////
133 #endif
This page took 0.036838 seconds and 4 git commands to generate.