gpt4 book ai didi

c++ - 找不到基的构造函数

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:43:30 40 4
gpt4 key购买 nike

<分区>

#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。

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com