推动::可选的替代在C ++标准库 [英] boost::optional alternative in C++ Standard Library

查看:181
本文介绍了推动::可选的替代在C ++标准库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的程序而不升压使用工作,但无法找到一些有用的模式替代。也就是说,我无法找到的boost ::可选的标准库-likewise格局。是否有升压一些标准的替代::可选(C ++ 11或其他地方)?

I'm trying to get my program working without boost usage, but can't find an alternative of some useful patterns. Namely, I can't find boost::optional-likewise pattern in the standard library. Is there some standard alternative for boost::optional (C++11 or somewhere else)?

推荐答案

简短的回答:没有。

龙答:根据升压规范自己动手。该文档是非常详尽和code不是那么复杂,但是这仍然需要高于平均水平的C ++技能。

Long answer: Roll your own according to the boost spec. The documentation is quite exhaustive and the code isn't that complex, but this still requires above average C++ skills.

要更新这个答案:C ++ 14遗憾的是没有用出货的std ::可选的。目前的建议(修订版5) N3793 ,预计发运作为一个单独的技术规范或成为C ++ 17的部分。

To update this answer: C++14 unfortunately did not ship with std::optional. The current proposal (Revision 5) is N3793 and it is expected to be shipped as a separate technical specification or to become part of C++17.

这篇关于推动::可选的替代在C ++标准库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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