Tuesday 28 November 2017

C++ template typedef

C++11 added alias declarations, which
are generalization of typedef, allowing
templates:



template             N>
using Vector = Matrix 1>;


The type
Vector<3> is equivalent to Matrix<3,
1>
.




/>

In C++03, the closest approximation
was:



template             N>
struct Vector
{
typedef Matrix
type;
};



Here,
the type Vector<3>::type is equivalent to
Matrix<3, 1>.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...