sources/basics.h

changeset 60
268721e6be20
parent 51
481073b016a9
child 70
0e947b487b18
equal deleted inserted replaced
59:00a084f8ed26 60:268721e6be20
42 42
43 using std::swap; 43 using std::swap;
44 using std::min; 44 using std::min;
45 using std::max; 45 using std::max;
46 46
47 template<typename Signature>
48 using Function = std::function<Signature>;
49
50 // -------------------------------------------------------------------------------------------------
51 //
47 enum Color 52 enum Color
48 { 53 {
49 BLACK, 54 BLACK,
50 RED, 55 RED,
51 GREEN, 56 GREEN,
57 DEFAULT, 62 DEFAULT,
58 63
59 NUM_COLORS 64 NUM_COLORS
60 }; 65 };
61 66
62 template<typename Signature> 67 // -------------------------------------------------------------------------------------------------
63 using Function = std::function<Signature>; 68 //
64
65 FUNCTION print_to_console (String a) -> void; 69 FUNCTION print_to_console (String a) -> void;
66 70
71 // -------------------------------------------------------------------------------------------------
72 //
67 template<typename T> inline FUNCTION 73 template<typename T> inline FUNCTION
68 clamp (T a, T b, T c) -> T 74 clamp (T a, T b, T c) -> T
69 { 75 {
70 return (a < b) ? b : (a > c) ? c : a; 76 return (a < b) ? b : (a > c) ? c : a;
71 } 77 }
72 78
79 // -------------------------------------------------------------------------------------------------
80 //
73 struct Exitception {}; 81 struct Exitception {};

mercurial