Category "c++"

Detecting camera motion with opencv

I am working on drone stabilization close to walls using a camera. For this to work I need to extract the motion the camera makes relative to the wall. For now

Is there any way to declare a array, not just its elements, as const?

Using std::array I can declare both the array itself and it's objects as const. const std::array<const int,2> a {1,2}; However, if I read the standard co

replacement for readlink() function in windows

readLink() is present in linux and is defined in unistd.h,is there any similar type function in windows please provide or else if we can make a function with si

error: call to implicitly-deleted copy constructor of 'std::__1::unique_ptr<A, std::__1::default_delete<A> >'

I'm constructing an object that takes a std::vector<std::unique_ptr<A> > as an argument. The constructor is defined like this class B { std::ve

Mergesorting and Removing Duplicates in C (Any language will work)

This is my first question so I apologize in advance if I leave anything out or am ambiguous on an item. Anyway, this is code I got form GeeksForGeeks.org (arr

c++: Remove Elements that are in one vector from another

I need to remove the elements that appear in Vector A and Vector B, but keep the elements that are only in Vector A. The vectors can be of any size, but are not

Why the definition works at function level, but not at class level?

#include <iostream> #include <vector> using std::vector; using MATRIX = vector<vector<int>>; class Matrix { public: MATRIX matri

How to find the quartiles in the linked list with only one iteration

I have a singly linked list of integers. The node is defined as class Node { public: int value; Node *next = NULL; };

SDL2 multiple windows focus

I have some problems with windows focus in SDL2. I got two windows and listen to focus gain and lost events. When I click on Window 2, the following events trig

Eclipse not finding std c++ libraries

I have a Windows8 machine with mingw installed in c:\mingw Eclipse does successfully compile programs, but it considers lines to contain errors that are fine wh

Emplace back thread on vector

Why this cause undefined behavior? #include <iostream> #include <thread> #include <vector> std::vector<std::thread> threads(3); void

Basic forward list using unique_ptrs

As an exercise in learning C++, I want to build my own forward list using raw pointers and using unique_ptrs. Using raw pointers, I have: struct node_raw {

Valgrind output

I have installed Valgrind on a Linux system and make this call: valgrind --tool=memcheck --leak-check=full --log-file=valgrindLog/%p --trace-children=yes --xml=

How to import and output several files in voro++?

This script makes me import a single file with the 'con.import()' function and it makes output a single file with 'con.print_costum()' function, now i want to i

Creating Python bindings for a large quantity of C++ Qt Libraries

Question in short: Do you maybe know, or have any idea how I could implement the below mentioned, existing libraries in Python, whether that be through bindings

Infinite Loop when a character is entered [duplicate]

I am trying to restrict the user to enter only '1' or '2'. int ch; do { cout<<"Enter: \n"; cin>>ch; switch(ch) {

Counting the number of occurrences of a string within a string

What's the best way of counting all the occurrences of a substring inside a string? Example: counting the occurrences of Foo inside FooBarFooBarFoo

Regex match whole string

I have the following pattern: [ \n\t]*([a-zA-Z][a-zA-Z0-9_]*)[ \n\t]+((char)[ \n\t]*\[[ \n\t]*([0-9]+)[ \t\n]*\]|(char)|(int)|(double)|(bool)|(blob)[ \n\t]*\[

How do I print a queue?

I am trying to print a queue below. I have tried the idea of creating a temp queue and writing into it then writing it back. But it's not working. Or what am I

How to get the number of rows and columns of an Eigen::MatrixXd?

I am trying to traverse Eigen::MatrixXd matrix. However, there does not seem to be a function that returns the columns size nor the row size. Does anybody have