Skip to content

Commit 3e307de

Browse files
authored
Update Infinity.hpp
1 parent 01572e5 commit 3e307de

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

Infinity.hpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Infinity on Aug 22, 2017
1+
// Infinity on Oct 8, 2017
22

33
#include <bits/stdc++.h>
44

@@ -25,11 +25,12 @@ constexpr const double eps = DBL_EPSILON;
2525

2626
inline namespace TypeDefine
2727
{
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;
3334
template<typename T> using ConstRef = const T &;
3435
template<typename T = vector<int>> using Iter = typename T::iterator;
3536
} // namespace Infinity::TypeDefine
@@ -135,6 +136,9 @@ template<typename T, typename F> T dichotomy(T l, T r, F check, T prec = 1)
135136
// returns the smallest value in (l, r] s.t. check(x)
136137
template<typename T, typename F> T dichotomy2(T l, T r, F check, T prec = 1)
137138
{ 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; }
138142
} // namespace Infinity::Miscelleneous
139143

140144
inline namespace BattleLab
@@ -261,6 +265,9 @@ class String : public std::string
261265
public:
262266
using std::string::string;
263267

268+
String(const std::string &s = "") : std::string(s)
269+
{}
270+
264271
String &prepend(char c)
265272
{ this->insert(this->begin(), c); return *this; }
266273

@@ -324,6 +331,9 @@ class StringList : public Array<String>
324331
}
325332
return s;
326333
}
334+
335+
operator vector<string>()
336+
{ vector<string> vs; for (String s : *this) { vs.push_back(s); } return vs; }
327337
};
328338

329339
inline StringList getstrs(int n, unsigned buffSize = 0x100000)
@@ -370,6 +380,8 @@ class Range
370380
};
371381

372382
typedef Range range;
383+
384+
//#define repeat(x) for (loop.i = 0, loop.n = x; loop.i < loop.n; loop.i++)
373385
} // namespace Infinity::BattleLab
374386

375387
inline namespace IO

0 commit comments

Comments
 (0)