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
966a18b92a
[iter] Remove some &&
2019-08-31 12:24:56 -05:00
Behdad Esfahbod
de45775c37
[iter] Use hb_ridentity instead of lazy +
2019-08-31 12:24:56 -05:00
Behdad Esfahbod
ce4d63beec
[iter] Separate hb_iota implementation from hb_range
2019-08-31 12:24:56 -05:00
Behdad Esfahbod
814dc3cbe5
[iter] Rename
...
Moving towards making iota useful for non-integers.
2019-08-31 12:24:56 -05:00
Behdad Esfahbod
c72589f13f
[iter] Change item_size to get_item_size()
...
By moving access to hb_static_size(Type) into a function instead of
a class-const, we can refer to iter types of incomplete types, which
come handy when a method of hb_array_t wants to return iterator
of hb_array_t. That kind of stuff. Next commit needs this to
build on clang...
2019-08-29 15:45:21 -07:00
Ebrahim Byagowi
a0b4ac4dce
Turn 8 spaces to tab across the project
...
According to the current code style of the project
2019-08-27 02:40:41 +04:30
Behdad Esfahbod
7bcc5dfa97
[iter] Fix accumulate to accept const types
2019-07-28 20:55:50 -07:00
Behdad Esfahbod
576065b442
[iter] Fix reduce type deduction
2019-07-17 11:19:34 -07:00
Behdad Esfahbod
ebf47a95f2
[iter] Simplify operator!= of iterator filters
...
Both to save ops, and also because lambdas don't implement operator!=,
so this was failing in range-based for loop if a lambda was passed to
hb_map() or hb_filter(). Just check end-condition assuming that we
are comparing to .end() or iterators that are otherwise derived from
current iterator. Ie. don't compare things that are expected to be
in common.
2019-05-15 15:14:26 -07:00
Behdad Esfahbod
f244224dbb
[iter] Use default operators instead of redefining empty ones
2019-05-15 14:34:36 -07:00
Behdad Esfahbod
889dc1eb06
[iter] Remove sort categorization
...
See comments.
2019-05-14 22:28:07 -07:00
Behdad Esfahbod
4d3cf2adb6
[iter] Fix zip iterator sortedness classification logic
2019-05-13 17:25:07 -07:00
Behdad Esfahbod
513762849a
[iter] Track strictly-sorted iterators
...
This make output of hb_enumerate() sorted regardless of input iterator.
2019-05-13 15:36:14 -07:00
Behdad Esfahbod
7e02063f32
[iter] Minor
2019-05-13 15:26:00 -07:00
Behdad Esfahbod
e98f0ddd63
Fix extra semi-colon
2019-05-13 13:53:06 -07:00
Behdad Esfahbod
606841b070
[iter] Check for more before forwarding/rewinding past ends
2019-05-11 11:56:26 -07:00
David Corbett
c1c122e7b3
[iter] Fix filter rewinding
2019-05-11 11:52:40 -07:00
Behdad Esfahbod
79126df307
[iter] Add hb_map_sorted() and hb_map_retains_sorting()
2019-05-11 11:23:31 -07:00
Behdad Esfahbod
19e08a1467
[iter] Adjust source_of/sink_of
2019-05-10 21:25:07 -07:00
Behdad Esfahbod
61d150c916
[meta] Add integral_constant, true_t -> true_type, false_t -> false_type
2019-05-10 20:06:31 -07:00
Behdad Esfahbod
98974ac16f
[iter] Adjust is_source_of / is_sink_of
...
There are two cases that we accept. Encode both.
2019-05-10 11:26:49 -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
726002a6a6
[iter] Make hb_is_iterator_of() check is_convertible
...
Instead of is_cr_convertible.
2019-05-09 15:24:25 -07:00
Behdad Esfahbod
4f2ad75a83
[enumerate] Fix hb_enumerate() len for step=0
2019-05-09 12:07:45 -07:00
Behdad Esfahbod
5da3c9c33f
[iter] Fix hb_zip() end condition
...
We should compare-equal to end if either iterator's end reaches,
not if both reach at the same time. Fixes infinite-loop in test
which was happening after hb_enumerate() switched to using hb_zip().
2019-05-09 11:31:13 -07:00
Behdad Esfahbod
57a5256fbc
[iter] Minor
2019-05-09 11:31:13 -07:00
Behdad Esfahbod
12dd56f857
[iter] Minor
2019-05-09 11:31:13 -07:00
Behdad Esfahbod
46837910e6
[iter] Allow negative step in hb_iota()
2019-05-09 11:31:13 -07:00
Behdad Esfahbod
087327af1e
[iter] Minor
2019-05-09 11:31:13 -07:00
Behdad Esfahbod
64f0899a9f
[iter] Bug fix
2019-05-09 11:31:13 -07:00
Behdad Esfahbod
5d263556b9
[iter] Fix
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
71537f93e0
[iota] end -> end_ to not shadow
2019-05-09 11:31:13 -07:00
Behdad Esfahbod
5875d775e1
[iter] Rename hb_iter_t() to hb_iter_type<> and add hb_item_type<>
2019-05-08 12:28:46 -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
aa4ac13f0b
[iter] Actually fix previous commit
...
The iter objects shouldn't not be const. D'oh.
2019-05-08 10:03:10 -07:00
Behdad Esfahbod
a66598e030
[iter] For ref-qualified variants
2019-05-08 10:03:10 -07:00
Behdad Esfahbod
8479eb5955
[iter] Fix hb_sink() to accept rvalue
2019-05-08 09:48:55 -07:00
Behdad Esfahbod
710d459aca
[iter] Default predicates to hb_identity instead of hb_bool
...
The bool conversion happens after predicate is called automatically.
2019-05-08 09:33:09 -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