Why does this dependent name lookup find a global identifier instead of the method?

To the best of my knowledge here’s what’s going on. DR228 says: [Voted into WP at April 2003 meeting.] Consider the following example: template<class T> struct X { virtual void f(); }; template<class T> struct Y { void g(X<T> *p) { p->template X<T>::f(); } }; This is an error because X is not a member … Read more

implementing future::then() equivalent for asynchronous execution in c++11

The problem with this approach to .then() is that you spawn 2 threads (that is costly) simultaneously, and second of them would block on its future.get/wait (if the first one would run long enough, of course) So, its better to use the work queue, to serialize the jobs execution order (and re-cycle the existing threads). … Read more

Understanding the C11 type hierarchy

The cluttered structure of C11 types resulting from the second step of the question can be simplified by removal/reduction of less important nodes and delegating some redundant/subsidiary information to be presented by other means. I propose the following five-step algorithm for that: Removal of all extended integer types (strictly conforming implementation assumed); Reduction of the … Read more

Container of fixed dynamic size

Theoretically vector has the properties you need. As you noted, actions that possibly do assignments to the contained type, including especially any sequence modifications (empace_back, push_back, insert etc.) are not supported if the elements are noncopyable and/or nonassignable. So to create a vector of noncopyable elements, you’d have to construct each element during vector construction. … Read more

How does the number of braces affect uniform initialization?

Overload resolution is fun like this. {a} has exact match rank for initializing (a temporary for) the const A& parameter, which outcompetes the user-defined conversion B(const A&) as a realization of {a}. This rule was added in C++14 to resolve ambiguities in list-initialization (along with adjustments for aggregates). Note that the notional temporary is never … Read more

SFINAE and partial class template specializations

I would like to argue that the Standard does not support SFINAE in partial specializations, due to a wording defect. Let’s start with [temp.class.spec.match]: A partial specialization matches a given actual template argument list if the template arguments of the partial specialization can be deduced from the actual template argument list (14.8.2). And, from [temp.deduct], … Read more

What are SCARY iterators?

If you’re using them, there’s no need to get SCAREd… just ignore their SCARY-ness. If you’re making them, that means you have to make your iterators independent of the container’s allocator type, and of other generic parameters to the container that don’t affect the iterators.

“Default member initializer needed within definition of enclosing class outside of member functions” – is my code ill-formed?

Your code is fine from what I can tell. Clang seems to struggle with the = default constructor rather than just defining a default constructor manually. It has the following spiel in its source code about it: DR1351: If the brace-or-equal-initializer of a non-static data member invokes a defaulted default constructor of its class or … Read more

Given int **p1 and const int**p2 is p1 == p2 well formed?

Before C++14 this case was ill-formed and the more general case with some exceptions was also ill-formed. This is covered in defect report 1512: Pointer comparison vs qualification conversions , which says: According to 5.9 [expr.rel] paragraph 2, describing pointer comparisons, Pointer conversions (4.10 [conv.ptr]) and qualification conversions (4.4 [conv.qual]) are performed on pointer operands … Read more

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