I am a using a boost regex on a boost circular buffer and would like to "remember" positions where matches occur, what's the best way to do this? I tried the code below, but "end" seems to store the same values all the time! When I try to traverse from a previous "end" to the most recent "end" for example, it doesn't work!
  boost::circular_buffer<char> cb(2048);
  typedef boost::circular_buffer<char>::iterator  ccb_iterator;
  boost::circular_buffer<ccb_iterator> cbi(4); 
  //just fill the whole cbi with cb.begin()  
  cbi.push_back(cb.begin());
  cbi.pushback(cb.begin());
  cbi.pushback(cb.begin());
  cbi.pushback(cb.begin());
 typedef regex_iterator<circular_buffer<char>::iterator> circular_regex_iterator;
 while (1)
{
  //insert new data in circular buffer (omitted)
  //basically reads data from file and pushes it back to cb
  boost::circular_buffer<char>::iterator    start,end;  
 circular_regex_iterator regexItr(
        cb.begin(), 
        cb.end() , 
         re, //expression of the regular expression
         boost::match_default | boost::match_partial); 
    circular_regex_iterator last;
    while(regexItr != last)
    {
            if((*regexItr)[0].matched == false)
           {
               //partial match      
               break;
            }
        else
        {
           // full match:
           start = (*regexItr)[0].first;
           end = (*regexItr)[0].second; 
             //I want to store these "end" positions to to use later so that I can 
             //traverse the buffer between these positions (matches).  
            //cbi stores positions of these matches, but this does not seem to work!                 
             cbi.push_back(end);    
            //for example, cbi[2] --> cbi[3] traversal works only first time this 
            //loop is run!
        }
        ++regexItr;
    }
}
 
     
    