Category : c++20

Currently I’m trying to convert some of C++’s named requirements to C++20 concepts (https://godbolt.org/z/EdY5d6319 still highly WIP!). However, I stumpled upon a problem. Given the final C++20 working draft (http://open-std.org/jtc1/sc22/wg21/docs/papers/2020/n4861.pdf): page 790: requirements for an allocator-aware container: Given an allocator-aware container X with value_type T the expression a == t where a denotes a non-const ..

Read more

I would like to initialise a vector by transforming the other one. I made a test with two ways of inline initialisation a transformed std::vector. One using lambda inline initialisation (with std::transform): std::vector<int> foo(100,42); const auto fooTimesTwo = [&]{ std::vector<int> tmp(foo.size()); std::transform(foo.begin(), foo.end(), tmp.begin(), convert); return tmp; }(); And the other one – using std::ranges::views::transform: ..

Read more

Happening I want to store move only data to promise_type, and get it in coroutine. I try return return lvalue from await_resume(). The result is compilation is successful but Segmentation fault appears during execution. How can I improve? Environment OS: WSL2 Ubuntu 20.04 Complier: gcc 10.3 Command: g++ -std=c++20 -fcoroutines main.cpp Code main.cpp: #include <iostream> ..

Read more

I’m trying to modernize my code with the help of some clang-tidy suggestions. Say I have a class like this: class Config { public: static constexpr auto FIELD1 = "FIELD1"; static constexpr auto FIELD2 = "FIELD2"; }; Since the list of fields grows bigger, I have a simple macro: #define CONFIG_PARAM(param) static constexpr auto param ..

Read more