]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/stlplus/containers_fixes.hpp
initial working frustum culling implementation
[chaz/yoink] / src / Moof / stlplus / containers_fixes.hpp
diff --git a/src/Moof/stlplus/containers_fixes.hpp b/src/Moof/stlplus/containers_fixes.hpp
new file mode 100755 (executable)
index 0000000..618ef84
--- /dev/null
@@ -0,0 +1,133 @@
+#ifndef STLPLUS_CONTAINERS_FIXES\r
+#define STLPLUS_CONTAINERS_FIXES\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+//   Author:    Andy Rushton\r
+//   Copyright: (c) Southampton University 1999-2004\r
+//              (c) Andy Rushton           2004-2009\r
+//   License:   BSD License, see ../docs/license.html\r
+\r
+//   Contains work arounds for OS or Compiler specific problems with container\r
+//   templates\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+// Unnecessary compiler warnings\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+#ifdef _MSC_VER\r
+// Microsoft Visual Studio\r
+// shut up the following irritating warnings\r
+//   4275 - VC6, exported class was derived from a class that was not exported\r
+//   4786 - VC6, identifier string exceeded maximum allowable length and was truncated (only affects debugger)\r
+//   4305 - VC6, identifier type was converted to a smaller type\r
+//   4503 - VC6, decorated name was longer than the maximum the compiler allows (only affects debugger)\r
+//   4309 - VC6, type conversion operation caused a constant to exceeded the space allocated for it\r
+//   4290 - VC6, C++ exception specification ignored\r
+//   4800 - VC6, forcing value to bool 'true' or 'false' (performance warning)\r
+//   4355 - VC6, 'this' : used in base member initializer list\r
+//   4675 - VC7.1, "change" in function overload resolution _might_ have altered program\r
+//   4996 - VC8, 'xxxx' was declared deprecated\r
+#pragma warning(disable: 4275 4786 4305 4503 4309 4290 4800 4355 4675 4996)\r
+#endif\r
+\r
+#ifdef __BORLANDC__\r
+// Borland\r
+// Shut up the following irritating warnings\r
+//   8008 - Condition is always true.\r
+//          Whenever the compiler encounters a constant comparison that (due to\r
+//          the nature of the value being compared) is always true or false, it\r
+//          issues this warning and evaluates the condition at compile time.\r
+//   8026 - Functions with exception specifications are not expanded inline\r
+//   8027 - Functions with xxx are not expanded inline\r
+//   8060 - Possibly incorrect assignment.\r
+//          This warning is generated when the compiler encounters an assignment\r
+//          operator as the main operator of a conditional expression (part of\r
+//          an if, while, or do-while statement). This is usually a\r
+//          typographical error for the equality operator.\r
+//   8066 - Unreachable code.\r
+//          A break, continue, goto, or return statement was not followed by a\r
+//          label or the end of a loop or function. The compiler checks while,\r
+//          do, and for loops with a constant test condition, and attempts to\r
+//          recognize loops that can't fall through.\r
+#pragma warn -8008\r
+#pragma warn -8026\r
+#pragma warn -8027\r
+#pragma warn -8060\r
+#pragma warn -8066\r
+#endif\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+// Problems with the typename keyword\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+// There are problems with using the 'typename' keyword. Technically, if you\r
+// use a type member of a template class (i.e. a type declared within the\r
+// template class by a local typedef), you need to tell the compiler that it\r
+// is a type name. This is because the compiler cannot work out whether a\r
+// member is a type, a method or a data field at compile time. However,\r
+// support for the typename keyword has traditionally been incomplete in both\r
+// gcc and Visual Studio. I have used macros to try to resolve this issue. The\r
+// macros add the keyword for compiler versions that require it and omit it\r
+// for compiler versions that do not support it\r
+\r
+// There are five places where typename keywords cause problems:\r
+//\r
+//   1) in a typedef where a template class's member type is being mapped onto\r
+//      a type definition within another template class or function \r
+//      e.g. template<typename T> fn () {\r
+//             typedef typename someclass<T>::member_type local_type;\r
+//                     ^^^^^^^^\r
+//   2) in a function parameter declaration, with similar rules to the above\r
+//      e.g. template<typename T> fn (typename someclass<T>::member_type)\r
+//                                    ^^^^^^^^\r
+//   3) in instantiating a template, the parameter to the template, with similar rules to the above\r
+//      e.g. template_class<typename someclass<T>::member_type>\r
+//                          ^^^^^^^^\r
+//   4) Return expressions\r
+//      e.g. return typename ntree<T>::const_iterator(this,m_root);\r
+//                  ^^^^^^^^\r
+//   5) Creating temporary objects when passing arguments to a function or constructor\r
+//      e.g. return typename ntree<T>::const_prefix_iterator(typename ntree<T>::const_iterator(this,m_root));\r
+//                                                           ^^^^^^^^\r
+// Note that the typename keyword is only required when the type being referred to is a member of a template class\r
+//\r
+// So far it *seems* as if all compilers either require all of them or none of\r
+// them, so this set of situations can be handled by a single macro\r
+\r
+// default values, overridden for individual problem cases below\r
+#define TYPENAME typename\r
+\r
+// GCC \r
+//   - pre-version 3 didn't handle typename in any of these cases\r
+//   - version 3 onwards, typename is required for all three cases as per default\r
+#ifdef __GNUC__\r
+#if __GNUC__ < 3\r
+#undef TYPENAME\r
+#define TYPENAME\r
+#endif\r
+#endif\r
+\r
+// Visual Studio\r
+//   - version 6 (compiler v.12) cannot handle typename in any of these cases\r
+//   - version 7 (.NET) (compiler v.13) requires a typename in a parameter specification but supports all\r
+//   - version 8 (2005) (compiler v.14) requires parameters and templates, supports all\r
+#ifdef _MSC_VER\r
+#if _MSC_VER < 1300\r
+#undef TYPENAME\r
+#define TYPENAME\r
+#endif\r
+#endif\r
+\r
+// Borland \r
+//   - doesn't handle typename in 5.5, does in 5.82, not sure about other cases\r
+#ifdef __BORLANDC__\r
+#if __BORLANDC__ <= 0x550\r
+#undef TYPENAME\r
+#define TYPENAME\r
+#endif\r
+#endif\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+#endif\r
This page took 0.022706 seconds and 4 git commands to generate.