其中升压功能与C ++ 11重叠? [英] Which Boost features overlap with C++11?
问题描述
几年前我把架子上我的C ++技能,现在看来,当我再次需要他们,景观发生了变化。
I put my C++ skills on the shelf several years ago and it seems now, when I need them again, the landscape has changed.
我们已经得到C ++ 11现在,我的理解是,它重叠多数Boost功能。
We have got C++11 now, and my understanding is that it overlaps many Boost features.
有一些总结,其中的重叠撒谎,这Boost库将成为遗留问题,建议,其C ++ 11的功能,而不是使用那些提升和更好的呢?
Is there some summary where those overlaps lie, which Boost libraries going to become legacy, recommendation of which C++11 features to use instead of boost ones and which better not?
推荐答案
这是C ++ 11的语言特性和库替换
Replaceable by C++11 language features or libraries
- Foreach源→基于范围为
- 功能/转发→完美转发(带的rvalue引用中的可变参数模板和的std ::向前)
- 到位厂,键入的地方厂→完美转发(在至少在记录用例)
- LAMBDA → LAMBDA前pression (非多态的情况下)
- 局部功能→LAMBDA前pression
- 最小 - 最大→的std ::最小最大,的的std :: minmax_element
- 比→的std ::比
- 静态断言→static_assert
- 主题→&LT;螺纹&gt;中等(但检查<一href=\"http://stackoverflow.com/questions/7241993/is-it-smart-to-replace-boostthread-and-boostmutex-with-c11-equivalents\">this问题)。
- TYPEOF →自动,decltype
- 值初始化→名单初始化(§8.5.4/ 3 )
- 数学/特殊功能→
&LT;&CMATH GT;
,见下面的列表- 伽玛功能(tgamma),日志伽玛功能(lgamma函数)
- 误差函数(ERF,ERFC)
-
log1p
,的expm1
-
CBRT
,hypot
-
ACOSH
,ASINH
,ATANH
- Foreach → range-based for
- Functional/Forward → Perfect forwarding (with rvalue references, variadic templates and std::forward)
- In Place Factory, Typed In Place Factory → Perfect forwarding (at least for the documented use cases)
- Lambda → Lambda expression (in non-polymorphic cases)
- Local function → Lambda expression
- Min-Max → std::minmax, std::minmax_element
- Ratio → std::ratio
- Static Assert → static_assert
- Thread → <thread>, etc (but check this question).
- Typeof → auto, decltype
- Value initialized → List-initialization (§8.5.4/3)
- Math/Special Functions →
<cmath>
, see the list below- gamma function (tgamma), log gamma function (lgamma)
- error functions (erf, erfc)
log1p
,expm1
cbrt
,hypot
acosh
,asinh
,atanh
TR1(它们标记在文档如果这些都是TR1库)
TR1 (they are marked in the documentation if those are TR1 libraries)
- 阵列→的std ::阵列
- 绑定→的std ::绑定
- 启用如果→的std :: enable_if
- 功能→的std ::功能
- 成员函数→的std ::的mem_fn
- 随机→&LT;随机&GT;
- 参考→的std ::裁判,的的std :: CREF
- 正则表达式→&LT;正则表达式&GT;
- 结果中→std::result_of
- 智能PTR →的std ::的unique_ptr,性病:: shared_ptr的,性病:: weak_ptr的(不过的boost :: intrusive_ptr仍不能替换)
- 交换(交换阵列)→的std ::互换
- 元组→的std ::元组
- 型性状→&LT; type_traits&GT;
- 无序→&LT; unordered_set&GT中,&lt;&unordered_map GT;
- Array → std::array
- Bind → std::bind
- Enable If → std::enable_if
- Function → std::function
- Member Function → std::mem_fn
- Random → <random>
- Ref → std::ref, std::cref
- Regex → <regex>
- Result Of → std::result_of
- Smart Ptr → std::unique_ptr, std::shared_ptr, std::weak_ptr (but boost::intrusive_ptr still cannot be replaced)
- Swap (swapping arrays) → std::swap
- Tuple → std::tuple
- Type Traits → <type_traits>
- Unordered → <unordered_set>, <unordered_map>
功能从C ++ 11后移植:
Features back-ported from C++11:
- Atomic ← std::atomic
- Chrono ← <chrono> (see below)
- Move ← Rvalue references
这是C ++ 17的语言功能替换:
Replaceable by C++17 language features:
- String_ref →的std :: string_view
- 文件系统→<filesystem> (文件系统TS)
- 可选→的std ::可选的(的图书馆基础TS V1 )
- 任何→性病::任何(库基础TS V1)
- 数学/特殊功能→
&LT;&CMATH GT;
(特殊数学)请参阅下面的列表- 测试功能
- (正常/关联/球),勒让德多项式
- (正常/关联)勒让德多项式
- 埃尔米特多项式
- 贝塞尔(J / Y / I / K)功能(是被称为诺依曼函数C ++)
- 球贝塞尔(J / y)的功能
- (不完整/完整)的椭圆积分(第一/二/三的那种)
- 黎曼ζ函数
- 指数积分荣
- String_ref → std::string_view
- Filesystem → <filesystem> (Filesystem TS)
- Optional → std::optional (Library Fundamentals TS v1)
- Any → std::any (Library Fundamentals TS v1)
- Math/Special Functions →
<cmath>
(Special Math IS), see the list below- beta function
- (normal / associated / spherical) Legendre polynomials
- (normal / associated) Legendre polynomials
- Hermite polynomials
- Bessel (J / Y / I / K) functions (Y is called Neumann function in C++)
- spherical Bessel (j / y) functions
- (incomplete / complete) elliptic integrals of (first / second / third kind)
- Riemann zeta function
- exponential integral Ei
标准的团队一直都在致力于它:
The standard team is still working on it:
- 数学公因式→的std ::实验性的: :GCD,LCM(图书馆基础TS V2)
- 概念检查→概念TS
- 范围→范围TS
- 短耳→网络TS(插座和计时器只)
- 多precision →Numerics的TS
- 协程 /的 Coroutine2 →协程TS
- Math Common Factor → std::experimetal::gcd, lcm (Library Fundamentals TS v2)
- Concept check → Concepts TS
- Range → Range TS
- Asio → Networking TS (sockets and timers only)
- Multiprecision → Numerics TS
- Coroutine/Coroutine2 → Coroutines TS
可以下调或卸下了很大一部分使用可变参数模板。 词汇投可以通过STD更换:: to_string和的std :: STO X
A large part of MPL can be trimmed down or removed using variadic templates. Some common use cases of Lexical cast can be replaced by std::to_string and std::stoX.
有些Boost库涉及到C ++ 11,但也有一些更多的扩展,例如 Boost.Functional /哈希包含的 hash_combine 和相关功能未发现C ++ 11的 Boost.Chrono 具有I / O和取整等诸多钟表等,所以你可能仍然希望看一看升压那些真正解雇他们。
Some Boost libraries are related to C++11 but also have some more extensions, e.g. Boost.Functional/Hash contains hash_combine and related functions not found in C++11, Boost.Chrono has I/O and rounding and many other clocks, etc. so you may still want to take a look at the boost ones before really dismissing them.
这篇关于其中升压功能与C ++ 11重叠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!