Category "c++"

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

get mtu C++ portable way

Is there a way to get mtu C++ portable way? Like from both Linux and Windows ? I know in Linux this is the code : sys_get_mtu(const char *ifname) { struct

how to access only element of unordered_set in c++?

For ex, unordered_set<int> s ; s.insert(100); How do I get value 100 from s? From http://www.cplusplus.com/reference/unordered_set/unordered_set/begin

How to take input 128 bit unsigned integer in c++

I am new to c++. I want to take input a unsigned 128 bit integer using scanf and print it using printf. As I am new to c++ , I only know these two methods for i

Error message "Undefined reference for std:string" [duplicate]

I have some code that reads the name of the file from arguments and outputs that file into the command line: #include <stdlib.h> #includ