General C++ Programming - January 2020 (Page 7)

Top 10 bugs found by the static analyzer in C++ projects in 2019
 
Do you want to look into the darkest spots of open source projects and see what kind of bugs are waiting for you there? Then check out the most interesting bugs...
[no replies]
Saving multidimensional vector to hdf5 format.
 
Hello Forum, Since multidimensional vectors in C++ (vector<vector<vector<etc...>>>) are not necessarily rectangular, we have to find an efficient way to sav...
[1 reply] : Never done that, but since HDF5 has C++ interface and documentation, I... (by keskiverto)
SFINAE problem
 
Hello, I'm trying to use SFINAE to detect when a class has a member function but I have found a problem when the class has two member functions with the same n...
[3 replies] Last: template <typename C> static constexpr std::true_type test (d... (by mbozzi)
Exception Thrown
 
Im trying to sort an array without using sort built-in function and i dont know why im getting this error ( using visual studio 2017) Exception thrown: read ...
[7 replies] Last: @doug4 i apologize to you i really do but i couldn't handle the situat... (by abdallahosama)
How would I Re-write the following binary search function so that it uses recursion
 
int binary_search(int arr , int find, int low, int high) { int middle; while(low <= high) { middle = (low + high) / 2; if (arr < find) low = middl...
[5 replies] Last: #include <iostream> int binsearch( int A , int value, int low, int h... (by lastchance)
Exception Thrown
 
Im trying to sort an array without using sort built-in function and i dont know why im getting this error ( using visual studio 2017) Exception thrown at 0x0...
[2 replies] Last: I don't see the unresolved external. You don't need <algorithm> in yo... (by doug4)
by lo2
How to detect stack overflow?
 
Hi there, Recently I tried running my C++ program with a much larger data set, and I quickly got an error crashing the program. I was quite surprised, as thi...
[7 replies] Last: if it helps the vector version of double cov ; is vector<double> cov(... (by jonnin)
by mnnsa
is this a dynamic programming problem
 
is this a dynamic programming problem can you give some tips to solve this ..... You are given an array B of length N. You need to construct an array A of posi...
[5 replies] Last: thanks, got it (by mnnsa)
by Aceix
Can a function return value be used in declaring an array
 
Hi guys, is this valid C++14? int factorials = { factorial(0), factorial(1), factorial(2), factorial(3), factorial(4), factor...
[2 replies] Last: oh...okay thanks (by Aceix)
How would I re-write the GetMin function
 
How would I re-write the GetMin function so that it can return and take as parameters any datatype (not just int) int GetMin (in a, int b) { if(a<b...
[2 replies] Last: template <typename T> T GetMin( T a, T b ) { return a < b ? a : b; }... (by nuderobmonkey)
C++ namespace with exception
 
is there any in C++ to use namespace with one, two, or three name exceptions ?
[1 reply] : The presence of a using statement using namespace std; Doesn't pre... (by mbozzi)
Last digit of the factorial of an integer
 
Hi. I am trying to make a program which first reads the number of times the program should be able to process my calculations and then processes it and outputs ...
[5 replies] Last: if you just want a factorial, there are a fairly small # you can have ... (by jonnin)
optional argument of a function
 
How to have optional argument of a function, being explicitly meant so with condition rule: . if argument/parameter exists, it's as is supposed to be . if i...
[15 replies] Last: @mbozzi, Thank you. That explains it. And that wg21.link redirect site... (by dutch)
How many times is the constructor called in the following code
 
How many times is the constructor called in the following code? and explain why. Apple func() { Apple w; Return w; } void main() { Apple x; ...
[3 replies] Last: [quote=shanno8]How many times is the constructor called in the followi... (by lastchance)
Read Config File
 
The code below parses the config file. After we successfully load the file, we read it line by line. We remove all the white-spaces from the line and skip the l...
[6 replies] Last: Thanks All. (by akash16)
what's the std::function<>
 
Could you explain us what std::function<> is all about?
[3 replies] Last: crystal clear ! Thank ! (by marhuum)
What is the difference between the following two code segments?
 
// code segment 1 int i = 48; char ch = i; // code segment 2 int i = 48; char ch = static_cast<char>(i);
[1 reply] : First code converts the int to a char. Second code casts int to a char... (by Ganado)
by ravss2
OPP Design For my Solution
 
I am working on a problem for which i have already developed a solution, but i am new to OPP prgramming and started learning recently. Would request OPP Gurus t...
[14 replies] Last: // TODO const, &, * #include <iostream> #include <string> #include... (by againtry)
inability to read line, more than a specific one!!
 
Dear I have a piece of code. It reads input files (Data.txt, Index_list.txt, and Nb_list.txt) and gives output file (NB.txt). Index_list.txt, and Nb_list.txt...
[1 reply] : > for (int linenox2 = 0; getline (Index_list_1,line1) && linenox2 < at... (by salem c)
What is the meaning of not specifying a template parameter?
 
Hi, I found this code which I don't understand: using namespace boost; auto injector = di::make_injector( di::bind<ILogger>().to<ConsoleLogger>...
[1 reply] : I believe di::bind is a template struct and di::bind<ILogger>() create... (by JUANDENT)
January 2020 Pages: 1... 56789
  Archived months: [dec2019] [feb2020]

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