General C++ Programming - August 2023

Uncaught error
 
Consider for VS2022: #include <iostream> int main() { int i {}; auto pi { &i }; try...
[16 replies] Last: a null pointer is fine, too 0x0000000000000000: I'm done for!... (by helios)
How to open a file that does not exist? For writing...
 
Hi, I need to open a binary files like this: fstream f; f.open(p, ios::binary | ios::in | ios::o...
[3 replies] Last: If you want to open a file for i/o even if it does not exist, try to o... (by seeplus)
by jNc
Ubuntu/CPP emulate CTRL+V
 
Need to emulate keyboard input short cut Ctrl+V, using cpp or some wrapper/library Having somethi...
[1 reply] : Maybe, https://stackoverflow.com/questions/1262310/simulate-keypress-i... (by Ganado)
by jNc
get data from text file and send to text field
 
I need to make something like copy and paste Having file, get string from here, need to send (paste...
[3 replies] Last: Im using Qt Editor, but I think it does not matter. It does matter. ... (by kigar64551)
What does this trick do? using unpack = int[]...
 
template<typename... T> std::string get_error_message(T&&... args) { std::ostrings...
[3 replies] Last: Thanks!! (by JUANDENT)
Why do we want perfect forwarding?
 
Hi, why should we use this code: do_print(std::forward<T>(arg)); instead of ...
[3 replies] Last: Does this code demonstrates the advantage of using perfect forwarding?... (by JUANDENT)
How to require all elements of a parameter pack to satisfy a concept?
 
See this code: template<typename...T> requires is_arithmetic_v<T>... int sum_by_fold(T...v) ...
[2 replies] Last: thanks!!! (by JUANDENT)
by jNc
get inputs from OS application even if app is not active
 
Having some app, made with x11 libs, tested for ubuntu. It takes simple keyboard inputs and outpu...
[2 replies] Last: I've googled a lot /dev/input but still not clue, how to get even smal... (by jNc)
Unable to link to a c++ dll from VB2019 (1,2)
 
I have upgraded all my projects to VS2019 and yet I still cannot get them to talk to each other betw...
[29 replies] Last: Hi all after, including the .def file in the youtube tutorial i manage... (by darkdave)
by StMick
Constructor Errors Between Classes
 
I'm building a LinkedList data structure with a nested Node class. The Node class within the LinkedL...
[2 replies] Last: Perhaps what you meant to do was LinkedList<Animal *> AList; AList.a... (by helios)
how can I compare the signatures of 2 functions when one of them is a lambda and the other is a regular function?
 
Please read this code and my explanation of the question after it: auto lambda = (unique_pt...
[3 replies] Last: #include <iostream> #include <memory> #include <array> #include <stri... (by mbozzi)
by StMick
Undefined Reference to User Defined Type
 
Hello! I have built a LinkedList template class and am trying to test out its functions on a user...
[3 replies] Last: All the template code should go into the header file. People are gener... (by Ganado)
How can I restrict a template parameter to a certain signature
 
Hi, I have a function template acting on a collection and receiving an operation whose signature ...
[1 reply] : #include <memory> #include <ranges> #include <vector> template < typ... (by JLBorges)
How to test if a container type holds unique_ptr as its elements?
 
Hi, I need a concept that specifies whether a container type's value_type is a specialization of ...
[4 replies] Last: > would that concept hold true even for a std::map ? No. The value_... (by JLBorges)
Why do I get segmentation fault error?
 
I am usually pretty good at catching the root of segmentation fault error except this time. I have t...
[6 replies] Last: @Peter87 You are right actually! Thanks! (by JamieAl)
which callable object requires std::forward when passed as an argument?
 
In which cases, when is it important to call std::forward<L>(lambda) as in the following 2 functions...
[4 replies] Last: So here is a minimal example what std::forward does: #include <iostrea... (by coder777)
by frek
std::packaged_task
 
std::bind(function, argsā€¦) returns a function object that is the result of the given arguments t...
[18 replies] Last: Right. Thanks for your time and info. (by frek)
implementation of std::exchange is not clear...
 
Some code from the standard that has some tricks I do not understand: EXPORT_STD template <c...
[3 replies] Last: No, you're right. I misread. (by mbozzi)
How does a default move ctor deal with pointers?
 
Hi, Depending on how the compiler implements the default move ctor, this code could duplicate the...
[2 replies] Last: Compiler-generated move constructors copy trivial sub-objects and move... (by mbozzi)
by frek
Callback vs callable object vs function
 
I'm rather confused about terminology. I think a callback and a callable object are exactly the...
[7 replies] Last: OK, thank you very much. (by frek)
August 2023 Pages: 12
  Archived months: [jul2023] [sep2023]

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