Bjarn's mistake in a C ++ 11 presentation?

I have a slide page ( http://www.ii.uni.wroc.pl/~nivelle/C++11_design_Wroclaw.pdf ) submitted by Bjarn Stroustroup.

enter image description here

The problem 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 error message:

generality.cpp:8:11: error: 'vector' is not a class, namespace, or scoped enumeration
    using vector::vector<T>; // inherit all constructors
          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:477:29: note: 'vector' declared here
class _LIBCPP_TYPE_VIS_ONLY vector

      

Is this error Bjarn or am I missing something?

I am using the compiler on Mac OS X 10.10.

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

      

It looks like he's making some mistakes: Could Bjarne be wrong? (explaining patterns) or am I still not getting it? ...

+3


source to share


1 answer


Yes, that's a typo. With, using vector<T>::vector;

you select the constructor vector

from the template class vector<T>

. Another way doesn't make sense in relation std::vector

.



+4


source







All Articles