为什么每个 C++ 平台都有不同的字符串类? [英] Why is there a different string class in every C++ platform out there?

查看:30
本文介绍了为什么每个 C++ 平台都有不同的字符串类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然我喜欢用 C++ 编程,但我讨厌这样的想法:
std::basic_string vs QString vs wxString vs .............
standard string 类不能满足这些框架的需求吗?我的意思是 standard string 类有什么问题?!

While I like programming in C++, I hate the idea of:
std::basic_string vs QString vs wxString vs .............
Doesn't the standard string class satisfy the needs for these frameworks? I mean what is wrong with the standard string class?!

只是强调一下,以下是重要的问题:
您是否在要使用的每个框架中都学习了框架的字符串"类?你会改用标准的字符串类,尝试在任何地方进行调整吗?

Just to emphasize, that below is the important question:
Do you learn "the" string class of the framework in every framework you are going to work with? would you instead stick to the standard string class by trying to adapt it everywhere?

谢谢...

推荐答案

之所以有多个字符串类,是因为 C++ 标准的定稿比较晚(1998 年);然后花了一些时间,直到所有系统都真正提供了正确的 C++ 库.到那时,所有这些相互竞争的字符串类都已经编写好了.

The reason for multiple string classes is that the C++ standard was finalized fairly late (in 1998); it then took some time until all systems actually provided a correct C++ library. By that time, all these competing string classes where already written.

此外,在某些情况下,人们希望从单个基类继承,而 std::string 不会这样做.

In addition, in some cases, people want to inherit from a single base class, which std::string wouldn't do.

这篇关于为什么每个 C++ 平台都有不同的字符串类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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