General C++ Programming - May 2020 (Page 3)

File I/O (HELP)!!
 
I have a inpu.dat binary file. I have to read this and assign the elements in it to a matrix. How can I do this? Thanks
[4 replies] Last: A C-style array type contains its dimensional information which sizeof... (by dutch)
student report program
 
I will be very a happy if anyone can assist me Suppose we want to compile a student academic report for a high school learner in grade 12 (matric). A mat...
[3 replies] Last: I great technique for doing assignments like this is to copy the list ... (by dhayden)
How to program games like Project QT
 
Hello friends. I am new to game programming. So many things are still unclear. Can someone show me the basic steps on how to program a quality game like Project...
[2 replies] Last: Some simple text games might be instructive and fun: High-low: The co... (by dhayden)
[SOLVED]Spinlock mutex not working with std::scoped_lock or std::lock_guard
 
I can call lock and unlock manually around the critical region and it works fine, but when I wrap it with a scoped_lock I still get a data race: #include <at...
[no replies]
by kohit
how to use a different type to find value in std::set
 
I have a struct like: struct point{ int f; int b; point(){} point(int u, int v){ f = u; b = v; } bool operator<(const p...
[4 replies] Last: I was confused, if I have a key_type value with the key I need(such a... (by keskiverto)
How to use Boost in Visual Studio/Qt
 
To make a long story short, I need to use boost for various reasons. Anyways, I've searched and searched for an extremely simple way to use Boost in Visual S...
[6 replies] Last: @malibor thank I really appreciate it and benefit of it.. (by marhuum)
functions help
 
i wanted to make a function and then checks if the user reboot or not. and in the int main function i want to call from that function. the code i have so far is...
[1 reply] : support's return type is void. That means it doesn't return any value.... (by Ganado)
by eladb
TCL shell fron CPP
 
hello gents, I would like to open TCL shell from CPP progrem. I have no idea how can it be done, do spmeone have any idea or some examples that can give m...
[11 replies] Last: I am not sure why you have been getting the answers you are getting...... (by Duthomhas)
List with multiple template (1,2)
 
Good evening to everyone, I'm opening this topic because i need to solve a problem with templates in lists. I need to create a list which can contain for ea...
[29 replies] Last: To clear exactly what i'm doing with template_variable i should post h... (by AlessandroTZ)
different types to ?: operator
 
namespace { struct Base {}; struct Derived: Base {}; } int main() { Base a; Derived b; Derived *p = &b; const Derived *c = &b; bool s = f...
[4 replies] Last: Are you saying const Derived can not be directly converted to Base ... (by dhayden)
Understanding std::memory_order_release and std::memory_order_acquire
 
Please consider the following example code: #include <atomic> #include <thread> #include <cassert> std::atomic<int> data ; std::atomic<bool> sync1(false),sync...
[3 replies] Last: My previous post was exclusively in response to this question: can th... (by helios)
request for member '', which is of non-class type
 
I am trying to build a struct array and input the different attributes to that struct array with a loop but I am being prompted with an error message saying "re...
[1 reply] : s is an array of water_bottle objects, not an individual water_bottl... (by Ganado)
by thmm
dlib::timer crashes
 
I am playing around with the dlib library. The following code crashes in DEBUG build, but works fine in RELEASE build. Using VS 2017 CE 15.9.23 Anything I co...
[2 replies] Last: I added t.stop() at the end of main, but still the same behavior. (by thmm)
by Odglog
How to remove spaces between lines?
 
Hi, I hope you have a good day :) I was wondering if removing spaces between lines is possible, lets say I have this code: #include <iostream> int mai...
[10 replies] Last: Odglog, you also don't necessarily need to use OpenGL for text renderi... (by Ganado)
C++ memory orderings
 
I just learned about memory orderings today, and I'm not sure I fully understand it. Basically the standard library provides six std::memory_order enumerators t...
[3 replies] Last: It looks like it deals with details of parallel processing and optim... (by TheToaster)
Using Generic Lambdas for SFINAE
 
In C++ Templates, The Complete Guide (2e), the author gives the following example trait definition template<typename F, typename... Args, typename = decltype...
[4 replies] Last: Ahh that makes sense. Thank you. (by TheToaster)
comparing two substrings
 
Hi guys below is my code...so am trying to read for the input file then compare a specific part of a string using their substrings input file format is: M...
[6 replies] Last: Inside the while loop you check if num1 == 0 (by Thomas1965)
Does Liskov Substitution Principle (LSP) conflict with public inheritance's IS-A semantics?
 
Hi, LSP states that if a function's parameter type is pointer or reference to Superclass, then providing an object from a Subclass should not break the code....
[3 replies] Last: So, it appears that Square IS-NOT-A rectangle... No, class square I... (by Repeater)
What's the best way to create a n array of classes?
 
So I have two classes, A and B. And I want to create an array of A in B. What's the best way to do this? Should I just create an array normally like this: ...
[1 reply] : Who cares? Yes indeed, who needs to know about A? If the answer is " ... (by keskiverto)
fold expression does not work when using std::unique_ptr<>
 
Hi, The following code will not compile - in particular the traverse() function. I get this error Error C2296 '->*': illegal, left operand has type 'st...
[2 replies] Last: great solution!! Thanks! Juan (by JUANDENT)
May 2020 Pages: 12345... 9
  Archived months: [apr2020] [jun2020]

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