Category "c++20"

Can std::ranges be used with std::list

I note that many algorithms can be used with ranges allowing the use of members of custom types, rather than needing lambda functions. So, am curious whether st

Question about exception guarantees for custom operator=

I have a class used to work with disk data consisting of an enum class and vector<char> sized based on the enum. The enum is an invariant for each object

Can g++ (gcc) 11 be used on Debian Bullseye?

Can g++ (gcc) 11.1 be used on Debian Bullseye? Debian 11 (bullseye) is soon to be released, and I am interested in a compiler with C++20 and modules support. De

asio How to change the executor inside an awaitable?

I have read this question and tried to replicate the answer with the following code: #include <iostream> #include <syncstream> #include <thread&g

asio How to change the executor inside an awaitable?

I have read this question and tried to replicate the answer with the following code: #include <iostream> #include <syncstream> #include <thread&g

Is there a simpler way to write a concept that accepts a set of types?

Essentially, is there a shorter/cleaner way to define Alphabet than using a bunch of std::same_as/std::is_same? struct A {}; struct B {}; struct C {}; ... temp

std::filesystem::path::u8string might not return valid UTF-8?

Consider this code, running on a Linux system (Compiler Explorer link): #include <filesystem> #include <cstdio> int main() { try {

std::future<T>::wait returns compile error in msvc

Using the msvc with the /std::c++20 flag on, I can't seem to get the wait call compiled. simple example: #include<future> std::future<int> fut = st

c++20 coroutines: boost asio co_spawn blocks from another coroutine

I do not know if this is the expected behavior of boost::asio::co_spawn (I did check the docs 1.78.0...), but if i call (e.g. co_spawn(ctx, ..., detached)) from

Performance problems with the C++20 spaceship operator?

Since C++20 the standard library uses the spaceship operator to implement comparison for strings and vectors (according to this video). I am worried that this c

Vector in C++ module causes useless Bad file data GCC output

TL;DR: GCC 11.2.0 (image f7ea55625e09) + C++20 + <vector>'s std::vector<anything> cause useless output. How to get out something I can work with? Co

Boost.Asio async_read a string from a socket

I'm trying to write a function async_read_string_n to asynchronously read a string of exactly n bytes from a socket with Boost.Asio 1.78 (and GCC 11.2). This is

Coroutines are not distributed over asio::thread_pool threads

I wanted to try out to c++20 coroutines together with asio. In a simple test three are coroutines which would be executed on a asio::thread_pool with 4 threads.

c++20 ranges view to vector

Now that the C++20 ranges implementation is actually here and released under GCC 10.2, I would like to know how to convert a ranges view back to an actual conta

`make_unique_for_overwrite` still initializes `std::pair` elements

I was hoping that auto myPairs = make_unique_for_overwrite<pair<uint64_t, void*>[]>(arraySize); would give me uninitialized memory for my pairs. I

Calling `std::vector<A>::data()` on `A` with const or reference fields, before C++20

This is a followup on the answers for placement new on a class with reference field. Calling std::vector<A>::data() on type A that has reference or const

How can I get a consistent, unique, identifier for a unique class combination?

I need a way to identify a unique combination of template types that gives me an easily indexable identifier. I have the following class: #include <cstdint&g

How to use c++20 modules with CMake?

Clang and MSVC already supports Modules TS from unfinished C++20 standard. Can I build my modules based project with CMake or other build system and how? I tri

Convert between std::u8string and std::string

C++20 added char8_t and std::u8string for UTF-8. However, there is no UTF-8 version of std::cout and OS APIs mostly expect char and execution character set. So

Convert between std::u8string and std::string

C++20 added char8_t and std::u8string for UTF-8. However, there is no UTF-8 version of std::cout and OS APIs mostly expect char and execution character set. So