Category : c++17

Code in compiler with error at bottom (error at line 8) I have tried to insert code like "using namespace std" as initializer, and other basics. However the error prevails. The idea of this code is to create an autorun sequence for the program, however the initial [autorun] command used was having trouble so I ..

Read more

I’m using a DataRouter class to handle communication with a QSerialPort (and then communicate the results elsewhere). The connected device sends a status package every second or so, and I would like to read it without polling the device. I tried directly using QSerialPort‘s waitForReadyRead function, but no matter how long I set the wait ..

Read more

I create two simple classes by inheritance, and I add a virtual function and the override in the child class. class Base { public: virtual Base* getThis() { std::cout << "called Base::getThis()n"; return this; } virtual void func1() { std::cout << "called Base::func1n"; } }; class Derived : public Base { public: Derived* getThis() override ..

Read more

I’m given a list of timestamps (suppose we have a ready-made std::vector<std::string>) in a string format of a kind std::vector<std::string> = {"12:27:37.740002", "19:37:17.314002", "20:00:07.140902",…}. No dates, no timezones. What would be a preferable way to parse these strings to some kind of C++ type (std::chrono::time_point ?) to be able to perform some comparisons and sorting ..

Read more