[iter] Use static_assert with hb_is_random_access_iterator()
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 9 Jan 2019 00:33:31 +0000 (16:33 -0800)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 21 Jan 2019 01:12:12 +0000 (20:12 -0500)
commit3fc03e42ce73021c4573729a637d19346f7e5f44
tree273f46d0b35282475404af1ce08969cdc4a5eb14
parent6af9c5f18eaf51f2d7e564d23d9b09219af9d700
[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))
                    ^
src/test-iter.cc