Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
8 votes
1 answer
197 views

Clang compiles the following C++20 code snippet, while at the same time it is rejected by both GCC and MSVC. There are at least two options: The code is illegal and Clang fails to report an ...
3 votes
1 answer
158 views

On cppreference (which I understand is not the c++ standard itself) I have read that the coroutine state contains "local variables and temporaries whose lifetime spans the current suspension ...
3 votes
3 answers
179 views

I want to pass a C-style array to a function taking a std::span, but overload resolution chooses to convert the array to bool instead. Is this behavior required by the standard, or is it a compiler ...
prl's user avatar
  • 12.5k
3 votes
2 answers
228 views

Is there a way to prevent implicit conversions happening in concepts? For example, this example compiles with GCC and clang when I actually want it to give an error that the char constructor is ...
-3 votes
0 answers
179 views

anybody anytime get next error? Assertion failed: endptr == token_buffer.data() + token_buffer.size(), file include/nlohmann/detail/input/lexer.hpp, line 1292 i've next code: int main(int argc, char *...
1 vote
2 answers
124 views

Is the following code valid in a C++ coroutine promise object? void promise_type::unhandled_exception() noexcept { try { // re-throw current exception throw; } catch (const std::exception &...
17 votes
1 answer
662 views

Consider struct A; namespace ns { int f(A&&); } struct A { friend int ns::f(A&&); }; int x = f(A{}); GCC trunk translates the last line into a call to ns::f(A&&) in C++20 ...
4 votes
1 answer
201 views

Assume that we have a potentially dangerous code that passes a const reference to a coroutine: #include <boost/asio.hpp> #include <iostream> namespace asio = boost::asio; using asio::...
Dmitriano's user avatar
  • 2,550
Best practices
0 votes
13 replies
147 views

I'm trying to implement these requirements: I have to execute functions i cannot modify. Unfortunately, the functions also needs a specific global state which needs to be set before calling the ...
Advice
0 votes
3 replies
66 views

I am creating a new project heavily laveraging C++ 20 modules in Visual Studio 2022. For me it is working perfectly as I can successfully build my sources, the only drawback is I still do not know how ...
4 votes
1 answer
405 views

According to some modern C++ guidelines, we should prefer uniform initialization everywhere, for example: int x{0}; However, when I try to combine uniform initialization with C++20’s designated ...
rafoo's user avatar
  • 1,708
3 votes
1 answer
142 views

Consider the following translation unit: export module Example; export inline void fn1(); export void fn2(); export void fn3(); void fn1() {} void fn2() {} module :private; void fn3() {} Firstly, ...
0 votes
0 answers
106 views

This question is a follow-up of std::bit_cast padding and undefined behavior. This "revival" is motivated by my answer to Accessing object storage where I proposed a function to modify a ...
-2 votes
1 answer
98 views

On Regex101, I have simple Regex with a named capture group in ECMAScript flavor: (?<name>.*) I'm trying to do the same thing in C++: #include <iostream> #include <regex> using ...
Thomas Weller's user avatar
Best practices
2 votes
8 replies
218 views

I need to define several constant strings that will be used across an entire C++20 project. I am considering the following options : constexpr char[] str1 = "foo"; constexpr std::string str2 ...

15 30 50 per page
1
2 3 4 5
...
410

AltStyle によって変換されたページ (->オリジナル) /