extends c

priority 1

snippet enum "Enumeration"
enum ${1:name} {
	$0
};
endsnippet

snippet for "For loop, index or range"
for (${1:auto} ${2:index} ${4/(.*;.*)|(\w*)/(?1:=:\:)/} ${4:${3:0}; $2 < ${5:count}; $2${6:++}}) {
	$0
}
endsnippet

snippet struct "Structure"
struct ${1:name} {
	$0
};
endsnippet

snippet class "Class"
class ${1:name} {
 public:
	${1/(\w+)\s.*/$1/}();

	~${1/(\w+)\s.*/$1/}();

	$0
};
endsnippet

snippet template "Template"
template <class ${1:type}>$0
endsnippet

snippet namespace "Named or anonymous namespace"
namespace $1${1/(\w+)/ /}{
$0
}  // ${1/(\w*)/(?1:$1:anonymous)/}
endsnippet

snippet const_cast "Const cast" i
const_cast<$1>($2)$0
endsnippet

snippet dynamic_cast "Dynamic cast" i
dynamic_cast<$1>($2)$0
endsnippet

snippet static_cast "Static cast" i
static_cast<$1>($2)$0
endsnippet

snippet reinterpret_cast "Reinterpret case" i
reinterpret_cast<$1>($2)$0
endsnippet

snippet [] "Labmda function" i
[$1]($2)${3/(.*)/(?1: -> ::)/}$3 {$0}
endsnippet

snippet static_assert "Static assert"
static_assert($1, "$2");
endsnippet

snippet noisy "A noise class"
class noisy_t {
 public:
	noisy_t() { puts(__PRETTY_FUNCTION__); }
	noisy_t(const noisy_t &) { puts(__PRETTY_FUNCTION__); }
	noisy_t(noisy_t &&) { puts(__PRETTY_FUNCTION__); }
	noisy_t &operator=(const noisy_t &) { puts(__PRETTY_FUNCTION__); return *this; }
	noisy_t &operator=(noisy_t &&) { puts(__PRETTY_FUNCTION__); return *this; }
	~noisy_t() { puts(__PRETTY_FUNCTION__); }
};
endsnippet

snippet std::enable_if "Enable if"
typename std::enable_if<${1:condition}${2:, ${3:type}}>::type
endsnippet