Commit Graph

102 Commits

Author SHA1 Message Date
Ebrahim Byagowi 2dda6dd744 minor, tweak spacing
turn 8 spaces to tab, add space before Null/Crap
2020-04-20 16:18:29 +04:30
Ebrahim Byagowi 0558413f27 Minor, tweak spaces 2019-10-01 13:50:11 +03:30
Behdad Esfahbod 67ec9fa9e4 [iter] Add hb_chop() 2019-08-31 14:51:49 -05:00
Behdad Esfahbod 398b296f3b [iter] Add hb_len() 2019-08-31 12:44:24 -05:00
Behdad Esfahbod 875131d478 [iter] Add hb_take() 2019-08-31 12:42:52 -05:00
Behdad Esfahbod 1f88dae9f5 [iter] Make iota() accept invokable for increasing to next item 2019-08-31 12:24:56 -05:00
Behdad Esfahbod b1378d8a21 [iter] Add hb_repeat() 2019-08-31 12:24:56 -05:00
Behdad Esfahbod 78d35f0e78 Reduce captures of lambdas 2019-05-15 18:15:05 -07:00
Behdad Esfahbod d0df996cdc Use implicit lambda return type 2019-05-15 00:32:41 -07:00
Behdad Esfahbod 606841b070 [iter] Check for more before forwarding/rewinding past ends 2019-05-11 11:56:26 -07:00
Behdad Esfahbod ed972d5d73 [iter] Rewrite test functions
Notably, add hb_is_source_of(,) and hb_is_sink_of(,) to replace most
uses of hb_is_iterator_of(,).
2019-05-09 16:58:28 -07:00
Behdad Esfahbod c9b287a867 Add hb_lidentity(), and rename hb_rvalue() to hb_ridentity() 2019-05-09 12:43:57 -07:00
Behdad Esfahbod 57d545932f [test-iter] Don't walk past end
That's not legal.
2019-05-09 11:31:13 -07:00
Behdad Esfahbod 2c24ea37b1 [iter] Take start value in hb_enumerate()
Also rewrite it via composition.
2019-05-09 11:31:13 -07:00
Behdad Esfahbod 7675d0d3a6 [iter] Add hb_range()
hb_range() is like Python range.  hb_iota() has slightly different API.
Ie. it takes a start, instead of end.
2019-05-09 11:31:13 -07:00
Behdad Esfahbod afb013f350 Fix msan issue
hb_identity returns rvalue-reference if input is rvalue.  That, can leak
the reference and cause in bad access to temporaries after they are
destructed.  This is unfortunately unfixable given the desired
transparency of hb_identity :(.  Just don't use it with hb_map().
2019-05-08 16:16:43 -07:00
Behdad Esfahbod a304827184 [map] Add .values() iterator 2019-05-08 15:08:33 -07:00
Behdad Esfahbod f5705d7656 Whitespace 2019-05-08 15:08:33 -07:00
rsheeter b827181ba1 [map] tweak test-iter.cc 2019-05-08 15:08:33 -07:00
rsheeter 492af0f1bf [map] add keys() 2019-05-08 15:08:33 -07:00
rsheeter ba60512813 [map] add a test for iteration 2019-05-08 15:08:33 -07:00
Behdad Esfahbod cdb61eb043 [iter] Accept pointer in hb_iter() and hb_iter_t() 2019-05-08 11:00:18 -07:00
Behdad Esfahbod c93eeba9b2 [iter] Accept pointer in hb_map() 2019-05-08 10:56:09 -07:00
Behdad Esfahbod 50dc3e7d9f Add hb_iota() 2019-05-08 10:35:02 -07:00
Behdad Esfahbod 8479eb5955 [iter] Fix hb_sink() to accept rvalue 2019-05-08 09:48:55 -07:00
Behdad Esfahbod fe14a4000a Adjust hb_all/any/none 2019-05-08 09:32:19 -07:00
Behdad Esfahbod bdbfdc92b5 [iter] Add value and projection to hb_all/any/none
Allows for eg, checking all values equal 2: hb_all (it, 2).
2019-05-07 23:02:44 -07:00
Behdad Esfahbod cf61acb9ea [iter] Accept rvalues to hb_enumerate() 2019-05-07 22:45:01 -07:00
Behdad Esfahbod af571dbffc [meta] Replace most hb_enable_if with hb_requires
They do absolutely same thing.  hb_requires is to encode constraints,
whereas hb_enable_if is for more conditional enabling.
2019-05-07 21:39:20 -07:00
Behdad Esfahbod 025eaa3c81 [iter] Make filter/map copyable 2019-05-07 00:05:37 -07:00
Behdad Esfahbod 4c2fd05ca5 [iter] Implement range-based for loops
Part of https://github.com/harfbuzz/harfbuzz/issues/1648
2019-05-06 19:57:35 -07:00
Ebrahim Byagowi 92588782d7
Remove space between right angle brackets now that we have C++11 (#1689) 2019-04-30 13:05:10 -07:00
Behdad Esfahbod 59a8fa5353 [iter] Add tests for casting to hb_iter_t<> base class for hb_sorted_array_t<>
Something's phishy about hb_sorted_array_t<>.  Can't get it work nicely with
change I'm making.  Ugh..
2019-04-24 12:49:58 -04:00
Behdad Esfahbod 12017db0bf Move test code around 2019-04-24 09:24:38 -04:00
Ebrahim Byagowi 64ca2ffa4c
Fix clang's -Wmain complain (#1678) 2019-04-23 01:10:46 -07:00
Behdad Esfahbod 25dd88efc6 Err, fix hb_invoke() variadic 2019-04-22 17:47:07 -04:00
Behdad Esfahbod 42ab32cbba [iter] Remove passing pointer to hb_iter()
While doable with hb_deref_pointer() as well, we also would then
need to do it in a ton of places.  Not worth it / messy.
2019-04-02 18:42:51 -07:00
Behdad Esfahbod b6f29bf141 [iter] Accept pointers in hb_iter()
No idea how to avoid dupicating code.  Was hoping hb_deref_pointer()
would do it, but looks like a pointer can't bind to a universal
reference T&&.  Humm.
2019-04-02 18:12:01 -07:00
Ebrahim Byagowi edad6b2c45
[test][iter] minor, fix double promotion warning 2019-04-03 00:48:59 +04:30
Ebrahim Byagowi 062f5d6e7a
[test] minor, c style comments 2019-04-02 20:27:00 +04:30
Ebrahim Byagowi afdbf960d6
[iter][test] Add another test for hb_reduce
Different initial and accumulator types
2019-04-02 20:25:06 +04:30
Ebrahim Byagowi b8642087e6 [iter] hb_reduce, accumulator with a different type 2019-04-01 16:56:29 -07:00
Ebrahim Byagowi e526414c75 [iter] Implement hb_reduce 2019-04-01 16:56:29 -07:00
Behdad Esfahbod 78fc43f293 [iter] Fix up build, ouch
Yeah, some things not very clear...
2019-03-31 19:17:07 -07:00
Behdad Esfahbod e530692799 [iter] Fix bug in hb_any() and hb_none() 2019-03-29 23:31:39 -07:00
Behdad Esfahbod 443db2a246 [iter] Remove hb_len()
Not planning on using it.  So remove.  Can add later if needed.
2019-03-29 10:47:13 -07:00
Behdad Esfahbod f639b9a8ea [iter] Add hb_len() function-object 2019-03-28 21:34:47 -07:00
Behdad Esfahbod 77060bcda2 [iter] Add hb_all, hb_any, hb_none 2019-02-15 16:55:08 -08:00
Behdad Esfahbod fa35d3fd81 [iter] Add hb_drain 2019-02-14 14:04:05 -08:00
Behdad Esfahbod 773d75637c [iter] Add hb_apply() 2019-02-14 11:40:22 -08:00