<分区>
#include <string_view>
class str_ref : public std::string_view
{
public:
using std::string_view::string_view;
};
int main()
{
std::string_view sv;
str_ref sr("", 0);
str_ref sr2(sv); // error C2664: 'str_ref::str_ref(const str_ref &)': cannot convert argument 1 from 'std::string_view' to 'const char *const '
}
为什么这里找不到 (string_view) 的构造函数?这个构造函数不应该用 using 语句导入吗?正在找到 (const char*, size_t) 构造函数。 我正在使用 VS2017。