X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/c718923582a2491791b129ed8572a38f45c9d62e..928005ffdaa1508c6f15bf386a29e02fa44b1136:/vim/ultisnips/cpp.snippets diff --git a/vim/ultisnips/cpp.snippets b/vim/ultisnips/cpp.snippets index 5b55701..4c79d78 100644 --- a/vim/ultisnips/cpp.snippets +++ b/vim/ultisnips/cpp.snippets @@ -24,6 +24,15 @@ private: }; // class${1/.+/ $0/m} endsnippet +snippet rule5 "Default constructors/destructors/operaters" b +${1:classname}() = default; +~$1() = default; +$1(const $1 &) = default; +$1($1 &&) = default; +$1 &operator=(const $1 &) = default; +$1 &operator=($1 &&) = default; +endsnippet + snippet ns "namespace .. (namespace)" namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`} { ${VISUAL}${0} @@ -122,6 +131,15 @@ auto ${1:alias}(Args&&... args) } endsnippet +# https://stackoverflow.com/a/14803335 +snippet bind_memfun +template +std::function ${1:object_bind}(Ret (T::* fun)(Args...), T &t) +{ + return [=](Args... args) { return (t.*fun)(args...); }; +} +endsnippet + snippet once "#pragma once" b #pragma once