Category "c++"

Calling `std::vector<A>::data()` on `A` with const or reference fields, before C++20

This is a followup on the answers for placement new on a class with reference field. Calling std::vector<A>::data() on type A that has reference or const

Naive reverse string iteration infinite loop and/or assertion failure C++ / Visual Studio 2022

I am trying to reverse iterate through a string, but am getting assertion failure for the [] operator in the latest VS. int foo() { std::string s = "s";

Let Join C++ MYSQL library

I'm trying to access "category" table with LEFT JOIN. I need to retrieve the field "name" in this table. This is my code: void Product::read(MYSQL *connection)

Why is an overloaded function with two arguments of type double called when passing a long long?

I wrote those two overloads: int func(int, int) { return 1; } int func(double, double) { return 2; } When I call them with the obvious two calling

Spectre-mitigated libraries are required for this project after disabled giving error that it needs to be enabled

Hope you are all doing well. I've decided to start learning kernel driver devlopment via microsofts documentation. I've downloaded the WDK and Windows SDK(10.0.

How do I use C++20 in vscode?

I want to use C++20 in vscode as I'd like to use .contains on an unordered_set, but when I try it I get error C2039: 'contains': is not a member of 'std::unord

How to match start and end of input with std::regex on Visual Studio

From what I understand, C++ regex symbol ^ should match only the beginning of input and $ should match only the end of input. This can be changed to match begin

Cmake link libmapnik c++

I am unable to connect Mapnik via cmake to my application. I tried to do like this: cmake_minimum_required(VERSION 3.1) project(MapnikTest) set(MAPNIK_LIB "/u

Is there a way to navigate to a function's definition in another file in VSCode or CLion for CPP?

I am working in a project where I am on a specific file in a folder, the structure is like this: └─project_folder/ ├─ myFile.cpp

Ambiguous partial specializations and enable_if_t

This question is due to insane curiosity rather than an actual problem. Consider the following code: template<typename...> struct type_list {}; template&

How to Install compiler g++-4.8.5 in ubuntu 20.04

As the title said I can't install that specific version of g++ in my current ubuntu (20.04). I have been trying the usual things as: sudo apt install g++- (and

Bit shifting a half-float into a float

I have no choice but to read in 2 bytes that make up a half-float. I would like to work with this in the form of a 4 byte float. Ive done some research and the

What is an undefined reference/unresolved external symbol error and how do I fix it?

What are undefined reference/unresolved external symbol errors? What are common causes and how to fix/prevent them?

Configuring protobuf C++ to dynamically link against MSVC runtime library

I would like to configure protobuf to link MSVC runtime library dynamically. While this is supported by protobuf and seems trivial to do, I have not been able t

Transferring string arrays from VBA7 to C++

I'm currently working on a project where I want to be able to manipulate and graph data with relative ease in Excel. However, a lot of the data involved exceeds

How can I access class members after creating a new object for that class?

I know my question doesn't really explain my problem all that well, but I'll try my best here. I have a graph program. It should add new vertices and edges, and

can c++ using cin to read one digit like scanf

does c++ have similar measure like scanf("%1d) read only one digit in cin >> or only #include <cstdin> and use scanf I try to use setw() but it seem

struct in union nested - understanding behaviour of type punning

The following code uses a structure inside a union inside a structure inside a union. #include <cstdio> union { char abcd[4]; struct {

Can't build RDCOMClient using rtools40 and R 4.0

A while back, I created a fork of the RDCOMClient package to keep it working with R 3.6 (https://github.com/dkyleward/RDCOMClient). People are now running into

how can i use a function from MyForm1.h in MyForm.h

i have a funcion 'button1_click' in the header 'MyForm1.h'. I want to use this function in another header 'MyForm.h'. How can i do this? i already included 'MyF