c++ - Problem with Boost bidirectionnal iterator not writable -


i try make bidirectionnal iterators boost iterator. have implemented functions suggested in documentation here.

i have parent class functions implement declared pure virtual (i need polymorphic iterators). moment, have 1 inherited class functions implemented. moreover, use boost::bidirectional_traversal_tag.

the dereference() function implemented follows in inherited class:

template <typename t> t& imageiterator_notplanar<t>::dereference() const {   return *((t*)buffer); } 

to read values following example, works perfectly:

for (; !iter.isendreached(); ++iter)   cout << "iterator inc: " << *iter << endl; 

(where isendreached() personal function). problem following code doesn't works:

*iter = 3; 

g++ returns following error:

lvalue required left operand of assignment 

what wrong ?

thanks

we need see exactly error generated. also, have assume have proper non-const version

could need have

template <typename t> t& imageiterator_notplanar<t>::dereference() {   return *((t*)buffer); }  template <typename t> t const& imageiterator_notplanar<t>::dereference() const {   return *((t*)buffer); } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -