Category "c++"

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

How to use the OpenCV c++ with VSCODE

Base on this video https://www.youtube.com/watch?v=l4372qtZ4dc I am trying to use OpenCV in vscode but I canot include the, .lib files what should I do main.

How to remove "noise" from GCC/clang assembly output?

I want to inspect the assembly output of applying boost::variant in my code in order to see which intermediate calls are optimized away. When I compile the fol

WebView2 proxy C++

I found this thread on GitHub, but seems that the code is not C++: WebView2 _webView2 = new WebView2(); CoreWebView2EnvironmentOptions options = new CoreWebVie