diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2017-06-11 10:05:34 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2017-06-11 10:05:34 +0200 |
commit | 0a2c88c2884e1c1ec0228b481745314e1b44fb4e (patch) | |
tree | c5b3747dcc24d60dd279534563b31d637a264d7a /tools.h | |
parent | c70d62aeb44360bc0e19241534dda113db190351 (diff) | |
download | vdr-0a2c88c2884e1c1ec0228b481745314e1b44fb4e.tar.gz vdr-0a2c88c2884e1c1ec0228b481745314e1b44fb4e.tar.bz2 |
Introduced the new macro DISABLE_TEMPLATES_COLLIDING_WITH_STL2.3.7
Diffstat (limited to 'tools.h')
-rw-r--r-- | tools.h | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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; } |