2015-06-05 23:58:52 -04:00
|
|
|
extends c
|
|
|
|
|
2012-08-28 00:24:47 -04:00
|
|
|
## STL Collections
|
|
|
|
# std::array
|
|
|
|
snippet array
|
2013-07-25 17:17:32 -04:00
|
|
|
std::array<${1:T}, ${2:N}> ${3};
|
2011-06-20 13:40:28 -04:00
|
|
|
# std::vector
|
|
|
|
snippet vector
|
2013-07-25 17:17:32 -04:00
|
|
|
std::vector<${1:T}> ${2};
|
2012-08-28 00:24:47 -04:00
|
|
|
# std::deque
|
|
|
|
snippet deque
|
2013-07-25 17:17:32 -04:00
|
|
|
std::deque<${1:T}> ${2};
|
2012-08-28 00:24:47 -04:00
|
|
|
# std::forward_list
|
|
|
|
snippet flist
|
2013-07-25 17:17:32 -04:00
|
|
|
std::forward_list<${1:T}> ${2};
|
2012-08-28 00:24:47 -04:00
|
|
|
# std::list
|
|
|
|
snippet list
|
2013-07-25 17:17:32 -04:00
|
|
|
std::list<${1:T}> ${2};
|
2012-08-28 00:24:47 -04:00
|
|
|
# std::set
|
|
|
|
snippet set
|
2013-07-25 17:17:32 -04:00
|
|
|
std::set<${1:T}> ${2};
|
2012-08-27 17:10:27 -04:00
|
|
|
# std::map
|
|
|
|
snippet map
|
2013-07-25 17:17:32 -04:00
|
|
|
std::map<${1:Key}, ${2:T}> ${3};
|
2012-08-28 00:24:47 -04:00
|
|
|
# std::multiset
|
|
|
|
snippet mset
|
2013-07-25 17:17:32 -04:00
|
|
|
std::multiset<${1:T}> ${2};
|
2012-08-28 00:24:47 -04:00
|
|
|
# std::multimap
|
|
|
|
snippet mmap
|
2013-07-25 17:17:32 -04:00
|
|
|
std::multimap<${1:Key}, ${2:T}> ${3};
|
2012-08-28 00:24:47 -04:00
|
|
|
# std::unordered_set
|
|
|
|
snippet uset
|
2013-07-25 17:17:32 -04:00
|
|
|
std::unordered_set<${1:T}> ${2};
|
2012-08-28 00:24:47 -04:00
|
|
|
# std::unordered_map
|
|
|
|
snippet umap
|
2013-07-25 17:17:32 -04:00
|
|
|
std::unordered_map<${1:Key}, ${2:T}> ${3};
|
2012-08-28 00:24:47 -04:00
|
|
|
# std::unordered_multiset
|
|
|
|
snippet umset
|
2013-07-25 17:17:32 -04:00
|
|
|
std::unordered_multiset<${1:T}> ${2};
|
2012-08-28 00:24:47 -04:00
|
|
|
# std::unordered_multimap
|
|
|
|
snippet ummap
|
2013-07-25 17:17:32 -04:00
|
|
|
std::unordered_multimap<${1:Key}, ${2:T}> ${3};
|
2012-08-28 00:24:47 -04:00
|
|
|
# std::stack
|
|
|
|
snippet stack
|
2013-07-25 17:17:32 -04:00
|
|
|
std::stack<${1:T}> ${2};
|
2012-08-28 00:24:47 -04:00
|
|
|
# std::queue
|
|
|
|
snippet queue
|
2013-07-25 17:17:32 -04:00
|
|
|
std::queue<${1:T}> ${2};
|
2012-08-28 00:24:47 -04:00
|
|
|
# std::priority_queue
|
|
|
|
snippet pqueue
|
2013-07-25 17:17:32 -04:00
|
|
|
std::priority_queue<${1:T}> ${2};
|
2012-08-28 12:33:50 -04:00
|
|
|
##
|
|
|
|
## Access Modifiers
|
|
|
|
# private
|
2012-08-28 13:56:17 -04:00
|
|
|
snippet pri
|
2012-08-28 12:33:50 -04:00
|
|
|
private
|
|
|
|
# protected
|
2012-08-28 13:56:17 -04:00
|
|
|
snippet pro
|
2012-08-28 12:33:50 -04:00
|
|
|
protected
|
|
|
|
# public
|
2012-08-28 13:56:17 -04:00
|
|
|
snippet pub
|
2012-08-28 12:33:50 -04:00
|
|
|
public
|
|
|
|
# friend
|
|
|
|
snippet fr
|
|
|
|
friend
|
|
|
|
# mutable
|
|
|
|
snippet mu
|
|
|
|
mutable
|
2013-06-20 17:39:31 -04:00
|
|
|
##
|
2012-08-28 12:41:16 -04:00
|
|
|
## Class
|
2012-08-27 17:10:27 -04:00
|
|
|
# class
|
2012-08-28 12:41:16 -04:00
|
|
|
snippet cl
|
2013-07-07 21:41:11 -04:00
|
|
|
class ${1:`vim_snippets#Filename('$1', 'name')`}
|
2011-06-20 13:40:28 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
$1(${2});
|
|
|
|
~$1();
|
|
|
|
|
|
|
|
private:
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:/* data */}
|
2011-06-20 13:40:28 -04:00
|
|
|
};
|
2012-08-28 12:41:16 -04:00
|
|
|
# member function implementation
|
2012-08-27 17:10:27 -04:00
|
|
|
snippet mfun
|
2013-07-07 21:41:11 -04:00
|
|
|
${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2012-08-27 17:10:27 -04:00
|
|
|
}
|
|
|
|
# namespace
|
|
|
|
snippet ns
|
2013-07-07 21:41:11 -04:00
|
|
|
namespace ${1:`vim_snippets#Filename('', 'my')`} {
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2012-08-27 17:10:27 -04:00
|
|
|
} /* namespace $1 */
|
2012-08-28 12:43:20 -04:00
|
|
|
##
|
|
|
|
## Input/Output
|
2012-08-28 12:41:16 -04:00
|
|
|
# std::cout
|
|
|
|
snippet cout
|
2013-07-25 17:17:32 -04:00
|
|
|
std::cout << ${1} << std::endl;
|
2012-08-28 12:41:16 -04:00
|
|
|
# std::cin
|
|
|
|
snippet cin
|
2013-07-25 17:17:32 -04:00
|
|
|
std::cin >> ${1};
|
2012-08-28 12:44:24 -04:00
|
|
|
##
|
|
|
|
## Iteration
|
2013-06-20 17:39:31 -04:00
|
|
|
# for i
|
2011-06-20 13:40:28 -04:00
|
|
|
snippet fori
|
|
|
|
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
2013-06-20 17:33:44 -04:00
|
|
|
${4}
|
2013-07-25 17:17:32 -04:00
|
|
|
}
|
2011-06-20 13:40:28 -04:00
|
|
|
|
2012-08-27 17:10:27 -04:00
|
|
|
# foreach
|
|
|
|
snippet fore
|
|
|
|
for (${1:auto} ${2:i} : ${3:container}) {
|
2013-06-20 17:33:44 -04:00
|
|
|
${4}
|
2013-07-25 17:17:32 -04:00
|
|
|
}
|
2011-06-20 13:40:28 -04:00
|
|
|
# iterator
|
|
|
|
snippet iter
|
|
|
|
for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) {
|
|
|
|
${6}
|
2013-07-25 17:17:32 -04:00
|
|
|
}
|
2011-06-20 13:40:28 -04:00
|
|
|
|
2012-08-27 17:10:27 -04:00
|
|
|
# auto iterator
|
|
|
|
snippet itera
|
2013-08-27 14:41:41 -04:00
|
|
|
for (auto ${1:i} = ${2:container}.begin(); $1 != $2.end(); ++$1) {
|
|
|
|
${3:std::cout << *$1 << std::endl;}
|
2013-07-25 17:17:32 -04:00
|
|
|
}
|
2012-08-31 17:53:39 -04:00
|
|
|
##
|
|
|
|
## Lambdas
|
|
|
|
# lamda (one line)
|
|
|
|
snippet ld
|
2013-07-25 17:17:32 -04:00
|
|
|
[${1}](${2}){${3}}
|
2012-08-31 17:53:39 -04:00
|
|
|
# lambda (multi-line)
|
|
|
|
snippet lld
|
|
|
|
[${1}](${2}){
|
2013-06-20 17:33:44 -04:00
|
|
|
${3}
|
2013-07-25 17:17:32 -04:00
|
|
|
}
|