Category "c++"

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

Is there an alternative to the builder pattern that is preferred in C++?

I'm coming from Java where the builder pattern is used heavily, e.g. Foo foo = new FooBuilder() .setBar(43) .setBaz("hello, world!") .enableCache(tr

How do I export templated classes from a dll without explicit specification?

I have a dll that contains a templated class. Is there a way to export it without explicit specification?

Error submitting the frame for encoding when submitting NV12 texture

I'm trying to encode D3D11 NV12 Texture on QSV encoder but getting [h264_qsv @ 00000244ce6f50c0] Error submitting the frame for encoding. Main: int width = 1920

3D head mesh morphing from one mesh into another using scripts (C, C++, python etc) [closed]

I have 2 3D head images and want to morph one into the other (animation) without using blender, three.js etc. I want to do it using coding pre

How do I correctly memoize this recurrence relation?

I am solving a problem: Given a list of integers nums, write a function that returns the largest sum of non-adjacent numbers. Numbers can be 0 or negative. Fo

clang 14.00 : _GLIBCXX11_DEPRECATED_SUGGEST("std::bind");

Installed clang 14.0 using GNU/Guix's clang-toolchain package. I am getting depreciated feature usage error when trying to compile a simple code: //build with:

Write empty packets into avi file ffmpeg

A task: I have a trusted video event detector. I trust to my event detector for 100% and I want to write an uncompressed frame to my avi containter only if my e

Calling a protected function from instance inside a derived class

Currently, I am trying to solve the following situation. I have a classB which contains some objects from a classA. Each classA has a function foo which needs t

How to create custom ConfigVersion.cmake

I am creating a c++ header only library and using CMake as my build system. I am pretty new with CMake, but after I read some blog posts, documentation and look

MISRA 5-0-15 - Pointer Arithmetic - Rule Violation

The following code violates the MISRA C++ rule 5-0-15: Array indexing shall be the only form of pointer arithmetic. (1) void doSomething(const uint8_t *&ptr

default constructor of "Library::Transaction" cant be referenced -- it's a deleted function

I really don't know what is wrong with my code, I have only pasted the entire code now (EDIT 1). #include "../../std_lib_facilities.h" class Date { public:

Linux read dilemma

I need to read from a fifo. Using ssize_t read(int fd, void *buf, size_t count);, I faced the following situation. When a large set of data must be read from fi

What does 'corrupt value' mean on iOS?

I'm writing C++ on my iOS app. When I call a v->assign(anotherVec.begin(), anotherVec.end()) it always show me malloc: Incorrect checksum for freed object 0x