diff options
author | Ludwig PACIFICI <ludwig@lud.cc> | 2016-10-11 22:25:05 +0100 |
---|---|---|
committer | Ludwig PACIFICI <ludwig@lud.cc> | 2016-10-11 22:25:05 +0100 |
commit | 21b915674a0dcd8e6e2a1145f393425ee706f8db (patch) | |
tree | 2d14adf2f29c5954240532b409c0721828804ba6 | |
parent | 11dec0b63d5d76f26a690adc6f6ab98e52b63b6a (diff) |
Added algorithm-mnemonics for C++
-rw-r--r-- | c++-mode/acl | 9 | ||||
-rw-r--r-- | c++-mode/acm | 7 | ||||
-rw-r--r-- | c++-mode/ajf | 10 | ||||
-rw-r--r-- | c++-mode/alo | 11 | ||||
-rw-r--r-- | c++-mode/ano | 11 | ||||
-rw-r--r-- | c++-mode/cni | 9 | ||||
-rw-r--r-- | c++-mode/cnt | 7 | ||||
-rw-r--r-- | c++-mode/cpb | 7 | ||||
-rw-r--r-- | c++-mode/cpi | 10 | ||||
-rw-r--r-- | c++-mode/cpn | 7 | ||||
-rw-r--r-- | c++-mode/cpy | 7 | ||||
-rw-r--r-- | c++-mode/eql | 9 | ||||
-rw-r--r-- | c++-mode/erm | 7 | ||||
-rw-r--r-- | c++-mode/ffo | 11 | ||||
-rw-r--r-- | c++-mode/fil | 7 | ||||
-rw-r--r-- | c++-mode/fin | 12 | ||||
-rw-r--r-- | c++-mode/fln | 7 | ||||
-rw-r--r-- | c++-mode/fnd | 10 | ||||
-rw-r--r-- | c++-mode/fne | 11 | ||||
-rw-r--r-- | c++-mode/fni | 12 | ||||
-rw-r--r-- | c++-mode/fre | 9 | ||||
-rw-r--r-- | c++-mode/gnn | 9 | ||||
-rw-r--r-- | c++-mode/gnr | 9 | ||||
-rw-r--r-- | c++-mode/ihp | 9 | ||||
-rw-r--r-- | c++-mode/ihu | 10 | ||||
-rw-r--r-- | c++-mode/ipr | 9 | ||||
-rw-r--r-- | c++-mode/ipt | 11 | ||||
-rw-r--r-- | c++-mode/iss | 9 | ||||
-rw-r--r-- | c++-mode/isu | 10 | ||||
-rw-r--r-- | c++-mode/ita | 7 | ||||
-rw-r--r-- | c++-mode/ltr | 7 | ||||
-rw-r--r-- | c++-mode/lwr | 8 | ||||
-rw-r--r-- | c++-mode/lxc | 10 | ||||
-rw-r--r-- | c++-mode/mkh | 7 | ||||
-rw-r--r-- | c++-mode/mme | 7 | ||||
-rw-r--r-- | c++-mode/mne | 7 | ||||
-rw-r--r-- | c++-mode/mpb | 7 | ||||
-rw-r--r-- | c++-mode/mrg | 8 | ||||
-rw-r--r-- | c++-mode/msm | 12 | ||||
-rw-r--r-- | c++-mode/mxe | 7 | ||||
-rw-r--r-- | c++-mode/nno | 11 | ||||
-rw-r--r-- | c++-mode/nth | 7 | ||||
-rw-r--r-- | c++-mode/nxp | 9 | ||||
-rw-r--r-- | c++-mode/oit | 9 | ||||
-rw-r--r-- | c++-mode/phh | 7 | ||||
-rw-r--r-- | c++-mode/ppt | 12 | ||||
-rw-r--r-- | c++-mode/prp | 9 | ||||
-rw-r--r-- | c++-mode/psc | 8 | ||||
-rw-r--r-- | c++-mode/pst | 7 | ||||
-rw-r--r-- | c++-mode/ptc | 8 | ||||
-rw-r--r-- | c++-mode/ptn | 12 | ||||
-rw-r--r-- | c++-mode/rci | 10 | ||||
-rw-r--r-- | c++-mode/rmc | 8 | ||||
-rw-r--r-- | c++-mode/rmf | 10 | ||||
-rw-r--r-- | c++-mode/rmi | 12 | ||||
-rw-r--r-- | c++-mode/rmv | 10 | ||||
-rw-r--r-- | c++-mode/rpc | 7 | ||||
-rw-r--r-- | c++-mode/rpi | 9 | ||||
-rw-r--r-- | c++-mode/rpl | 7 | ||||
-rw-r--r-- | c++-mode/rtc | 8 | ||||
-rw-r--r-- | c++-mode/rte | 7 | ||||
-rw-r--r-- | c++-mode/rvc | 7 | ||||
-rw-r--r-- | c++-mode/rvr | 7 | ||||
-rw-r--r-- | c++-mode/shf | 7 | ||||
-rw-r--r-- | c++-mode/spt | 11 | ||||
-rw-r--r-- | c++-mode/srh | 11 | ||||
-rw-r--r-- | c++-mode/srn | 10 | ||||
-rw-r--r-- | c++-mode/srt | 7 | ||||
-rw-r--r-- | c++-mode/sth | 7 | ||||
-rw-r--r-- | c++-mode/sti | 7 | ||||
-rw-r--r-- | c++-mode/sto | 7 | ||||
-rw-r--r-- | c++-mode/sts | 7 | ||||
-rw-r--r-- | c++-mode/stv | 7 | ||||
-rw-r--r-- | c++-mode/swr | 7 | ||||
-rw-r--r-- | c++-mode/tfm | 10 | ||||
-rw-r--r-- | c++-mode/trm | 7 | ||||
-rw-r--r-- | c++-mode/ucp | 8 | ||||
-rw-r--r-- | c++-mode/upr | 10 | ||||
-rw-r--r-- | c++-mode/uqe | 7 |
79 files changed, 684 insertions, 0 deletions
diff --git a/c++-mode/acl b/c++-mode/acl new file mode 100644 index 0000000..c7c9014 --- /dev/null +++ b/c++-mode/acl @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: accumulate +# key: acl +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto sum = std::accumulate(std::begin(${1:container}), std::end($1), 0, [](int total, $2) { + $3 +}); +$0 diff --git a/c++-mode/acm b/c++-mode/acm new file mode 100644 index 0000000..b4c445b --- /dev/null +++ b/c++-mode/acm @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: accumulate +# key: acm +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto sum = std::accumulate(std::begin(${1:container}), std::end($1), 0); +$0 diff --git a/c++-mode/ajf b/c++-mode/ajf new file mode 100644 index 0000000..5f206a9 --- /dev/null +++ b/c++-mode/ajf @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: adjacent_find +# key: ajf +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::adjacent_find(std::begin(${1:container}), std::end($1)); +if (pos != std::end($1)) { + $2 +} +$0 diff --git a/c++-mode/alo b/c++-mode/alo new file mode 100644 index 0000000..0fecd24 --- /dev/null +++ b/c++-mode/alo @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: all_of +# key: alo +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +if (std::all_of(std::begin(${1:container}), std::end($1), []($2) { + $3 +})) { + $4 +} +$0 diff --git a/c++-mode/ano b/c++-mode/ano new file mode 100644 index 0000000..d4c70d5 --- /dev/null +++ b/c++-mode/ano @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: any_of +# key: ano +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +if (std::any_of(std::begin(${1:container}), std::end($1), []($2) { + $3 +})) { + $4 +} +$0 diff --git a/c++-mode/cni b/c++-mode/cni new file mode 100644 index 0000000..815c9bd --- /dev/null +++ b/c++-mode/cni @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: count_if +# key: cni +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto n = std::count_if(std::begin(${1:container}), std::end($1), []($2) { + $3 +}); +$0 diff --git a/c++-mode/cnt b/c++-mode/cnt new file mode 100644 index 0000000..8232916 --- /dev/null +++ b/c++-mode/cnt @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: count +# key: cnt +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto n = std::count(std::begin(${1:container}), std::end($1), $2); +$0 diff --git a/c++-mode/cpb b/c++-mode/cpb new file mode 100644 index 0000000..58b1fda --- /dev/null +++ b/c++-mode/cpb @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: copy_backward +# key: cpb +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::copy_backward(std::begin(${1:container}), std::end($1), std::end($1)); +$0 diff --git a/c++-mode/cpi b/c++-mode/cpi new file mode 100644 index 0000000..1d75088 --- /dev/null +++ b/c++-mode/cpi @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: copy_if +# key: cpi +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::copy_if(std::begin(${1:container}), std::end($1), std::begin($2), +[]($3) { + $4 +}); +$0 diff --git a/c++-mode/cpn b/c++-mode/cpn new file mode 100644 index 0000000..e8a95a2 --- /dev/null +++ b/c++-mode/cpn @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: copy_n +# key: cpn +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::copy_n(std::begin(${1:container}), $2, std::end($1)); +$0 diff --git a/c++-mode/cpy b/c++-mode/cpy new file mode 100644 index 0000000..a6f3880 --- /dev/null +++ b/c++-mode/cpy @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: copy +# key: cpy +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::copy(std::begin(${1:container}), std::end($1), std::begin($2)); +$0 diff --git a/c++-mode/eql b/c++-mode/eql new file mode 100644 index 0000000..a4f7cd5 --- /dev/null +++ b/c++-mode/eql @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: equal +# key: eql +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +if (std::equal(std::begin(${1:container}), std::end($1), std::begin($2))) { + $3 +} +$0 diff --git a/c++-mode/erm b/c++-mode/erm new file mode 100644 index 0000000..e2dd8ea --- /dev/null +++ b/c++-mode/erm @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: remove +# key: erm +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +${1:container}.erase(std::remove(std::begin($1), std::end($1), $2), std::end($1)); +$0 diff --git a/c++-mode/ffo b/c++-mode/ffo new file mode 100644 index 0000000..f87ebbb --- /dev/null +++ b/c++-mode/ffo @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: find_first_of +# key: ffo +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::find_first_of(std::begin(${1:container}), std::end($1), + std::begin($2), std::end($3)); +if (pos != std::end($1)) { + $4 +} +$0 diff --git a/c++-mode/fil b/c++-mode/fil new file mode 100644 index 0000000..8fc49e9 --- /dev/null +++ b/c++-mode/fil @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: fill +# key: fil +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::fill(std::begin(${1:container}), std::end($1), $2); +$0 diff --git a/c++-mode/fin b/c++-mode/fin new file mode 100644 index 0000000..0f495af --- /dev/null +++ b/c++-mode/fin @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: find_if_not +# key: fin +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::find_if_not(std::begin(${1:container}), std::end($1),[]($2) { + $3 +}); +if (pos != std::end($1)) { + $4 +} +$0 diff --git a/c++-mode/fln b/c++-mode/fln new file mode 100644 index 0000000..ffe05b0 --- /dev/null +++ b/c++-mode/fln @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: fill_n +# key: fln +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::fill_n(std::begin(${1:container}), $2, $3); +$0 diff --git a/c++-mode/fnd b/c++-mode/fnd new file mode 100644 index 0000000..6141036 --- /dev/null +++ b/c++-mode/fnd @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: find +# key: fnd +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::find(std::begin(${1:container}), std::end($1), $2); +if (pos != std::end($1)) { + $3 +} +$0 diff --git a/c++-mode/fne b/c++-mode/fne new file mode 100644 index 0000000..5054da0 --- /dev/null +++ b/c++-mode/fne @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: find_end +# key: fne +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::find_std::end(std::begin(${1:container}), std::end($1), + std::begin($2), std::end($3)); +if (pos != std::end($1)) { + $4 +} +$0 diff --git a/c++-mode/fni b/c++-mode/fni new file mode 100644 index 0000000..f06925c --- /dev/null +++ b/c++-mode/fni @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: find_if +# key: fni +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::find_if(std::begin(${1:container}), std::end($1), []($2) { + $3 +}); +if (pos != std::end($1)) { + $4 +} +$0 diff --git a/c++-mode/fre b/c++-mode/fre new file mode 100644 index 0000000..4ec2ed5 --- /dev/null +++ b/c++-mode/fre @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: for_each +# key: fre +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::for_each(std::begin(${1:container}), std::end($1), []($2) { + $3 +}); +$0 diff --git a/c++-mode/gnn b/c++-mode/gnn new file mode 100644 index 0000000..25825dd --- /dev/null +++ b/c++-mode/gnn @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: generate_n +# key: gnn +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::generate_n(std::begin(${1:container}), $2, []($3) { + $4 +}); +$0 diff --git a/c++-mode/gnr b/c++-mode/gnr new file mode 100644 index 0000000..387916f --- /dev/null +++ b/c++-mode/gnr @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: generate +# key: gnr +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::generate(std::begin(${1:container}), std::end($1), []($2) { + $3 +}); +$0 diff --git a/c++-mode/ihp b/c++-mode/ihp new file mode 100644 index 0000000..0c55ca1 --- /dev/null +++ b/c++-mode/ihp @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: is_heap +# key: ihp +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +if (std::is_heap(std::begin(${1:container}), std::end($1))) { + $2 +} +$0 diff --git a/c++-mode/ihu b/c++-mode/ihu new file mode 100644 index 0000000..702fbf7 --- /dev/null +++ b/c++-mode/ihu @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: is_heap_until +# key: ihu +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::is_heap_until(std::begin(${1:container}), std::end($1)); +if (pos != std::end($1)) { + $2 +} +$0 diff --git a/c++-mode/ipr b/c++-mode/ipr new file mode 100644 index 0000000..a08030f --- /dev/null +++ b/c++-mode/ipr @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: is_permutation +# key: ipr +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +if (std::is_permutation(std::begin(${1:container}), std::end($1), std::begin($2))) { + $3 +} +$0 diff --git a/c++-mode/ipt b/c++-mode/ipt new file mode 100644 index 0000000..bca9f6b --- /dev/null +++ b/c++-mode/ipt @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: is_partitioned +# key: ipt +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +if (std::is_partitioned(std::begin(${1:container}), std::end($1), []($2) { + $3 +})) { + $4 +} +$0 diff --git a/c++-mode/iss b/c++-mode/iss new file mode 100644 index 0000000..046decd --- /dev/null +++ b/c++-mode/iss @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: is_sorted +# key: iss +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +if (std::is_sorted(std::begin(${1:container}), std::end($1))) { + $2 +} +$0 diff --git a/c++-mode/isu b/c++-mode/isu new file mode 100644 index 0000000..28ccddf --- /dev/null +++ b/c++-mode/isu @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: is_sorted_until +# key: isu +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::is_sorted_until(std::begin(${1:container}), std::end($1)); +if (pos != std::end($1)) { + $2 +} +$0 diff --git a/c++-mode/ita b/c++-mode/ita new file mode 100644 index 0000000..862c011 --- /dev/null +++ b/c++-mode/ita @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: iota +# key: ita +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::iota(std::begin(${1:container}), std::end($1), $2); +$0 diff --git a/c++-mode/ltr b/c++-mode/ltr new file mode 100644 index 0000000..fd0d7d3 --- /dev/null +++ b/c++-mode/ltr @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: transform +# key: ltr +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +${1:container}.erase(0, $1.find_first_not_of(" \t\n\r")); +$0 diff --git a/c++-mode/lwr b/c++-mode/lwr new file mode 100644 index 0000000..893e833 --- /dev/null +++ b/c++-mode/lwr @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: transform +# key: lwr +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::transform(std::begin(${1:container}), std::end($1), std::begin($1), [](char c) { +return std::tolower(c);}); +$0 diff --git a/c++-mode/lxc b/c++-mode/lxc new file mode 100644 index 0000000..82cc883 --- /dev/null +++ b/c++-mode/lxc @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: lexigraphical_compare +# key: lxc +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +if (std::lexigraphical_compare(std::begin(${1:container}), std::end($1), + std::begin($2), std::end($3)) { + $4 +} +$0 diff --git a/c++-mode/mkh b/c++-mode/mkh new file mode 100644 index 0000000..f225c3e --- /dev/null +++ b/c++-mode/mkh @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: make_heap +# key: mkh +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::make_heap(std::begin(${1:container}), std::end($1)); +$0 diff --git a/c++-mode/mme b/c++-mode/mme new file mode 100644 index 0000000..e350c66 --- /dev/null +++ b/c++-mode/mme @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: minmax_element +# key: mme +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto minmax = std::minmax_element(std::begin(${1:container}), std::end($1)); +$0 diff --git a/c++-mode/mne b/c++-mode/mne new file mode 100644 index 0000000..61f0171 --- /dev/null +++ b/c++-mode/mne @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: min_element +# key: mne +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::min_element(std::begin(${1:container}), std::end($1)); +$0 diff --git a/c++-mode/mpb b/c++-mode/mpb new file mode 100644 index 0000000..c097841 --- /dev/null +++ b/c++-mode/mpb @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: move_backward +# key: mpb +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::move_backward(std::begin(${1:container}), std::end($1), std::end($1)); +$0 diff --git a/c++-mode/mrg b/c++-mode/mrg new file mode 100644 index 0000000..fff86fd --- /dev/null +++ b/c++-mode/mrg @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: merge +# key: mrg +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::merge(std::begin(${1:container}), std::end($1), +std::begin($2), std::end($3), std::begin($4)); +$0 diff --git a/c++-mode/msm b/c++-mode/msm new file mode 100644 index 0000000..5cf856d --- /dev/null +++ b/c++-mode/msm @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: mismatch +# key: msm +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto values = std::mismatch(std::begin(${1:container}), std::end($1), std::begin($1)); +if (values.first == std::end($1)) { + $2 +} else { + $3 +} +$0 diff --git a/c++-mode/mxe b/c++-mode/mxe new file mode 100644 index 0000000..49f058f --- /dev/null +++ b/c++-mode/mxe @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: max_element +# key: mxe +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::max_element(std::begin(${1:container}), std::end($1)); +$0 diff --git a/c++-mode/nno b/c++-mode/nno new file mode 100644 index 0000000..1dc76f9 --- /dev/null +++ b/c++-mode/nno @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: none_of +# key: nno +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +if (std::none_of(std::begin(${1:container}), std::end($1), []($2) { + $3 +})) { + $4 +} +$0 diff --git a/c++-mode/nth b/c++-mode/nth new file mode 100644 index 0000000..beec2a0 --- /dev/null +++ b/c++-mode/nth @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: nth_element +# key: nth +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::nth_element(std::begin(${1:container}), std::end($1), std::end($1)); +$0 diff --git a/c++-mode/nxp b/c++-mode/nxp new file mode 100644 index 0000000..7ce5dae --- /dev/null +++ b/c++-mode/nxp @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: next_permutation +# key: nxp +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +if (std::next_permutation(std::begin(${1:container}), std::end($1))) { + $2 +} +$0 diff --git a/c++-mode/oit b/c++-mode/oit new file mode 100644 index 0000000..b6d7e5d --- /dev/null +++ b/c++-mode/oit @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: copy +# key: oit +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::copy(std::begin(${1:container}), std::end($1), std::ostream_iterator<$2>{ +%\istd::cout, "$3" +}); +$0 diff --git a/c++-mode/phh b/c++-mode/phh new file mode 100644 index 0000000..200684b --- /dev/null +++ b/c++-mode/phh @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: push_heap +# key: phh +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::push_heap(std::begin(${1:container}), std::end($1)); +$0 diff --git a/c++-mode/ppt b/c++-mode/ppt new file mode 100644 index 0000000..27fae51 --- /dev/null +++ b/c++-mode/ppt @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: partition_point +# key: ppt +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::partition_point(std::begin(${1:container}), std::end($1), []($2) { + $3 +}); +if (pos != std::end($1)) { + $4 +} +$0 diff --git a/c++-mode/prp b/c++-mode/prp new file mode 100644 index 0000000..13c3793 --- /dev/null +++ b/c++-mode/prp @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: prev_permutation +# key: prp +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +if (std::prev_permutation(std::begin(${1:container}), std::end($1))) { + $2 +} +$0 diff --git a/c++-mode/psc b/c++-mode/psc new file mode 100644 index 0000000..9549968 --- /dev/null +++ b/c++-mode/psc @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: partial_sort_copy +# key: psc +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::partial_sort_copy(std::begin(${1:container}), std::end($1), + std::begin($2), std::end($3)); +$0 diff --git a/c++-mode/pst b/c++-mode/pst new file mode 100644 index 0000000..545485e --- /dev/null +++ b/c++-mode/pst @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: partial_sort +# key: pst +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::partial_sort(std::begin(${1:container}), std::end($1), std::end($1)); +$0 diff --git a/c++-mode/ptc b/c++-mode/ptc new file mode 100644 index 0000000..5ff3dc6 --- /dev/null +++ b/c++-mode/ptc @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: partition_copy +# key: ptc +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::partition_copy(std::begin(${1:container}), std::end($1), + std::begin($2), std::end($3)); +$0 diff --git a/c++-mode/ptn b/c++-mode/ptn new file mode 100644 index 0000000..af9775e --- /dev/null +++ b/c++-mode/ptn @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: partition +# key: ptn +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::partition(std::begin(${1:container}), std::end($1), []($2) { + $3 +}); +if (pos != std::end($1)) { + $4 +} +$0 diff --git a/c++-mode/rci b/c++-mode/rci new file mode 100644 index 0000000..ad473b5 --- /dev/null +++ b/c++-mode/rci @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: replace_copy_if +# key: rci +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::replace_copy_if(std::begin(${1:container}), std::end($1), + std::begin($1), []($2) { + $3 +}, $4); +$0 diff --git a/c++-mode/rmc b/c++-mode/rmc new file mode 100644 index 0000000..a03893a --- /dev/null +++ b/c++-mode/rmc @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: remove_copy +# key: rmc +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::remove_copy(std::begin(${1:container}), std::end($1), + std::begin($1), $2); +$0 diff --git a/c++-mode/rmf b/c++-mode/rmf new file mode 100644 index 0000000..caf73bd --- /dev/null +++ b/c++-mode/rmf @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: remove_copy_if +# key: rmf +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::remove_copy_if(std::begin(${1:container}), std::end($1), + std::begin($1), []($2) { + $3 +}); +$0 diff --git a/c++-mode/rmi b/c++-mode/rmi new file mode 100644 index 0000000..7cb47ab --- /dev/null +++ b/c++-mode/rmi @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: remove_if +# key: rmi +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::remove_if(std::begin(${1:container}), std::end($1), []($2) { + $3 +}); +if (pos != std::end($1)) { + $4 +} +$0 diff --git a/c++-mode/rmv b/c++-mode/rmv new file mode 100644 index 0000000..d178d47 --- /dev/null +++ b/c++-mode/rmv @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: remove +# key: rmv +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::remove(std::begin(${1:container}), std::end($1), $2); +if (pos != std::end($1)) { + $3 +} +$0 diff --git a/c++-mode/rpc b/c++-mode/rpc new file mode 100644 index 0000000..01fb570 --- /dev/null +++ b/c++-mode/rpc @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: replace_copy +# key: rpc +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::replace_copy(std::begin(${1:container}), std::end($1), std::begin($1), $2, $3); +$0 diff --git a/c++-mode/rpi b/c++-mode/rpi new file mode 100644 index 0000000..9922c66 --- /dev/null +++ b/c++-mode/rpi @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: replace_if +# key: rpi +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::replace_if(std::begin(${1:container}), std::end($1), []($2) { +$3 +}, $4); +$0 diff --git a/c++-mode/rpl b/c++-mode/rpl new file mode 100644 index 0000000..9993d98 --- /dev/null +++ b/c++-mode/rpl @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: replace +# key: rpl +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::replace(std::begin(${1:container}), std::end($1), $2, $3); +$0 diff --git a/c++-mode/rtc b/c++-mode/rtc new file mode 100644 index 0000000..84e817c --- /dev/null +++ b/c++-mode/rtc @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: rotate_copy +# key: rtc +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::rotate_copy(std::begin(${1:container}), std::begin($2), std::end($1), + std::begin($3)); +$0 diff --git a/c++-mode/rte b/c++-mode/rte new file mode 100644 index 0000000..b6be336 --- /dev/null +++ b/c++-mode/rte @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: rotate +# key: rte +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::rotate(std::begin(${1:container}), std::begin($2), std::end($1)); +$0 diff --git a/c++-mode/rvc b/c++-mode/rvc new file mode 100644 index 0000000..b8a3a17 --- /dev/null +++ b/c++-mode/rvc @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: reverse_copy +# key: rvc +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::reverse_copy(std::begin(${1:container}), std::end($1), std::begin($2)); +$0 diff --git a/c++-mode/rvr b/c++-mode/rvr new file mode 100644 index 0000000..81c9037 --- /dev/null +++ b/c++-mode/rvr @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: reverse +# key: rvr +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::reverse(std::begin(${1:container}), std::end($1)); +$0 diff --git a/c++-mode/shf b/c++-mode/shf new file mode 100644 index 0000000..3ad42b7 --- /dev/null +++ b/c++-mode/shf @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: random_shuffle +# key: shf +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::random_shuffle(std::begin(${1:container}), std::end($1)); +$0 diff --git a/c++-mode/spt b/c++-mode/spt new file mode 100644 index 0000000..55c0808 --- /dev/null +++ b/c++-mode/spt @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: stable_partition +# key: spt +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::stable_partition(std::begin(${1:container}), std::end($1), []($2) { + $3}); +if (pos != std::end($1)) { + $4 +} +$0 diff --git a/c++-mode/srh b/c++-mode/srh new file mode 100644 index 0000000..12fbbe7 --- /dev/null +++ b/c++-mode/srh @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: search +# key: srh +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::search(std::begin(${1:container}), std::end($1), + std::begin($2), std::end($3)); +if (pos != std::end($1)) { + $4 +} +$0 diff --git a/c++-mode/srn b/c++-mode/srn new file mode 100644 index 0000000..1fca802 --- /dev/null +++ b/c++-mode/srn @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: search_n +# key: srn +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::search_n(std::begin(${1:container}), std::end($1),$2,$3); +if (pos != std::end($1)) { + $4 +} +$0 diff --git a/c++-mode/srt b/c++-mode/srt new file mode 100644 index 0000000..7d0c60d --- /dev/null +++ b/c++-mode/srt @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: sort +# key: srt +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::sort(std::begin(${1:container}), std::end($1)); +$0 diff --git a/c++-mode/sth b/c++-mode/sth new file mode 100644 index 0000000..e2a5bff --- /dev/null +++ b/c++-mode/sth @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: sort_heap +# key: sth +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::sort_heap(std::begin(${1:container}), std::end($1)); +$0 diff --git a/c++-mode/sti b/c++-mode/sti new file mode 100644 index 0000000..27cf249 --- /dev/null +++ b/c++-mode/sti @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: cin +# key: sti +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::cin >> +$0 diff --git a/c++-mode/sto b/c++-mode/sto new file mode 100644 index 0000000..39d452a --- /dev/null +++ b/c++-mode/sto @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: cout +# key: sto +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::cout << +$0 diff --git a/c++-mode/sts b/c++-mode/sts new file mode 100644 index 0000000..fcf3de3 --- /dev/null +++ b/c++-mode/sts @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: stable_sort +# key: sts +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::stable_sort(std::begin(${1:container}), std::end($1)); +$0 diff --git a/c++-mode/stv b/c++-mode/stv new file mode 100644 index 0000000..994ade4 --- /dev/null +++ b/c++-mode/stv @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: vector +# key: stv +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::vector<$2> $3 +$0 diff --git a/c++-mode/swr b/c++-mode/swr new file mode 100644 index 0000000..bb1ec45 --- /dev/null +++ b/c++-mode/swr @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: swap_ranges +# key: swr +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::swap_ranges(std::begin(${1:container}), std::end($1), std::begin($2)); +$0 diff --git a/c++-mode/tfm b/c++-mode/tfm new file mode 100644 index 0000000..c81aee9 --- /dev/null +++ b/c++-mode/tfm @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: transform +# key: tfm +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::transform(std::begin(${1:container}), std::end($1), + std::begin($1), []($2) { +$3% +}); +$0 diff --git a/c++-mode/trm b/c++-mode/trm new file mode 100644 index 0000000..e3fe028 --- /dev/null +++ b/c++-mode/trm @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: generate_n +# key: trm +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +${1:container}.erase($1.find_last_not_of(" \t\n\r") + 1); +$0 diff --git a/c++-mode/ucp b/c++-mode/ucp new file mode 100644 index 0000000..5b411f9 --- /dev/null +++ b/c++-mode/ucp @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: unique_copy +# key: ucp +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::unique_copy(std::begin(${1:container}), std::end($1), + std::ostream_iterator<string>(std::cout, "\n")); +$0 diff --git a/c++-mode/upr b/c++-mode/upr new file mode 100644 index 0000000..fd470cf --- /dev/null +++ b/c++-mode/upr @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: transform +# key: upr +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +std::transform(std::begin(${1:container}), std::end($1), std::begin($1), [](char c) { +return std::toupper(c); +}); +$2 +$0 diff --git a/c++-mode/uqe b/c++-mode/uqe new file mode 100644 index 0000000..f1d994e --- /dev/null +++ b/c++-mode/uqe @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: unique +# key: uqe +# contributor: Tommy BENNETT and Ludwig PACIFICI <ludwig@lud.cc> +# -- +auto pos = std::unique(std::begin(${1:container}), std::end($1)); +$0 |