How to directly bind a member function to an std::function in Visual Studio 11?

I think according to the C++11 standard, this should be supported Not really, because a non-static member function has an implicit first parameter of type (cv-qualified) YourType*, so in this case it does not match void(int). Hence the need for std::bind: Register(std::bind(&Class::Function, PointerToSomeInstanceOfClass, _1)); For example Class c; using namespace std::placeholders; // for _1, _2 … Read more

Stopping C++ 11 std::threads waiting on a std::condition_variable

No, there’s nothing wrong with your design, and it’s the normal approach taken for this sort of problem. It’s perfectly valid for you to have multiple conditions (eg anything on queue or program stopping) attached to a condition variable. The key thing is that the bits in the condition are checked for when the wait … Read more

Latest changes in C11

I just learned today that there was one (somewhat) significant change between N1570 and the final C11 standard (ISO/IEC 9899:2011 (E)). In N1570, 6.3.2p3 says: Except when it is the operand of the sizeof operator, the _Alignof operator, or the unary & operator, or is a string literal used to initialize an array, an expression … Read more

What is the current status of C++ AMP

What leads me to this thought is that even the MS C++AMP blogs have been silent for about a year. Looking at the C++ AMP algorithms library http://ampalgorithms.codeplex.com/wikipage/history it seems nothing at all has happened for over a year. I used to work on the C++AMP algorithms library. After the initial release, which Microsoft put … Read more

Is it defined behavior to reference an early member from a later member expression during aggregate initialization?

Your second case is undefined behavior, you are no longer using aggregate initialization, it is still list initialization but in this case you have a user defined constructor which is being called. In order to pass the second argument to your constructor it needs to evaluate foo.i but it is not initialized yet since you … Read more

Any disadvantage of using const reference when iterating over basic types?

The standard containers all return references from their iterator (note, however, that some “containers aren’t really container, e.g., std::vector<bool> which returns a proxy). Other iterators might return proxies or values although this isn’t strictly supported. Of course, the standard doesn’t make any guarantees with respect to performance. Any sort of performance related feature (beyond complexity … Read more

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