【发布时间】:2021-12-29 08:02:45
【问题描述】:
我有以下方法,它将std::string 作为输入参数。
int func(const std::string &filename);
从它的签名来看,输入类型是通过引用传递的(不复制),不应更改(通过const 前缀)。
是否等同于使用std::string_view,它也用于只读?
int func(std::string_view filename);
如果不是,那么它们在哪些方面不相似(运行时、内存消耗、功能等)
【问题讨论】:
标签: c++ string noncopyable