Questions tagged [iterator-facade]

7 questions
9
votes
1 answer

boost iterator facade and dereference() function

I'm trying to create an iterator which only can dereference to real value types, not to references. Is this possible using boost::iterator_facade, or does it require me to have values that can be returned by adress\reference. To be more specfic, my…
Viktor Sehr
  • 12,825
  • 5
  • 58
  • 90
6
votes
1 answer

How to wrap a java.util.Iterator to change the type of object being iterated

I am providing some facade classes for a third-party API and I need to wrap an iterator so that I can replace what is iterated with my own facade object. Here's a simplified version of my facade class that wraps an API class called Item class…
Glenn Lawrence
  • 2,844
  • 1
  • 32
  • 38
1
vote
1 answer

boost::iterator_facade operator->() fails to compile

Consider the following code: #include #include // Class implements an stl compliant iterator to access the "sections" stored within a configuration. template < typename _Iterator, typename…
Maik
  • 541
  • 4
  • 15
1
vote
1 answer

How can I remove the warning that my iterator has a non-virtual destructor when extending boost::iterator_facade?

When compiling with -Weffc++ and extending boost::iterator_facade, I get the compiler warning: base class has a non-virtual destructor. What can I do to fix this? Here is sample code: #include #include…
Bruce
  • 53
  • 1
  • 4
1
vote
1 answer

Using JsonCPP ValueIterator with STL algorithms

I know, ValueIterator from JsonCPP cannot be used in standard STL algorithms directly. But is there a some "indirect" way to use it in STL algorithms (maybe via Boost.Iterator or something like this)? I want something likes to following: Json::Value…
Loom
  • 9,768
  • 22
  • 60
  • 112
1
vote
2 answers

Return ref for iterator but const_ref for const_iterator using boost::iterator_facade<>?

I have a class like this, template class BSTIteratorBase : public boost::iterator_facade< BSTIteratorBase, typename Node::value_type, boost::forward_traversal_tag > { ... value_type& dereference() const {…
Hindol
  • 2,924
  • 2
  • 28
  • 41
0
votes
1 answer

Compile errors on boost::iterator_facade

I'm learning boost::iterator_facade. Here is an example code from a book: #include #include template class step_iterator: public…
user957121
  • 2,946
  • 4
  • 24
  • 36