General C++ Programming - August 2024

How come a concept receives 2 template parameters but only one is used?
 
How come a concept receives 2 template parameters but only one is used? Here is use of concept ...
[1 reply] : There are two syntaxes involved, both of which ultimately supply the s... (by DizzyDon)
Parameters and move semantics
 
Here's some error logging code in my program (basically): void SetError(std::string&& arg){ er...
[10 replies] Last: I think I've actually got a handle on this now - thank you very much! (by LsDefect)
why pass by universal reference?
 
I understand by universal reference the argument passing following this pattern: template<type...
[1 reply] : Universal references are useful when you want to move the argument if ... (by Peter87)
Cannot convert from T to T&
 
Cannot convert from T to T& as in the following: auto f(const map<string, int>& mp) { auto p = f...
[4 replies] Last: Is there any harm in using auto&&? No, I don't think so. does f re... (by Peter87)
How to write a concept that requires one to create an object to specify that that constructor must exist
 
I need to write the following concept: template<typename T> concept Element = requires (T a, ...
[no replies]
what are the differences between returning auto, auto&, auto&& and decltype(auto)?
 
what are the differences between returning auto, auto&, auto&& and decltype(auto)? for instance: ...
[1 reply] : For auto and decltype(auto): https://stackoverflow.com/questions/2136... (by deleted account xyzzy)
Error: Using EigenFFT in for loop
 
I am testing EigenFFT with some Eigen tensors and matrices. I have been so far successful with imple...
[no replies]
what #define are defined
 
Within VS or other, for each source file of a solution/project is there a way of obtaining a list of...
[3 replies] Last: Thanks. I missed that one........ (by seeplus)
are these assignments to temporary valid?
 
Hi, I have this code where I am not sure the assignments are valid: int g(double x) { return st...
[1 reply] : h and i return dangling references. All big compilers (GCC, Clang ... (by Peter87)
vector of unique_ptrs - how to initialize?
 
Hi, I have a vector of std::unique_ptr<Shape> but cannot initialize it. I tried: vector<...
[7 replies] Last: std::initializer_list only gives const access to the elements. You c... (by Peter87)
  Archived months: [jul2024] [sep2024]

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