Category "c++"

Why does string not work here while char const* does?

Why does string not work here when I catch an error, and char const* does? What is the difference between the two? try { throw "connection fail"; } catch(

Holder class (Having some objects references) compile error: 'Can not be referenced -- it is a deletted funciton'

I need a "holder" class. It is supposed to store objects references. Like: holder.A = a; // Gets a reference! Sample code bellow including the compiler error: c

Reading arguments from a text file using <

I have a txt file called test.txt that looks like this, hi this is a test and I have a c++ file called selection_sort.cpp that looks like this, #include <io

Weird bug in pointers

I was trying to access single bytes of an int value via the code below. My problem is that whenever I try to remove long int i=0; from the code, it gives me a s

Couldn't create a linked list

My create function is not creating a linked list. I can't seem to figure out the problem here. The code runs but I don't get any output. Can anyone figure out w

What is the time complexity of passing a Vector of size n to another function by passing by value and passing by reference?

void fun(vector<int>vec) { some code } int main() { int n = 5; vector<int>avec(n); fun(avec); } What is the time complexity of passing

windows - how to link against API sets (*ms-win*) instead kernel32.dll, ntdll.dll etc.?

How do I specify explicitly to MSVC compiler / linker to link against API sets (*ms-win* pattern matcing dlls) instead kernel32.dll, ntdll.dll etc.? For example

How to subtract char out from string in c++?

Hello I want to know how to subract string from string For example If string s = "124ab" I can easily extract integer by using sstream but I don't know how to e

ByBit Api. Open Active Order. Return "empty param of timestamp". Libcurl c++

Please help!!!! Is there a working example of opening an order in C++ Constantly sending a request to open an order POST https://api.bybit.com/private/linear/or

GCC, constant tables and .rodata

I have a strange problem with gcc and constants and .rodata Let's assume: typedef const struct { const char *a; } data_t; typedef const struct { const dat

Vector in C++ module causes useless Bad file data GCC output

TL;DR: GCC 11.2.0 (image f7ea55625e09) + C++20 + <vector>'s std::vector<anything> cause useless output. How to get out something I can work with? Co

Handle multiply cameras in Vulkan

I'm trying to implement rendering with different cameras. When I use only one camera, everything is ok. But when I have two cameras with different transformatio

When assigning value to a member function pointer, the assignment tampered with other data

Before the assignment operation, the member variable u works fine, see figure 1 After the assignment operation, the data of the member variable u is tampered, s

Where is query pipelining in libpq?

I'm developing a high load server application using C++ and libpq (libpqxx is very unstable). I use async queries in threads to improve performance. But I've di

configure: error: Fortran compiler cannot create executables

I'm trying to install Quantum ESPRESSO on my computer and have run into an issue when using the ./configure command in the unpacked directory. $ ./configure ch

UGameplayStatics Emitter Attached but not completing

I have created a particle effect and I am attaching it using UGameplayStatics::SpawnEmitterAttached(Elecricity, gunMesh, TEXT("MuzzleFlashSocket")); but the par

AVX2 code cannot be faster than gcc base optmization

I am studying AVX by writing AVX code with inline assembly. In this case, I tried to implement AVX in a simple function. The function name I made is lower_all_c

using vkEnumerateInstanceVersion to get exact Vulkan API version

I am using vkEnumerateInstanceVersion to get the vulkan api version and pass it to VkApplicationInfo struct. I can easily differentiate between VK_VERSION_1_0 a

Most insanely fastest way to convert 9 char digits into an int or unsigned int

#include <stdio.h> #include <iostream> #include <string> #include <chrono> #include <memory> #include <cstdlib> #include <

Why does C++'s "using namespace" work the way it does?

All students are surprised by the behavior of C++ using-directives. Consider this snippet (Godbolt): namespace NA { int foo(Zoo::Lion); } namespace NB {