1
- // Infinity on Aug 22 , 2017
1
+ // Infinity on Oct 8 , 2017
2
2
3
3
#include < bits/stdc++.h>
4
4
@@ -25,11 +25,12 @@ constexpr const double eps = DBL_EPSILON;
25
25
26
26
inline namespace TypeDefine
27
27
{
28
- using uint = unsigned int ;
29
- using ll = long long int ;
30
- using llong = long long int ;
31
- using ull = unsigned long long int ;
32
- using ld = long double ;
28
+ using uint = unsigned int ;
29
+ using ll = long long int ;
30
+ using llong = long long int ;
31
+ using ull = unsigned long long int ;
32
+ using ullong = unsigned long long int ;
33
+ using ld = long double ;
33
34
template <typename T> using ConstRef = const T &;
34
35
template <typename T = vector<int >> using Iter = typename T::iterator;
35
36
} // namespace Infinity::TypeDefine
@@ -135,6 +136,9 @@ template<typename T, typename F> T dichotomy(T l, T r, F check, T prec = 1)
135
136
// returns the smallest value in (l, r] s.t. check(x)
136
137
template <typename T, typename F> T dichotomy2 (T l, T r, F check, T prec = 1 )
137
138
{ while (r - l > prec) { T m = rmiddle (l, r); (check (m) ? r : l) = m; } return r; }
139
+
140
+ template <typename T> bool equals (initializer_list<T> list)
141
+ { for (T item : list) { if (item != *list.begin ()) { return false ; } } return true ; }
138
142
} // namespace Infinity::Miscelleneous
139
143
140
144
inline namespace BattleLab
@@ -261,6 +265,9 @@ class String : public std::string
261
265
public:
262
266
using std::string::string;
263
267
268
+ String (const std::string &s = " " ) : std::string(s)
269
+ {}
270
+
264
271
String &prepend (char c)
265
272
{ this ->insert (this ->begin (), c); return *this ; }
266
273
@@ -324,6 +331,9 @@ class StringList : public Array<String>
324
331
}
325
332
return s;
326
333
}
334
+
335
+ operator vector<string>()
336
+ { vector<string> vs; for (String s : *this ) { vs.push_back (s); } return vs; }
327
337
};
328
338
329
339
inline StringList getstrs (int n, unsigned buffSize = 0x100000 )
@@ -370,6 +380,8 @@ class Range
370
380
};
371
381
372
382
typedef Range range;
383
+
384
+ // #define repeat(x) for (loop.i = 0, loop.n = x; loop.i < loop.n; loop.i++)
373
385
} // namespace Infinity::BattleLab
374
386
375
387
inline namespace IO
0 commit comments