Skip to main content
Advice
0 votes
3 replies
92 views

Lately I've been running into some performance Issues with std's unordered_map, I use it mainly for hash wise lookup, e.g: std::unordered_map<uint64_t, mpark::variant<int32_t, float>> ...
pogrammerX's user avatar
-2 votes
0 answers
147 views

std::cout stores values in a buffer and then prints them to the console. I have this example: #include <iostream> int main() { for(int i=0;i<10000;i++) std::cout << "A&...
Tushar's user avatar
  • 105
0 votes
0 answers
265 views

While debugging something I stumbled into this behavior on godbolt. When compiling and running the following (godbolt link https://godbolt.org/z/9c5966sbK): #include <array> int main() { ...
Xenophilius Mildrententus's user avatar
-2 votes
1 answer
195 views

class string { struct long_mode { size_t size; size_t capacity; char* buffer; }; struct short_mode { uint8_t size; char buffer[23]; }; ...
Renat's user avatar
  • 5
10 votes
2 answers
388 views

With std::ranges::max, it is possible to use a projection as follows std::vector<std::tuple<char,int,double>> v = { {'a',2,1.0}, {'c',1,3.0}, {'b',4,2.0}, {'d',3,4.0} }; auto m = std::...
abcdefg's user avatar
  • 5,615
Advice
4 votes
22 replies
386 views

Edit: Turns out the issue was an outdated glibc version, both on my computer and in all of the linked Godbolt examples. This issue does not occur with glibc versions >= 2.38 and the various string ...
rmc's user avatar
  • 1,240
Advice
1 vote
11 replies
98 views

hope you are doing well guys i just have learnt how to build my own local library or what we call a header (MVS) and i built it within a project and everything was good, but when i have started new ...
The_Slayer's user avatar
0 votes
0 answers
137 views

I follow How to use module `std` with gcc to generate "gcm.cache/std.gcm" on Windows using GCC 15.2.0 and ran g++ -std=c++23 -fmodules -fsearch-include-path -c bits/std.cc at "C:\bak\...
Jason's user avatar
  • 1
4 votes
3 answers
340 views

I have a struct that contains a std::atomic member: #include <atomic> #include <cstdint> struct Foo { std::atomic<int64_t> value; int64_t age; }; If I allocate memory for ...
Abhishek's user avatar
  • 293
2 votes
1 answer
345 views

Is std::system thread safe? If not, in which way? Clangd gives me warning about it, says this function is not thread safe. If not, I want to execute different task in a thread safe way, is there a ...
qgi's user avatar
  • 347
4 votes
2 answers
325 views

Recently I've decided to "modularize" my library. No success. Here is the repo where you can find CMakeLists.txt & CMakePresets.json: kissra (GitHub) The issue is that CMake cannot find ...
Dmitry Katkevich's user avatar
6 votes
4 answers
266 views

Let's say I have n arrays (right now I have 4 but that might go up) and they're supposed to be of the same size, but since I'm fetching them from outside the code I want to be sure std::vector<int&...
Nicolas A_Bored_Boy's user avatar
Advice
0 votes
10 replies
259 views

The standard says that after a move, an object is in a "valid but unspecified state". I found nothing in the standard on the properties of being in a "specified state" and being in ...
Norbert's user avatar
  • 103
Advice
3 votes
8 replies
341 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
246 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

15 30 50 per page
1
2 3 4 5
415