title: Exactly same function but data struture returned would be different
body: <p>I have a function <code>foo()</code>. I want it to either return a <code>std::queue</code> or a thread safe queue object. What's the best way of doing this? I considered templates but not sure they fit the situation. I could copy and paste the entire body of <code>foo()</code> where one would be <code>std::queue foo1()</code> and the other would be <code>MyQueue foo2()</code> and just change the type of the data structure. But that would be ugly.</p>