Boost Replaceable by C ++ 11 language features or libraries

Source: Internet
Author: User
Tags variadic

Replaceable by C ++ 11 language features or libraries

  • Foreach → Range-based
  • 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 specified ented 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 (2.2.8. 5.4/3)

TR1 (they are marked in the documentation if those are TR1 libraries)

  • 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>

Features back-ported from C ++ 11:

  • Atomic writable std: atomic
  • Chrono lower <chrono> (see below)
  • Move parameter Rvalue references

Replaceable by C ++ 14/17 language features or libraries (based on http://isocpp.org/blog/2013/04/trip-report-iso-c-spring-2013-meeting)

  • Concept check → Concepts Lite
  • Filesystem → <filesystem>
  • Optional → std: optional

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.

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. chronohas I/O and rounding and export other clocks, etc. so you may still want to take a look at the boost ones before really dismissing them.


Http://stackoverflow.com/questions/8851670/relevant-boost-features-vs-c11


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.