Commit Graph

180 Commits

Author SHA1 Message Date
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
Behdad Esfahbod 41248cce0e Remove MIN/MAX in favor of hb_min/hb_max 2019-05-07 20:54:31 -07:00
Behdad Esfahbod 7654ebe3a5 Whitespace 2019-05-07 16:53:03 -07:00
Behdad Esfahbod c09d6c58e9 [iter] Require lvalue in operators that return reference 2019-05-07 14:09:00 -07:00
Behdad Esfahbod 8903040fcd Actually make it work 2019-05-07 00:13:11 -07:00
Behdad Esfahbod 025eaa3c81 [iter] Make filter/map copyable 2019-05-07 00:05:37 -07:00
Behdad Esfahbod 0b1ca5a13b [iter] Adjust hb_filter 2019-05-06 23:04:32 -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 73c82f2301 [iter] Fix hb_is_iterator_of() to actually check item type 2019-04-26 13:16:48 -07:00
Behdad Esfahbod 714307cc43 [iter] Remove fixed TODO 2019-04-24 10:56:12 -04:00
Behdad Esfahbod ae8da4b61b Minor 2019-04-22 15:25:11 -04:00
Behdad Esfahbod 6916b77863 One more auto return type 2019-04-16 18:33:51 -04:00
Behdad Esfahbod 54ece299bc Use type aliasing for meta-functions, ie. those returning a type 2019-04-16 16:45:53 -04:00
Behdad Esfahbod b8e763fd71 [meta] Add hb_invoke() 2019-04-16 10:54:24 -04:00
Behdad Esfahbod a3fcb9a370 [meta] Add HB_AUTO_RETURN_EXPR, HB_VOID_RETURN_EXPR, hb_priority, hb_has(), hb_get()
The first three based on range-v3.
2019-04-16 10:45:57 -04:00
Behdad Esfahbod 89fea21697 Fix copyright 2019-04-15 17:36:09 -04:00
Behdad Esfahbod 02d864aa26 Add HB_FUNCOBJ()
Fixes https://github.com/harfbuzz/harfbuzz/issues/1651
2019-04-15 15:39:30 -04:00
Behdad Esfahbod a98e4068e7 Revert "Hide symbols in hb-iter"
This reverts commit 98f14c4cdb.

Same as previous commit.
2019-04-12 22:42:44 -04:00
Behdad Esfahbod 98f14c4cdb Hide symbols in hb-iter
Painful.  All template methods need to be explicitly hidden :(.

Maybe we should switch to -fvisibility=hidden pragma.

A LOT more to go.
2019-04-12 18:12:06 -04:00
Behdad Esfahbod 2bd2750234 [iter] Tweak SFINAE again
Don't think we need hb_is_same().
2019-04-03 15:31:53 -07:00
Behdad Esfahbod d419a9a437 [iter] Use different SFINAE scheme to make MSVC happy
From Orvid King: TLDR; MSVC has some issues using sizeof(declval<T>()) for
SFINAE of templated types, so I just used SFINAE in a different context where
MSVC doesn't have the issue.
2019-04-03 14:18:19 -07:00