Skip to content

Commit

Permalink
Remove space after "template" keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
simonlindholm committed Jul 14, 2018
1 parent 51018fb commit 92d523b
Show file tree
Hide file tree
Showing 28 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion content/data-structures/Matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
#pragma once

template <class T, int N> struct Matrix {
template<class T, int N> struct Matrix {
typedef Matrix M;
array<array<T, N>, N> d{};
M operator*(const M& m) const {
Expand Down
2 changes: 1 addition & 1 deletion content/data-structures/OrderStatisticTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <bits/extc++.h> /** keep-include */
using namespace __gnu_pbds;

template <class T>
template<class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag,
tree_order_statistics_node_update>;

Expand Down
2 changes: 1 addition & 1 deletion content/data-structures/RMQ.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
const int inf = numeric_limits<int>::max();
#endif /** exclude-line */

template <class T>
template<class T>
struct RMQ {
vector<vector<T>> jmp;

Expand Down
2 changes: 1 addition & 1 deletion content/data-structures/SubMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
#pragma once

template <class T>
template<class T>
struct SubMatrix {
vector<vector<T>> p;
SubMatrix(vector<vector<T>>& v) {
Expand Down
2 changes: 1 addition & 1 deletion content/geometry/Point.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
#pragma once

template <class T>
template<class T>
struct Point {
typedef Point P;
T x, y;
Expand Down
2 changes: 1 addition & 1 deletion content/geometry/Point3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
#pragma once

template <class T> struct Point3D {
template<class T> struct Point3D {
typedef Point3D P;
typedef const P& R;
T x, y, z;
Expand Down
2 changes: 1 addition & 1 deletion content/geometry/PolygonArea.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "Point.h"

template <class T>
template<class T>
T polygonArea2(vector<Point<T>>& v) {
T a = v.back().cross(v[0]);
rep(i,0,sz(v)-1) a += v[i].cross(v[i+1]);
Expand Down
2 changes: 1 addition & 1 deletion content/geometry/PolyhedronVolume.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
#pragma once

template <class V, class L>
template<class V, class L>
double signed_poly_volume(const V& p, const L& trilist) {
double v = 0;
trav(i, trilist) v += p[i.a].cross(p[i.b]).dot(p[i.c]);
Expand Down
2 changes: 1 addition & 1 deletion content/geometry/SegmentIntersection.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Use segmentIntersectionQ to get just a true/false answer.

#include "Point.h"

template <class P>
template<class P>
int segmentIntersection(const P& s1, const P& e1,
const P& s2, const P& e2, P& r1, P& r2) {
if (e1==s1) {
Expand Down
2 changes: 1 addition & 1 deletion content/geometry/SegmentIntersectionQ.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "Point.h"

template <class P>
template<class P>
bool segmentIntersectionQ(P s1, P e1, P s2, P e2) {
if (e1 == s1) {
if (e2 == s2) return e1 == e2;
Expand Down
2 changes: 1 addition & 1 deletion content/geometry/circleTangents.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Returns a pair of the two points on the circle with radius r centered around c w

#include "Point.h"

template <class P>
template<class P>
pair<P,P> circleTangents(const P &p, const P &c, double r) {
P a = p-c;
double x = r*r/a.dist2(), y = sqrt(x-x*x);
Expand Down
4 changes: 2 additions & 2 deletions content/geometry/closestPair.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

#include "Point.h"

template <class It>
template<class It>
bool it_less(const It& i, const It& j) { return *i < *j; }
template <class It>
template<class It>
bool y_it_less(const It& i,const It& j) {return i->y < j->y;}

template<class It, class IIt> /* IIt = vector<It>::iterator */
Expand Down
2 changes: 1 addition & 1 deletion content/geometry/insidePolygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "onSegment.h"
#include "SegmentDistance.h"

template <class It, class P>
template<class It, class P>
bool insidePolygon(It begin, It end, const P& p,
bool strict = true) {
int n = 0; //number of isects with line from p to (inf,p.y)
Expand Down
2 changes: 1 addition & 1 deletion content/geometry/lineDistance.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Returns the signed distance between point p and the line containing points a and

#include "Point.h"

template <class P>
template<class P>
double lineDist(const P& a, const P& b, const P& p) {
return (double)(b-a).cross(p-a)/(b-a).dist();
}
2 changes: 1 addition & 1 deletion content/geometry/lineIntersection.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If a unique intersetion point of the lines going through s1,e1 and s2,e2 exists

#include "Point.h"

template <class P>
template<class P>
int lineIntersection(const P& s1, const P& e1, const P& s2,
const P& e2, P& r) {
if ((e1-s1).cross(e2-s2)) { //if not parallell
Expand Down
2 changes: 1 addition & 1 deletion content/geometry/onSegment.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "Point.h"

template <class P>
template<class P>
bool onSegment(const P& s, const P& e, const P& p) {
P ds = p-s, de = p-e;
return ds.cross(de) == 0 && ds.dot(de) <= 0;
Expand Down
4 changes: 2 additions & 2 deletions content/geometry/sideOf.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

#include "Point.h"

template <class P>
template<class P>
int sideOf(const P& s, const P& e, const P& p) {
auto a = (e-s).cross(p-s);
return (a > 0) - (a < 0);
}
template <class P>
template<class P>
int sideOf(const P& s, const P& e, const P& p, double eps) {
auto a = (e-s).cross(p-s);
double l = (e-s).dist()*eps;
Expand Down
2 changes: 1 addition & 1 deletion content/graph/TopoSort.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
#pragma once

template <class E, class I>
template<class E, class I>
bool topo_sort(const E &edges, I &idx, int n) {
vi indeg(n);
rep(i,0,n)
Expand Down
4 changes: 2 additions & 2 deletions content/number-theory/chinese.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

#include "euclid.h"

template <class Z> Z chinese(Z a, Z m, Z b, Z n) {
template<class Z> Z chinese(Z a, Z m, Z b, Z n) {
Z x, y; euclid(m, n, x, y);
Z ret = a * (y + m) % m * n + b * (x + n) % n * m;
if (ret >= m * n) ret -= m * n;
return ret;
}

template <class Z> Z chinese_common(Z a, Z m, Z b, Z n) {
template<class Z> Z chinese_common(Z a, Z m, Z b, Z n) {
Z d = gcd(m, n);
if (((b -= a) %= n) < 0) b += n;
if (b % d) return -1; // No solution
Expand Down
4 changes: 2 additions & 2 deletions content/various/BumpAllocatorSTL.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
char buf[450 << 20] alignas(16);
size_t buf_ind = sizeof buf;

template <class T> struct small {
template<class T> struct small {
typedef T value_type;
small() {}
template <class U> small(const U&) {}
template<class U> small(const U&) {}
T* allocate(size_t n) {
buf_ind -= n * sizeof(T);
buf_ind &= 0 - alignof(T);
Expand Down
2 changes: 1 addition & 1 deletion content/various/LCS.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
#pragma once

template <class T> T lcs(const T &X, const T &Y) {
template<class T> T lcs(const T &X, const T &Y) {
int a = sz(X), b = sz(Y);
vector<vi> dp(a+1, vi(b+1));
rep(i,1,a+1) rep(j,1,b+1)
Expand Down
2 changes: 1 addition & 1 deletion fuzz-tests/hull-intersection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ typedef vector<int> vi;

#include "../content/geometry/Point.h"

template <>
template<>
struct Point<double> {
typedef Point P;
typedef double T;
Expand Down
2 changes: 1 addition & 1 deletion old-unit-tests/geometry/test_convexHull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <sstream>
typedef Point<double> P;

template <class T>
template<class T>
ostream & operator<<(ostream & os, const vector<T> p) {
os << "[ ";
trav(it,p) os << it << " ";
Expand Down
4 changes: 2 additions & 2 deletions old-unit-tests/geometry/test_lineDistDouble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ class test_lineDistDouble :



/*template <class T>
/*template<class T>
void test(T p1, T p2, T p3, double a) {
stringstream ss;
ss << p1 << " " << p2 << " " << p3;
check(lineDist(p1,p2,p3), a, ss.str());
}*/
template <class T>
template<class T>
void test(T p1, T p2, T p3, double a) {
stringstream ss;
ss << p1 << " " << p2 << " " << p3;
Expand Down
2 changes: 1 addition & 1 deletion old-unit-tests/geometry/test_segDistDouble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class test_segDistDouble :



template <class T>
template<class T>
void test(T p1, T p2, T p3, double a) {
stringstream ss;
ss << p1 << " " << p2 << " " << p3;
Expand Down
2 changes: 1 addition & 1 deletion old-unit-tests/geometry/test_segDistInt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class test_segDist :



template <class T>
template<class T>
void test(T p1, T p2, T p3, double a) {
stringstream ss;
ss << p1 << " " << p2 << " " << p3;
Expand Down
16 changes: 8 additions & 8 deletions old-unit-tests/geometry/test_segmentIntersectionDouble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class test_segmentIntersectionDouble :

virtual ~test_segmentIntersectionDouble() { }

template <class T>
template<class T>
void oldTest(T s1, T e1, T s2, T e2, vector<T> res) {
stringstream ss;
ss << s1 << " " << e1 << " " << s2 << " " << e2;
Expand All @@ -32,7 +32,7 @@ class test_segmentIntersectionDouble :
fail(ss.str());
//check(v,res,ss.str());
}
template <class T>
template<class T>
void test(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
stringstream ss;
ss << s1 << " " << e1 << " " << s2 << " " << e2;
Expand All @@ -47,21 +47,21 @@ class test_segmentIntersectionDouble :
}
}

template <class T>
template<class T>
void test1(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
T p1(3,9), p2(-12409, 1421);
test2(s1,e1,s2,e2,n,r1,r2);
test2(s1+p1,e1+p1,s2+p1,e2+p1,n,r1+p1,r2+p1);
test2(s1+p2,e1+p2,s2+p2,e2+p2,n,r1+p2,r2+p2);
}
template <class T>
template<class T>
void test2(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
int p1 = 4, p2 = -3;
test3(s1,e1,s2,e2,n,r1,r2);
test3(s1*p1,e1*p1,s2*p1,e2*p1,n,r1*p1,r2*p1);
test3(s1*p2,e1*p2,s2*p2,e2*p2,n,r1*p2,r2*p2);
}
template <class T>
template<class T>
void test3(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
T s1p = s1.perp(),e1p = e1.perp(),s2p=s2.perp(),e2p=e2.perp(),
r1p=r1.perp(),r2p=r2.perp();
Expand All @@ -71,17 +71,17 @@ class test_segmentIntersectionDouble :
test4(s1-s1p,e1-e1p,s2-s2p,e2-e2p,n,r1-r1p,r2-r2p);
test4(s1*3-s1p,e1*3-e1p,s2*3-s2p,e2*3-e2p,n,r1*3-r1p,r2*3-r2p);
}
template <class T>
template<class T>
void test4(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
test5(s1,e1,s2,e2,n,r1,r2);
test5(s2,e2,s1,e1,n,r1,r2);
}
template <class T>
template<class T>
void test5(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
test6(s1,e1,s2,e2,n,r1,r2);
test6(e1,s1,s2,e2,n,r1,r2);
}
template <class T>
template<class T>
void test6(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
test(s1,e1,s2,e2,n,r1,r2);
test(s1,e1,e2,s2,n,r1,r2);
Expand Down
16 changes: 8 additions & 8 deletions old-unit-tests/geometry/test_segmentIntersectionInt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class test_segmentIntersectionInt :

virtual ~test_segmentIntersectionInt() { }

template <class T>
template<class T>
void oldTest(T s1, T e1, T s2, T e2, vector<T> res) {
stringstream ss;
ss << s1 << " " << e1 << " " << s2 << " " << e2;
Expand All @@ -32,7 +32,7 @@ class test_segmentIntersectionInt :
fail(ss.str());
//check(v,res,ss.str());
}
template <class T>
template<class T>
void test(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
stringstream ss;
ss << s1 << " " << e1 << " " << s2 << " " << e2;
Expand All @@ -47,21 +47,21 @@ class test_segmentIntersectionInt :
}
}

template <class T>
template<class T>
void test1(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
T p1(3,9), p2(-12409, 1421);
test2(s1,e1,s2,e2,n,r1,r2);
test2(s1+p1,e1+p1,s2+p1,e2+p1,n,r1+p1,r2+p1);
test2(s1+p2,e1+p2,s2+p2,e2+p2,n,r1+p2,r2+p2);
}
template <class T>
template<class T>
void test2(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
int p1 = 4, p2 = -3;
test3(s1,e1,s2,e2,n,r1,r2);
test3(s1*p1,e1*p1,s2*p1,e2*p1,n,r1*p1,r2*p1);
test3(s1*p2,e1*p2,s2*p2,e2*p2,n,r1*p2,r2*p2);
}
template <class T>
template<class T>
void test3(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
T s1p = s1.perp(),e1p = e1.perp(),s2p=s2.perp(),e2p=e2.perp(),
r1p=r1.perp(),r2p=r2.perp();
Expand All @@ -71,17 +71,17 @@ class test_segmentIntersectionInt :
test4(s1-s1p,e1-e1p,s2-s2p,e2-e2p,n,r1-r1p,r2-r2p);
test4(s1*3-s1p,e1*3-e1p,s2*3-s2p,e2*3-e2p,n,r1*3-r1p,r2*3-r2p);
}
template <class T>
template<class T>
void test4(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
test5(s1,e1,s2,e2,n,r1,r2);
test5(s2,e2,s1,e1,n,r1,r2);
}
template <class T>
template<class T>
void test5(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
test6(s1,e1,s2,e2,n,r1,r2);
test6(e1,s1,s2,e2,n,r1,r2);
}
template <class T>
template<class T>
void test6(T s1, T e1, T s2, T e2, int n, T r1, T r2) {
test(s1,e1,s2,e2,n,r1,r2);
test(s1,e1,e2,s2,n,r1,r2);
Expand Down

0 comments on commit 92d523b

Please sign in to comment.