• Forum
  • General C++ Programming

General C++ Programming

by admin
Welcome to this board!
 
Welcome to the general programming forum in C++.com! In this forum, users can to talk about any top...
[no replies]
How can a export an existing concept from a c++20 module
 
Hey guys. I have been using concepts for some time and they work very well. Now I'd like to add mod...
[no replies]
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 George PlusPlus)
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)
cannot instantiate a string literal
 
I have this code: template<typename ...T> struct Group; template<typename T1> struct Grou...
[13 replies] Last: To allow std::make_unique and similar functions to initialize aggreg... (by Peter87)
How to define a concept that checks for the size of a parameter pack?
 
I want a concept that requires parameter packs to be of size > 0. I wrote this: template<ty...
[2 replies] Last: This seems to work: template<typename...T> concept NonEmpty = sizeof.... (by Peter87)
How to include library feature macros like __cpp_lib_* if importing std only?
 
the library feature macros __cpp_lib_* are defined in header yvals_core.h (for visual C++) which is ...
[4 replies] Last: Even though <version> was added to C++20 it isn't automatically adde... (by George PlusPlus)
function returning an int cannot be assigned to
 
I have a confusion. A function returning a value of type int cannot be assigned to - is it because t...
[2 replies] Last: b.value() returns an int (not addressable temporary) Correct. The ... (by seeplus)
order of importing does affect the outcome!
 
Reading about C++ 20 modules we find the assertion that the order of importing modules does not matt...
[2 replies] Last: the order of importing modules does matter if they are at least vague... (by keskiverto)
subclass does not deduce template argument in class with using std::vector<T>::vector
 
Hi, I have this subclass of std::vector template<typename T> class Vec : public std::vecto...
[3 replies] Last: The class needs to be declared with 2 parameters like std::vector! Tha... (by JUANDENT)
Unlock mutex when returning
 
The back-end of my application executes a command with _popen and passes the output to the front-end...
[2 replies] Last: Whoops you're right, thanks I'll make bufferLoaded atomic. As for out... (by LsDefect)
how to read a single character as with getchar but in C++?
 
Hi, in C one could read a single character from the keyboard with functions like getc() or getcha...
[8 replies] Last: in C one could read a single character from the keyboard with functio... (by seeplus)
  Archived months: [jul2024]