X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/a9258672b4d7b9e877d197d394e7291196c18ce5..adb08bd4e31993ab091aaada083fff4af0c957b7:/vim/ultisnips/cpp.snippets?ds=inline

diff --git a/vim/ultisnips/cpp.snippets b/vim/ultisnips/cpp.snippets
index d5083d5..90cd84d 100644
--- a/vim/ultisnips/cpp.snippets
+++ b/vim/ultisnips/cpp.snippets
@@ -16,14 +16,23 @@ 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:arguments}) = default;
+	virtual ~${1/(\w+).*/$1/}() = default;
 
 private:
 	${0:/* data */}
 }; // class${1/.+/ $0/m}
 endsnippet
 
+snippet rule5 "Default constructors/destructors/operaters" b
+${1:classname}() = default;
+~$1() = default;
+$1($1 const &) = default;
+$1($1 &&) = default;
+$1 &operator=($1 const &) = default;
+$1 &operator=($1 &&) = default;
+endsnippet
+
 snippet ns "namespace .. (namespace)"
 namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`} {
 ${VISUAL}${0}
@@ -99,8 +108,8 @@ class ${1:`!p snip.rv = snip.basename or "WidgetClass"`} : public QWidget
 	Q_OBJECT
 
 public:
-	explicit $1(${2}QWidget *parent = 0);
-	~$1() = default;
+	explicit $1(${2}QWidget *parent = nullptr);
+	virtual ~$1() = default;
 
 	$0
 public slots:
@@ -136,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