您今天使用 C++11 的情况如何?

发布于 2024-08-11 07:56:10 字数 453 浏览 3 评论 0原文

这是一个分为两部分的问题,第一部分是最重要的,现在关注的是:

  • 您是否关注 C++11 的设计和演变?您关注哪些博客、新闻组、委员会文件和其他资源?
  • 即使您没有使用任何新功能,它们对您当前的选择有何影响?
  • 您现在在生产中或其他方面使用哪些新功能?

第二部分是后续部分,涉及新标准最终确定后的情况:

  • 您希望立即使用它吗?除了前面问题中列出的之外,您还为 C++11 做了哪些准备?
  • 显然,编译器支持必须存在,但仍然需要考虑同事、辅助工具和其他因素。什么对您的收养影响最大?

编辑:原著确实太争论了;但是,我仍然对根本问题感兴趣,因此我尝试清理它并希望使其可以接受。这似乎是比重复更好的途径——尽管有些答案回应了争论的语气,但它们仍然适用于解决问题的范围,并且所有答案都是社区财产,需要酌情清理。

This is a question in two parts, the first is the most important and concerns now:

  • Are you following the design and evolution of C++11? What blogs, newsgroups, committee papers, and other resources do you follow?
  • Even where you're not using any new features, how have they affected your current choices?
  • What new features are you using now, either in production or otherwise?

The second part is a follow-up, concerning the new standard once it is final:

  • Do you expect to use it immediately? What are you doing to prepare for C++11, other than as listed for the previous questions?
  • Obviously, compiler support must be there, but there's still co-workers, ancillary tools, and other factors to consider. What will most affect your adoption?

Edit: The original really was too argumentative; however, I'm still interested in the underlying question, so I've tried to clean it up and hopefully make it acceptable. This seems a much better avenue than duplicating—even though some answers responded to the argumentative tone, they still apply to the extent that they addressed the questions, and all answers are community property to be cleaned up as appropriate, too.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(15

天邊彩虹 2024-08-18 07:56:11

目前,我使用的是 auto 和 decltype,因为我的大部分代码不使用任何需要 r 值引用或类似内容的东西,而且我现在对 auto 非常满意(优于声明迭代器地图向量)

for now, all I'm using is auto and decltype, since most of my code doesn't use anything necessitating r-value references or things of the like, and I'm quite satisfied with auto for now(beats declaring a an iterator of a vector of maps)

雪花飘飘的天空 2024-08-18 07:56:11

unordered_map。很明显,当 map 最初被指定时,并不是每个人都愿意支付对其关联容器键进行排序的成本,但是,哦,好吧,至少我们终于有了一个完全标准化的 STL 容器。 。

我还使用线程库和其他东西。哈哈,我是早期采用者!我没有工作,也不直接与任何人一起工作,所以我基本上可以随心所欲地处理这些事情。 :)

unordered_map. It should've been obvious when map was originally specified that not everyone would want to pay the cost of sorting their associative container keys but, oh well, at least we finally have a completely standardised STL container for it.

I'm also using the threading library and other stuff. Haha, I'm an early adopter! I'm not employed and I don't work directly with anyone so I can basically do as I like with these things. :)

烟雨扶苏 2024-08-18 07:56:10

无法猜测有多少人对新的 C++0x 感兴趣,我很确定每个了解 C++ 并使用它的人都很好奇并渴望获得更多有关它的新闻。

一旦从 g++ 实现了 C++0x 中的所有新功能,我就开始使用它。仍然适用于小型非便携式项目。
为什么? - 人们不断地告诉我忘记 C++,完全转向脚本语言,以获得更快的代码开发速度,并忘记内存管理。然而,我最好的经验和知识是 C++。我了解 RAII 并每天使用 Boost 库。现在,新功能使我的写作速度比以前快得多。知道右值在这里,指针(甚至是智能指针)从代码中消失了。带有 lambda 表达式的 STL 算法和初始化器列表让我非常高兴。 Auto 关键字很愤怒。

所以,我现在使用 C++0x 的主要原因是开发速度

Can't guess how many are interested in the new C++0x and I am pretty sure that everyone who knows C++ and uses it is curious and eager for more news about it.

I started using everything new from C++0x as soon as it was implemented from g++. Still for small non portable projects.
Why? - People constantly telling me to forget about c++ and switch totally to a scripting language to gain faster code developing and forget about memory management. However, my best experience and knowledge is in c++. I know RAII and use Boost library everyday. Now, the new features make me write much faster then before. Knowing that rvalues are here, pointers(even the smart) disappeared from the code. STL algorithms with lambdas just rock and initilizer lists make me so happy. Auto keyword is furious.

So, my primary reason to use C++0x now is speed of development.

绅士风度i 2024-08-18 07:56:10

我今天不使用C++0x,因为它会导致代码可移植性的丧失。因为现在还没有 C++0x 标准。

答案:
原因:代码可移植性

I'm not using C++0x today, because it will lead to losing code portability. Because there is no C++0x Standard today.

Answer: No
Reason: code portability

猫七 2024-08-18 07:56:10

不,因为它没有在我使用的编译器上完全实现。

当 C++0x 出现并且 Visual Studio 2010 完全发布以及“匹配的”g++ 时,我将尽可能使用 C++0x。这可能是因为我经常开始新项目(我制作游戏)。

尽管我有一个现有的代码库,但每次我想出更好的方法时,它都会发生变化;改变对我来说并不是障碍。利用 C++0x 只是另一个改变。

您会在更大的代码库中发现不同的意见。有些地方更喜欢代码看起来统一,这意味着参差不齐的 C++0x 不是一个选择:他们要么必须转换整个代码才能利用 C++0x,要么不使用它。

其他地方可能鼓励使用 C++0x 功能,并在空闲时间尝试修复旧代码以匹配。

而其他地方,比如我,可能会立即想要利用 C++0x 提供的所有功能。

答案是:视情况而定。

No, because it's not fully implemented on the compilers I use.

When C++0x comes out, and Visual Studio 2010 is fully released, along with a "matching" g++, I will use C++0x when I can. This is likely because I frequently start new projects (I make games).

Although I have an existed code-base, it changes every time I figure out a way to do something better; change isn't an obstacle for me. Taking advantage of C++0x would just be another change.

You'll find different opinions with larger code-bases. Some places prefer code to look uniform, and that means spotty C++0x isn't an option: they'd either have to convert the entire thing to take advantage of C++0x, or not use it.

Other places might encourage the use of C++0x features, and in spare time try to fix up older code to match.

And other places, like me, might immediately want to take advantage of all C++0x has to offer.

The answer is: it depends.

仄言 2024-08-18 07:56:10

不,但我愿意,特别是对于 lambda 功能。

No, but I would like to, especially for the lambda functionality.

鯉魚旗 2024-08-18 07:56:10

不,

我所有的应用软件都是用Java开发的。我所有的快速而肮脏的代码都是用 Python 完成的。我所有的低级工作都是用 C 完成的。我通常不使用 C++(因此它没有影响我)。

如果我确实使用C++,我会像对待C1x一样对待c++0x - 我确保我的代码不会破坏,但我不会使用新功能直到标准完成并除尘。

至于标准批准后我是否会立即使用新功能,答案是不会。这一过程将是一个渐进的过程。随着我当前的应用程序推出维护,我可能会添加它,具体取决于可能的好处。

即使我编写的新应用程序在我考虑使用这些功能之前也需要新的语言功能。

No.

All my application software is developed in Java. All my quick-and-dirty code is done in Python. All my low-level work is done in C. I don't generally use C++ (hence it hasn't affected me).

If I did use C++, I'd treat c++0x like I'm treating C1x - I'm making sure my code won't break but I'm not going to use the new features until the standard is done and dusted.

As to whether I'll use new features as soon as the standard ratifies, no. The process will be a gradual one. As maintenance gets rolled out for my current applications, I may add it, depending on the likely benefit.

Even new applications that I write will require a need for the new language features before I consider using those feautures.

┊风居住的梦幻卍 2024-08-18 07:56:10

不,我大部分时间仍在使用 VC6 :(,最早要到 2020 年才会开始使用 C++0x(也许我应该换家公司?)

No, I'm still using VC6 most of the time :(, won't get on to C++0x until 2020 at the earliest (perhaps I should change company?)

无名指的心愿 2024-08-18 07:56:10

我使用了大量的 C++0x,特别是可变参数模板和函数、auto 和 decltype 以及右值引用。

虽然使用 g++ 4.5 和 Visual Studio 10 可能会有点有趣,但这些功能现在相当稳定,并且在两个编译器上的工作方式相同。

我现在开始的软件项目可能在一年左右的时间内不会发布,到那时我希望这些新的编译器能够作为标准使用。

I'm using lots of C++0x, in particular variadic templates and functions, auto and decltype, and rvalue references.

While things can be a little fun, with g++ 4.5 and Visual Studio 10, these features are now fairly stable and work the same on both compilers.

Software projects I am starting now probably won't be released for a year or so, and by then I expect these new compilers to available as standard.

悲喜皆因你 2024-08-18 07:56:10

是的,当我玩弄我自己的代码时,它并没有假装在大自然中出去。

当我编写一些人会在旧编译器上使用的代码时,不会。

Yes when toying arround on my own code that doesn't have the pretention to go out in the nature.

No when I code something that some people will use on older compilers.

萝莉病 2024-08-18 07:56:10

视情况而定。我正准备在我的硕士论文中使用某些 C++0x 功能(尽管到目前为止,我在等待 VS2010b2 期间主要使用 C++03 编译器),但

我还不会在实际的专业生产工作中使用它,尽管。为此,我想等到标准最终确定,至少在 MSVC 的情况下,等到编译器以非测试版本发布。

Depends. I'm getting ready to use certain C++0x features in my master's thesis (although so far I've stuck with C++03 compilers mostly while waiting for VS2010b2)

I wouldn't use it in actual professional production work yet, though. For that, I'd want to wait until the standard had been finalized, and in the case of MSVC at least, until the compiler had been released in a non-beta version.

我为君王 2024-08-18 07:56:10

我正在使用 TR1(正则表达式、unordered_map、unordered_set...)和一些将在下一个标准中使用的增强功能,例如(希望)lexical_cast...每天,而不仅仅是今天:)

I'm using the TR1 (regex, unordered_map, unordered_set...) and some boost features that'll be in the next standard like (hopefully) lexical_cast... everyday, not just today :)

起风了 2024-08-18 07:56:10

今年的新工作,所以我自愿转向 .NET/C# 世界。我对 C++ 的大部分抱怨在 C# 中都不存在。他们做了很多正确的事情(d'oh!我赞扬 MS)

我认为 C++ 已经成为一个怪物,当我最后一次看到它时,C++0x 似乎让这个怪物变大,而不是把它缩小到真正必要的子集。

对于一个主观问题,我只想说两分钱;)

New job this year, so I willingly changed sides to the .NET/C# world. Most of the gripes I had with C++ are just non-existant in C#. They did a lot of things right (d'oh! Me praising MS)

I think C++ has become a monster, and when I last looked at it C++0x appeared to grow the monster instead of slimming it down to the really necessary subset.

Just my two cents for a subjective question ;)

旧城烟雨 2024-08-18 07:56:10

了解 C++0x 的功能很有趣,特别是当我意识到我已经通过 C++ TR1 使用其中一些功能时。到目前为止,扩展的 for ("foreach")、static_assert 的改进是我使用得最多的。在 C++0x 程序中。

它还教会了我一些关于代码重用的知识。尝试减少我必须更改以适应 C++0x 的代码量,同时尽可能保留与 C++-pre-0x 兼容的代码(例如:库内容)教会了我将一些 C++0x 修复和元素集成到我的 C++0x 之前的工具箱中;特别是扩展 numeric_limits 以包含 const_ 成员,添加 nullptr 模拟,添加 default_delete 和类似的构造,并利用(显然经常被遗忘,因为我除了我的之外还没有找到使用它的代码)[slist|forward_list]< /代码>。

我想说今天使用 C++0x 帮助我更好地继续使用 C++-pre-0x 今天。我不确定我是否会很快实现“完整”C++0x,考虑到 Boost 有助于覆盖那里的一些基础。而且我不打算在很长一段时间内接触 C++ 的正则表达式或线程。

Learning about the features coming in for C++0x was interesting, in particular when I realized I was already using some of them via C++ TR1. So far the extended for ("foreach"), static_assert and the improvements in <functional> are the ones I'm using the more in C++0x programs.

It has also taught me a bit about code reuse. Trying to reduce the amount of code I have to change to adapt to C++0x, and at the same time preserve the code compatible with C++-pre-0x as much as I can (for eg.: library stuff) has taught me to integrate some C++0x fixes and elements to my pre-C++0x toolbox; in particular extending numeric_limits<> to include the const_ members, adding nullptr emulation, adding default_delete and similar constructs, and making use of the (apparently often forgotten, as I've not found code using it besides mine) [slist|forward_list].

I'd say using C++0x today has helped me better continue to use C++-pre-0x today. I'm not sure I'll be taking the leap to "full" C++0x anytime soon, considering Boost helps to cover some ground there. And that I don't intend to touch regexes or threads with C++ in a long, long time.

网白 2024-08-18 07:56:10

我使用 static_assert、decltype,偶尔还使用 r 值引用

I am using static_assert, decltype, and, occasionally, r-value references

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文