misc.h

changeset 78
c190fe218506
parent 72
5755c02d89f0
child 85
b1541b547c8c
equal deleted inserted replaced
77:7c2f500405fe 78:c190fe218506
34 34
35 // Converts a float value to a string value. 35 // Converts a float value to a string value.
36 str ftoa (double fCoord); 36 str ftoa (double fCoord);
37 37
38 template<class T> bool in (T needle, std::initializer_list<T> haystack) { 38 template<class T> bool in (T needle, std::initializer_list<T> haystack) {
39 for (size_t i = 0; i < haystack.size(); ++i) 39 for (T hay : haystack) {
40 if (needle = *(haystack.begin() + i)) 40 printf ("%s: %ld <-> %ld\n", __func__, needle, hay);
41 if (needle == hay)
41 return true; 42 return true;
43 }
42 44
43 return false; 45 return false;
44 } 46 }
45 47
46 // ============================================================================= 48 // =============================================================================

mercurial