c++ - std::addressof for the end iterator -


i want address of first , last iterators can converter them void pointers, have code looks this:

class foo { public:   template <typename random_access_iterator>   foo(random_access_iterator first, random_access_iterator last)     : first_(std::addressof(*first))     , last_ (std::addressof(*last)   {}  private:   const void* first_;   const void* last_; }; 

however, when try initialize last_ can't dereference iterator. there way can last address without doing silly hack like

last_(first_ + std::distance(first, last)) 

or option?


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -