Perfect-forwarding while implementing emplace I am trying to write a class similar to std::set, and I was wondering if I handled the perfect forwarding right in implementing the emplace member function below. Basically, I forwarded calls to my class to a member set. But I wasn't sure whether I used std::forward enough. 

Also, is there an easy way to tell when something is not forwarded as desired, and values are copied instead?

#include &lt;set&gt;
using namespace std;

template&lt;typename T&gt;
class myset {
  std::set&lt;T&gt; m_s;
  typedef typename std::set&lt;T&gt;::iterator iterator;
  int cnt;
public:
  template &lt;class... Args&gt;
  pair &lt;iterator,bool&gt; emplace ( Args&amp;&amp;... args ) {
    pair&lt;iterator,bool&gt; p = m_s.emplace(std::forward&lt;Args&gt;(args)...);
    if (p.second) //true if a new element was inserted
      cnt ++; //house keeping
    return p;
  }
};

int main() {myset&lt;int&gt; s;}
You are using std::forward correctly. However, there are several other things worth noting about your code:


why do you need a private counter instead of re-using m_s.size() that will automatically update itself after each emplace_back()?
are you sure that you don't need additional template arguments Compare and Allocator instead of relying on their defaults std::less&lt;T&gt; and std::allocator&lt;T&gt;?
since you are using C++11 already, please use auto to get rid of the pair&lt;itererator, bool&gt; (and if you are using C++14, you can also use auto for the return type). 
try also to write using iterator = typename std::set&lt;T&gt;::iterator; because left-to-right is much easier to parse than right-to-left of the current typedef.