Capturing perfectly-forwarded variable in lambda

Is it correct to capture the perfectly-forwarded mStuff variable with the &mStuff syntax? Yes, assuming that you don’t use this lambda outside doSomething. Your code captures mStuff per reference and will correctly forward it inside the lambda. For mStuff being a parameter pack it suffices to use a simple-capture with a pack-expansion: template <typename… T> … Read more

What are the main purposes of std::forward and which problems does it solve?

You have to understand the forwarding problem. You can read the entire problem in detail, but I’ll summarize. Basically, given the expression E(a, b, … , c), we want the expression f(a, b, … , c) to be equivalent. In C++03, this is impossible. There are many attempts, but they all fail in some regard. … Read more

What are the main purposes of using std::forward and which problems it solves?

You have to understand the forwarding problem. You can read the entire problem in detail, but I’ll summarize. Basically, given the expression E(a, b, … , c), we want the expression f(a, b, … , c) to be equivalent. In C++03, this is impossible. There are many attempts, but they all fail in some regard. … Read more

What does T&& (double ampersand) mean in C++11?

It declares an rvalue reference (standards proposal doc). Here’s an introduction to rvalue references. Here’s a fantastic in-depth look at rvalue references by one of Microsoft’s standard library developers. CAUTION: the linked article on MSDN (“Rvalue References: C++0x Features in VC10, Part 2”) is a very clear introduction to Rvalue references, but makes statements about … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)