what does “const char(&a)[N]” mean?

后端 未结 1 744
没有蜡笔的小新
没有蜡笔的小新 2021-01-14 16:13

I was checking the C++11 features and see the following codes:

class conststr {
    const char* p;
    std::size_t sz;
public:
    template

        
相关标签:
1条回答
  • 2021-01-14 16:55

    It's a reference to array of const char of size N. This is probably used to accept a string literal as argument.

    conststr("whatever"); // ok
    char const * psz_whatever("whatever");
    conststr(psz_whatever); // error
    
    0 讨论(0)
提交回复
热议问题