General C++ Programming - June 2020

about temporary objects...
 
It is said about C++ 17, that if expressions instead of names are passed to decltype(auto), then the deduced type depends on the value category of the expressio...
[3 replies] Last: Thanks to the both of you!! Regards, Juan (by JUANDENT)
Trying to define a homogeneous value list with a variadic template
 
Hi, I came across the following code which I do not understand: template< auto v1, decltype(v1)...VS> struct HomogeneousValueList {}; Please ex...
[7 replies] Last: dutch I was trying to speed up my understanding; the link is large wit... (by JUANDENT)
Should I pass a struct by the struct for string?
 
I have a struct like this: struct Token { std::string type; std::string token; } And I have a function that compares a struct to a value. Bu...
[5 replies] Last: If two tokens have the same "token" but different types, are they the ... (by dhayden)
by volang
Doing lower layer stuff (1,2)
 
Is there a library in c++ (or another languge) that lets me handle tcp synack, tls and that stuff on my own? What needs to be done to get to that level?
[31 replies] Last: But before, I printed out of the received data without touching it(no ... (by jonnin)
How many exponent digits displayed on output?
 
http://www.cplusplus.com/reference/ios/scientific/ says "Finally, this notation always includes an exponential part consisting on the letter e followed by...
[1 reply] : 3 supports 999 digits. remember that 1.23 e2 is 123. e3 is 1230. floa... (by jonnin)
Computer as a player
 
Hello there, I wanna add the Computer as a Player, if there are only 3 player who play the game. My first try was this: int numberofplayers; cout << "How ...
[3 replies] Last: Oh lord! Thank you so much! (by QatarAirways)
Multiple function definition
 
Goodmorning everyone, I'm facing a linker error that i can't solve. I create a program that after the compiling gives to me an error from linker, apparently t...
[1 reply] : must give us sufficient C++ code and its build messages (by marhuum)
what is the difference between declaring a lambda as constexpr vrs returning constexpr?
 
What is the difference between these 2 lambdas? auto squared4 = (auto val) constexpr { return val * val; }; constexpr auto squared5 = (auto val)...
[4 replies] Last: this code you provide does not compile does too: https://wandbox.org... (by Cubbi)
DXT5 data to rgba image converter
 
Hello all. I am currently trying to create a "data" to rgba image viewer. My DXT5 data is in the form of a pak file. I am trying to upload a pak file into my p...
[7 replies] Last: https://www.file-extensions.org/pak-file-extension The first thing to ... (by salem c)
by bibo
Mutate passed 2d vector later
 
Comparator(const vector<vector<int>>& arr) : mat(arr){}; bool yo(const mp& p1, const mp& p2) const { //mat =4; return mat[p1.first][p1.s...
[4 replies] Last: Wow, TLE error vanished. Thanks :) (by bibo)
by bibo
OperatorOverloading with a state variable
 
typedef pair<int,int> mp; class Comparator { public: vector<vector<int>> mat; Comparator(vector<vector<int>>& arr) : mat(arr) {}; bool op...
[2 replies] Last: typedef priority_queue <mp, vector<mp>, Comparator> mypq_type; mypq... (by bibo)
does blocked thread go to the ready queue?
 
if main thread is blocked by calling thread::join(), does blocked thread go to the ready queue? OR Is it guaranteed that the block will be released and e...
[2 replies] Last: // salem c Thank you! I got it! (by woohyeon)
C++ disassembler project
 
I am creating a c++ disassembler (coverts from Machine code to RISC-V) project, and I am in the process of writing the I_imm, S_imm, B_imm, U_imm, J_imm. So far...
[2 replies] Last: I see your point; thank you. I corrected it (by Jack Van Stone)
Random Number from an Array
 
Hello there! I wanna know if there is any posibility to get a random number from Array? I want to get one random number from this Array: const int array =...
[7 replies] Last: Alas, even the seed_seq might be problematic That's what I meant by ... (by dutch)
should I use decltype(auto) or auto for return type?
 
Hi, I have this code.. I don't know if operator() should return decltype(auto) or auto. What is the difference? Which should I use? template<typename ...
[2 replies] Last: thanks!! (by JUANDENT)
file->SendRequest retreiving ANSI encoding
 
Hello All, I hope you are fine.. Please, I am doing a C++ request: file->SendRequest (class CHttpFile afxinet.h ) When I retrieve this data(get request) it ...
[no replies]
non-constexpr lambda marked constexpr should not compile
 
According to C++ 17, the following code should not compile: auto squared2 = (auto val) constexpr { static int a = 1; return val * val; }; ...
[2 replies] Last: Makes sense... I agree VStudio hasn't implemented this error reporting... (by JUANDENT)
Should I put #include"" or #include<> first?
 
Is there a different to doing: #inlcude "file.h" #include <iostream> rather than: #include <iostream> #include "file.h" And "file" in ...
[1 reply] : Depends entirely on what is inside file.h. But generally speaking, no... (by Ganado)
In what order are translation units linked?
 
I have a VStudio 2019 project with many .cpp files. I copied some code and did some chnages and now I am getting a linker error like so: main already defi...
[8 replies] Last: thanks! (by JUANDENT)
[SDL] randomly changing movement
 
Hi guys, right now with the following code, the movements of the rectangle are quite compound, the rectangle doesn't change direction until it hits an edge of ...
[5 replies] Last: Whenever the 'virtual' wall appears the rectangle is rejected. I would... (by coder777)
June 2020 Pages: 123... 6
  Archived months: [may2020] [jul2020]

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