From d7eab641c02463d05fa9492149f9bcb791f089ce Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 4 Oct 2020 10:49:52 -0400 Subject: [PATCH] cwCommonImpl.h : Added is_even(). --- cwCommonImpl.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cwCommonImpl.h b/cwCommonImpl.h index ae78b3d..0fb171d 100644 --- a/cwCommonImpl.h +++ b/cwCommonImpl.h @@ -16,6 +16,9 @@ #include // std::numeric_limits< #include #include +#include +#include + #if defined(OS_LINUX) || defined(OS_OSX) #define cwPOSIX_FILE_SYS @@ -175,7 +178,13 @@ namespace cw void sleepMs( unsigned ms ); // sleep milliseconds void sleepUs( unsigned us ); // sleep seconds void sleepNs( unsigned ns ); // sleep nanoseconds - + + template< typename T > + bool is_even( const T& t ) + { + assert( is_integral(t) ); + return (t % 2) == 0; + } }