]> git.r.bdr.sh - rbdr/dotfiles/blame_incremental - vim/snippets/cpp.snippets
Update vim
[rbdr/dotfiles] / vim / snippets / cpp.snippets
... / ...
CommitLineData
1# Read File Into Vector
2snippet readfile
3 std::vector<char> v;
4 if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) {
5 char buf[1024];
6 while (size_t len = fread(buf, 1, sizeof(buf), $2))
7 v.insert(v.end(), buf, buf + len);
8 fclose($2);
9 }${3}
10# std::map
11snippet map
12 std::map<${1:key}, ${2:value}> map${3};
13# std::vector
14snippet vector
15 std::vector<${1:char}> v${2};
16# Namespace
17snippet ns
18 namespace ${1:`Filename('', 'my')`} {
19 ${2}
20 } /* $1 */
21# Class
22snippet cl
23 class ${1:`Filename('$1_t', 'name')`} {
24 public:
25 $1 (${2:arguments});
26 virtual ~$1 ();
27
28 private:
29 ${3:/* data */}
30 };
31snippet fori
32 for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
33 ${4:/* code */}
34 }