$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] problem with xpressive sregex and stl::list::iterator
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2011-09-30 00:42:16
> thanks, I know the reason now. 
>  
> it is because I have declared const on the member function where I  
> iterate the sregex object. 
> after I removed the const declaration, the compile passed. but I am  
> still curious, I am not changing 
> anything when I iterate the sregex object, why I cannot use the const  
> declareation. To make it clear, 
> I give a more complete formulation of the problem I encountered. 
You have to use std::list<boost::xpressive::sregex>::const_iterator
if you want to iterate over a const list.
This is because the non-const iterator allows doing things like
*it = some_new_value;
which would violate const-correctness.
Regards,
Nate