Aleph-w  1.9
General library for algorithms and data structures
ah-dry.H
1 
2 /* Aleph-w
3 
4  / \ | | ___ _ __ | |__ __ __
5  / _ \ | |/ _ \ '_ \| '_ \ ____\ \ /\ / / Data structures & Algorithms
6  / ___ \| | __/ |_) | | | |_____\ V V / version 1.9b
7  /_/ \_\_|\___| .__/|_| |_| \_/\_/ https://github.com/lrleon/Aleph-w
8  |_|
9 
10  This file is part of Aleph-w library
11 
12  Copyright (c) 2002-2018 Leandro Rabindranath Leon & Alejandro Mujica
13 
14  This program is free software: you can redistribute it and/or modify
15  it under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  This program is distributed in the hope that it will be useful, but
20  WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  General Public License for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with this program. If not, see <https://www.gnu.org/licenses/>.
26 */
27 
28 # ifndef AH_DRY_H
29 # define AH_DRY_H
30 
31 # include "ahFunctional.H"
32 
44 template <class Container>
46 {
66  template <class Operation>
67  bool traverse(Operation & operation) noexcept(noexcept(operation))
68  {
69  for (typename Container::Iterator it(*static_cast<Container*>(this));
70  it.has_curr(); it.next_ne())
71  if (not operation(it.get_curr_ne()))
72  return false;
73  return true;
74  }
75 
77  template <class Operation>
78  bool traverse(Operation & operation) const noexcept(noexcept(operation))
79  {
80  return const_cast<GenericTraverse*>(this)->traverse<Operation>(operation);
81  }
82 
84  template <class Operation>
85  bool traverse(Operation && operation) const noexcept(noexcept(operation))
86  {
87  return traverse<Operation>(operation);
88  }
89 
91  template <class Operation>
92  bool traverse(Operation && operation) noexcept(noexcept(operation))
93  {
94  return traverse<Operation>(operation);
95  }
96 };
97 
98 template <class Container, class Operation>
99 bool traverse(const Container & c, Operation & op)
100 {
101  return c.traverse(op);
102 }
103 
104 template <class Container, class Operation>
105 bool traverse(const Container & c, Operation && op = Operation())
106 {
107  return traverse<Container, Operation>(c, op);
108 }
109 
132 template <class Container, typename Type>
134 {
135  Container * me() noexcept { return static_cast<Container*>(this); }
136 
137  const Container * const_me() const noexcept
138  {
139  return static_cast<const Container*>(this);
140  }
141 
142  LocateFunctions<Container, Type> * base() const
143  {
144  return const_cast<LocateFunctions*>(this);
145  }
146 
147 public:
148 
151  auto get_it() const
152  {
153  auto ret = typename Container::Iterator(*const_me());
154  return ret;
155  }
156 
159  auto get_it(size_t pos) const
160  {
161  auto ret = typename Container::Iterator(*const_me());
162  for (size_t i = 0; i < pos; ++i)
163  ret.next();
164  return ret;
165  }
166 
168  auto get_itor() const { return get_it(); }
169 
170  Type & nth_ne(const size_t n) noexcept
171  {
172  Type * ptr = nullptr;
173  size_t i = 0;
174  me()->traverse([&ptr, &i, &n] (Type & item)
175  {
176  if (i++ < n)
177  return true;
178  ptr = &item;
179  return false;
180  });
181  return *ptr;
182  }
183 
185  const Type & nth_ne(const size_t n) const noexcept
186  {
187  return base()->nth_ne(n);
188  }
189 
206  Type & nth(const size_t n)
207  {
208  Type * ptr = nullptr;
209  size_t i = 0;
210  me()->traverse([&ptr, &i, &n] (Type & item)
211  {
212  if (i++ < n)
213  return true;
214  ptr = &item;
215  return false;
216  });
217 
218  if (i != n + 1)
219  throw std::out_of_range("index out of range");
220 
221  return *ptr;
222  }
223 
225  const Type & nth(const size_t n) const
226  {
227  return base()->nth(n);
228  }
229 
252  template <class Operation>
253  Type * find_ptr(Operation & operation) noexcept(noexcept(operation))
254  {
255  Type * ptr = nullptr;
256  me()->traverse([&ptr,&operation] (Type & item)
257  {
258  if (operation(item))
259  {
260  ptr = &item;
261  return false;
262  }
263  return true;
264  });
265  return ptr;
266  }
267 
269  template <class Operation>
270  const Type * find_ptr(Operation & operation) const
271  noexcept(noexcept(operation))
272  {
273  return base()->find_ptr(operation);
274  }
275 
277  template <class Operation>
278  const Type * find_ptr(Operation && operation) const
279  noexcept(noexcept(operation))
280  {
281  return find_ptr<Operation>(operation);
282  }
283 
285  template <class Operation>
286  Type * find_ptr(Operation && operation) noexcept(noexcept(operation))
287  {
288  return find_ptr(operation);
289  }
290 
313  template <class Operation>
314  size_t find_index(Operation & operation) const noexcept(noexcept(operation))
315  {
316  size_t i = 0;
317  const_me()->traverse([&i,&operation] (Type & item)
318  {
319  if (operation(item))
320  return false;
321  ++i;
322  return true;
323  });
324  return i;
325  }
326 
328  template <class Operation>
329  size_t find_index(Operation && operation) const noexcept(noexcept(operation))
330  {
331  return find_index<Operation>(operation);
332  }
333 
354  template <class Operation>
355  std::tuple<bool, Type> find_item(Operation & operation)
356  noexcept(noexcept(operation))
357  {
358  using TT = std::tuple<bool, Type>;
359  auto ptr = find_ptr(operation);
360  return ptr ? TT(true, *ptr) : TT(false, Type());
361  }
362 
364  template <class Operation>
365  std::tuple<bool, Type> find_item(Operation & operation) const
366  noexcept(noexcept(operation))
367  {
368  using TT = std::tuple<bool, Type>;
369  auto ptr = find_ptr(operation);
370  return ptr ? TT(true, *ptr) : TT(false, Type());
371  }
372 
374  template <class Operation>
375  std::tuple<bool, Type> find_item(Operation && operation)
376  noexcept(noexcept(operation))
377  {
378  return find_item(operation);
379  }
380 
382  template <class Operation>
383  std::tuple<bool, Type> find_item(Operation && operation) const
384  noexcept(noexcept(operation))
385  {
386  return find_item(operation);
387  }
388 };
389 
405 template <class Container, typename T>
407 {
408  SpecialCtors() {}
409 
410  SpecialCtors(const SpecialCtors&) {}
411 
413 
414  SpecialCtors & operator = (const SpecialCtors&) { return *this; }
415 
416  SpecialCtors & operator = (SpecialCtors&&) { return *this; }
417 
420  {
421  l.for_each([this] (const T & item)
422  {
423  static_cast<Container*>(this)->append(item);
424  });
425  }
426 
427  template <class It>
428  SpecialCtors(It b, It e)
429  {
430  for (It it = b; it != e; ++it)
431  static_cast<Container*>(this)->append(*it);
432  }
433 
434  SpecialCtors(std::initializer_list<T> l)
435  {
436  for (const auto & item : l)
437  static_cast<Container*>(this)->append(item);
438  }
439 };
440 
441 
449 template <class Container, typename T>
451 {
452  Container * me() { return static_cast<Container*>(this); }
453 
454  FunctionalMethods<Container, T> * base() const noexcept
455  {
456  return const_cast<FunctionalMethods<Container, T>*>(this);
457  }
458 
459  const Container * const_me() const noexcept
460  {
461  return static_cast<const Container*>(this);
462  }
463 
464 public:
465 
484  template <typename ...Args>
485  void emplace(Args && ... args)
486  {
487  me()->append(T(args...));
488  }
489 
491  template <typename ...Args>
492  void emplace_end(Args && ... args)
493  {
494  me()->append(T(args...));
495  }
496 
515  template <typename ...Args>
516  void emplace_ins(Args && ... args)
517  {
518  me()->insert(T(args...));
519  }
520 
521 private:
522 
523  void nninsert(size_t&) {}
524  void nnappend(size_t&) {}
525 
526  template <typename ... Args>
527  void nninsert(size_t & n, const T & item, Args & ... args)
528  {
529  me()->insert(item);
530  ++n;
531  nninsert(n, args...);
532  }
533 
534  template <typename ... Args>
535  void nnappend(size_t & n, const T & item, Args & ... args)
536  {
537  me()->append(item);
538  ++n;
539  nnappend(n, args...);
540  }
541 
542 public:
543 
549  template <typename ... Args>
550  size_t ninsert(Args ... args)
551  {
552  size_t n = 0;
553  nninsert(n, args...);
554  return n;
555  }
556 
562  template <typename ... Args>
563  size_t nappend(Args ... args)
564  {
565  size_t n = 0;
566  nnappend(n, args...);
567  return n;
568  }
569 
588  template <class Operation>
589  void for_each(Operation & operation) noexcept(noexcept(operation))
590  {
591  me()->traverse([&operation] (const T & item)
592  {
593  operation(item);
594  return true;
595  });
596  }
597 
599  template <class Operation>
600  void for_each(Operation & operation) const noexcept(noexcept(operation))
601  {
602  base()->for_each(operation);
603  }
604 
606  template <class Operation>
607  void for_each(Operation && operation) const noexcept(noexcept(operation))
608  {
609  for_each(operation);
610  }
611 
613  template <class Operation>
614  void for_each(Operation && operation) noexcept(noexcept(operation))
615  {
616  for_each(operation);
617  }
618 
620  template <class Operation>
621  void each(Operation & operation) noexcept(noexcept(operation))
622  {
623  for_each(operation);
624  }
625 
627  template <class Operation>
628  void each(Operation & operation) const noexcept(noexcept(operation))
629  {
630  for_each(operation);
631  }
632 
634  template <class Operation>
635  void each(Operation && operation) const noexcept(noexcept(operation))
636  {
637  for_each(operation);
638  }
639 
641  template <class Operation>
642  void each(Operation && operation) noexcept(noexcept(operation))
643  {
644  for_each(operation);
645  }
646 
666  template <class Operation>
667  void each(size_t pos, size_t slice, Operation & operation) const
668  {
669  auto it = const_me()->get_it(pos);
670  for (size_t i = pos; true; i += slice)
671  {
672  operation(it.get_curr());
673  for (size_t k = 0; k < slice; ++k)
674  {
675  it.next();
676  if (not it.has_curr())
677  return;
678  }
679  }
680  }
681 
683  template <class Operation>
684  void each(size_t pos, size_t slice, Operation && operation) const
685  {
686  each(pos, slice, operation);
687  }
688 
689  template <class Operation>
690  void mutable_for_each(Operation & operation) noexcept(noexcept(operation))
691  {
692  me()->traverse([&operation] (T & item)
693  {
694  operation(item);
695  return true;
696  });
697  }
698 
700  template <class Operation>
701  void mutable_for_each(Operation && operation) noexcept(noexcept(operation))
702  {
703  mutable_for_each(operation);
704  }
705 
718  template <class Operation>
719  bool all(Operation & operation) const noexcept(noexcept(operation))
720  {
721  return const_me()->traverse(operation);
722  }
723 
725  template <class Operation>
726  bool all(Operation && operation) const noexcept(noexcept(operation))
727  {
728  return all(operation);
729  }
730 
744  template <class Operation>
745  bool exists(Operation & op) const noexcept(noexcept(op))
746  {
747  return not const_me()->
748  traverse([&op] (const T & i) { return not op(i); });
749  }
750 
752  template <class Operation>
753  bool exists(Operation && op) const noexcept(noexcept(op))
754  {
755  return exists(op);
756  }
757 
798  template <typename __T = T, class Operation = Dft_Map_Op<T, __T>>
799  DynList<__T> maps(Operation & op) const
800  {
801  DynList<__T> ret_val;
802  const_me()->for_each([&ret_val, &op] (const T & item)
803  {
804  ret_val.append(op(item));
805  });
806  return ret_val;
807  }
808 
810  template <typename __T = T, class Operation = Dft_Map_Op<__T, __T>>
811  DynList<__T> maps(Operation && op) const { return maps<__T, Operation>(op); }
812 
829  template <typename __T = T, class Prop, class Operation>
830  DynList<__T> maps_if(Prop prop, Operation & op) const
831  {
832  DynList<__T> ret_val;
833  const_me()->for_each([&ret_val, &prop, &op] (const T & item)
834  {
835  if (prop(item))
836  ret_val.append(op(item));
837  });
838  return ret_val;
839  }
840 
842  template <typename __T = T, class Prop, class Operation>
843  DynList<__T> maps_if(Prop prop, Operation && op) const
844  {
845  return maps<__T, Prop, Operation>(prop, op);
846  }
847 
848  DynList<T> to_dynlist() const
849  {
850  return maps([] (auto & item) { return item; });
851  }
852 
900  template <typename __T = T, class Op = Dft_Fold_Op<__T, T>>
901  __T foldl(const __T & init, Op & op) const noexcept(noexcept(op))
902  {
903  __T ret_val = init;
904  const_me()->for_each([&ret_val, &op] (const T & item)
905  {
906  ret_val = op(ret_val, item);
907  });
908  return ret_val;
909  }
910 
912  template <typename __T = T, class Op = Dft_Fold_Op<__T, T>>
913  __T foldl(const __T & init, Op && op = Op()) const noexcept(noexcept(op))
914  {
915  return foldl(init, op);
916  }
917 
923  template <class Operation>
924  T fold(const T & init, Operation & operation) const
925  noexcept(noexcept(operation))
926  {
927  auto ret_val = init;
928  const_me()->for_each([&ret_val, &operation] (const T & item)
929  {
930  ret_val = operation(ret_val, item);
931  });
932  return ret_val;
933  }
934 
936  template <class Operation>
937  T fold(const T & init, Operation && operation) const
938  noexcept(noexcept(operation))
939  {
940  return fold(init, operation);
941  }
942 
966  template <class Operation>
967  DynList<T> filter(Operation & operation) const
968  {
969  DynList<T> ret_val;
970  const_me()->for_each([&ret_val, &operation] (const T & item)
971  {
972  if (operation(item))
973  ret_val.append(item);
974  });
975  return ret_val;
976  }
977 
979  template <class Operation>
980  DynList<T> filter(Operation && operation) const
981  {
982  return filter(operation);
983  }
984 
1008  template <class Operation>
1009  DynList<const T*> ptr_filter(Operation & operation) const
1010  {
1011  DynList<const T*> ret_val;
1012  const_me()->for_each([&ret_val, &operation] (const T & item)
1013  {
1014  if (operation(item))
1015  ret_val.append(&item);
1016  });
1017  return ret_val;
1018  }
1019 
1020  template <class Operation>
1021  DynList<const T*> ptr_filter(Operation && operation) const
1022  {
1023  return ptr_filter(operation);
1024  }
1025 
1045  template <class Operation>
1046  DynList<std::tuple<T, size_t>> pfilter(Operation & operation) const
1047  {
1048  using TT = std::tuple<T, size_t>;
1049  DynList<TT> ret_val;
1050  size_t i = 0;
1051  const_me()->for_each([&ret_val, &operation, &i] (const T & item)
1052  {
1053  if (operation(item))
1054  ret_val.append(TT(item, i));
1055  ++i;
1056  });
1057  return ret_val;
1058  }
1059 
1061  template <class Operation>
1062  DynList<std::tuple<T, size_t>> pfilter(Operation && operation) const
1063  {
1064  return pfilter(operation);
1065  }
1066 
1084  template <class Operation>
1085  std::pair<DynList<T>, DynList<T>> partition(Operation & op) const
1086  {
1087  std::pair<DynList<T>, DynList<T>> ret_val;
1088  const_me()->for_each([&ret_val, &op] (const T & item)
1089  {
1090  if (op(item))
1091  ret_val.first.append(item);
1092  else
1093  ret_val.second.append(item);
1094  });
1095  return ret_val;
1096  }
1097 
1099  template <class Operation>
1100  std::pair<DynList<T>, DynList<T>> partition(Operation && op) const
1101  {
1102  return partition(op);
1103  }
1104 
1115  template <class Operation>
1116  std::pair<DynList<T>, DynList<T>> partition(size_t n) const
1117  {
1118  size_t i = 0;
1119  std::pair<DynList<T>, DynList<T>> ret_val;
1120  const_me()->for_each([&ret_val, &i, n] (const T & item)
1121  {
1122  if (i++ < n)
1123  ret_val.first.append(item);
1124  else
1125  ret_val.second.append(item);
1126  });
1127  return ret_val;
1128  }
1129 
1143  template <class Operation>
1144  std::tuple<DynList<T>, DynList<T>> tpartition(Operation & op) const
1145  {
1146  DynList<T> r1, r2;
1147  const_me()->for_each([&r1, &r2, &op] (const T & item)
1148  {
1149  if (op(item))
1150  r1.append(item);
1151  else
1152  r2.append(item);
1153  });
1154  return std::tuple<DynList<T>, DynList<T>>(r1, r2);
1155  }
1156 
1158  template <class Operation>
1159  std::tuple<DynList<T>, DynList<T>> tpartition(Operation && op) const
1160  {
1161  return partition(op);
1162  }
1163 
1175  size_t length() const noexcept
1176  {
1177  size_t count = 0;
1178  const_me()->for_each([&count] (const T &) { ++count; });
1179  return count;
1180  }
1181 
1189  DynList<T> rev() const
1190  {
1191  DynList<T> ret;
1192  const_me()->for_each([&ret] (const T & i) { ret.insert(i); });
1193  return ret;
1194  }
1195 
1208  DynList<T> take(const size_t n) const
1209  {
1210  size_t i = 0;
1211  DynList<T> ret;
1212  const_me()->traverse([&i, &ret, n] (const T & item)
1213  {
1214  if (i++ >= n)
1215  return false;
1216  ret.append(item);
1217  return true;
1218  });
1219  return ret;
1220  }
1221 
1234  DynList<T> take(size_t i, size_t j, size_t step = 1) const
1235  {
1236  DynList<T> ret;
1237  if (step == 0)
1238  return ret;
1239  for (auto it = const_me()->get_it(i); i <= j and it.has_curr();
1240  it.next_ne(), i += step)
1241  ret.append(it.get_curr_ne());
1242  return ret;
1243  }
1244 
1257  DynList<T> drop(const size_t n) const
1258  {
1259  size_t i = 0;
1260  DynList<T> ret;
1261  const_me()->traverse([&i, &ret, n] (const T & item)
1262  {
1263  if (i++ >= n)
1264  ret.append(item);
1265  return true;
1266  });
1267  return ret;
1268  }
1269 
1278  void mutable_drop(size_t n)
1279  {
1280  for (size_t i = 0; i < n; ++i)
1281  me()->remove();
1282  }
1283 };
1284 
1289 template <class Container, typename T>
1291 {
1300  {
1301  return static_cast<const Container*>(this)->
1302  Container::template maps<T> ([] (const T & key) { return key; });
1303  }
1304 
1306  DynList<T> keys() const { return items(); }
1307 };
1308 
1309 
1314 template <class Container, typename T>
1316 
1317 
1322 template <class Container>
1324 {
1325  const Container * const_me() const
1326  {
1327  return static_cast<const Container*>(this);
1328  }
1329 
1330 public:
1331 
1350  bool equal_to(const Container & r) const noexcept
1351  {
1352  if (this == &r)
1353  return true;
1354 
1355  if (const_me()->size() != r.size())
1356  return false;
1357 
1358  return const_me()->all([&r] (const typename Container::Key_Type & k)
1359  { return r.search(k) != nullptr; });
1360  }
1361 
1363  bool operator == (const Container & r) const noexcept
1364  {
1365  return equal_to(r);
1366  }
1367 
1369  bool operator != (const Container & r) const noexcept
1370  {
1371  return not equal_to(r);
1372  }
1373 };
1374 
1379 template <class Container, typename Key, typename Data>
1381 {
1382  const Container * const_me() const
1383  {
1384  return static_cast<const Container*>(this);
1385  }
1386 
1387 public:
1388 
1402  template <template <typename> class C = DynList>
1403  C<Key> keys() const
1404  {
1405  C<Key> ret_val;
1406  const_me()->for_each([&ret_val] (const Key & p)
1407  {
1408  ret_val.append(p.first);
1409  });
1410  return ret_val;
1411  }
1412 
1426  template <template <typename> class C = DynList>
1427  C<Data> values() const
1428  {
1429  C<Data> ret_val;
1430  const_me()->for_each([&ret_val] (const std::pair<Key, Data> & p)
1431  {
1432  ret_val.append(p.second);
1433  });
1434  return ret_val;
1435  }
1436 
1452  template <template <typename> class C = DynList>
1453  C<Data*> values_ptr() const
1454  {
1455  C<Data*> ret_val;
1456  const_me()->for_each([&ret_val] (std::pair<Key, Data> & p)
1457  { ret_val.append(&p.second); });
1458  return ret_val;
1459  }
1460 
1470  template <template <typename> class C = DynList>
1471  C<std::pair<Key, Data>> items() const
1472  {
1473  C<std::pair<Key, Data>> ret;
1474  const_me()->for_each([&ret] (std::pair<Key, Data> & p) { ret.append(p); });
1475  return ret;
1476  }
1477 
1489  template <template <typename> class C = DynList>
1490  C<std::pair<Key, Data*>> items_ptr() const
1491  {
1492  C<Data> ret_val;
1493  const_me()->for_each([&ret_val] (std::pair<Key, Data> & p)
1494  {
1495  ret_val.append(std::pair<Key,Data*>(p.first,
1496  p.second));
1497  });
1498  return ret_val;
1499  }
1500 
1506  Data & operator () (const Key & key)
1507  {
1508  return this->find(key);
1509  }
1510 
1516  const Data & operator () (const Key & key) const
1517  {
1518  return this->find(key);
1519  }
1520 };
1521 
1522 
1523 
1524 # endif // AH_DRY_H
size_t length() const noexcept
Definition: ah-dry.H:1175
std::tuple< bool, Type > find_item(Operation &operation) noexcept(noexcept(operation))
Definition: ah-dry.H:355
const Type * find_ptr(Operation &&operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:278
C< std::pair< Key, Data * > > items_ptr() const
Definition: ah-dry.H:1490
Definition: ah-dry.H:406
__T foldl(const __T &init, Op &op) const noexcept(noexcept(op))
Definition: ah-dry.H:901
size_t ninsert(Args ... args)
Definition: ah-dry.H:550
DynList< T > items() const
Definition: ah-dry.H:1299
Definition: ah-dry.H:1323
DynList< T > drop(const size_t n) const
Definition: ah-dry.H:1257
C< Key > keys() const
Definition: ah-dry.H:1403
void for_each(Operation &&operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:607
DynList< std::tuple< T, size_t > > pfilter(Operation &&operation) const
Definition: ah-dry.H:1062
void emplace(Args &&... args)
Definition: ah-dry.H:485
bool traverse(Operation &&operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:85
auto get_it() const
Definition: ah-dry.H:151
SpecialCtors(const DynList< T > &l)
Build the container by inserting all item of list l
Definition: ah-dry.H:419
const Type & nth(const size_t n) const
Definition: ah-dry.H:225
bool exists(Operation &op) const noexcept(noexcept(op))
Definition: ah-dry.H:745
void for_each(Operation &&operation) noexcept(noexcept(operation))
Definition: ah-dry.H:614
void emplace_end(Args &&... args)
Definition: ah-dry.H:492
void mutable_drop(size_t n)
Definition: ah-dry.H:1278
auto get_it(size_t pos) const
Definition: ah-dry.H:159
void for_each(Operation &operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:600
Definition: ah-dry.H:45
DynList< T > filter(Operation &&operation) const
Definition: ah-dry.H:980
const Type * find_ptr(Operation &operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:270
void each(Operation &&operation) noexcept(noexcept(operation))
Definition: ah-dry.H:642
Type & nth(const size_t n)
Definition: ah-dry.H:206
size_t nappend(Args ... args)
Definition: ah-dry.H:563
void mutable_for_each(Operation &&operation) noexcept(noexcept(operation))
Definition: ah-dry.H:701
bool equal_to(const Container &r) const noexcept
Definition: ah-dry.H:1350
bool all(Operation &operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:719
void each(size_t pos, size_t slice, Operation &operation) const
Definition: ah-dry.H:667
size_t find_index(Operation &operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:314
auto get_itor() const
Definition: ah-dry.H:168
void each(Operation &operation) noexcept(noexcept(operation))
Definition: ah-dry.H:621
void for_each(Operation &operation) noexcept(noexcept(operation))
Definition: ah-dry.H:589
Recorre condicionalmente el contenedor y ejecuta una operation mientras ésta retorne true...
DynList< std::tuple< T, size_t > > pfilter(Operation &operation) const
Definition: ah-dry.H:1046
std::tuple< bool, Type > find_item(Operation &&operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:383
void each(size_t pos, size_t slice, Operation &&operation) const
Definition: ah-dry.H:684
bool exists(Operation &&op) const noexcept(noexcept(op))
Definition: ah-dry.H:753
std::tuple< bool, Type > find_item(Operation &operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:365
T fold(const T &init, Operation &operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:924
DynList< __T > maps(Operation &op) const
Definition: ah-dry.H:799
DynList< __T > maps_if(Prop prop, Operation &&op) const
Definition: ah-dry.H:843
Type * find_ptr(Operation &operation) noexcept(noexcept(operation))
Definition: ah-dry.H:253
Definition: ah-dry.H:1290
void each(Operation &&operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:635
std::tuple< DynList< T >, DynList< T > > tpartition(Operation &op) const
Definition: ah-dry.H:1144
std::pair< DynList< T >, DynList< T > > partition(Operation &op) const
Definition: ah-dry.H:1085
void emplace_ins(Args &&... args)
Definition: ah-dry.H:516
std::pair< DynList< T >, DynList< T > > partition(size_t n) const
Definition: ah-dry.H:1116
bool traverse(Operation &operation) noexcept(noexcept(operation))
Definition: ah-dry.H:67
Definition: ah-dry.H:133
C< std::pair< Key, Data > > items() const
Definition: ah-dry.H:1471
__T foldl(const __T &init, Op &&op=Op()) const noexcept(noexcept(op))
Definition: ah-dry.H:913
DynList< T > rev() const
Definition: ah-dry.H:1189
DynList< __T > maps(Operation &&op) const
Definition: ah-dry.H:811
const Type & nth_ne(const size_t n) const noexcept
Definition: ah-dry.H:185
std::tuple< DynList< T >, DynList< T > > tpartition(Operation &&op) const
Definition: ah-dry.H:1159
void each(Operation &operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:628
size_t find_index(Operation &&operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:329
std::tuple< bool, Type > find_item(Operation &&operation) noexcept(noexcept(operation))
Definition: ah-dry.H:375
C< Data * > values_ptr() const
Definition: ah-dry.H:1453
DynList< T > keys() const
Definition: ah-dry.H:1306
bool traverse(Operation &operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:78
T fold(const T &init, Operation &&operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:937
Definition: ah-dry.H:1380
std::pair< DynList< T >, DynList< T > > partition(Operation &&op) const
Definition: ah-dry.H:1100
Type * find_ptr(Operation &&operation) noexcept(noexcept(operation))
Definition: ah-dry.H:286
DynList< T > take(const size_t n) const
Definition: ah-dry.H:1208
DynList< const T * > ptr_filter(Operation &operation) const
Definition: ah-dry.H:1009
C< Data > values() const
Definition: ah-dry.H:1427
bool all(Operation &&operation) const noexcept(noexcept(operation))
Definition: ah-dry.H:726
DynList< __T > maps_if(Prop prop, Operation &op) const
Definition: ah-dry.H:830
DynList< T > take(size_t i, size_t j, size_t step=1) const
Definition: ah-dry.H:1234
bool traverse(Operation &&operation) noexcept(noexcept(operation))
Definition: ah-dry.H:92
DynList< T > filter(Operation &operation) const
Definition: ah-dry.H:967
Definition: ah-dry.H:450

Leandro Rabindranath León