Category "c++"

why alignas(64) not aligned with 64

why alignas(64) not aligned with 64? for example: struct alignas(32) st32 { float a; uint16_t b; uint64_t c; }; struct alignas(64) st64 { float

Seamless Loop Problem with Media Foundation

I am trying to make seamless looping video in a game engine, and I have two questions. Even though I used the Sequencer Source, I still found that the playback

I'm trying to create a 2D vector to which i can append values easily

In my head it seems like creating (a) vector by pushing n number of elements and then appending the (a) vector to the (b) vector to make a 2D vector. I'm still

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?

Why does a non-constexpr std::integral_constant work as a template argument?

My question is why the following code is valid C++: #include <iostream> #include <tuple> #include <type_traits> std::tuple<const char *, c

Access violation in nvoglv64.dll when using OpenGL

My code is giving me this error: Exception thrown at 0x00007FFCF428A6CF (nvoglv64.dll) in program.exe: 0xC0000005: Access violation reading location 0x000001D6

How to specialize a type trait using concepts?

I am trying to use C++ concepts in order to write a type trait that will produce a different type depending on whether its template argument is a fundamental ty

How do I call a method for all objects in a class?

I want to call a method for all objects in a class at once. What's the simplest way to do that? Also, how do I call a method for some, but not all objects in a

C++/C Importing Third Party Library to CMake

Hi I was wondering if anyone here could help me identify what I'm doing wrong while trying to add a library to my CMake project: So originally I built the libra

C++ init a class member inside a subclass constructor init list

Is there a way to init the member of a class inside the initialisation list of one of its subclasses ? let me explain, since it is way easier to visualise like

Matlab new C++ MEX function runnign speed vs C Mex interfaces

Recently I am working on boosting Matlab project performances. As you may know, Matlab 2017 introduced a new C++ Mex function to avoid unnecessary data copies,

Why is std::ctype's virtual destructor protected?

I was trying to write std::ctype<char> c; but I couldn't, because that class's is both protected (directly) and virtual (indirectly, through facet). But

Struct member names as map keys

I'm looking for a way to map a struct's member to a string (or some other type for that matter): struct Foo { int intMember; int otherIntMember; cha

Split linked list into half in c++

What is wrong with my code in splitting the linked list into half, what causes the error? I kinda get the logic on how to split it, but is this the right implem

Outer class can't create an object of my inner class [duplicate]

I am so confused. I have a nested class where Book is the inner and Bookshelf is the outer class. When I try to create a Book object in my Boo

Do FMA instructions of different CPUs have different intermediate accuracy? If yes, then how does a compiler equalize the floating-point behavior?

When I run fma-optimized horner-scheme polynomial computation (for cosine approximation), it makes 0.161 ulps error on FX8150 but 0.154 ulps on godbolt.org serv

Check if number should be C++ float or C++ double using python

I am working on a simple C++ code generator created by excel parsing and I will need to distinguish between number type. I can deduce integer size (e.g. uint_32

C++ and Java array declaration/definition : differences

my question is really simple (which doesn't imply that the answer will be as simple.. :D ) why do arrays in C++ include the size as part of the type and Java's

cppflow model loading hangs unity

I'm trying to load a tensorflow graph model using cppflow in c++. I am able to load the model when I define the model loading globally in a standalone applicait

C++: How to do a matrix multiplication with pointers? Error: argument of type int is incompatible with parameter of type int**

I need to multiply two matrices, I have a header file where the function product is, and I need to call it in main. I am not very familiar with pointers, so I d