////
Copyright (c) 2024 The C++ Alliance, Inc. (https://cppalliance.org)

Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Official repository: https://github.com/boostorg/website-v2-docs
////
= Standard C++ Library
:navtitle: Standard C++ Library

== FAQ


. *Where can I find the most complete documentation on the C++ Standard Library?*
+
Here, the https://en.cppreference.com/w/cpp/standard_library[C++ Standard Library]. The Search feature is useful for locating individual components.

. *How can I be sure when I should use a Boost library or a component of the Standard Library?*
+
Most Boost libraries provide useful and advanced functionality unavailable in the Standard Library. A few Boost libraries have indeed been superseded by the Standard Library, but remain in Boost for backwards compatibility. To determine which you should use, given the choice, consider working through the following process.
+
Note:: When a Boost library is included in the Standard Library, not _all_ of the functionality provided is necessarily standardized. For example, boost:system[] has been standardized but still contains additional functionality not available in the standard. Although standardization might include all of the functionality of a Boost library, performance is not always identical and it can be of value to use the Boost version for higher performance (for example, boost:regex[]). In a few cases, the whole of the Boost library is standardized and the Boost version does not improve on performance (for example, boost:thread[]). 
+
.. Check the Boost library documentation, as their relationship to the Standard Library is sometimes documented. Both the Overview and the Release Notes are good sources of information for mentions of standardization.
.. The https://en.cppreference.com/w/cpp/standard_library[C++ Standard Library] is also well documented. Check to see if the functionality you are looking for is now part of the standard. If you have specific features in mind, comparing the Boost and Standard library functions and classes should provide you with a definitive answer on which to use.
.. If you are less certain of the specific features you need, developers often discuss the status and relevance of Boost libraries in comparison to the standard. Browse, or ask a question in, https://stackoverflow.com/search?q=Boost&s=f447efbc-2ea3-4846-a5d3-0f8676b3f65c[Stack Overflow], https://www.reddit.com/search/?q=Boost+libraries&type=link&cId=28644139-c8b3-48a5-87b6-0c9822188ed4&iId=7f450c5d-6180-4538-a39f-7df7876df4e9&onetap_auto=true&one_tap=true[Reddit], or the https://lists.boost.org/mailman/listinfo.cgi/boost[Boost Developers Mailing List].
.. If you want to dig into the source code, check the activity in the https://github.com/boostorg/boost/tree/master/libs[Boost library's GitHub repository]. Libraries that have been largely superseded have less recent activity compared to those still actively developed and extended. Also check Release Notes for mentions of deprecations or recommendations.
.. Current examples of libraries where you should now use the Standard Library include boost:smart_ptr[] (use `std::shared_ptr`, `std::unique_ptr` etc.), boost:thread[] (use `std::thread`), boost:chrono[] (use `std::chrono`), and boost:random[] (use `std::rand`). Referring to the documentation for these might help show the language used when discussing the relationship with the Standard Library.

. *Are there any Boost libraries currently being considered for inclusion in the Standard Library?*
+
Yes, currently the functionality of two Boost libraries are being considered:
+
.. boost:lambda2[] : for details refer to https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3171r0.html[Adding functionality to placeholder types]
.. boost:fiber[] : for details refer to https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p0876r17.pdf[fiber_context - fibers without scheduler]

. *What is the current status of the Standard Library and when is the next release?*
+
*C++ 2026* is slated as the next full release, for full details refer to https://isocpp.org/std/status[Current Status].

. *What are the big ticket items that should appear in the C++26 Standard Library?*
+
Here is a table of the most compelling:
+
[cols="1,3",options="header",stripes=even,frame=none]
|===
| *Feature* | *Description* 
| **Contracts**                                        | Language support for preconditions, postconditions, and assertions (`expects`, `ensures`). Major safety and correctness feature long awaited since C++20 removal. 
| **Static Reflection**                        | Compile-time introspection of types, members, functions, attributes. Enables metaprogramming without template hacks.          
| **Pattern Matching**                                 | Functional-style `match`/`inspect` syntax for variant-like types and structured branching. 
| **`std::expected` Improvements & Monadic Utilities** | Functional chaining helpers (`and_then`, `transform`, etc.) across error-handling types. 
| **Senders / Receivers (`std::execution`)**             | Modern async execution model replacing ad-hoc futures. Foundation for high-performance async C++. 
| **`std::generator`**                                 | Coroutine-based lazy range generator for pipelines and streaming data.  
| **`std::embed` (Binary Resource Embedding)**         | Embed files/resources directly into binaries at compile time. Great for games, ML, embedded, tooling.  
| **Hazard Pointers / RCU**                            | Lock-free memory reclamation primitives for high-performance concurrency.
| **Standard Units & Quantities Library**              | Type-safe physical units (meters, seconds, etc.). Prevents unit conversion bugs. 
| **`std::flat_map` / `std::flat_set`**                | Cache-friendly associative containers (vector-based). 
| **`std::inplace_vector`**                            | Fixed-capacity vector with no heap allocation. Important for real-time systems.
| **Freestanding Library Expansion**                   | Makes C++ usable in kernels, embedded, GPUs without full runtime. 
| **constexpr expansion (“constexpr everything”)**     | Many standard library components now usable at compile time.
| **Improved Module Ecosystem**                        | Numerous refinements to make modules practical for large codebases. 
| **Unicode improvements**                             | Better text encoding and Unicode handling across the standard library.
|===

. *What are the big ticket items that missed the C++26 Standard Library, but may appear in the 2029 release?*
+
Several initiatives are likely candidates, but need more time:
+
[cols="1,3,2",options="header",stripes=even,frame=none]
|===
| *Feature* | *Description* | *Why it missed 26*
| **Pattern Matching v2 (full algebraic matching)**                 | Extends the accepted pattern matching to support destructuring, guards, exhaustive checking, and more functional-style power. | Initial version was accepted, but the full vision is large and still evolving. 
| **Metaclasses / Compile-time Classes**                            | A revolutionary feature allowing user-defined “kinds of classes” (value types, interfaces, etc.) enforced by the compiler.    | Huge design space and tooling impact. Needs more experience from Reflection first. Perhaps more long-term than likely for C++29.     
| **Unified Call Syntax (UFCS)**                                    | Allows `obj.func(x)` to call free functions as if they were members. Improves discoverability and pipeline style.             | Lots of bikeshedding over lookup rules and ambiguity.     
| **Executor refinements & Networking TS integration**              | Completing the networking library on top of Senders/Receivers.                                                                | Senders/Receivers landed late; networking integration needs time to bake.  
| **Trivial Relocation**                                            | Lets objects be safely moved with `memcpy` when possible, which should lead to a massive performance win for containers.                            | Deep ABI and library implications; needed more consensus.   
| **`std::async_scope` and structured concurrency**                 | High-level lifetime management for async tasks (similar to modern languages).                                                 | Depends on ecosystem experience with Senders/Receivers first.               
| **SIMD Everywhere (`std::simd` expansion)**                         | Making vectorization first-class and pervasive across the standard library.                                                   | Big scope and ongoing performance experimentation.
| **Language support for contracts tooling modes**                  | The accepted Contracts feature is the “MVP”. Advanced tooling levels and build modes are still being designed.                | Needed to ship a minimal version first.                                         
| **Compile-time Reflection v2 (code injection / metaprogramming)** | Extends reflection to allow generating new declarations.                                                                      | Committee intentionally staged reflection to reduce risk.   
| **Pattern-based error handling (try expressions)**                | Expression-based error propagation similar to Rust.                                                                     | Interaction with exceptions and `expected` still debated.       
| **`std::status_code` / modern error system**                      | A zero-overhead alternative to exceptions and `std::error_code`.                                                              | Competes with existing mechanisms; consensus not complete.              
| **Heterogeneous lookup everywhere**                               | Transparent hashing/comparisons across more containers and algorithms.                                                        | Lots of small but invasive library changes.                               

|===

. *Are there _themes_ to a release of the Standard?*
+
To an extent, pass:[C++20] was the "Coroutines and Ranges" release, then pass:[C++23] was a cleanup release. pass:[C++26] is shaping up to be the "Safety and Async and Metaprogramming" release. Perhaps pass:[C++29] will be the "Performance, Networking, and Compile-time Metaprogramming Superpowers" release.



== See Also

* xref:faq.adoc[]