]>
Dogcows Code - chaz/yoink/blob - containers_fixes.hpp
f244323d279427e2094be08fb88702451276f641
1 #ifndef STLPLUS_CONTAINERS_FIXES
2 #define STLPLUS_CONTAINERS_FIXES
3 ////////////////////////////////////////////////////////////////////////////////
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
10 // Contains work arounds for OS or Compiler specific problems with container
13 ////////////////////////////////////////////////////////////////////////////////
15 ////////////////////////////////////////////////////////////////////////////////
16 // Unnecessary compiler warnings
17 ////////////////////////////////////////////////////////////////////////////////
20 // Microsoft Visual Studio
21 // shut up the following irritating warnings
22 // 4786 - VC6, identifier string exceeded maximum allowable length and was truncated (only affects debugger)
23 // 4305 - VC6, identifier type was converted to a smaller type
24 // 4503 - VC6, decorated name was longer than the maximum the compiler allows (only affects debugger)
25 // 4309 - VC6, type conversion operation caused a constant to exceeded the space allocated for it
26 // 4290 - VC6, C++ exception specification ignored
27 // 4800 - VC6, forcing value to bool 'true' or 'false' (performance warning)
28 // 4355 - VC6, 'this' : used in base member initializer list
29 // 4675 - VC7.1, "change" in function overload resolution _might_ have altered program
30 // 4996 - VC8, 'xxxx' was declared deprecated
31 #pragma warning(disable: 4786 4305 4503 4309 4290 4800 4355 4675 4996)
36 // Shut up the following irritating warnings
37 // 8026 - Functions with exception specifications are not expanded inline
38 // 8027 - Functions with xxx are not expanded inline
43 ////////////////////////////////////////////////////////////////////////////////
44 // Problems with the typename keyword
45 ////////////////////////////////////////////////////////////////////////////////
47 // There are problems with using the 'typename' keyword. Technically, if you
48 // use a type member of a template class (i.e. a type declared within the
49 // template class by a local typedef), you need to tell the compiler that it
50 // is a type name. This is because the compiler cannot work out whether a
51 // member is a type, a method or a data field at compile time. However,
52 // support for the typename keyword has traditionally been incomplete in both
53 // gcc and Visual Studio. I have used macros to try to resolve this issue. The
54 // macros add the keyword for compiler versions that require it and omit it
55 // for compiler versions that do not support it
57 // There are five places where typename keywords cause problems:
59 // 1) in a typedef where a template class's member type is being mapped onto
60 // a type definition within another template class or function
61 // e.g. template<typename T> fn () {
62 // typedef typename someclass<T>::member_type local_type;
64 // 2) in a function parameter declaration, with similar rules to the above
65 // e.g. template<typename T> fn (typename someclass<T>::member_type)
67 // 3) in instantiating a template, the parameter to the template, with similar rules to the above
68 // e.g. template_class<typename someclass<T>::member_type>
70 // 4) Return expressions
71 // e.g. return typename ntree<T>::const_iterator(this,m_root);
73 // 5) Creating temporary objects when passing arguments to a function or constructor
74 // e.g. return typename ntree<T>::const_prefix_iterator(typename ntree<T>::const_iterator(this,m_root));
76 // Note that the typename keyword is only required when the type being referred to is a member of a template class
78 // So far it *seems* as if all compilers either require all of them or none of
79 // them, so this set of situations can be handled by a single macro
81 // default values, overridden for individual problem cases below
82 #define TYPENAME typename
85 // - pre-version 3 didn't handle typename in any of these cases
86 // - version 3 onwards, typename is required for all three cases as per default
95 // - version 6 (compiler v.12) cannot handle typename in any of these cases
96 // - version 7 (.NET) (compiler v.13) requires a typename in a parameter specification but supports all
97 // - version 8 (2005) (compiler v.14) requires parameters and templates, supports all
106 // - doesn't handle typename in 5.5, does in 5.82, not sure about other cases
108 #if __BORLANDC__ <= 0x550
114 ////////////////////////////////////////////////////////////////////////////////
116 // e.g. a template function in a template class
118 // Not all compilers support them - this fix can be used to disable member
119 // templates for compilers that don't. Unfortunately that means that some
120 // functionality will be missing for those compilers.
122 #define STLPLUS_MEMBER_TEMPLATES
124 // Visual Studio v6 (compiler version 12) does not support them
127 #undef STLPLUS_MEMBER_TEMPLATES
131 ////////////////////////////////////////////////////////////////////////////////
This page took 0.038004 seconds and 3 git commands to generate.