0

I am reading bit masks on learnCpp.com: bit-manipulation-with-bitwise-operators-and-bit-masks and encountered this line:

constexpr std::uint_fast8_t mask0{ 0b0000'0001 };

I forget what constexpr means, probably forgot it for a million times already lol. so I went to see what it is through cppreference.com: https://en.cppreference.com/w/cpp/language/constexpr

The reading was difficult, so I try to understand through the example on that website, and I see this strange parameter type in a constructor(N is a known template non-type parameter):

constexpr conststr(const char(&a)[N]): p(a), sz(N - 1) {}

So what exactly is this:

char(&a)[N]
Waqar
  • 8,558
  • 4
  • 35
  • 43
JT Woodson
  • 249
  • 2
  • 5
  • i would say _const reference to a char array of size N_ – Alberto Sinigaglia Jul 21 '20 at 19:25
  • cppreference.com isn't really a C++ tutorial site. It's meant to be used as a reference for those who already know C++. If you would like to learn more about C++, the best resource would be a [good C++ textbook](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) that goes into detail about various C++ types, how they are used, describing them in greater detail that can be summarized in just one or two short sentences on stackoverflow.com – Sam Varshavchik Jul 21 '20 at 19:26
  • @Berto99 A reference to an array of N const chars. A "const reference" is not a thing. – cdhowie Jul 21 '20 at 19:40

0 Answers0