[iter] Use static_assert with hb_is_random_access_iterator()
Both, checks constexpr'ness, and fixes build with cra**y implementations of assert() macro: test-iter.cc:108:11: error: too many arguments provided to function-like macro invocation assert (hb_is_random_access_iterator (array_iter_t<int>)); ^ ./hb-iter.hh:186:42: note: expanded from macro 'hb_is_random_access_iterator' hb_is_random_access_iterator_of (Iter, typename Iter::item_t) ^ /usr/include/x86_64-linux-gnu/sys/cdefs.h:89:9: note: macro '__STRING' defined here \#define __STRING(x) #x ^ test-iter.cc:108:3: error: use of undeclared identifier '__STRING' assert (hb_is_random_access_iterator (array_iter_t<int>)); ^ /usr/include/assert.h:91:21: note: expanded from macro 'assert' : __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION)) ^
This commit is contained in:
parent
6af9c5f18e
commit
3fc03e42ce
|
@ -105,7 +105,7 @@ main (int argc, char **argv)
|
||||||
array_iter_t<const int> s2 (v); /* Implicit conversion from vector. */
|
array_iter_t<const int> s2 (v); /* Implicit conversion from vector. */
|
||||||
array_iter_t<int> t (dst);
|
array_iter_t<int> t (dst);
|
||||||
|
|
||||||
assert (hb_is_random_access_iterator (array_iter_t<int>));
|
static_assert (hb_is_random_access_iterator (array_iter_t<int>), "");
|
||||||
|
|
||||||
some_array_t<const int> a (src);
|
some_array_t<const int> a (src);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue