Category "c++"

Inversion count gives error on large inputs

The given code is for counting the inversions in the given array or we can say to count the number of changes to be made in an array so that it becomes sorted.

Why there is a delay in running a console application just created?

I have noticed this for a while. After building a cpp console application, when i run it through command prompt, the first time it takes some time to run. The s

E-olymp: Profit. 90% gives, one test wrong answer

Description of my code: For example, take n = 3, and let p [i] be 1 2 3. For beginnings, max = 0. I take in this order the sequences: 1, 1 + 2, 1 + 2 + 3, 2, 2

Object Oriented Programming - Inheritance C++, Code does not compile

Source Code #include <iostream> using namespace std; class A { private: long int a; public: long int b,x; void s

VSCode C/C++ IntelliSense ignore patterns for includePath and browse.path

Is there a feature in VSCode IntelliSense that allows to ignore specific header files for includePath and browse.path settings? In my case I have a CMake based

An incomprehensible error in Qt6. Can't init 2 QMap

I'm trying to create a class in Qt6, but i can't. I'm writting in tunnel.h: QMap<quint64, QMap<quint64, QByteArray>> *storage = new QMap<quint64,

Segfault 11 when invoking python callback from c/cpp library

I am running a UDP socket from a c/cpp library and passing in a callback from python. The callback runs fine, until I attempt to modify a member variable of the

Which GCC optimization flags affect binary size the most?

I am developing a C++ for ARM using GCC. I have ran into an issue where, I no optimizations are enabled, I am unable to create a binary (ELF) for my code becau

How to access FlexLexer's input function without deriving from yyFlexLexer?

I am writing a simple compiler for a simple C like language. To do that I would like to use Flex and Bison but use them both in the context of modern C++ Right

Problem: Assigning a group number to elements near eachother where groups are separated from spaces

We have a room divided of 6x5 possible seats, every place in the 6x5 matrix could be a seat or could be empty. We have the Matrix with all the seats already ass

How to run my analysis pass on optimized ir

I write a driver to run pass in my code. void MyPassManager::addNewFuncPassByCode(string PassCode, FunctionPassManag

Are there any good mappings between GCC and MSVC warnings? E.g. -Wredundant-move on MSVC

This question is somewhat two fold, one being more general than the other. The specific question is; does MSVC have equivalent warnings to -Wredundant-move? Mor

Custom distance with FLANN in OpenCV

Is there a way to define our own distance for FLANN tool in OpenCV. This question has been asked here but remains not answered for more than 6 years.

Template of multiple abstract classes

There are many questions about template specialization with abstract classes, still I couldn't find something that helped me solve my problem. First of all, let

ld: fatal: file bcPACplacebo.o: wrong ELF class: ELFCLASS32

Below are my environments that I am running my project which has C and CPP codes. uname -a: SunOS nzdrb12z 5.11 11.4.40.107.3 sun4v sparc sun4v non-global-zone

Install IPOPT locally into C++ codebase with CMake ExternalProject

I would like to use Ipopt in a CMake-based project using ExternalProject. The library should be installed locally and automatically in the build folder so that

Add a library in Android.mk

I don't now how many time I try to add a library in my Android.mk, but nothing work. My Android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MO

Eigen3 library with C++20 format

I am trying to print Eigen::Array or Eigen::Matrix with c++20 format, instead of Eigen::IOFormat. I would like to control the precision and alignment of element

Leetcode C++ error: reference to non-static member function must be called

when I was doing Leetcode, I wrote my codes as follows: class Solution { public: bool compare(vector<int> a, vector<int> b) { return

How does os figure if a dll is already loaded in memory or how does os figure two dll are the same?

In my comprehension, "dll/so" can be shared between programs(processes). for example when "libprint.so" is loaded in "main"(called main1) at first time, "libpri