Here're two functions:
std::deque<int> q;
// Push lots of elements to q
xxxxx
void foo() {
auto begin = q.cbegin();
auto end = q.cend();
q.erase(begin, end);
}
void bar(int x) { q.push_back(x); }
Is is thread-safe to call foo
and bar
from two different threads? Is the behavior undefined?