std::string 一个容器 [英] std::string a container

查看:56
本文介绍了std::string 一个容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

std::string 是标准 c++ 库中的容器类,仅限于保存 char 元素吗?

Is std::string a container class in standard c++ library, restricted to hold only char elements?

推荐答案

其实是 std::basic_string 的 typedef.std::basic_string 是专门为字符串操作设计的容器类.这个容器也可以用于宽字符(wchar_t);在这种情况下,它的 typedef 将是 wstring.

It's a typedef of std::basic_string<char>, actually. std::basic_string is a container class specifically designed for string operations. This container can be used for wide characters (wchar_t) as well; for that case its typedef would be wstring.

这篇关于std::string 一个容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆