Category "c++"

Leetcode Q9 Palindrome Number same code works in Java but not in C++

I tried solving this problem: https://leetcode.com/problems/palindrome-number/ using code: class Solution { public: bool isPalindrome(int x) { int r

Custom substitutions for compression in the Itanium ABI

The Itanium ABI has some rules for compressing identifier for name mangling: for instance, given namespace foo { struct string { void f(); }; }; the f

"ImportError: *.so: cannot open shared object file" after pip installing extension module built with pybind11

I'm running into some peculiar behavior that I don't understand. I have a python/C++ module (call it X) built using pybind11. In my build directory I have build

How can I get the mouse position in a console program?

How can I get the mouse click position in C++ in a Windows console program? (A variable that returns the position of the mouse when clicked) I want to draw a m

Qt creator tracepoint

In Qt creator there are breakpoint settings. So I can put condition like this *(quint16*)((void*)e+0x8)==2 and it works nicely. But I would like to also print a

Repeat a cubemap texture on a cube face with OpenGL

Is it possible to make a cube map texture (GL_TEXTURE_CUBE_MAP_POSITIVE_X...) repeat on a given face with OpenGL? I have a simple unit cube with 24 vertexes cen

Is #include "filename.hpp" actually an undefined behavior?

The C++20 standard states the following about source file inclusion: 15.3:5 (page 437): The implementation shall provide unique mappings for sequences consisti

Is there a way to set jumbo frame with C++ in Windows?

My C++ application uses Gige camera on many various Windows 10 PC. So I wanna set jumbo frame of LAN card of PC programmatically. (when the process starts it is

pyarrow dependency custom build wheel

I am developing a python package using pybind11 which depends on pyarrow to interop between data types in python and C++. Therefore I build apache-arrow with th

clang-format pointer syntax alignment with multiple declarations on one line

With a C++ input file such as: int *p1; int *p2, *p3; I can run clang-format using the Chromium style; which has a Left value for the PointerAlignment option.

Visual Studio C++ static lib function exposing problem

I have created example of using static libraries. The goal is this functionality: DllTestFunctDll.dll links static_lib.lib (contains fnStaticLibrary()) example.

how to convert a buffer to arrow parquet table in c++

I read a parquet file from remote, so get the binary file, which is a buffer. (unsigned char *buffer) How can I convert it to readable table? I can save the buf

Boost ASIO "Bad address" error when passing unique_ptr to completion handler

I'm trying to implement a simple TCP server using ASIO. The main difference here is that I'm using std::unique_ptr to hold the buffers instead of raw pointers a

Big O notation calculation for nested loop

for ( int i = 1; i < n*n*n; i *= n ) { for ( int j = 0; j < n; j += 2 ) { for ( int k = 1; k < n; k *= 3 ) { cout<<k*n;

Mix_PlayChannel function in SDL_mixer

As described in documentation, Mix_PlayChannel function have a 3 parameters: channel: Channel to play on, or -1 for the first free unreserved channel. chunk: Sa

Creating installer using cpack and windeployqt, To contain qt and VTK libraries

Trying to package an application with Microsoft Visual Studio 2022 and qt6 libraries I do not no were to start from. I've done a bit of research most people use

Why is std::reverse_iterator slower than a direct iterator?

I noticed that std::reverse_iterator always decrements a copy of internal iterator before dereference: _GLIBCXX17_CONSTEXPR reference operator*() const { _I

I am trying to take the contents of fa plain txt file and put it into a char array, then I would like to print it out of the array

#include <stdio.h> #include <fstream> #include <string> #include <iostream> #include <cstdlib> using namespace std; int

I am trying to write a two sum function but I keep getting an extra value on my output [duplicate]

I am trying to defamiliarize myself with c++ so I have been trying to solve problems on LeetCode. I came across this very simple 2 sum problem

Gtk::DrawingArea's size_allocate signal not captured

I want to code a hand-free drawing soft using gtkmm. So I derive the Gdk::DrawingArea class and override it's on_size_allocate() function to initialize the surf