Category "c++"

CGBN: How to send to device memory short cgbn_mem_t, but make calculations over long cgbn_mem_t?

I'm somewhat lost on the point of converting, for instance, cgbn_mem_t<256> into cgbn_mem_t<1024> in device code. Say, the kernel receives two point

How can I call out a string from an object array?

I have recently started some OOP in C++, and I was trying to make a small program in Dev-C++ to store arrays of information on employees through a friends funct

How to reserve memory space for std::vector in terms of bytes?

I am trying to write up a config parser class in c++. I'll first give a snippet of my class: class foo{ private: struct st{ std::vector<pair<s

How do I add numbers into an array from a loop that creates random numbers in C++?

How do I add numbers into an array from a loop that creates random numbers? I also need to sort these numbers in a certain way. The next number cannot be greate

C++ call to API function ::GetTickCount() jumps ~18 days

On a few Windows computers I have seen that two, on each other following, calls to ::GetTickCount() returns a difference of 1610619236 ms (around 18 days). This

Manipulating the standard output stream to print multiline strings horizontally

So I have three strings and these strings are supposed to occupy 3 lines. I thought this was a good way to represent my string: std::string str1 = "█π

Adding a node to the beginning of a double-linked list

I am trying to create a function that adds a node to the beginning of a double-linked list in C++, and I'm getting this error in Xcode. I know it must be becaus

incorrect output when using C++ lower/upper_bound function with custom compare operator

I've been experimenting with the "lower_bound()/upper_bound()" functions in C++ w.r.t. arrays/vectors, and I get incorrect results when applying custom compare

Deleting a pointer from a vector... Error: terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc

I'm getting the error after I delete a pointer from the vector and try to delete a second one. I'm still new to pointers I created a base class of shapes and ha

What is the fastest way to get the lowest set bit of a C++ std::bitset?

I noticed that std::bitset does not have a function for returning or popping the lowest set bit of a bitset (nor the highest set bit for that matter). What is t

Directshow Transform filter's implementation exposes data race? [solved]

I'm writing a transform filter in Directshow. I've looked at the Transform filter implementation. They use 1 filter_lock for protecting filter's state and anoth

Why is this texture displaying all black?

Here is the function where I am calling all of my draw operations. I also compile the shaders inline in the function. It displays the quad correctly when I just

How to access the files in the res folder in the imgui conan package?

I am using conan to handle dependencies, for those of you familiar with imgui, it provides a series of backends you can include. When you look at the conan pack

Error Missing Type specifer - int assumed . Note C++ does not support default init

In order to make two objects, User1 and User2, of a class User sending and receiving messages, #include <iostream> using namespace std; class reply { p

Using for_each to print the highest value in a vector

I've this code: vector<pair<double, complex<double>>> vC; GetFourierCoeffs(N, t, A, vC); so vC is a vector that contains pairs with doubles a

Delete cl::buffer from Device in OpenCL C++

I am trying to set up memory management in my program as I noticed that my GPU's VRAM slowly fills up. I tried with clReleaseMemObject but it gives me the No s

in-tree include directory with bazel custom toolchain

Is it possible to configure a Bazel custom toolchain to include directories in the repository? Assume that I have following in the root of my repository: sysroo

C++ how to declare an array of priority_queue with customed comparator

With the idea from: declaring a priority_queue in c++ with a custom comparator , I tried to use lambda as comparator for the priority_queue, but when I tried to

Understanding behavior of trivial constructors in C++

I'm trying to understand how the following construction behaves differently across C++ standards, and what the guarantees are on elements a and b. struct X {

Why is Windows Defender scanning my code?

I am compiling C++ code using Visual Studio 2019. The code ranges from simple projects to learn C++ features to game dev. But no matter the scope of the project