General C++ Programming - September 2023

Use concepts to test for member functions
Hey guys, I'd like to use concepts to verify that an interface is implented correctly. Usally I would use virtual functions for this. However in this particul...
[4 replies] Last: AH thx alot, now it's working fine :) (by JuliusCaesar)
Wait for stdout completed (C)
For C. Is there a way to wait for all output sent to stdout to be displayed before continuing? I have a situation where I use puts() to display some initialisat...
[9 replies] Last: We don't 'mix' our io with standard output. We only use standard outpu... (by seeplus)
by PeteDD
Use array as incrementer in for loop - no longer compiling
I am in the process of moving some code to a new toolchain and encountered the following code (which is running in many production systems just fine) that will ...
[8 replies] Last: I'm still left wondering why the developer put this variable in as an... (by coder777)
by ruzip
GLUT Keys with VK Keys
I'm looking for a way to make the GLUT key functions to work simultaneously with VK Keys (GetAsyncKeyState) so the other special keys that GLUT cannot detect ...
[2 replies] Last: Thanks kilgar, but actually not involving any external library. And a... (by ruzip)
How to implement FFTW efficiently in C/C++?
From the FFTW documentation: You are probably recreating the plan before every transform, rather than creating it once and reusing it for all transforms of ...
[13 replies] Last: I'm surprised there's even a correlation between thread count and elap... (by helios)
by jNc
send text to clipboard
Having some text that I want to send to clipboard, something like string "random text", I want to call some function (C or 3rd party lib or can be Ubuntu tool)...
[4 replies] Last: It looks like the modern default Ubuntu does not come with a clipboard... (by newbieg)
time elapsed since local midnight?
I need to find the elapsed time (duration) from local midnight. I tried this: // if we have a time_point, must convert to a duration first auto tp = chr::s...
[6 replies] Last: You could also write this without zoned_time if you prefer: int ma... (by mbozzi)
How to get sys_days from local_time?
In attempting to create a today() function, then first idea that comes to mind is this: sys_days{ floor<days>(system_clock::now()) }; but this does ...
[6 replies] Last: Note that for Windows, C++ time zone data is only available from Windo... (by seeplus)
What is a strict weak ordering?
a total ordering means for all a,b in Container, one of the following is true: a < b a == b a > b so, all elements are comparable (this is the total par...
[9 replies] Last: Thanks Helios!! (by JUANDENT)
by Cplusc
Point In Triangle
I am trying to generate points with equal spacing inside complex geometry. I have the STL file representing the triangulation of the surface of the complex geom...
[5 replies] Last: A'ight. (by helios)
How to implement MATLAB's colon operator in C++?
I have the following MATLAB code that uses zero padding to deal with aliasing errors that I would like to rewrite in my C/C++ code. The issue is with the zero p...
[2 replies] Last: If you want zero padded output look to either C's printf or C++20's ... (by George P)
istream_iterator invokes reading from the keyboard by just defining it!!
Hi, The following code opens for reading from the keyboard instead of waiting for the vector: (this does not occur if the istream is an ifstream - associated...
[7 replies] Last: Pressing enter does not end the stream. Correct. This iterates the... (by seeplus)
How can ofstream not trunc existing file?
Hi, I have this code that erases the output file as it opens it... I want to not truncate the file. ofstream os{ to }; ostream_iterator<string> oo{ os...
[2 replies] Last: I think the "problem" with the above code is that is not atomic. Fo... (by kigar64551)
how to insert into an unordered_map for a given struct
Hi, I have this code which gives me an illegal indirection: unordered_map<Record, Record, RHash> rmap; rmap.insert(Record{ "juan"s, 55 }, Record{ "les...
[3 replies] Last: Thanks!! (by JUANDENT)
  Archived months: [aug2023] [oct2023]

This is an archived page. To post a new message, go to the current page.