C++ on Stack Overflow and Game Dev

2 answers

Implementing progress visualization in C++

Let's say I have a computationally intensive algorithm running. For example, let's say it's a routing algorithm, and on window running on a separate thread, I want to show the user what routes are ...

1 answer

How the compiler know that which overload of std::forward function has to be called?

The following signatures are declared as std::forward overloads: template<class T> T&& forward(typename remove_reference<T>::type& arg) noexcept; template<class T> ...

2 answers

Loading specific files from arbitrary directories?

I want to load foo.txt. foo.txt might exist in the data/bar/ directory, or it might exist in the data/New Folder/ directory. There might be a different foo.txt in both of these directories, in which …

2 answers | 4 mins ago by Haydn V. Harach on Stack Overflow stackoverflow.com
0 answers

Extract diagonal elements (like spdiags in matlab)

I want to implement ,as possible , spdiags function in c . Having as input matrix: inMx = 1 0 0 4 5 6 0 7 9 you should obtain (running that using spdiags in matlab) : …

0 answers

libxml2 namespace prefix for schemaLocation is not defined

Few days ago I started to learn libxml2 for parsing xml documents on Linux (Ubuntu 14.04). But unfortunately I have a lot of problems with it. First, I have an error message when I use function ...

1 answer

Cocos2d-x how do i dispatch N node actions animation with delay between them

Basically i want to be able to dispatch movement animation of N number of sprites the first one is at the start the second is 10 px behind him and the third sprite 10px behind the second. and so on .. …

0 answers

How to change icon using delegate in Qt

I am using a delegate in a Qtreeview which just shows an icon next to the text : What I would like to be able to do is click on one of the items from the list and change the icon of just that one …

1 answer

Implementing realloc in CUDA without moving data

According to this question and reference NVIDIA CUDA Programming Guide the realloc function is not implemented: The CUDA in-kernel malloc() function allocates at least size bytes from the device …

1 answers | 9 mins ago by Grzegorz Szpetkowski on Stack Overflow stackoverflow.com
1 answer

C++ Should I avoid operator overloading with dynamic allocation if I cant throw exceptions?

Should I avoid operator overloading with dynamic allocation if my spec says I shouldn't throw exceptions? I have a class similar to vector that is primarily a dynamically sized array. I am writing it …

0 answers

Problems with QProcess: text editor focus + receive, send and get commands + use custom class from parent process

I have an window, tabs as central widget in window, and embed containers in each tab ( content ).My code:Parent process:main.cpp: #include "main.hpp" int main ( int argc, char * argv [] ) { ...

3 answers

C++ destructor called on array index? Crash on non-thread-safe ref-counting objects

The following code (from Apache Tuscany SDO C++) occasionally (actually very rarely) causes subsequent crashes and I don't understand what's going on. The following statement is in DataObjectImpl.cpp …

3 answers

Why is the size of this struct 24?

I have a structure of which I want to calculate its size: #pragma pack(push,4) struct MyStruct { uint32_t i1; /* size=4, offset=0. */ uint32_t i2; /* size =4 offset =4 */ ...

4 answers

Get intermediate color from a gradient

Say I have a liner gradient as shown: QLinearGradient linearGrad(QPointF(0, 0), QPointF(0, 100)); linearGrad.setColorAt(1, Qt::red); linearGrad.setColorAt(0.5, Qt::yellow); linearGrad.setColorAt(0, …

1 answer

Choose a TCP port on a Windows machine, add a firewall exception if necessary (programmatically)?

Thank you for reading my post. Can you help me interpret what the following line from "netstat -anb" means: Proto Local Address Foreign Address State TCP …

0 answers

QML application

My program has two modes GUI(on qml) and no GUI(command line).What code I must write for changing mode by passing argument in cmd for example if I pass nameofapp.exe -no-gui must be work no-gui ...

0 answers

Factory Pattern: typedef Class *(createClassFunction)(void)

What does typedef Class *(createClassFunction)(void) (or another variation is typedef Class* (__stdcall *CreateClassFunction)(void))stand for? What does it mean? How am I supposed to explain it? ...

2 answers

Variadic template of variadic template class

I am trying to create a function named Choose which can take the following as arguments: template<typename... Args> class Option { Option(Args... arguments) { // irrelevant …

3 answers

c++ float subtraction rounding error

I have a float value between 0 and 1. I need to convert it with -120 to 80. To do this, first I multiply with 200 after 120 subtract. When subtract is made I had rounding error. Let's look my ...

2 answers

Visual Studio 2012: 'opencv2/opencv.hpp' : No such file or directory (C1083)

This question was asked several times, there are some answers, but this problem is more specific, the additional directories path is set correctly (files are found). Nevertheless building my project …

2 answers

Will concepts lite change the need of CRTP to achieve static polymorphism?

Since I have discovered CRTP some years ago, I use it in many places to achieve compile-time polymorphism for very intensive computing oriented codes. It's great to "inject" member functions into ...

1 answer

How to use a struct as an operand of a conditional?

I have a simple struct in C++11 struct a { int a; int b; int c; .... } I would like to use this struct as if it is an scalar type itself, so I overloaded all operators. One ...

2 answers

Are C++ concepts a form of existential type?

I was looking at the definition of existential types on Wikipedia (Existential_types) and it feels similar in some way to concepts in C++ (particularly to concepts lite). Are C++ concepts a form of …

0 answers

javascript websocket connect to QWebSocketServer failed

I'm using QWebSocketServer to provide communication with javascript websocket. The code is very similar with EchoServer in Qt Examples. javascript side code is listed as following: <!DOCTYPE ...

0 answers

Specifying a concept for a type that has a member function template using Concepts Lite

I'm trying to specify a concept to constrain a higher kinded type that has a member function template using Concepts Lite. However I am not able to find inside the technical specification or the ...

0 answers

Strange compiler messages when using lambdas in C++

So I've added the use of lambdas in a C++ project and now the compiler is giving output like this: 3> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxfunction(386) : see …

0 answers

HDR de ghosting in opencv

I am working on an application to create tonemapped images from several LDR images with different exposure time. I found several documents and source code to do tonempping, but it could not find any …

2 answers

How can we express Concept in UML diagram?

Does UML Class Diagram support expressing Concept? Also, is there any other diagrams that expresses Concept? Just in case of misunderstanding, I mean the "Concept" in C++ and generic programming.

2 answers | 39 mins ago by Nicky C on Stack Overflow stackoverflow.com
1 answer

Decode compressed frame to memory using LibAV: avcodec_decode_video2?

I am completely new to libAV. I have a single video frame coming from somewhere else (it's in memory, not in a file). It should be H.264 encoded keyframe. I'm trying to decode with ...

1 answers | 40 mins ago by Micka on Stack Overflow stackoverflow.com
2 answers

How to open a url from a c++ program in windows?

I want my c++ code to open a url.However all the threads online promote using ShellExecute with an already specified url. My code requires the user to input the url and the program must then open it …

0 answers

Linux C++ userspace app real time sleep function (POSIX, Raspberry Pi)

I need a function which suspends my program in µs, it should be real time, so if I call it with 50µs the thread should stop for exactly 50µs. My C++ program is running on a Raspberry Pi with normal …

15 30 50 per page
1 2 3