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 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 inline T min(T a, T b) { return a <= b ? a : b; } template 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 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 inline void swap(T &a, T &b) { T t = a; a = b; b = t; } #endif +#endif template inline T constrain(T v, T l, T h) { return v < l ? l : v > h ? h : v; }