[iter] Test hb_is_iterable / hb_is_iterator

This commit is contained in:
Behdad Esfahbod 2019-01-08 14:23:12 -05:00
parent 8237809f06
commit ca6adcd1ad
1 changed files with 8 additions and 4 deletions

View File

@ -65,10 +65,12 @@ struct some_array_t
};
template <typename Iterator> static void
test_iterator (Iterator it)
template <typename Iter> static
hb_enable_if_t (hb_is_iterator (Iter, typename Iter::item_t),
void)
test_iterator (Iter it)
{
Iterator default_constructed;
Iter default_constructed;
/* Iterate over a copy of it. */
for (auto c = it.iter (); c; c++)
@ -83,7 +85,9 @@ test_iterator (Iterator it)
if (it.is_random_access_iterator) {}
}
template <typename Iterable> static void
template <typename Iterable> static
hb_enable_if_t (hb_is_iterable (Iterable),
void)
test_iterable (const Iterable &lst = Null(Iterable))
{
// Test that can take iterator from.