X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/612969653144b079f4d45f084ae132a7e41ff662..f8c02273484224b9133f77606f0016fb6cdaff4b:/vim/ultisnips/cpp.snippets diff --git a/vim/ultisnips/cpp.snippets b/vim/ultisnips/cpp.snippets index 5529a1a..7a27d78 100644 --- a/vim/ultisnips/cpp.snippets +++ b/vim/ultisnips/cpp.snippets @@ -2,7 +2,7 @@ priority 1 # disable horrible one word snippets -clearsnippets pri pro pub fr mu +clearsnippets pri pro pub fr mu t snippet inc "#include <>" b #include <${1:iostream}> @@ -16,8 +16,8 @@ snippet cl "class .. (class)" b class ${1:`!p snip.rv = snip.basename or "name"`} { public: - ${1/(\w+).*/$1/}(${2:arguments}); - virtual ~${1/(\w+).*/$1/}(); + ${1/(\w+).*/$1/}(${2}) = default; + virtual ~${1/(\w+).*/$1/}() = default; private: ${0:/* data */} @@ -27,9 +27,9 @@ endsnippet snippet rule5 "Default constructors/destructors/operaters" b ${1:classname}() = default; ~$1() = default; -$1(const $1 &) = default; +$1($1 const &) = default; $1($1 &&) = default; -$1 &operator=(const $1 &) = default; +$1 &operator=($1 const &) = default; $1 &operator=($1 &&) = default; endsnippet @@ -47,7 +47,7 @@ ${4:void} ${1:`!p snip.rv = snip.basename or "name"`}::${2:memberFunction}(${3}) endsnippet snippet for "for loop (for)" -for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) +for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { ${VISUAL}${0} } @@ -145,3 +145,11 @@ snippet once "#pragma once" b ${0} endsnippet + +snippet ostream "operator<<(ostream)" b +inline std::ostream & operator<<(std::ostream &os, ${1:Type} const & rhs) +{ + os << ${0}; + return os; +} +endsnippet