Skip to main content
Advice
3 votes
7 replies
249 views

Off the top of my head, I only remember LLVM's standard library do this, but I remember seeing other libraries also do this. I'm not entirely sure what is the advantage here. I feel like namespace std ...
Somedude's user avatar
Advice
0 votes
6 replies
207 views

I need to layout a structure in two different ways depending on the endianness of the target platform. Currently I'm using an additional pre-compile phase to run a program to test the endianness, and ...
Alnitak's user avatar
  • 341k
-1 votes
1 answer
226 views

I am currently studying the work of the mutex and I have a question, if we have the std::try_lock() method, then why not always use it instead of std::lock(), what are its disadvantages? For example, ...
freakl's user avatar
  • 7
Advice
1 vote
7 replies
179 views

In the question Why does Microsoft's implementation of std::string require 40 bytes on the stack? the observation is made, that a std::string requires 8 additional bytes in Debug mode. After ...
Brandlingo's user avatar
  • 3,242
0 votes
0 answers
80 views

I'm compiling this with VS 2022 C++ compiler, as "ISO C++20 Standard (/std:c++20)" for a Debug configuration. How come this throws the following std::regex_error: regex_error(error_backref):...
c00000fd's user avatar
  • 22.8k
6 votes
4 answers
283 views

Sometimes, it may be useful to build an integral value from a list of bits (in increasing order). Such a function could be named to_integral. Example: static_assert (to_integral(1,1,0,1,0,1) == ...
abcdefg's user avatar
  • 4,672
0 votes
0 answers
115 views

Today I stumbled upon weird behavior of std::is_invocable_r. While doing research for why it is happening, I stumbled upon this question on Stack Overflow: is_invocable_r ignoring the return parameter ...
CygnusX1's user avatar
  • 22.1k
15 votes
1 answer
1k views

According to What are the reasons that extending the std namespace is considered undefined behavior?, adding anything to namespace std is Undefined Behavior, with some exceptions carved out, such as ...
Dominik Kaszewski's user avatar
0 votes
1 answer
379 views

I am trying to use the C++ 23 stacktrace header in my project but I can't get it to compile. I've reproduced this with a minimal case to demonstrate the error I am getting. Any input would be greatly ...
Keegan's user avatar
  • 19
5 votes
0 answers
202 views

I was checking the size of std::atomic compared to T on different platforms (Windows/MSVC, Linux/GCC, Android/Clang). For intrinsic types (like int, int64_t, etc.), the size of std::atomic matches the ...
Abhishek's user avatar
  • 251
0 votes
1 answer
137 views

In c++ when i try to write a code that returns reverse of a type list what i wrote( a user defined template class): template <typename ...V,typename ...D> constexpr decltype(auto) merge(...
Hazret Hasanov's user avatar
5 votes
1 answer
143 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
  • 387
1 vote
0 answers
166 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
4 votes
2 answers
431 views

I'm trying to modernize an old code base that's written in a combination of C and C++. My first task is to get it compiling with cl.exe v19.44.35214. I'm getting a lot of this error in yvals_core.h: #...
Andy's user avatar
  • 3,658
4 votes
2 answers
220 views

My problem is the following : std::vector<struct pollfd> vec = { ... }; // Actually a member variable on a Server object for (auto iter = vec.begin(); iter != vec.end(); ) { if (...
Azyrod's user avatar
  • 151

15 30 50 per page
1
2 3 4 5
415