Code Monkey home page Code Monkey logo

stl's Introduction

Microsoft's C++ Standard Library

This is the official repository for Microsoft's implementation of the C++ Standard Library (also known as the STL), which ships as part of the MSVC toolset and the Visual Studio IDE.

  • Our Changelog tracks which updates to this repository appear in each VS release.
  • Our Status Chart displays our overall progress over time.
  • Join our Discord server.
  • CI Status Badge (STL-CI build status)
  • ASan CI Status Badge (STL-ASan-CI build status)

What This Repo Is Useful For

If you're a programmer who just wants to use the STL, you don't need this repo. Simply install the Visual Studio IDE and select the "Desktop development with C++" workload.

If you want to participate in the STL's development, welcome! You can report issues, comment on pull requests, and learn about what we're working on. You can also submit pull requests to fix bugs or add features: see CONTRIBUTING.md for more information.

Finally, you can take our code and use it in other apps and libraries (according to the terms of our license, like everything else).

GitHub Migration Status

We're in the process of moving all of our work on the STL to GitHub. Current status:

  • Code: Done. Our source code is available under the Apache License v2.0 with LLVM Exception. (See LICENSE.txt and NOTICE.txt for more information.)

  • Build System: In progress. We're working on a CMake build system, which is currently capable of building one flavor of the STL (native desktop). We need to extend this to build all of the flavors required for the MSVC toolset (e.g. /clr, /clr:pure, OneCore, Spectre). Until that's done, we're keeping our legacy build system around in the stl/msbuild subdirectory. (We're keeping those files in this repo, even though they're unusable outside of Microsoft, because they need to be updated whenever source files are added/renamed/deleted. We'll delete the legacy machinery as soon as possible.)

  • Tests: In progress. We rely on three test suites: std, tr1, and libcxx. We've partially ported std and tr1, and fully ported libcxx to run under lit using the various configurations/compilers we test internally.

  • Continuous Integration: In progress. We've set up Azure Pipelines to validate changes to the repository. Currently, it builds the STL (native desktop for x86, x64, ARM, and ARM64). Also, it strictly verifies that all of our files have been formatted with clang-format and follow our other whitespace conventions.

  • Contribution Guidelines: Coming soon. Working on the STL's code involves following many rules. We have codebase conventions, Standard requirements, Microsoft-specific requirements, binary compatibility (ABI) requirements, and more. We're eager to begin accepting features and fixes from the community, but in addition to setting up a CI system, we need to write down all of the rules that are currently stored in our brains. (The ABI rules may be useful to other C++ libraries.)

  • Issues: In progress. We're going to use GitHub issues to track all of the things that we need to work on. This includes C++20 features, LWG issues, conformance bugs, performance improvements, and other todos. There are approximately 200 active bugs in the STL's Microsoft-internal database; we need to manually replicate all of them to GitHub issues. Currently, the cxx20 tag and LWG tag are done; every remaining work item is tracked by a GitHub issue. The bug tag and enhancement tag are being populated.

  • Plans: In progress. We're writing up our Roadmap.

Goals

We're implementing the latest C++ Working Draft, currently N4981, which will eventually become the next C++ International Standard. The terms Working Draft (WD) and Working Paper (WP) are interchangeable; we often informally refer to these drafts as "the Standard" while being aware of the difference. (There are other relevant Standards; for example, supporting /std:c++14 and /std:c++17 involves understanding how the C++14 and C++17 Standards differ from the Working Paper, and we often need to refer to the C Standard Library and ECMAScript regular expression specifications.)

Our primary goals are conformance, performance, usability, and compatibility.

  • Conformance: The Working Paper is a moving target; as features and LWG issue resolutions are added, we need to implement them. That can involve a lot of work because the STL is required to behave in very specific ways and to handle users doing very unusual things.

  • Performance: The STL needs to be extremely fast at runtime; speed is one of C++'s core strengths and most C++ programs use the STL extensively. As a result, we spend more time on optimization than most general-purpose libraries. (However, we're wary of changes that improve some scenarios at the expense of others, or changes that make code significantly more complicated and fragile. That is, there's a "complexity budget" that must be spent carefully.)

  • Usability: This includes parts of the programming experience like compiler throughput, diagnostic messages, and debugging checks. For example, we've extensively marked the STL with [[nodiscard]] attributes because this helps programmers avoid bugs.

  • Compatibility: This includes binary compatibility and source compatibility. We're keeping VS 2022 binary-compatible with VS 2015/2017/2019, which restricts what we can change in VS 2022 updates. (We've found that significant changes are possible even though other changes are impossible, which we'll be documenting in our Contribution Guidelines soon.) While there are a few exceptions to this rule (e.g. if a feature is added to the Working Paper, we implement it, and then the feature is significantly changed before the International Standard is finalized, we reserve the right to break binary compatibility because /std:c++latest offers an experimental preview of such features), binary compatibility generally overrides all other considerations, even conformance. Source compatibility refers to being able to successfully recompile user code without changes. We consider source compatibility to be important, but not all-important; breaking source compatibility can be an acceptable cost if done for the right reasons in the right way (e.g. in a controlled manner with escape hatches).

Non-Goals

There are things that we aren't interested in doing with this project, for various reasons (most importantly, we need to focus development effort on our goals). Some examples:

  • Non-goal: Porting to other platforms.

  • Non-goal: Adding non-Standard extensions.

  • Non-goal: Implementing Technical Specifications. (We're prioritizing features in the Working Paper. Occasionally, we might implement some or all of a TS, often when we're working on the specification itself.)

If you're proposing a feature to WG21 (the C++ Standardization Committee), you're welcome (and encouraged!) to use our code as a base for a proof-of-concept implementation. These non-goals simply mean that we're unable to consider pull requests for a proposed feature until it has been voted into a Working Paper. After that happens, we'll be delighted to review a production-ready pull request.

Reporting Issues

You can report STL bugs here, where they'll be directly reviewed by maintainers. You can also report STL bugs through Developer Community, or the VS IDE (Help > Send Feedback > Report a Problem...).

Please help us efficiently process bug reports by following these rules:

  • Only STL bugs should be reported here. If it's a bug in the compiler, CRT, or IDE, please report it through Developer Community or Report A Problem. If it's a bug in the Windows SDK, please report it through the Feedback Hub app. If you aren't sure, try to reduce your test case and see if you can eliminate the STL's involvement while still reproducing the bug.

  • You should be reasonably confident that you're looking at an actual implementation bug, instead of undefined behavior or surprising-yet-Standard behavior. Comparing against other implementations can help (but remember that implementations can differ while conforming to the Standard); try Compiler Explorer. If you still aren't sure, ask the nearest C++ expert.

  • You should prepare a self-contained command-line test case, ideally as small as possible. We need a source file, a command line, what happened (e.g. a compiler error, runtime misbehavior), and what you expected to happen. By "self-contained", we mean that your source file has to avoid including code that we don't have. Ideally, only CRT and STL headers should be included. If you have to include other MSVC libraries, or the Windows SDK, to trigger an STL bug, that's okay. But if you need parts of your own source code to trigger the STL bug, you need to extract that for us. (On Developer Community, we'll accept zipped IDE projects if you have no other way to reproduce a bug, but this is very time-consuming for us to reduce.)

  • A good title is helpful. We prefer "<header_name>: Short description of your issue". You don't usually need to mention std:: or C++. For example, "<type_traits>: is_cute should be true for enum class FluffyKittens".

It's okay if you report an apparent STL bug that turns out to be a compiler bug or surprising-yet-Standard behavior. Just try to follow these rules, so we can spend more time fixing bugs and implementing features.

How To Build With The Visual Studio IDE

  1. Install Visual Studio 2022 17.11 Preview 1 or later.
    • Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
    • We recommend selecting "C++ CMake tools for Windows" in the VS Installer. This will ensure that you're using supported versions of CMake and Ninja.
    • Otherwise, install CMake 3.28.0 or later, and Ninja 1.11.0 or later.
    • Make sure Python 3.12 or later is available to CMake.
  2. Open Visual Studio, and choose the "Clone or check out code" option. Enter the URL of this repository, https://github.com/microsoft/STL.
  3. Open a terminal in the IDE with Ctrl + ` (by default) or press on "View" in the top bar, and then "Terminal".
  4. In the terminal, invoke git submodule update --init --progress
  5. Choose the architecture you wish to build in the IDE, and build as you would any other project. All necessary CMake settings are set by CMakePresets.json.

How To Build With A Native Tools Command Prompt

  1. Install Visual Studio 2022 17.11 Preview 1 or later.
    • Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
    • We recommend selecting "C++ CMake tools for Windows" in the VS Installer. This will ensure that you're using supported versions of CMake and Ninja.
    • Otherwise, install CMake 3.28.0 or later, and Ninja 1.11.0 or later.
    • Make sure Python 3.12 or later is available to CMake.
  2. Open a command prompt.
  3. Change directories to a location where you'd like a clone of this STL repository.
  4. git clone https://github.com/microsoft/STL.git --recurse-submodules

To build the x86 target:

  1. Open an "x86 Native Tools Command Prompt for VS 2022 Preview".
  2. Change directories to the previously cloned STL directory.
  3. cmake --preset x86
  4. cmake --build --preset x86

To build the x64 target (recommended):

  1. Open an "x64 Native Tools Command Prompt for VS 2022 Preview".
  2. Change directories to the previously cloned STL directory.
  3. cmake --preset x64
  4. cmake --build --preset x64

How To Consume

Consumption of the built library is largely based on the build system you're using. There are at least 2 directories you need to hook up. Assuming you built the x64 target with the Visual Studio IDE, with the STL repository cloned to C:\Dev\STL, build outputs will end up at C:\Dev\STL\out\x64\out. Ensure that the inc directory is searched for headers, and that lib\{architecture} is searched for link libraries, before any defaults supplied by MSVC. The names of the import and static libraries are the same as those that ship with MSVC. As a result, the compiler /MD, /MDd, /MT, or /MTd switches will work without modification of your build scripts or command-line muscle memory.

Should you choose to use the DLL flavors, the DLLs to deploy are built to bin\{architecture}. Note that the DLLs generated by the CMake build system here have a suffix, defaulting to _oss, which distinguishes them from the binaries that ship with MSVC. That avoids any conflict with the DLLs installed by the redistributables into System32 and ensures that other components wanting to be a "guest in your process", like print drivers and shell extensions, see the export surface of the STL they were built with. Otherwise, the "msvcp140.dll" you deployed in the same directory as your .exe would "win" over the versions in System32.

The compiler looks for include directories according to the INCLUDE environment variable, and the linker looks for import library directories according to the LIB environment variable, and the Windows loader will (eventually) look for DLL dependencies according to directories in the PATH environment variable. The build generates a batch script named set_environment.bat in the output directory. If you run this script in a VS Developer Command Prompt, it will insert the proper directories into the INCLUDE, LIB, and PATH environment variables to ensure that the built headers and libraries are used.

Complete Example Using x64 DLL Flavor

From an "x64 Native Tools Command Prompt for VS 2022 Preview":

C:\Users\username\Desktop>C:\Dev\STL\out\x64\set_environment.bat

C:\Users\username\Desktop>type example.cpp
#include <iostream>

int main() {
    std::cout << "Hello STL OSS world!\n";
}

C:\Users\username\Desktop>cl /nologo /EHsc /W4 /WX /MDd /std:c++latest .\example.cpp
example.cpp

C:\Users\username\Desktop>.\example.exe
Hello STL OSS world!

C:\Users\username\Desktop>dumpbin /DEPENDENTS .\example.exe | findstr msvcp
    msvcp140d_oss.dll

How To Run The Tests With A Native Tools Command Prompt

  1. Follow either How To Build With A Native Tools Command Prompt or How To Build With The Visual Studio IDE.
  2. Acquire Python 3.12 or newer and have it on the PATH (or run it directly using its absolute or relative path).
  3. Have LLVM's bin directory on the PATH (so clang-cl.exe is available).
    • We recommend selecting "C++ Clang tools for Windows" in the VS Installer. This will automatically add LLVM to the PATH of the x86 and x64 Native Tools Command Prompts, and will ensure that you're using a supported version.
    • Otherwise, use LLVM's installer and choose to add LLVM to your PATH during installation.
  4. Follow the instructions below.

Running All The Tests

After configuring and building the project, running ctest from the build output directory will run all the tests. CTest will only display the standard error output of tests that failed. In order to get more details from CTest's lit invocations, run the tests with ctest -V.

Running A Subset Of The Tests

${PROJECT_BINARY_DIR}\tests\utils\stl-lit\stl-lit.py can be invoked on a subdirectory of a test suite and will execute all the tests under that subdirectory. This can mean executing the entirety of a single test suite, running all tests under a category in libcxx, or running a single test in std and tr1.

Examples

These examples assume that your current directory is C:\Dev\STL\out\x64.

  • This command will run all of the test suites with verbose output.
    • ctest -V
  • This command will also run all of the test suites.
    • python tests\utils\stl-lit\stl-lit.py ..\..\llvm-project\libcxx\test ..\..\tests\std ..\..\tests\tr1
  • This command will run all of the std test suite.
    • python tests\utils\stl-lit\stl-lit.py ..\..\tests\std
  • If you want to run a subset of a test suite, you need to point it to the right place in the sources. The following will run the single test found under VSO_0000000_any_calling_conventions.
    • python tests\utils\stl-lit\stl-lit.py ..\..\tests\std\tests\VSO_0000000_any_calling_conventions
  • You can invoke stl-lit with any arbitrary subdirectory of a test suite. In libcxx this allows you to have finer control over what category of tests you would like to run. The following will run all the libcxx map tests.
    • python tests\utils\stl-lit\stl-lit.py ..\..\llvm-project\libcxx\test\std\containers\associative\map
  • You can also use the --filter option to include tests whose names match a regular expression. The following command will run tests with "atomic_wait" in their names in both the std and libcxx test suites.
    • python tests\utils\stl-lit\stl-lit.py ..\..\llvm-project\libcxx\test ..\..\tests\std --filter=atomic_wait
  • There's also a --filter-out option to exclude tests matching a regular expression; --filter=iota --filter-out=view would run tests with names matching "iota" but not "view".

Interpreting The Results Of Tests

CTest

When running the tests via CTest, all of the test suites are considered to be a single test. If any single test in a test suite fails, CTest will simply report that the stl test failed.

Example:

0% tests passed, 1 tests failed out of 1

Total Test time (real) = 2441.55 sec

The following tests FAILED:
      1 - stl (Failed)

The primary utility of CTest in this case is to conveniently invoke stl-lit.py with the correct set of arguments.

CTest will output everything that was sent to stderr for each of the failed test suites, which can be used to identify which individual test within the test suite failed. It can sometimes be helpful to run CTest with the -V option in order to see the stdout of the tests.

stl-lit

When running the tests directly via the generated stl-lit.py script the result of each test will be printed. The format of each result is {Result Code}: {Test Suite Name} :: {Test Name}:{Configuration Number}.

Example:

-- Testing: 28 tests, 12 workers --
PASS: tr1 :: tests/cwchar1:01 (1 of 28)
PASS: tr1 :: tests/cwchar1:11 (2 of 28)
PASS: tr1 :: tests/cwchar1:02 (3 of 28)
PASS: tr1 :: tests/cwchar1:03 (4 of 28)
PASS: tr1 :: tests/cwchar1:00 (5 of 28)
PASS: tr1 :: tests/cwchar1:04 (6 of 28)
PASS: tr1 :: tests/cwchar1:05 (7 of 28)
PASS: tr1 :: tests/cwchar1:09 (8 of 28)
PASS: tr1 :: tests/cwchar1:06 (9 of 28)
UNSUPPORTED: tr1 :: tests/cwchar1:20 (10 of 28)
UNSUPPORTED: tr1 :: tests/cwchar1:21 (11 of 28)
UNSUPPORTED: tr1 :: tests/cwchar1:22 (12 of 28)
UNSUPPORTED: tr1 :: tests/cwchar1:23 (13 of 28)
UNSUPPORTED: tr1 :: tests/cwchar1:24 (14 of 28)
PASS: tr1 :: tests/cwchar1:07 (15 of 28)
PASS: tr1 :: tests/cwchar1:08 (16 of 28)
PASS: tr1 :: tests/cwchar1:10 (17 of 28)
PASS: tr1 :: tests/cwchar1:16 (18 of 28)
PASS: tr1 :: tests/cwchar1:17 (19 of 28)
PASS: tr1 :: tests/cwchar1:14 (20 of 28)
PASS: tr1 :: tests/cwchar1:12 (21 of 28)
PASS: tr1 :: tests/cwchar1:13 (22 of 28)
PASS: tr1 :: tests/cwchar1:19 (23 of 28)
PASS: tr1 :: tests/cwchar1:18 (24 of 28)
PASS: tr1 :: tests/cwchar1:15 (25 of 28)
PASS: tr1 :: tests/cwchar1:25 (26 of 28)
PASS: tr1 :: tests/cwchar1:26 (27 of 28)
PASS: tr1 :: tests/cwchar1:27 (28 of 28)

Testing Time: 3.96s
  Expected Passes    : 23
  Unsupported Tests  : 5

In the above example, we see that 23 tests succeeded and 5 were unsupported.

Result Code Values

Our tests use the standard lit result codes, and an undocumented result code: SKIPPED. For our tests, only the PASS, XFAIL, XPASS, FAIL, UNSUPPORTED, and SKIPPED result codes are relevant.

The PASS and FAIL result codes are self-explanatory. We want our tests to PASS and not FAIL.

The XPASS and XFAIL result codes are less obvious. XPASS is actually a failure result and indicates that we expected a test to fail but it passed. XFAIL is a successful result and indicates that we expected the test to fail and it did. Typically an XPASS result means that the expected_results.txt file for the test suite needs to be modified. If the XPASS result is a test legitimately passing, the usual course of action would be to remove a FAIL entry from the expected_results.txt. However, some tests from libcxx mark themselves as XFAIL (meaning they expect to fail) for features they have added tests for but have yet to implement in libcxx. If the STL implements those features first the tests will begin passing unexpectedly for us and return XPASS results. In order to resolve this it is necessary to add a PASS entry to the expected_results.txt of the test suite in question.

The UNSUPPORTED result code means that the requirements for a test are not met and so it will not be run. Currently, all tests which use the /clr or /clr:pure options are unsupported. Also, the /BE option is unsupported for x86.

The SKIPPED result code indicates that a given test was explicitly skipped by adding a SKIPPED entry to the expected_results.txt. A test may be skipped for a number of reasons, which include, but are not limited to:

  • being an incorrect test
  • taking a very long time to run
  • failing or passing for the incorrect reason

Debugging Individual Tests

While stl-lit is super awesome in finding out that something is wrong or not even compiling, it is not really helpful in debugging what is going wrong. However, debugging individual tests is rather simple given some additional steps. Let's assume we want to debug a new feature with tests located in tests\std\tests\GH_XXXX_meow.

As always, build the STL from your branch and run the tests:

C:\STL\out\x64> ninja
C:\STL\out\x64> python tests\utils\stl-lit\stl-lit.py -v C:\STL\tests\std\tests\GH_XXXX_meow

Let's assume one of the tests fails an assert and we want to debug that configuration. stl-lit will conveniently print the build command, which is far too long to provide here in full. The important part is to add the following options to provide debug symbols: /Zi /Fdbark.pdb.

You can replace bark with any descriptive name you like. Add these before the "-link" option in the command line and recompile. Example:

C:\STL\out\x64>cl "C:\STL\tests\std\tests\GH_XXXX_meow\test.cpp" [... more arguments ...]
"-FeC:\STL\out\x64\tests\std\tests\GH_XXXX_meow\Output\02\GH_XXXX_meow.exe" /Zi /Fdbark.pdb "-link"
[... more arguments ...]

You can now start debugging the test via:

devenv "C:\STL\out\x64\tests\std\tests\GH_XXXX_meow\Output\02\GH_XXXX_meow.exe"
       "C:\STL\tests\std\tests\GH_XXXX_meow\test.cpp"

However, this might not work right away, as Visual Studio may complain about a missing msvcp140_oss.dll. The reason is that the STL builds those and other DLLs itself and we should under no circumstances overwrite the installed ones. If you are testing one of the configurations with dynamic linkage (/MD or /MDd) the easiest solution is to add the build folder to your path:

set PATH=C:\STL\out\x64\out\bin\amd64;%PATH%

Benchmarking

For performance-sensitive code โ€“ containers, algorithms, and the like โ€“ you may wish to write and/or run benchmarks, and the STL team will likely run any benchmarks we do have in our PR process. Additionally, if you are writing a "performance improvement" PR, please add and run benchmarks to show that the PR does, in fact, improve performance.

The benchmarking code is located in benchmarks. Adding a new benchmark is as easy as adding a new file to benchmarks/src, and then adding add_benchmark(<name> <source_file>) to benchmarks/CMakeLists.txt. You may also modify an existing benchmark file. We use Google's Benchmark library, so you may find their documentation helpful, and you can also read the existing code for how we use it.

To run benchmarks, you'll need to first build the STL, then build the benchmarks:

cmake --preset x64
cmake --build --preset x64
cmake -B out\bench -S benchmarks -G Ninja -DSTL_BINARY_DIR=out\x64
cmake --build out\bench

You can then run your benchmark with:

out\bench\benchmark-<benchmark-name> --benchmark_out=<file> --benchmark_out_format=csv

And then you can copy this CSV file into Excel, or another spreadsheet program. For example:

out\bench\benchmark-std_copy --benchmark_out=benchmark-std_copy-results.csv --benchmark_out_format=csv

If you want to see all the other flags you can pass, run:

out\bench\benchmark-<benchmark-name> --help

Editing And Testing The Debugger Visualizer

Modify The Visualizer

To modify how components are visualized in the debugger, edit the file stl\debugger\STL.natvis. For more information on how to modify this file, check the natvis documentation.

Test Your Changes

You can add the natvis file to any Visual Studio C++ project if you right-click your project > Add > Existing Item and select the STL.natvis file. After doing this you should be able to see your changes in a Visual Studio debugging session.

Block Diagram

The STL is built atop other compiler support libraries that ship with Windows and Visual Studio, like the UCRT, VCRuntime, and VCStartup. The following diagram describes the dependencies between those components and their ship vehicles.

flowchart TB
%%{ init: {"flowchart": {"htmlLabels": true}} }%%
    classDef default text-align:left
    subgraph VisualStudioSubgraph[Visual Studio]
        direction TB
        STLNode("<b>STL</b>
        This repo; provides C++ Standard Library headers, separately
        compiled implementations of most of the iostreams functionality,
        and a few runtime support components like std::exception_ptr.")
        subgraph VCRuntimeSubgraph[VCRuntime]
            direction TB
            VCStartupNode("<b>VCStartup</b>
            Provides compiler support mechanisms that
            live in each binary; such as machinery to
            call constructors and destructors for global
            variables, the entry point, and the /GS cookie.

            Merged into static and import libraries of VCRuntime.")
            VCRuntimeNode("<b>VCRuntime</b>
            Provides compiler support mechanisms that can be
            shared between binaries; code that the compiler calls
            on your behalf, such as the C++ exception handling
            runtime, string.h intrinsics, math intrinsics, and
            declarations for CPU-vendor-specific intrinsics.")
        end
    end
    subgraph WindowsSDKSubgraph[Windows SDK]
        UniversalCRTNode("<b>Universal CRT</b>
        Windows component that provides C library support, such as printf,
        C locales, and some POSIX-like shims for the Windows API, like _stat.")
    end
    STLNode ==> VCRuntimeSubgraph & UniversalCRTNode
    VCStartupNode ==> VCRuntimeNode ==> UniversalCRTNode

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

See CONTRIBUTING.md for more information.

Code Of Conduct

This project has adopted the Microsoft Open Source Code of Conduct.

See CODE_OF_CONDUCT.md for more information.

License

Copyright (c) Microsoft Corporation.

SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

stl's People

Contributors

achabense avatar adambucior avatar alexguteniev avatar arzaghi avatar ataridreams avatar barcharcraz avatar bhardwajs avatar billyoneal avatar caseycarter avatar cbezault avatar cpplearner avatar frederick-vs-ja avatar fsb4000 avatar futuarmo avatar grcm10 avatar jeanphilippekernel avatar jmazurkiewicz avatar joemmett avatar mattstephanson avatar michaelrizkalla avatar miscco avatar nathansward avatar neargye avatar sam20908 avatar statementreply avatar stephantlavavej avatar strega-nil-ms avatar superwig avatar svido avatar sylveon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stl's Issues

GitHub: Incorrect repository language detection

Our code is being detected as 57.4% C++, 33.4% Objective-C, 7.3% C, and 1.9% CMake. There are several issues here:

  1. Extensionless headers like stl/inc/vector are indexed and searchable, but aren't being detected as any language.

  2. stl/inc/xcharconv_ryu_tables.h is being detected as Objective-C, but it's C++.

  3. stl/src/nlsdownlevel.h is being detected as Objective-C. This is C++ (included by stl/src/winapinls.cpp only), but it uses C idioms (self-typedefs). We should probably fuse nlsdownlevel.h into winapinls.cpp and remove the C idioms.

  4. Several files like stl/inc/xcharconv.h are being detected as C when they're C++. A very small number of our files are intended to be usable as both C and C++, while the rest are purely C++.

https://github.com/github/linguist#troubleshooting explains how to override this language detection.

P0912R5 Library Support For Coroutines

P0912R5 Library Support For Coroutines

Feature-test macro as of LWG-3393 "Missing/incorrect feature test macro for coroutines":
#define __cpp_lib_coroutine 201902L

The compiler feature-test macro is __cpp_impl_coroutine defined to be 201902L.

P0355R7 <chrono> Calendars And Time Zones

P0355R7 <chrono> Calendars And Time Zones
P1466R3 Miscellaneous Minor Fixes For <chrono>
P1650R0 Printing std::chrono::days With Suffix "d"
P1981R0 Renaming leap To leap_second
P1982R0 Renaming link To time_zone_link

LWG-3094 [time.duration.io]p4 makes surprising claims about encoding
LWG-3145 file_clock breaks ABI for C++17 implementations
LWG-3206 year_month_day conversion to sys_days uses not-existing member function
LWG-3209 Expression in year::ok() returns clause is ill-formed
LWG-3218 Modifier for %d parse flag does not match POSIX and format specification
LWG-3221 Result of year_month arithmetic with months is ambiguous
LWG-3224 zoned_time constructor from TimeZonePtr does not specify initialization of tp_
LWG-3225 zoned_time converting constructor shall not be noexcept
LWG-3226 zoned_time constructor from string_view should accept zoned_time<Duration2, TimeZonePtr2>
LWG-3230 Format specifier %y/%Y is missing locale alternative versions
LWG-3231 year_month_day_last::day specification does not cover !ok() values
LWG-3232 Inconsistency in zoned_time deduction guides
LWG-3235 parse manipulator without abbreviation is not callable
LWG-3241 chrono-spec grammar ambiguity in [time.format]
LWG-3245 Unnecessary restriction on '%p' parse specifier
LWG-3252 Parse locale's aware modifiers for commands are not consistent with POSIX spec
LWG-3260 year_month* arithmetic rejects durations convertible to years
LWG-3262 Formatting of negative durations is not specified
LWG-3269 Parse manipulators do not specify the result of the extraction from stream
LWG-3270 Parsing and formatting %j with durations
LWG-3272 %I%p should parse/format duration since midnight
LWG-3273 Specify weekday_indexed to range of [0, 7]
LWG-3294 zoned_time deduction guides misinterprets string/char*
LWG-3314 Is stream insertion behavior locale dependent when Period::type is micro?
LWG-3316 Correctly define epoch for utc_clock/utc_timepoint
LWG-3317 Incorrect operator<< for floating-point durations
LWG-3318 Clarify whether clocks can represent time before their epoch
LWG-3319 Properly reference specification of IANA time zone database
LWG-3332 [time.format] chrono-format-spec forgot q and Q
LWG-3359 <chrono> leap second support should allow for negative leap seconds
LWG-3383 [time.zone.leap.nonmembers] sys_seconds should be replaced with seconds

Feature-test macro as of WG21-N4842, increased by WG21-P1902:
#define __cpp_lib_chrono 201907L

P1065R2 constexpr INVOKE

P1065R2 constexpr INVOKE

This needs compiler support for P0859R0 "CWG 1581: When are constexpr member functions defined?".

Feature-test macro as of WG21-N4842 (note that WG21-P1065 proposed adding __cpp_lib_constexpr_invoke, which was renamed by WG21-P1902):
#define __cpp_lib_constexpr_functional 201907L
(This was originally added for #50 WG21-P1032 "Miscellaneous constexpr" with the value 201811L, see SD-6.)

P1135R6 The C++20 Synchronization Library

P1135R6 The C++20 Synchronization Library
P1643R1 Adding wait/notify To atomic_ref
P1644R0 Adding wait/notify To atomic<shared_ptr<T>>, atomic<weak_ptr<T>>
P1865R1 Adding max() To latch And barrier

The IDE's list of extensionless headers has been updated for VS 2019 16.5.

Feature-test macros as of WG21-N4842:

#define __cpp_lib_atomic_lock_free_type_aliases 201907L
#define __cpp_lib_atomic_flag_test 201907L
#define __cpp_lib_atomic_wait 201907L
#define __cpp_lib_semaphore 201907L
#define __cpp_lib_latch 201907L
#define __cpp_lib_barrier 201907L

P1032R1 Miscellaneous constexpr

P1032R1 Miscellaneous constexpr
P1424R1 __cpp_lib_constexpr

WG21-P1902 "Missing Feature-Test Macros 2017-2019" further revised this, saying:

[P1032R1] (Misc constexpr bits): This paper originally added a single feature test macro, __cpp_lib_constexpr_misc, that was since renamed by [P1424R1] to __cpp_lib_constexpr. Per the policy laid out in this paper, this paper proposes to remove __cpp_lib_constexpr and instead add separate macros for each header: __cpp_lib_constexpr_functional, __cpp_lib_constexpr_iterator, __cpp_lib_constexpr_string_view, __cpp_lib_constexpr_tuple, and __cpp_lib_constexpr_utility and to bump __cpp_lib_array_constexpr.

Feature-test macros as of WG21-N4842:

#define __cpp_lib_constexpr_iterator 201811L
#define __cpp_lib_constexpr_string_view 201811L
#define __cpp_lib_constexpr_tuple 201811L
#define __cpp_lib_constexpr_utility 201811L

The following added value is unusual (it was further increased for #51 WG21-P1065 "constexpr INVOKE" to 201907L, see SD-6):
#define __cpp_lib_constexpr_functional 201811L

The following increased value is unusual (it was originally increased for #49 WG21-P1023 "constexpr For std::array Comparisons" to 201806L, see SD-6):
#define __cpp_lib_array_constexpr 201811L

P0645R10 <format> Text Formatting

P0645R10 <format> Text Formatting
P1361R2 Integrating <chrono> With <format>
P1652R1 printf() Corner Cases In std::format()
P1868R2 Clarifying Units Of Width And Precision In std::format()
P1892R1 Extended Locale-Specific Presentation Specifiers For std::format()

LWG-3242 std::format missing rules for arg-id in width and precision
LWG-3243 std::format and negative zeroes
LWG-3246 What are the constraints on the template parameter of basic_format_arg?
LWG-3248 std::format #b, #B, #o, #x, and #X presentation types misformat negative numbers
LWG-3250 std::format # (alternate form) for NaN and inf
LWG-3251 Are std::format alignment specifiers applied to string arguments?
LWG-3327 Format alignment specifiers vs. text direction
LWG-3340 Formatting functions should throw on argument/format string mismatch in [format.functions]
LWG-3371 visit_format_arg and make_format_args are not hidden friends
LWG-3372 vformat_to should not try to deduce Out twice
LWG-3373 {to,from}_chars_result and format_to_n_result need the "we really mean what we say" wording
LWG-3473 Normative encouragement in non-normative note

The IDE's list of extensionless headers has been updated for VS 2019 16.5.

Feature-test macro as of WG21-N4842:
#define __cpp_lib_format 201907L

P0466R5 Layout-Compatibility And Pointer-Interconvertibility Traits

P0466R5 Layout-Compatibility And Pointer-Interconvertibility Traits

Feature-test macros as of WG21-N4842:

#define __cpp_lib_is_layout_compatible 201907L
#define __cpp_lib_is_pointer_interconvertible 201907L

This needs compiler support, implemented by Microsoft-internal MSVC-PR-227560 for VS 2019 16.7.

Compiler bugs encountered:

  • VSO-1231996 Missing __builtin_* intrinsics helpers for Corresponding Member and Pointer-interconvertibility Traits
  • VSO-1232619 __builtin_is_pointer_interconvertible_base_of intrinsic returns incorrect values

P1001R2 execution::unseq

P1001R2 execution::unseq

This may need support from the compiler back-end (tracked by Microsoft-internal VSO-1143256).

Feature-test macro as of WG21-N4842 (increased from current value; note that this value differs from the "suggestion" in WG21-P1001):
#define __cpp_lib_execution 201902L

P0122R7 <span>

P0122R7 <span>
P1024R3 Enhancing span Usability
P1085R2 Removing span Comparisons
P1394R4 Range Constructor For span
P1872R0 span Should Have size_type, Not index_type

LWG-3101 span's Container constructors need another constraint
LWG-3102 Clarify span iterator and const_iterator behavior
LWG-3103 Errors in taking subview of span should be ill-formed where possible
LWG-3144 span does not have a const_pointer typedef
LWG-3198 Bad constraint on std::span::span()
LWG-3274 Missing feature test macro for <span>
LWG-3369 span's deduction-guide for built-in arrays doesn't work

This is also patched by #56, P1227R2 Signed std::ssize(), Unsigned span::size().

Feature-test macro as of WG21-N4842:
#define __cpp_lib_span 201902L

P0896R4 <ranges>

P0896R4 <ranges>
P1035R7 Input Range Adaptors
P1207R4 Movability Of Single-Pass Iterators
P1243R4 Rangify New Algorithms
P1248R1 Fixing Relations
P1252R2 Ranges Design Cleanup
P1391R4 Range Constructor For string_view
P1456R1 Move-Only Views
P1474R1 Helpful Pointers For contiguous_iterator
P1522R1 Iterator Difference Type And Integer Overflow
P1523R1 Views And Size Types
P1638R1 basic_istream_view::iterator Should Not Be Copyable
P1716R3 Range Comparison Algorithms Are Over-Constrained
P1739R4 Avoiding Template Bloat For Ranges
P1862R1 Range Adaptors For Non-Copyable Iterators
P1870R1 safe_range
P1871R1 disable_sized_sentinel_for
P1878R1 Constraining Readable Types
P1970R2 ranges::ssize
P1983R0 Fixing Minor Ranges Issues
P1994R1 elements_view Needs Its Own sentinel
P2091R0 Fixing Issues With Range Access CPOs
P2106R0 Range Algorithm Result Types

LWG-3169 ranges permutation generators discard useful information
LWG-3173 Enable CTAD for ref-view
LWG-3179 subrange should always model Range
LWG-3180 Inconsistently named return type for ranges::minmax_element
LWG-3183 Normative permission to specialize Ranges variable templates
LWG-3186 ranges removal, partition, and partial_sort_copy algorithms discard useful information
LWG-3191 std::ranges::shuffle synopsis does not match algorithm definition
LWG-3276 Class split_view::outer_iterator::value_type should inherit from view_interface
LWG-3280 View converting constructors can cause constraint recursion and are unneeded
LWG-3281 Conversion from pair-like types to subrange is a silent semantic promotion
LWG-3282 subrange converting constructor should disallow derived to base conversions
LWG-3286 ranges::size is not required to be valid after a call to ranges::begin on an input range
LWG-3291 iota_view::iterator has the wrong iterator_category
LWG-3292 iota_view is under-constrained
LWG-3299 Pointers don't need customized iterator behavior
LWG-3301 transform_view::iterator has incorrect iterator_category
LWG-3302 Range adaptor objects keys and values are unspecified
LWG-3313 join_view::iterator::operator-- is incorrectly constrained
LWG-3323 has-tuple-element helper concept needs convertible_to
LWG-3325 Constrain return type of transformation function for transform_view
LWG-3335 range_size_t and views::all_t
LWG-3355 The memory algorithms should support move-only input iterators introduced by P1207
LWG-3363 drop_while_view should opt-out of sized_range
LWG-3364 Initialize data members of ranges and their iterators
LWG-3381 begin and data must agree for contiguous_range
LWG-3384 transform_view::sentinel has an incorrect operator-
LWG-3385 common_iterator is not sufficiently constrained for non-copyable iterators
LWG-3387 [range.reverse.view] reverse_view<V> unintentionally requires range<const V>
LWG-3388 view iterator types have ill-formed <=> operators
LWG-3389 A move-only iterator still does not have a counted_iterator
LWG-3397 ranges::basic_istream_view::iterator should not provide iterator_category
LWG-3398 tuple_element_t is also wrong for const subrange
LWG-3474 Nesting join_views is broken because of CTAD
LWG-3500 join_view::iterator::operator->() is bogus
LWG-3505 split_view::outer-iterator::operator++ misspecified

Feature-test macro as of WG21-N4842, increased by WG21-P1902:
#define __cpp_lib_ranges 201911L

<execution>: Parallelize more algorithms

Some strategies that can be used:

Just call parallel transform:

  • replace_copy
  • replace_copy_if

Scans:

  • copy_if
  • partition_copy
  • remove_copy
  • remove_copy_if
  • unique
  • unique_copy

Same as serial nth_element but call the parallel partition op for large N:

  • nth_element

Predicate tests (like all_of):

  • lexicographical_compare

Summary statistics (like find / find_end):

  • min_element
  • max_element
  • minmax_element

Divide and conquer:

  • inplace_merge
  • stable_partition

Divide range1 into chunks, binary search to find matching range2 chunks, scan:

  • merge
  • set_symmetric_difference
  • set_union

Other:

  • includes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.