Visual Studio 2019 v16.10 Preview 2 Releases Today
DRANK
We are excited to announce the release of Visual Studio v16.10 preview 2. This release continues a theme of developer productivity and convenience. We’ve added C++20 ranges, IntelliSense completions, and new features for testing, Docker tooling enhancements, and Git integration! Download the latest Visual Studio preview release to try the new features in 16.10.
2 comments
<source_location>
<syncstream>
constexpr std::vector
constexpr std::string
# include <iostream> # include <string> # include <source_location> # include <syncstream> # include <ranges> # include <vector> # include <future> # include <algorithm> # include <numeric> void F() { // ソースコードのファイル名、関数名、行番号、列番号取得 constexpr auto sl = std::source_location::current(); std::cout << "File: " << sl.file_name() << '\n' << "Function: " << sl.function_name() << " (" << sl.line() << ", " << sl.column() << ")\n"; } constexpr int Sum() // std::vector を使っても constexpr に { std::vector<int> v; for (int i = 0; i <= 10; ++i) { v.push_back(i); } return std::reduce(v.begin(), v.end()); } int main() { static_assert(Sum() == 55); static_assert(std::string("Hello").size() == 5); F(); std::cout << "--------------\n"; for (int i : std::views::iota(0, 5)) { std::cout << i << '\n'; } std::cout << "--------------\n"; { std::vector<std::future<void>> v; for (int i = 0; i < 5; ++i) { v.push_back(std::async(std::launch::async, [=]() { // 標準出力を排他制御。出力が混在しなくなる std::osyncstream{ std::cout } << "Hello, " << i << '\n'; })); } } std::cout << "--------------\n"; { std::vector<std::future<void>> v; for (int i = 0; i < 5; ++i) { v.push_back(std::async(std::launch::async, [=]() { std::cout << "Hello, " << i << std::endl; })); } } }