#include "hb-set.hh"
#include "hb-ot-layout-common.hh"
-
template <typename T>
struct array_iter_t : hb_iter_with_fallback_t<array_iter_t<T>, T&>
{
test_iterable<hb_sorted_array_t<const int>> ();
test_iterable<hb_vector_t<float>> ();
test_iterable<hb_set_t> ();
- test_iterable<OT::Coverage> ();
+ test_iterable<OT::Array16Of<OT::HBUINT16>> ();
test_iterator (hb_zip (st, v));
test_iterator_non_default_constructable (hb_enumerate (st));
;
/* The result should be something like 0->10, 1->11, ..., 9->19 */
assert (hb_map_get (result, 9) == 19);
+ hb_map_destroy (result);
+
+ /* Like above, but passing hb_set_t instead of hb_set_t * */
+ temp1 = 10;
+ temp2 = 0;
+ result =
+ + hb_iter (src)
+ | hb_map ([&] (int i) -> hb_set_t
+ {
+ hb_set_t set;
+ for (unsigned int i = 0; i < temp1; ++i)
+ hb_set_add (&set, i);
+ temp1++;
+ return set;
+ })
+ | hb_reduce ([&] (hb_map_t *acc, hb_set_t value) -> hb_map_t *
+ {
+ hb_map_set (acc, temp2++, hb_set_get_population (&value));
+ return acc;
+ }, hb_map_create ())
+ ;
+ /* The result should be something like 0->10, 1->11, ..., 9->19 */
+ assert (hb_map_get (result, 9) == 19);
+ hb_map_destroy (result);
unsigned int temp3 = 0;
+ hb_iter(src)
| hb_map([&] (int i) { return ++temp3; })
| hb_reduce([&] (float acc, int value) { return acc + value; }, 0)
;
- hb_map_destroy (result);
+ hb_iter (src)
| hb_drain