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
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
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
8a8d45b924
[iter] Adjust hb_copy() and use it
...
Untested.
2019-03-31 19:00:09 -07:00
Behdad Esfahbod
e530692799
[iter] Fix bug in hb_any() and hb_none()
2019-03-29 23:31:39 -07:00
Behdad Esfahbod
d51452500f
[iter] Remove more wrong &&'s
...
Sigh...
2019-03-29 22:48:12 -07:00
Behdad Esfahbod
6237b47f0c
[iter] Add hb_unzip()
2019-03-29 21:36:49 -07:00
Behdad Esfahbod
8e34cb251a
[iter] Remove unneeded &&
...
Next commit needs this. I never fully get this, sigh.
2019-03-29 21:14:20 -07:00
Behdad Esfahbod
4c38a9f601
Remove hb_assign()
...
Not needed anymore. We just use operator= now.
2019-03-29 20:23:07 -07:00
Behdad Esfahbod
3f36c89f2e
Inline explicit_operator macro
...
Now that we require C++11, no need to macro.
2019-03-29 15:22:46 -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
72dd5e34e0
[iter] Make hb_iter() into function-object
2019-02-15 16:15:50 -08:00
Behdad Esfahbod
98be7bd77a
[iter] Make hb_map into function-object
2019-02-15 16:09:29 -08:00
Behdad Esfahbod
b8b3b3e38b
[iter] Add hb_enumerate() and use it
2019-02-15 16:05:36 -08:00
Behdad Esfahbod
5b99c92d4c
[iter] Use more
2019-02-14 17:10:04 -08:00
Behdad Esfahbod
fa35d3fd81
[iter] Add hb_drain
2019-02-14 14:04:05 -08:00
Behdad Esfahbod
0670e1a6f5
[iter] Remove excess use of universal references
...
Every time I have to study these to understand why a change is right..
2019-02-14 11:53:40 -08:00
Behdad Esfahbod
773d75637c
[iter] Add hb_apply()
2019-02-14 11:40:22 -08:00
Behdad Esfahbod
00db94095d
[iter] Make hb_filter() a function-object
2019-02-14 11:10:13 -08:00
Behdad Esfahbod
aa4c321262
[iter] Make hb_zip() a function-object
2019-02-14 11:07:12 -08:00
Behdad Esfahbod
f8fcfb263e
[iter] Accept pointers to hb_sink()
2019-02-14 11:03:29 -08:00
Behdad Esfahbod
b530573ad9
[iter] Make hb_sink function-object
2019-02-14 11:00:10 -08:00
Behdad Esfahbod
5fa52e62b1
[iter] Accept iterator, not iterable, in hb_sink()()
2019-02-14 10:51:02 -08:00
Behdad Esfahbod
0f292ea85f
[iter] Accept iterator, not iterable, in hb_filter()()
2019-02-14 10:49:31 -08:00
Behdad Esfahbod
345bfbb207
[iter] Accept iterator, not iterable, in hb_map()()
2019-02-14 10:48:20 -08:00
Behdad Esfahbod
b702a0cbf8
[iter] Add hb_sink()
2019-02-14 10:39:58 -08:00
Behdad Esfahbod
2d940946d5
[iter] Fix mystery crash
...
Fuzzer caught it:
==14==ERROR: AddressSanitizer: stack-use-after-return on address 0x7fca2ed7a3e0 at pc 0x0000006057aa bp 0x7ffc3290f1d0 sp 0x7ffc3290f1c8
READ of size 4 at 0x7fca2ed7a3e0 thread T0
SCARINESS: 55 (4-byte-read-stack-use-after-return)
#0 0x6057a9 in OT::SingleSubstFormat2::subset(hb_subset_context_t*) const /src/harfbuzz/src/./hb-ot-layout-gsub-table.hh:194:40
#1 0x5ff921 in hb_subset_context_t::return_t OT::SingleSubst::dispatch<hb_subset_context_t>(hb_subset_context_t*) const /src/harfbuzz/src/./hb-ot-layout-gsub-table.hh:256:13
I can't reproduce locally, but many of the bots are failing because of this
as well.
It's a pity that operator-> must return pointer. Ugh. Why?!
2019-01-30 16:03:16 -08:00
Behdad Esfahbod
7c292c0853
[iter] Warning fix
...
Not sure why I don't get it, but this warning:
warning: base class ‘struct hb_iter_fallback_mixin_t<hb_array_t<const OT::UVSMapping>, const OT::UVSMapping&>’ should be explicitly initialized in the copy constructor [-Wextra]
2019-01-30 14:54:23 -08:00
Behdad Esfahbod
e799004e9f
[iter] Whitespace
2019-01-29 17:15:12 -08:00
Behdad Esfahbod
849a0f1758
[iter] Add hb_iter_with_fallback_t instead
2019-01-29 17:10:19 -08:00
Behdad Esfahbod
4d40ed9d1a
[iter] Add hb_iter_with_mixin_t<>
2019-01-29 13:55:23 -08:00
Behdad Esfahbod
6521d5b201
[iter] Export operator << / >>
2019-01-29 13:44:39 -08:00
Behdad Esfahbod
84a25d79c6
[iter] Rename
2019-01-29 13:39:19 -08:00
Behdad Esfahbod
e75b22039f
Move hb_addressof() to hb-meta.hh
2019-01-28 21:26:23 -05:00
Behdad Esfahbod
71157a4520
[meta] Remove _ft struct names
...
Using decltype() instead.
2019-01-28 21:20:12 -05:00
Behdad Esfahbod
57795bc8dd
[iter] Add operator>> and operator<<
2019-01-28 16:23:12 -05:00
Behdad Esfahbod
8bd96be994
[iter] Use auto c = C.iter() internally
2019-01-28 16:17:36 -05:00
Behdad Esfahbod
0363ce650b
[iter] Accept C arrays in hb_iter()
2019-01-27 01:06:32 +01:00
Behdad Esfahbod
778c96b8d7
[iter] Fix hb_iter()
2019-01-27 00:50:54 +01:00
Behdad Esfahbod
2f5b1a9104
[iter] Add unary operator+ that returns a copy
2019-01-27 00:49:37 +01:00
Behdad Esfahbod
fbab07f9b3
[iter] Add hb_bool() and make hb_filter default to it for predicate
2019-01-27 00:44:45 +01:00
Behdad Esfahbod
313d63e240
[meta] Back to using _ft suffix for function-object types
...
Seprate namespace, cleaner, more clear.
2019-01-26 22:58:26 +01:00
Behdad Esfahbod
509353357c
[iter] Use hb_declval() instead of Null() to get instance
...
I had used Null to make one of the bots happy before. Not going
to bend to such demands anymore..
2019-01-26 22:47:35 +01:00
Behdad Esfahbod
6b6783e158
[iter/meta] Fix build on newer clang
...
The mystery failure had to do with SFINAE failure because the template
function involved was accessing ::iter_t of a type that was also named iter_t.
In this context, apparently:
warning: ISO C++ specifies that qualified reference to 'iter_t' is a
constructor name rather than a type in this context, despite preceding 'typename' keyword
[-Winjected-class-name]
We use a new macro, also called hb_iter_t(), to get iterator type of
a type. This uses declval/hb_decltype, and has the added benefit
that it returns correct type for const vs non-const objects, if they
have different iterators.
2019-01-26 22:44:09 +01:00
Behdad Esfahbod
5adb113baf
[meta] Mark function-objects as const
2019-01-26 22:15:59 +01:00
Behdad Esfahbod
090fe56dc6
Merge branch 'master' into iter
2019-01-25 16:06:52 +01:00
Behdad Esfahbod
70a52d6bd8
Convert all other enum class consts to static constexpr
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/1553
2019-01-22 12:17:26 +01:00
Behdad Esfahbod
83cecd80d9
[iter] Default projection to identity
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
471e96e55d
[iter] Use forwarding references
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
343f5a4bfc
[iter] Misc fixes to get piping almost work
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
f35568d603
[iter] Add hb_filter()
...
Untested.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
1733e4702c
[iter] Add hb_map()
...
Untested.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
f7fcc47641
[iter] Make hb_zip() take const references
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
200cdb721b
[iter] Rename hb_zip_t to hb_zip_iter_t
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
014c50292b
[iter] Move code
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
6e3ad650d1
Rename hb-dsalgs to hb-algs
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
7987095e64
[meta] Remove hb_enable_if_t
...
It was only used for C++<11 which does not allow default parameters
in function templates. Looks like we cannot support <11 anyway, so,
start cleaning up.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
15a6928436
[iter] Implement operator-> unconditionally
...
The right condition to check for would have been "is_struct", which
we don't have.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
84e5d00229
[iter] Add hb_zip()
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
636786ecaf
[iter] Rename __item_type__ to __item_t__
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
42bf80e578
[iter] More semicolon
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
f78f837ef1
[iter] Use aliasing using for types
...
Fix ambiguity of hb_sorted_array_t::item_t with gcc. No idea if that's a gcc bug
or what spec requires, but using aliasing using seems to fix it. It probably breaks
our non-C++11 bots, in which case I have to condition the change. Testing.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
6af9c5f18e
[iter] Remove stray semicolons
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
6c548b6657
[iter] Add TODO
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
54c30e949e
[iter] Constrain hb_fill() and hb_copy()
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
dc0a98cbe7
[iter] Add TODO
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
2658e40ffb
[iter] Add hb_is_random_access_iterator()
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
445364d80a
[iter] Rename hb_is_[sorted_]iterator() -> hb_is_[sorted_]iterator_of()
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
a6c013b1bf
[meta] Add hb_declval() macro
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
adc5910a63
[iter] Syntax
2019-01-20 20:12:12 -05:00
Behdad Esfahbod
47333c8a30
[iter] Fix operator->
2019-01-20 20:12:12 -05:00