Skip to main content
Filter by
Sorted by
Tagged with
4 votes
1 answer
121 views

[stdatomics.h.syn] specifies the following: template<class T> using std-atomic = std::atomic<T>; // exposition only #define _Atomic(T) std-atomic<T> libc++ and libstdc++ ...
Jan Schultke's user avatar
  • 43.6k
2 votes
0 answers
44 views

In WSL (Ubuntu 24.04), when using Conan to create a package that links pybind11/3.0.1, the resulting executable in the test_package fails to run. Even if the executable doesn't directly call any ...
AzusaYu's user avatar
  • 21
9 votes
1 answer
288 views

Here is a possibly incorrect program for communicating between a function and a signal handler that might interrupt it. Assume that HandleSignal has been arranged to run as a signal handler. The ...
jacobsa's user avatar
  • 7,817
5 votes
2 answers
234 views

I'm building a container which uses, as its internal representation, a couple of standard containers, each with a different type. I need to code my version of emplace(..) and here's where I got stuck. ...
Andrea Bocco's user avatar
  • 1,078
1 vote
0 answers
63 views

I'm trying to get clang-cl (the compiler I installed via Visual Studio Installer), MSVC standard library and IntelliSense to work together. Simple 'Hello world' by C++23 std::println does build and ...
knamgie's user avatar
2 votes
1 answer
133 views

I have a C++ function template: #include <string_view> template<typename T> T get_gadget(std::string_view str); I also added explicit specializations for some user-defined types, e.g., ...
Roger World's user avatar
0 votes
1 answer
199 views

Here is code: aml::type_list<int,int,char,std::string> example; std::tuple_element_t<2,std::tuple<decltype(example)>> a = 'b'; But when i try to run code it says, static assertion ...
Hazret Hasanov's user avatar
5 votes
1 answer
141 views

I came across a strange problem. I made a C++20 module with the following content (file module.cppm): module; #include <regex> #include <string> export module foo; export namespace bar { ...
d7d1cd's user avatar
  • 385
1 vote
0 answers
164 views

I'm using clang 21.1.0 from linuxbrew's LLVM package with libstdc++ from Fedora 42's repos (gcc 15.2.1). The following code compiles: #include <memory> #include <string> auto main() -> ...
rdong8's user avatar
  • 97
1 vote
1 answer
328 views

I'm using spdlog with fmt::format_string to log messages, and I also want to capture the call location using std::source_location. My goal is to have a simple logging function like this: Logger::Error(...
ATOM's user avatar
  • 59
8 votes
3 answers
338 views

C++23 introduces std::ranges::to, allowing the construction of a container from a range. E.g., auto my_set = produce_range() | std::ranges::to<std::set>(); And C++23 also introduces the std::...
Drew Dormann's user avatar
  • 65.4k
2 votes
1 answer
78 views

There is an extensive discussion of the risk that a write to shared state in a signal handler could be interrupted midway by another signal handler. I handle CTRL+C in a function that is set up with ...
lucidbrot's user avatar
  • 6,554
0 votes
1 answer
222 views

I am refactoring a project, and I have to unify a set of derived classes under the same base class. These are two derived classes: class D1 : public virtual B { virtual int F(int i) { ...
Pietro's user avatar
  • 13.5k
0 votes
0 answers
86 views

tl;dr Given this code: #include <functional> #include <optional> #include <range/v3/range/conversion.hpp> #include <range/v3/range/primitives.hpp> #include <range/v3/view/...
Enlico's user avatar
  • 30.2k
1 vote
1 answer
214 views

I am designing a new embedded c++23 library that will have a few hundreds of optional features. the global idea is like this: I would expect that if constexpr(...) would remove code when flag is false....
PoolLord's user avatar
2 votes
2 answers
133 views

I am writing a function probeMaxArgs that deduces the maximum number of arguments in a function/callable object. For simplicity I assume, that the object don't have any overloads of operator() (...
Sergey Kolesnik's user avatar
5 votes
1 answer
115 views

I asked the similar question for find() method of std::unordered_set last day - How can I use a lightweight argument in unordered_set::find() method?. But the recommendations received for find() ...
mistermad's user avatar
3 votes
0 answers
123 views

cppreference.com gives an example on how to use the c++23 std::generator. From https://en.cppreference.com/w/cpp/coroutine/generator.html: #include <generator> #include <iostream> ...
bad's user avatar
  • 111
3 votes
2 answers
151 views

Consider the following snippet: // included, for exposition only SomeData buzz(std::string_view); constexpr auto foo(std::string_view v) { using namespace std::string_view_literals; return v ...
Sergey Kolesnik's user avatar
13 votes
1 answer
1k views

#include <iostream> #include <new> struct A { int const n; void f() { new (this) A{2}; } void g() { std::cout << this->n; } void h() { ...
xmllmx's user avatar
  • 44.6k
1 vote
0 answers
168 views

Modern CPUs—even entry-level models—now ship with four or more hardware cores, so multithreaded programming is the norm rather than an afterthought. By contrast, standard C++23 still offers only low-...
K.R.Park's user avatar
  • 1,229
5 votes
1 answer
159 views

I'm writing an async, callback-heavy program, and a common pattern I encounter is, in a member function, having to make a callback pointing to another member function. What I have so far is this: void ...
Bence Viktor Csókás's user avatar
11 votes
2 answers
1k views

Herb Sutter refers to that in Peering Forward - C++’s Next Decade - Herb Sutter - CppCon 2024, and it stresses language several times (e.g. here), so I'd like to understand how to tell it apart from ...
Enlico's user avatar
  • 30.2k
2 votes
0 answers
115 views

I'm experimenting, with wrapping move semantics into a wrapper type: #include <utility> #include <type_traits> // Type that will get moved struct NonDestructible { ~NonDestructible() =...
Dimo Markov's user avatar
1 vote
2 answers
77 views

I'm trying to parse UUID expression using C++23, However compiling under clang 20.1.6 and gcc 15.1.0 find the operator as candidates yet it get ignored. here is my code: union uuid_t { unsigned ...
Muhammad's user avatar
  • 1,707

1
2 3 4 5
14