How to fix problem with iterating through list if times using iterator? : <p>Debugger sais there is an incompatible iterator.
How i can solve this.
What can cause the problem.
Here is my main code</p>

<pre><code>for (std::list&lt;std::chrono::duration&lt;double, std::milli&gt;&gt;
::iterator it = road.get_times().begin()
;it!= road.get_times().end();it++,z++) //error incompatible iterator
            {
                *road::file &lt;&lt; "Samochod z drogi " &lt;&lt; road.get_lane_number() &lt;&lt; " pojechal ";
                switch (road.get_direction())
                {
                case'S':
                    *road::file &lt;&lt; "prosto" &lt;&lt; std::endl;
                    break;
                case'L':
                    *road::file &lt;&lt; "w lewo" &lt;&lt; std::endl;
                    break;
                case'R':
                    *road::file &lt;&lt; "w prawo" &lt;&lt; std::endl;
                    break;
                }
                *road::file &lt;&lt; "Jego czas stania w kolejce wyniosl ";
                avarage_time += it-&gt;count() / 1000;
                *road::file &lt;&lt; round(it-&gt;count() / 1000) &lt;&lt; std::endl;
                }
</code></pre>

<p>function road.get_times ()</p>

<pre><code>   std::list&lt; std::chrono::duration&lt;double, std::milli&gt;&gt; get_times()
    {
    return times;
    }
</code></pre>
