Category : c++

values on the output are duplicated CODE: enum class status_t { _success, }; const char* set_status(status_t status) { switch(status) { case status_t::_success: return xorstr_("[SUCCESS]"); } } enum class action_t { _launch, }; const char* set_action(action_t action) { switch (action) { case action_t::_launch: return xorstr_("[LAUNCH]"); } } void record(const char* status, const char* action, char* message) ..

Read more

I wanted to simulate timer which would call a function (callback) periodically for that i wrote following snippet (naive though) wherein, Argument deduction is failing at line Timer/<int, int, float>/.. in main function. I am compiling this code with c++17 std. How I can fix this? or those arguments necessary? Any help in this regard ..

Read more

Working on a piece of code that assigns points to student based on a condition. the way it works is vector of type Student. Student is struct that contains a double percentage. the vector is sorted based on the highest percentage. I would like to go through the vector and assign 10 points to first ..

Read more

I’m beginner in parallel programming for GPU. I’m trying to implement a convolutional operation between a 512×512 RGB image size and a 9×9 filter. I got an error: illegal memory access was encountered. Here is my kernel function: __global__ void blurImgKernel(uchar3 * inPixels, int width, int height, float * filter, int filterWidth, uchar3 * outPixels) ..

Read more

I writing a application record voice and I want to put input voice to CMiniportWaveRTStream::WriteBytes in sysvad to the listener can hear instead they hear piippp because in CMiniportWaveRTStream::WriteBytes, function GenerateSine create sin wave: while (ByteDisplacement > 0) { ULONG runWrite = min(ByteDisplacement, m_ulDmaBufferSize – bufferOffset); m_ToneGenerator.GenerateSine(m_pDmaBuffer + bufferOffset, runWrite); bufferOffset = (bufferOffset + runWrite) ..

Read more

After a 2 years break, I’ve started using C++ again, and I’m pretty rusty. I’m trying to implement a 5-coloring algorithm for a graph, but I’m having trouble with vectors. I’ve 3 classes (snippets below). The problem is that somewhere in Graph::Graph(), a copy constructor is called on both vectors (While troubleshooting the Graph::solve() function, ..

Read more