General C++ Programming - July 2022 (Page 2)

by hbcpp
Smart pointer confusion (std::unique_ptr in function argument) (1,2)
this is my first time working smart pointer and I getting confused with this: void test(std::unique_ptr<int> s) { cout << *s;//(s == nullptr); } int main...
Jul 20, 2022 at 12:21pm
[29 replies] Last: "I saw the light, I saw the light No more darkness, no more night Now ... (by seeplus)
how to get locale based digit groups separator (ansi c)
I've tried searching for this information on the web but keep getting directed to either c# or c++ solutions that rely on sprintf etc, but as noted at https://m...
Jul 20, 2022 at 10:25am
[8 replies] Last: I may have had an ABI issue, I did a rebuild during my attempts to fin... (by awsdert)
dynamic array allocation
Hello. Had an assignment using dynamic array allocation. Instructions: Write a program that prompts the user to input the length of a string as an integer, fo...
Jul 19, 2022 at 11:47am
[4 replies] Last: There is also a design decision about how to handle less consistent us... (by keskiverto)
by Cj230
Desperate for Explanation on I/O Assignment
Hello Everyone! I have a programming assignment I have been working on all day. I'm pretty sure I've just been overthinking it so I am going to post on here to...
Jul 19, 2022 at 9:40am
[3 replies] Last: I have been working on all day So post your code so that we can see... (by seeplus)
by t im
About the upper_bound Function
Edit: In Solution 2, if I use upper_bound function instead of the menber function of multiset, time limit exceeded will alse be reported. So, I think the differ...
Jul 19, 2022 at 4:36am
[3 replies] Last: Thanks for your answers that benefit me. (by t im)
assistance with class code
Hello, been having issues with this program that uses classes. Any help would be appreciated, but please make it as simple as possible. This chapter defines ...
Jul 18, 2022 at 6:48pm
[15 replies] Last: sorry for not responding at all, was in the hospital for 3 days. Here... (by seeplus)
by t im
About the loop condition
In case of the following two for loop: // case 1 for (int i = 0; i < n; i++) something; // case 2 for (int i = 0; i <= n - 1; i++) something; ...
Jul 18, 2022 at 6:36am
[3 replies] Last: Thanks for your answers which solve my confusion. (by t im)
does all stream object have buffer except cerr?
I just started learning about stream and I am not quite sure how it works. correct me if I am wrong. A buffer is a memory region in which data is stored t...
Jul 16, 2022 at 1:46pm
[13 replies] Last: To determine if the standard C++ streams are synchronized with the sta... (by JLBorges)
Variadic Template not working expectetly
Dear Community, i cannot figure out how to solve this. I am coding a Container Class and run into a Problem with my constructor. I wanna take a variadic list o...
Jul 15, 2022 at 11:58am
[6 replies] Last: C++20: #include <concepts> template < typename VTYPE > struct Conta... (by JLBorges)
by ruzip
Convert any value/type to string callable from C
I'm trying to build a C++ function that converts any type to string. ex. int 4 will be "4" float foo with value of 2.5 will be "2.5" .. .. So far I'm ...
Jul 15, 2022 at 9:55am
[5 replies] Last: Thanks guys for the added info. Yes the C part requires it to be C99. ... (by ruzip)
Remove unwanted character from String concat macro
Hi I have a macro to do concatenation as below #define dd Cloud #define ff _Storage #define CCM_BRAND_CONCAT2(a,b) a##b The output is "Cloud _Stor...
Jul 13, 2022 at 9:33am
[1 reply] : Pre-processor macros are very limited in what they can do. And, gener... (by kigar64551)
by Geckoo
Rosetta Site
Hello. I really like to "rummage" for some interesting codes on the Rosetta site which seems to me really relevant. I learnt many, many things especially about ...
Jul 12, 2022 at 9:35pm
[8 replies] Last: I used to work for a US technology chain store company* that had a sto... (by deleted account xyzzy)
Class as struct member
Suppose there is a struct with a class as a member of the struct, as in the example below. typedef struct _MYSTRUCT { int Num; Class MyClass; } MYSTR...
Jul 12, 2022 at 8:29am
[3 replies] Last: If you want to define its members out-of-line (say, in a .cpp file): ... (by JLBorges)
Execute Code on task kill
Hi everyone, i'm currently working on a sockets project, and i want to recognize wheather the clients process is killed, but this is not windows topic. My que...
Jul 12, 2022 at 3:22am
[10 replies] Last: That is good to know, thanks JL. I have never needed to do that, and... (by jonnin)
Further pure virtual calling issues
A debugbrk_ call occurs when I try to call pure virtual function Allocate_Square(). The debug call occurs on the first iteration through the inner loop. Stepp...
Jul 11, 2022 at 4:18pm
[11 replies] Last: Use a factory method: https://en.wikipedia.org/wiki/Factory_method_pat... (by JLBorges)
error C2041 - C2415 - C2426
I want to make a dell file, but there are some errors my code #include <Windows.h> #include <iostream> #include <string> #include <TCHAR.H> using namesp...
Jul 11, 2022 at 3:21pm
[6 replies] Last: thanks for replay yes i use vs 2010 , I made a lot of dell files wit... (by Hawlong)
why is istream::read cast to char*
1. why do I need to reinterpret_cast the 1st argument of read() function of ifstream into a char* when reading a file and also casting the 1st argument of write...
Jul 11, 2022 at 10:06am
[3 replies] Last: Unlike other languages (Java, C#, etc.), there is no explicit "byte"... (by kigar64551)
template metaprogrammingNewTupleType_ not compiling
I have errors in the following: template<typename TVal, size_t N, size_t M, typename TProcessedTypes, typename ...TRemainTypes> struct NewTupleType_; ...
Jul 10, 2022 at 6:05am
[2 replies] Last: Looks like the usage of NewTupleType on line 42 can be replaced entire... (by mbozzi)
Error when filling a matrix using Eigen
I have the MATLAB code: Nx = 10; Ny = 10; %X,Y defined u = (Y-0.5).^2 .* sin( (2*pi / Lx) * X); %Y.^2 .* sin( (2*pi / Lx) * X); uh = fft(u, ,2); %use discre...
Jul 10, 2022 at 3:49am
[5 replies] Last: I did find the issue and to fix it I used seq() instead of seqN... (by JamieAl)
Tag2ID is giving me trouble
Hi, I am trying to create a metafunction that returns the index of a type in a list of types (Tag2ID) but am having trouble: template<typename ...
Jul 10, 2022 at 1:27am
[5 replies] Last: You're right, thank you. (by mbozzi)
July 2022 Pages: 123
  Archived months: [jun2022] [aug2022]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.