Category "c++"

solved - OpenCV DNN YOLO V4 with CUDA in Python is 5x Faster than the same code in C++

TL;DR; it was a stupid bug in my code. Not a cuda problem at all. I'm trying to compare the performance of the following code: frames = ... for i in range(2000)

json config reader in C++

I have this config data in this json, { "difficulty":-1, "damage":100, "infinite":true, "tilewidth":16, "type":"map", "version":"1.2.4"

Passing and Returning a 2D array of unknown size in C++

I want to pass and return a 2D array of unknown size but I donot know how to do it. I know how to only return array of unknown size only (array of pointers). I

CMake - Install Find script for depencency together with script

I am making a CMake library around some installable SDK. So the dependency tree looks like: Application --> MyLibrary --> OfficialSDK This SDK is

How to call a function at periodic interval that takes in an object as argument in C++?

I want to execute a function at periodic interval that takes an object as argument. I tried this answer: https://stackoverflow.com/a/72226772/13798537 that call

Different output on recursive call using static variable [closed]

int fun1(int x){ static int n; n = 0; if(x > 0){ n++; return fun1(x-1)+n; } return 0; } int fun(int x){

Blazor RenderFragment to String

I'm developing a code block component using .Net 6 Blazor wasm. I need to display the RenderFragment as string and also render the component in my html. Here is

LNK2005 linkage error when running c++ unit test

I am relatively new to c++ and I am not sure how I can resolve this error. I have a namespace QueryUtils which I am including it into another class QuerySyntaxP

Why sources codes c++ in linux compile and does not start?

Source codes c++ gtkmm3 gtk4 linux: #include <gtkmm.h> #include <gtk/gtk.h> #include <glib.h> int main(int argc, char *argv[]) { auto app =

why are my first and second LED not lighting up? is it a problem with the for loops?

When I power my Arduino it only lights up the 2-5 and leds and skips the 1st and the 6th led. I tried seeing what's the problem by giving a check on the value o

Installation of taichi legacy branch on ubuntu 20.04

I am willing to work with code spgrid_topo_opt which needs taichi legacy to be installed first. To install taichi legacy following the instruction on the page I

How to find a substring in only a portion of a std::string?

I have a std::string and i want to be able to find text only in a section of it : so i need to specify a start and an end position. In std::string::find() one c

How to find a substring in only a portion of a std::string?

I have a std::string and i want to be able to find text only in a section of it : so i need to specify a start and an end position. In std::string::find() one c

Having problem Understanding fork() hierarchy tree

I have this Code that I can't understand. I understood the basics of fork() but I don't understand the Hierarchical tree for this process. The code is like this

How to test the problem size scaling performance of code

I'm running a simple kernel which adds two streams of double-precision complex-values. I've parallelized it using OpenMP with custom scheduling: the slice_indic

Cant cout item in container with std::any

This script #include <iostream> #include <unordered_map> #include <any> using namespace std; int main() { unordered_map<int, any> t

Can I serialize a class by casting it to a char*

In C++, can I cast a class or some data to a void*, then to a char* to serialize it? If so, how would I de-serialize? I don't really care about portability. cla

Downloading only specific AWS C++ SDKs using CMake's FetchContent

I'm trying to link-in the AWS C++ SDK for my CMake C++ Project. However, I'm only going to be using a subset of the SDK modules (lambda) and I don't want FetchC

Using #define for a function [duplicate]

After struggling with C++ typedef and define, I've tried myself some code and here it is: #include <iostream> #include <string> #d

Find the number of steps a string can be reduced to 0

My assignment: You are given a non-negative integer variable $Z$. There are two actions available that can change its value: if $Z$ is odd, subtract 1