sources/basics.h

branch
protocol5
changeset 131
4996c8684b93
parent 114
0e7f3ecdf65a
child 157
42bb29924218
--- a/sources/basics.h	Mon Jan 25 04:15:31 2016 +0200
+++ b/sources/basics.h	Wed Jul 20 12:55:39 2016 +0300
@@ -1,5 +1,5 @@
 /*
-	Copyright 2014, 2015 Teemu Piippo
+	Copyright 2014 - 2016 Teemu Piippo
 	All rights reserved.
 
 	Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,8 @@
 */
 
 #pragma once
+#include <stdlib.h>
+
 #if !defined(_MSC_VER) && !defined(__cdecl)
 # define __cdecl
 #endif
@@ -88,6 +90,10 @@
 	return (a < b) ? b : (a > c) ? c : a;
 }
 
+template <typename T, size_t N>
+char (&_ArraySizeHelper(T (&array)[N]))[N];
+#define countof(array) (sizeof(_ArraySizeHelper( array )))
+
 struct Exitception {};
 
 END_ZFC_NAMESPACE

mercurial