sources/basics.h

changeset 88
08ccaf26cffd
parent 87
53c2aecb9704
child 89
777b2a10b835
--- a/sources/basics.h	Thu Jul 23 00:16:47 2015 +0300
+++ b/sources/basics.h	Thu Jul 23 01:52:04 2015 +0300
@@ -29,13 +29,6 @@
 */
 
 #pragma once
-#include <algorithm>
-#include <functional>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <cctype>
-
 #if !defined(_MSC_VER) && !defined(__cdecl)
 # define __cdecl
 #endif
@@ -43,10 +36,12 @@
 #define MACRO_TO_STRING_2(A) #A
 #define MACRO_TO_STRING(A) MACRO_TO_STRING_2(A)
 
+#define BEGIN_ZFC_NAMESPACE namespace zfc {
+#define END_ZFC_NAMESPACE }
+
+BEGIN_ZFC_NAMESPACE
+
 class String;
-using std::swap;
-using std::min;
-using std::max;
 
 // -------------------------------------------------------------------------------------------------
 //
@@ -65,6 +60,14 @@
 	NUM_COLORS
 };
 
+// Goddamnit, MSVC
+#ifdef _MSC_VER
+# define and &&
+# define or ||
+# define not !
+# define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #define TEXTCOLOR_Escape "\x1C"
 #define TEXTCOLOR_Black			TEXTCOLOR_Escape "M"
 #define TEXTCOLOR_Gray			TEXTCOLOR_Escape "U"
@@ -82,14 +85,23 @@
 #define TEXTCOLOR_BrightCyan	TEXTCOLOR_Escape "V"
 #define TEXTCOLOR_Reset			TEXTCOLOR_Escape "-"
 
-// -------------------------------------------------------------------------------------------------
-//
+template<typename T>
+T min (T a, T b)
+{
+	return (a < b) ? b : a;
+}
+
 template<typename T>
-inline T clamp (T a, T b, T c)
+T max (T a, T b)
+{
+	return (a > b) ? b : a;
+}
+
+template<typename T>
+T clamp (T a, T b, T c)
 {
 	return (a < b) ? b : (a > c) ? c : a;
 }
 
-// -------------------------------------------------------------------------------------------------
-//
 struct Exitception {};
+END_ZFC_NAMESPACE

mercurial