jeudi 28 mai 2015

Bjarne's mistake in C++11 presentation?

I have a page from the slide (http://ift.tt/1HQ479S) that Bjarn Stroustroup presented.

enter image description here

The issue is that this code doesn't compile, but this does:

using namespace std;

template<typename T> class Vector : vector<T> {
    using vector<T>::vector; // inherit all constructors
    // ... 
};

This is the error message:

generality.cpp:8:11: error: 'vector' is not a class, namespace, or scoped enumeration
    using vector::vector<T>; // inherit all constructors
          ^
/Applications/http://ift.tt/1HQ451Y: note: 'vector' declared here
class _LIBCPP_TYPE_VIS_ONLY vector

Is this Bjarne's mistake, or am I missing something?

The compiler that I use is clang on Mac OS X 10.10.

clang++ -x c++ -lc++ -std=c++11 -o

It looks like that he can make some mistakes: Could Bjarne make mistake? (while explaining templates), or I still do not understand?.

Aucun commentaire:

Enregistrer un commentaire