[iter] Remove a few TODO items

This commit is contained in:
Behdad Esfahbod 2022-06-10 07:41:39 -06:00
parent 689c77530a
commit e1575f2347
1 changed files with 3 additions and 13 deletions

View File

@ -43,17 +43,12 @@
* is writable, then the iterator returns lvalues, otherwise it * is writable, then the iterator returns lvalues, otherwise it
* returns rvalues. * returns rvalues.
* *
* TODO Document more. * If iterator implementation implements operator!=, then it can be
*
* If iterator implementation implements operator!=, then can be
* used in range-based for loop. That already happens if the iterator * used in range-based for loop. That already happens if the iterator
* is random-access. Otherwise, the range-based for loop incurs * is random-access. Otherwise, the range-based for loop incurs
* one traversal to find end(), which can be avoided if written * one traversal to find end(), which can be avoided if written
* as a while-style for loop, or if iterator implements a faster * as a while-style for loop, or if iterator implements a faster
* __end__() method. * __end__() method. */
* TODO When opting in for C++17, address this by changing return
* type of .end()?
*/
/* /*
* Base classes for iterators. * Base classes for iterators.
@ -75,10 +70,6 @@ struct hb_iter_t
iter_t* thiz () { return static_cast< iter_t *> (this); } iter_t* thiz () { return static_cast< iter_t *> (this); }
public: public:
/* TODO:
* Port operators below to use hb_enable_if to sniff which method implements
* an operator and use it, and remove hb_iter_fallback_mixin_t completely. */
/* Operators. */ /* Operators. */
iter_t iter () const { return *thiz(); } iter_t iter () const { return *thiz(); }
iter_t operator + () const { return *thiz(); } iter_t operator + () const { return *thiz(); }
@ -87,8 +78,7 @@ struct hb_iter_t
explicit operator bool () const { return thiz()->__more__ (); } explicit operator bool () const { return thiz()->__more__ (); }
unsigned len () const { return thiz()->__len__ (); } unsigned len () const { return thiz()->__len__ (); }
/* The following can only be enabled if item_t is reference type. Otherwise /* The following can only be enabled if item_t is reference type. Otherwise
* it will be returning pointer to temporary rvalue. * it will be returning pointer to temporary rvalue. */
* TODO Use a wrapper return type to fix for non-reference type. */
template <typename T = item_t, template <typename T = item_t,
hb_enable_if (std::is_reference<T>::value)> hb_enable_if (std::is_reference<T>::value)>
hb_remove_reference<item_t>* operator -> () const { return std::addressof (**thiz()); } hb_remove_reference<item_t>* operator -> () const { return std::addressof (**thiz()); }