std :: string和std :: basic_string之间有什么区别?为什么都需要? [英] What's the difference between std::string and std::basic_string? And why are both needed?

查看:826
本文介绍了std :: string和std :: basic_string之间有什么区别?为什么都需要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

std :: string std :: basic_string 有什么区别?为什么都需要?

What's the difference between std::string and std::basic_string? And why are both needed?

推荐答案

std :: basic_string 是用于根据字符类型制作字符串的类模板, std :: string typedef ,用于对该类模板进行专门化处理为 char 。是的,它们都是必需的(或至少是标准要求的)。

std::basic_string is a class template for making strings out of character types, std::string is a typedef for a specialization of that class template for char. Yes they are both needed (or at least required by the standard).

这篇关于std :: string和std :: basic_string之间有什么区别?为什么都需要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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