Skip to content

Instantly share code, notes, and snippets.

@borisbat
Last active December 18, 2015 23:39
Show Gist options
  • Save borisbat/5863559 to your computer and use it in GitHub Desktop.
Save borisbat/5863559 to your computer and use it in GitHub Desktop.
class Report
{
public:
Report() { cout << "Report();" << endl; }
Report(const Report & ) { cout << "Report(const & Report);" << endl; };
Report(Report &&) { cout << "Report(&&);" << endl; }
Report & operator = (const Report &) { cout << "Report::=(const Report &);" << endl; return *this; };
};
template <typename Tc, typename T>
void push1 ( Tc & c, T t )
{
c.push_back(move(t));
}
template <typename Tc, typename T>
void push2 ( Tc & c, const T & t )
{
c.push_back(t);
}
int main(int argc, const char * argv[])
{
vector<Report> a, A;
Report b;
cout << "push1" << endl;
push1(a, b);
cout << "push2" << endl;
push2(A, b);
return 0;
}
/*
Report();
push1
Report(const & Report);
Report(&&);
push2
Report(const & Report);
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment