From fb053b633351afe2012ece0874a8ac15d504a15c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 26 Dec 2018 19:01:30 -0500 Subject: [PATCH] [iter] Rename random_access() to constexpr is_random_access() --- src/hb-iter.hh | 4 ++-- src/test-iter.cc | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hb-iter.hh b/src/hb-iter.hh index c80cf7d7e..43d03a8d0 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -83,7 +83,7 @@ struct hb_iter_t void forward (unsigned n) { thiz()->__forward__ (n); } void prev () { thiz()->__prev__ (); } void rewind (unsigned n) { thiz()->__rewind__ (n); } - bool random_access () const { return thiz()->__random_access__ (); } + constexpr bool is_random_access () const { return thiz()->__random_access__ (); } protected: hb_iter_t () {} @@ -130,7 +130,7 @@ struct hb_iter_mixin_t void __rewind__ (unsigned n) { while (n--) thiz()->prev (); } /* Random access: Return true if item_at(), len(), forward() are fast. */ - bool __random_access__ () const { return false; } + constexpr bool __random_access__ () const { return false; } protected: hb_iter_mixin_t () {} diff --git a/src/test-iter.cc b/src/test-iter.cc index 5f69a928c..2baf7d7a0 100644 --- a/src/test-iter.cc +++ b/src/test-iter.cc @@ -73,6 +73,8 @@ test_iterator (Iterator it) it = it + 10; assert (*it == it[0]); + + if (it.is_random_access ()) {} } template static void