summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2017-06-11 10:05:34 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2017-06-11 10:05:34 +0200
commit0a2c88c2884e1c1ec0228b481745314e1b44fb4e (patch)
treec5b3747dcc24d60dd279534563b31d637a264d7a
parentc70d62aeb44360bc0e19241534dda113db190351 (diff)
downloadvdr-0a2c88c2884e1c1ec0228b481745314e1b44fb4e.tar.gz
vdr-0a2c88c2884e1c1ec0228b481745314e1b44fb4e.tar.bz2
Introduced the new macro DISABLE_TEMPLATES_COLLIDING_WITH_STL2.3.7
-rw-r--r--HISTORY3
-rw-r--r--tools.h13
2 files changed, 11 insertions, 5 deletions
diff --git a/HISTORY b/HISTORY
index 150ae394..45b72215 100644
--- a/HISTORY
+++ b/HISTORY
@@ -9126,3 +9126,6 @@ Video Disk Recorder Revision History
had an abandoned member of class cSchedulesLock, which, as a side effect, caused an
invalid lock sequence to be flagged (reported by Johann Friedrichs). In order to
have the compiler report such things, these macros have been changed.
+- Introduced the new macro DISABLE_TEMPLATES_COLLIDING_WITH_STL, which can be defined
+ before including tools.h in case some plugin needs to use the STL and gets error
+ messages regarding one of the template functions defined in tools.h.
diff --git a/tools.h b/tools.h
index cc4b2b66..5894a184 100644
--- a/tools.h
+++ b/tools.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.h 4.11 2017/06/11 08:52:06 kls Exp $
+ * $Id: tools.h 4.12 2017/06/11 10:00:49 kls Exp $
*/
#ifndef __TOOLS_H
@@ -51,16 +51,19 @@ template<class T> inline void DELETENULL(T *&p) { T *q = p; p = NULL; delete q;
#define CHECK(s) { if ((s) < 0) LOG_ERROR; } // used for 'ioctl()' calls
#define FATALERRNO (errno && errno != EAGAIN && errno != EINTR)
-#ifndef _STL_ALGOBASE_H // in case some plugin needs to use the STL
+// In case some plugin needs to use the STL and gets an error message regarding one
+// of these functions, you can #define DISABLE_TEMPLATES_COLLIDING_WITH_STL before
+// including tools.h.
+#if !defined(__STL_CONFIG_H) // for old versions of the STL
+#if !defined(DISABLE_TEMPLATES_COLLIDING_WITH_STL) && !defined(_STL_ALGOBASE_H)
template<class T> inline T min(T a, T b) { return a <= b ? a : b; }
template<class T> inline T max(T a, T b) { return a >= b ? a : b; }
#endif
-#ifndef __STL_CONFIG_H // in case some plugin needs to use the STL
template<class T> inline int sgn(T a) { return a < 0 ? -1 : a > 0 ? 1 : 0; }
-#endif
-#ifndef _MOVE_H // in case some plugin needs to use the STL
+#if !defined(DISABLE_TEMPLATES_COLLIDING_WITH_STL) && !defined(_MOVE_H)
template<class T> inline void swap(T &a, T &b) { T t = a; a = b; b = t; }
#endif
+#endif
template<class T> inline T constrain(T v, T l, T h) { return v < l ? l : v > h ? h : v; }