diff options
author | Andrea Crotti <andrea.crotti.0@gmail.com> | 2016-10-15 12:16:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-15 12:16:16 +0100 |
commit | 29da8e6c0444188406fdc5bb8b18e9b328fb710e (patch) | |
tree | c4cc1663f2007caa04f0e8d298dde9f3959b0e76 | |
parent | 11dec0b63d5d76f26a690adc6f6ab98e52b63b6a (diff) | |
parent | 04ef7136a5f764cd170a722cef730f7263f30c01 (diff) |
Merge pull request #163 from ludwigpacifici/master
Added algorithm-mnemonics for C++
-rw-r--r-- | c++-mode/acl | 8 | ||||
-rw-r--r-- | c++-mode/acm | 6 | ||||
-rw-r--r-- | c++-mode/ajf | 9 | ||||
-rw-r--r-- | c++-mode/alo | 10 | ||||
-rw-r--r-- | c++-mode/ano | 10 | ||||
-rw-r--r-- | c++-mode/cni | 8 | ||||
-rw-r--r-- | c++-mode/cnt | 6 | ||||
-rw-r--r-- | c++-mode/cpb | 6 | ||||
-rw-r--r-- | c++-mode/cpi | 9 | ||||
-rw-r--r-- | c++-mode/cpn | 6 | ||||
-rw-r--r-- | c++-mode/cpy | 6 | ||||
-rw-r--r-- | c++-mode/eql | 8 | ||||
-rw-r--r-- | c++-mode/erm | 6 | ||||
-rw-r--r-- | c++-mode/ffo | 10 | ||||
-rw-r--r-- | c++-mode/fil | 6 | ||||
-rw-r--r-- | c++-mode/fin | 11 | ||||
-rw-r--r-- | c++-mode/fln | 6 | ||||
-rw-r--r-- | c++-mode/fnd | 9 | ||||
-rw-r--r-- | c++-mode/fne | 10 | ||||
-rw-r--r-- | c++-mode/fni | 11 | ||||
-rw-r--r-- | c++-mode/fre | 8 | ||||
-rw-r--r-- | c++-mode/gnn | 8 | ||||
-rw-r--r-- | c++-mode/gnr | 8 | ||||
-rw-r--r-- | c++-mode/ihp | 8 | ||||
-rw-r--r-- | c++-mode/ihu | 9 | ||||
-rw-r--r-- | c++-mode/ipr | 8 | ||||
-rw-r--r-- | c++-mode/ipt | 10 | ||||
-rw-r--r-- | c++-mode/iss | 8 | ||||
-rw-r--r-- | c++-mode/isu | 9 | ||||
-rw-r--r-- | c++-mode/ita | 6 | ||||
-rw-r--r-- | c++-mode/ltr | 6 | ||||
-rw-r--r-- | c++-mode/lwr | 7 | ||||
-rw-r--r-- | c++-mode/lxc | 9 | ||||
-rw-r--r-- | c++-mode/mkh | 6 | ||||
-rw-r--r-- | c++-mode/mme | 6 | ||||
-rw-r--r-- | c++-mode/mne | 6 | ||||
-rw-r--r-- | c++-mode/mpb | 6 | ||||
-rw-r--r-- | c++-mode/mrg | 7 | ||||
-rw-r--r-- | c++-mode/msm | 11 | ||||
-rw-r--r-- | c++-mode/mxe | 6 | ||||
-rw-r--r-- | c++-mode/nno | 10 | ||||
-rw-r--r-- | c++-mode/nth | 6 | ||||
-rw-r--r-- | c++-mode/nxp | 8 | ||||
-rw-r--r-- | c++-mode/oit | 8 | ||||
-rw-r--r-- | c++-mode/phh | 6 | ||||
-rw-r--r-- | c++-mode/ppt | 11 | ||||
-rw-r--r-- | c++-mode/prp | 8 | ||||
-rw-r--r-- | c++-mode/psc | 7 | ||||
-rw-r--r-- | c++-mode/pst | 6 | ||||
-rw-r--r-- | c++-mode/ptc | 7 | ||||
-rw-r--r-- | c++-mode/ptn | 11 | ||||
-rw-r--r-- | c++-mode/rci | 9 | ||||
-rw-r--r-- | c++-mode/rmc | 7 | ||||
-rw-r--r-- | c++-mode/rmf | 9 | ||||
-rw-r--r-- | c++-mode/rmi | 11 | ||||
-rw-r--r-- | c++-mode/rmv | 9 | ||||
-rw-r--r-- | c++-mode/rpc | 6 | ||||
-rw-r--r-- | c++-mode/rpi | 8 | ||||
-rw-r--r-- | c++-mode/rpl | 6 | ||||
-rw-r--r-- | c++-mode/rtc | 7 | ||||
-rw-r--r-- | c++-mode/rte | 6 | ||||
-rw-r--r-- | c++-mode/rvc | 6 | ||||
-rw-r--r-- | c++-mode/rvr | 6 | ||||
-rw-r--r-- | c++-mode/shf | 6 | ||||
-rw-r--r-- | c++-mode/spt | 10 | ||||
-rw-r--r-- | c++-mode/srh | 10 | ||||
-rw-r--r-- | c++-mode/srn | 9 | ||||
-rw-r--r-- | c++-mode/srt | 6 | ||||
-rw-r--r-- | c++-mode/sth | 6 | ||||
-rw-r--r-- | c++-mode/sti | 6 | ||||
-rw-r--r-- | c++-mode/sto | 6 | ||||
-rw-r--r-- | c++-mode/sts | 6 | ||||
-rw-r--r-- | c++-mode/stv | 6 | ||||
-rw-r--r-- | c++-mode/swr | 6 | ||||
-rw-r--r-- | c++-mode/tfm | 9 | ||||
-rw-r--r-- | c++-mode/trm | 6 | ||||
-rw-r--r-- | c++-mode/ucp | 7 | ||||
-rw-r--r-- | c++-mode/upr | 9 | ||||
-rw-r--r-- | c++-mode/uqe | 6 |
79 files changed, 605 insertions, 0 deletions
diff --git a/c++-mode/acl b/c++-mode/acl new file mode 100644 index 0000000..9d5d042 --- /dev/null +++ b/c++-mode/acl @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: accumulate +# key: acl +# -- +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..6e885bc --- /dev/null +++ b/c++-mode/acm @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: accumulate +# key: acm +# -- +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..105419e --- /dev/null +++ b/c++-mode/ajf @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: adjacent_find +# key: ajf +# -- +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..f16ad54 --- /dev/null +++ b/c++-mode/alo @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: all_of +# key: alo +# -- +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..36e017f --- /dev/null +++ b/c++-mode/ano @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: any_of +# key: ano +# -- +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..e8694d2 --- /dev/null +++ b/c++-mode/cni @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: count_if +# key: cni +# -- +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..0004798 --- /dev/null +++ b/c++-mode/cnt @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: count +# key: cnt +# -- +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..0ca826c --- /dev/null +++ b/c++-mode/cpb @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: copy_backward +# key: cpb +# -- +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..4c17712 --- /dev/null +++ b/c++-mode/cpi @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: copy_if +# key: cpi +# -- +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..a96996e --- /dev/null +++ b/c++-mode/cpn @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: copy_n +# key: cpn +# -- +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..14b36b6 --- /dev/null +++ b/c++-mode/cpy @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: copy +# key: cpy +# -- +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..01368cc --- /dev/null +++ b/c++-mode/eql @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: equal +# key: eql +# -- +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..16b8f36 --- /dev/null +++ b/c++-mode/erm @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: remove +# key: erm +# -- +${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..36c6894 --- /dev/null +++ b/c++-mode/ffo @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: find_first_of +# key: ffo +# -- +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..12d065a --- /dev/null +++ b/c++-mode/fil @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: fill +# key: fil +# -- +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..41eaf6c --- /dev/null +++ b/c++-mode/fin @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: find_if_not +# key: fin +# -- +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..ef2028a --- /dev/null +++ b/c++-mode/fln @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: fill_n +# key: fln +# -- +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..6009138 --- /dev/null +++ b/c++-mode/fnd @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: find +# key: fnd +# -- +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..7f27e7a --- /dev/null +++ b/c++-mode/fne @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: find_end +# key: fne +# -- +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..de0a6e8 --- /dev/null +++ b/c++-mode/fni @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: find_if +# key: fni +# -- +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..09d1a78 --- /dev/null +++ b/c++-mode/fre @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: for_each +# key: fre +# -- +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..b3b74b5 --- /dev/null +++ b/c++-mode/gnn @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: generate_n +# key: gnn +# -- +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..e48e7c1 --- /dev/null +++ b/c++-mode/gnr @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: generate +# key: gnr +# -- +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..bf975b9 --- /dev/null +++ b/c++-mode/ihp @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: is_heap +# key: ihp +# -- +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..765508e --- /dev/null +++ b/c++-mode/ihu @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: is_heap_until +# key: ihu +# -- +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..c7ffd71 --- /dev/null +++ b/c++-mode/ipr @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: is_permutation +# key: ipr +# -- +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..b7a1509 --- /dev/null +++ b/c++-mode/ipt @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: is_partitioned +# key: ipt +# -- +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..11c4cf0 --- /dev/null +++ b/c++-mode/iss @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: is_sorted +# key: iss +# -- +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..0c443ff --- /dev/null +++ b/c++-mode/isu @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: is_sorted_until +# key: isu +# -- +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..45da1bc --- /dev/null +++ b/c++-mode/ita @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: iota +# key: ita +# -- +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..1aec200 --- /dev/null +++ b/c++-mode/ltr @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: transform +# key: ltr +# -- +${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..4736a05 --- /dev/null +++ b/c++-mode/lwr @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: transform +# key: lwr +# -- +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..d60c1e5 --- /dev/null +++ b/c++-mode/lxc @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: lexigraphical_compare +# key: lxc +# -- +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..9d50614 --- /dev/null +++ b/c++-mode/mkh @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: make_heap +# key: mkh +# -- +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..e40fa07 --- /dev/null +++ b/c++-mode/mme @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: minmax_element +# key: mme +# -- +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..0491705 --- /dev/null +++ b/c++-mode/mne @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: min_element +# key: mne +# -- +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..4ca0b09 --- /dev/null +++ b/c++-mode/mpb @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: move_backward +# key: mpb +# -- +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..d6bbc71 --- /dev/null +++ b/c++-mode/mrg @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: merge +# key: mrg +# -- +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..6c729f6 --- /dev/null +++ b/c++-mode/msm @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: mismatch +# key: msm +# -- +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..a2ffea4 --- /dev/null +++ b/c++-mode/mxe @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: max_element +# key: mxe +# -- +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..4372782 --- /dev/null +++ b/c++-mode/nno @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: none_of +# key: nno +# -- +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..e0c0fba --- /dev/null +++ b/c++-mode/nth @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: nth_element +# key: nth +# -- +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..46ece1e --- /dev/null +++ b/c++-mode/nxp @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: next_permutation +# key: nxp +# -- +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..74ad7e5 --- /dev/null +++ b/c++-mode/oit @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: copy +# key: oit +# -- +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..4527265 --- /dev/null +++ b/c++-mode/phh @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: push_heap +# key: phh +# -- +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..fc05481 --- /dev/null +++ b/c++-mode/ppt @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: partition_point +# key: ppt +# -- +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..a94f0e9 --- /dev/null +++ b/c++-mode/prp @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: prev_permutation +# key: prp +# -- +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..ad8ff42 --- /dev/null +++ b/c++-mode/psc @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: partial_sort_copy +# key: psc +# -- +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..e7287e2 --- /dev/null +++ b/c++-mode/pst @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: partial_sort +# key: pst +# -- +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..dcd7e38 --- /dev/null +++ b/c++-mode/ptc @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: partition_copy +# key: ptc +# -- +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..44f3c42 --- /dev/null +++ b/c++-mode/ptn @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: partition +# key: ptn +# -- +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..1149255 --- /dev/null +++ b/c++-mode/rci @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: replace_copy_if +# key: rci +# -- +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..681c10b --- /dev/null +++ b/c++-mode/rmc @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: remove_copy +# key: rmc +# -- +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..c1713ff --- /dev/null +++ b/c++-mode/rmf @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: remove_copy_if +# key: rmf +# -- +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..c78f926 --- /dev/null +++ b/c++-mode/rmi @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: remove_if +# key: rmi +# -- +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..01fa9f9 --- /dev/null +++ b/c++-mode/rmv @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: remove +# key: rmv +# -- +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..a4116f1 --- /dev/null +++ b/c++-mode/rpc @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: replace_copy +# key: rpc +# -- +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..bc96c47 --- /dev/null +++ b/c++-mode/rpi @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: replace_if +# key: rpi +# -- +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..9badf4b --- /dev/null +++ b/c++-mode/rpl @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: replace +# key: rpl +# -- +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..373f85d --- /dev/null +++ b/c++-mode/rtc @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: rotate_copy +# key: rtc +# -- +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..a098782 --- /dev/null +++ b/c++-mode/rte @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: rotate +# key: rte +# -- +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..2e4618d --- /dev/null +++ b/c++-mode/rvc @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: reverse_copy +# key: rvc +# -- +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..71d00c5 --- /dev/null +++ b/c++-mode/rvr @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: reverse +# key: rvr +# -- +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..ef7adb1 --- /dev/null +++ b/c++-mode/shf @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: random_shuffle +# key: shf +# -- +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..40ef2c8 --- /dev/null +++ b/c++-mode/spt @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: stable_partition +# key: spt +# -- +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..2c9df59 --- /dev/null +++ b/c++-mode/srh @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: search +# key: srh +# -- +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..c7d929d --- /dev/null +++ b/c++-mode/srn @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: search_n +# key: srn +# -- +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..8d44cfd --- /dev/null +++ b/c++-mode/srt @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: sort +# key: srt +# -- +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..c8e6fb1 --- /dev/null +++ b/c++-mode/sth @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: sort_heap +# key: sth +# -- +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..37a2182 --- /dev/null +++ b/c++-mode/sti @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: cin +# key: sti +# -- +std::cin >> +$0 diff --git a/c++-mode/sto b/c++-mode/sto new file mode 100644 index 0000000..30db50b --- /dev/null +++ b/c++-mode/sto @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: cout +# key: sto +# -- +std::cout << +$0 diff --git a/c++-mode/sts b/c++-mode/sts new file mode 100644 index 0000000..a5c4d12 --- /dev/null +++ b/c++-mode/sts @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: stable_sort +# key: sts +# -- +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..1354c3d --- /dev/null +++ b/c++-mode/stv @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: vector +# key: stv +# -- +std::vector<$2> $3 +$0 diff --git a/c++-mode/swr b/c++-mode/swr new file mode 100644 index 0000000..9357578 --- /dev/null +++ b/c++-mode/swr @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: swap_ranges +# key: swr +# -- +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..12d4881 --- /dev/null +++ b/c++-mode/tfm @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: transform +# key: tfm +# -- +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..d7ffea1 --- /dev/null +++ b/c++-mode/trm @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: generate_n +# key: trm +# -- +${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..1dc71ff --- /dev/null +++ b/c++-mode/ucp @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: unique_copy +# key: ucp +# -- +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..8c9e0f8 --- /dev/null +++ b/c++-mode/upr @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: transform +# key: upr +# -- +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..c35ff16 --- /dev/null +++ b/c++-mode/uqe @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: unique +# key: uqe +# -- +auto pos = std::unique(std::begin(${1:container}), std::end($1)); +$0 |