blob: 7e18d528535e0aa35daa59e7f74f2b5f578dfe15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
snippet bare "barebone code template"
#include <iostream>
#include <vector>
#include <string>
using std::cout;
using std::endl;
using std::vector;
using std::string;
int main()
{
return 0;
}
endsnippet
snippet icd "#include directive" b
#include <$1>
$0
endsnippet
snippet plist "print vector" w
void printList(vector<int>& arr, const string& desc){
cout << desc << ": ";
for (auto it = arr.begin(); it != arr.end(); it++){
cout << *it << ((it != arr.end()-1) ? ' ' : '\n');
}
}
endsnippet
snippet pmat "print list of list" w
void printMat(const vector<vector<int>>& mat, const string& desc){
cout << desc << ": " << endl;
for (auto it1 = mat.begin(); it1 != mat.end(); it1++){
auto cur_vec = *it1;
for (auto it2 = cur_vec.begin(); it2 != cur_vec.end(); it2++){
cout << *it2 << ((it2 != cur_vec.end()-1) ? ' ' : '\n');
}
}
}
endsnippet
snippet cout "print a variable" w
cout << "$1: " << $2 << endl;
endsnippet
|