title: have i to lock mutex on queue front access
body: <p>i have a (<strong>std::)queue</strong> / <strong>(std::)deque</strong> which pushed by one thread and popped by an other. so i know i have to lock a mutex on push and pop functions because they are modifying the queue, but do i also have to lock a mutex if i access the front()?</p>
  
  <p>the reason why i am asking is, i don't really know how the queue is organized internally. i've read something that it is allocation/deleting on time it is needed. so if i read the front while the other thread is pushing, <strong>is it possible that the front is moved</strong>?</p>
  
  <p>and how about iterators? <strong>do i also have to lock the mutex while an iterator is reading a value?</strong></p>
  
  <p>i think it is always a good idea to lock the mutex while reading but i'm not sure if it is really needed to lock the whole queue.mutex on every iterator/front access. it may slow down the the whole programm if it locks everytime.</p>