On a piece of code in a previous question in stackoverflow I saw this, strange to me, declaration with using
:
template
class A
{
public:
...
using const_buffer_t = const char(&)[SIZE];
...
};
Could someone please address the following questions:
- What type it represents?
- Where do we need such kind of declarations?
Answer
That's a type alias, a new syntax available since c++11.
What you're actually doing is typedefing the type of an array
const_buffer_t
will be an array of const char with length = SIZE
No comments:
Post a Comment