c++

What portable data backends are there which have fast append and random access?

I'm working on a Qt GUI for visualizing 'live' data which is received via a TCP/IP connection. The issue is that the data is arriving rather quickly (a few dozen MB per second) - it's coming in faster than I'm able to visualize it even though I don't do any fancy visualization - I just show the data in a QTableView object. As if that's ...

Situations where "old" C features might be better than newer C++ ones?

Recently i had a discussion with my boss (a long time C developer) who discouraged me in using C++ streams and stick to "good old" printf & friends. Now i can understand why he is saying this and believe me i did not follow his advice. But still this is bugging me - are there things in C that are still better in some cases than newer C+...

How to convert int to QString ?

Hey guys .. Just a simple question .. Is there an QString function which takes and int and outputs its QString form ? ...

Unit tests for std::map

Does anyone know where I can find unit tests that will test std::map? The reason I ask is because I have written a class that acts as a replacment for std::map and has virtually all the same functionality, so unit tests for std::map will be suitable for my class, too. Of course, I can write my own, but if someone has already written ex...

c++ forward declaration of pure virtual class

Hi, I have a forward deceleration problem. I had a normal class before, called GlobalCWND, it was instantiated and used in another class ProtocolContext. I forward declare the ProtocolContext class in Requestor.h. You can see the related part of the code of this 2 classes. ============Protocol Context======== class Requestor<Reques...

C++ How to create a heterogeneous container

I need to store a series of data-points in the form of (name, value), where the value could take different types. I am trying to use a class template for each data-point. Then for each data-point I see, I want to create a new object and push it back into a vector. For each new type, I need to create a new class from the template first...

Install gcc on linux with no root privilege

I have access to computer in a public library and I want to try out some C++ and maybe other code. Problem is that there is no g++ installed and I can't install it using packages because I have no root access. Is there a "smart" way to make a full environment for programming in a home folder? I have gcc installed (I can compile C code)....

Qt moving from LGPL to commercial halfway through

I've never understood this bit about licensing on the Qt website. Qt Commercial Developer License The Qt Commercial Developer License is the correct license to use for the development of proprietary and/or commercial software with Qt where you do not want to share any source code. You must purchase a Qt Commercial De...

QTreeView, QFileSystemModel, setRootPath and QSortFilterProxyModel with RegExp for filtering

I need to show a QTreeView of a specific directory and I want to give the user the possibility to filter the files with a RegExp. As I understand the Qt Documentation I can achieve this with the classes mentioned in the title like this: // Create the Models QFileSystemModel *fileSystemModel = new QFileSystemModel(this); QSortFilterProx...

Cross-platform compatible directory creation in C++

I need to dynamically create directory based on input filenames in C++ and it must be cross-platform compatible. I am also familiar with the boost library. The input to the directory creation function will be a string with the following prototype: void createDirectory (std::string name) Sample code would be much appreciated. ...

About the texture switch in OpenGLES

When the texture is switched, why is the speed slow? Code - 1  glBindTexture(GL_TEXTURE_2D,texId01);  glDrawArray(glDrawArrays(GL_TRIANGLES, 0, 4);  glBindTexture(GL_TEXTURE_2D,texId02);  glDrawArray(glDrawArrays(GL_TRIANGLES, 0, 4); Code - 2  glBindTexture(GL_TEXTURE_2D,texId01);  glDrawArray(GL_TRIANGLES, 0, 4);  glDrawArr...

Usefulness of the "inline" feature

There's two things about inlining: The inline keyword will be ignored if the compiler determines that the function cannot be inlined. There is a compiler optimization (on Visual Studio, I don't know about GCC) that tells the compiler to inline all functions where possible. From this I conclude that I never need to bother about inlini...

How to fill memory fast with a `int32_t` value?

Is there a function (SSEx intrinsics is OK) which will fill the memory with a specified int32_t value? For instance, when this value is equal to 0xAABBCC00 the result memory should look like: AABBCC00AABBCC00AABBCC00AABBCC00AABBCC00 AABBCC00AABBCC00AABBCC00AABBCC00AABBCC00 AABBCC00AABBCC00AABBCC00AABBCC00AABBCC00 AABBCC00AABBCC00AABBCC0...

Will a boost smart pointer help me?

Hi, i am using Xerces to do some xml writing. here's a couple of lines extracted from my code: DOMLSSerializer *serializer = ((DOMImplementationLS*)implementation)->createLSSerializer(); serializer->release(); Is there a boost smart pointer that i can use, so i can avoid calling serializer->release(); as it's not exception safe. The ...

poppack.h wrong?

Hi, i got a Project to go on coding, so its not my code till now and i can´t explain the following warning message in VS2008 compiling my code: Warnung 2 warning C4161: #pragma pack(pop...): Mehr pop- als push-Vorgänge c:\programme\microsoft sdks\windows\v6.0a\include\poppack.h 29 /*++ Copyright (c) Microsoft Corporation. A...

Ambiguous Class Namespace Issue

I... feel really silly asking this, but I'm not sure how to resolve the problem. This is a little snippit of my code (Objective-C++): #include "eq/eq.h" namespace eqOther { class Window : public eq::Window //<-- Error occurs here { public: Window( eq::Pipe* parent ) : eq::Window( parent ) {} void popup(); ...

win32 DialogBox app: how to show text from callback on the DialogBox?

I'm working on a win32 DialogBox based app. This uses DialogBox() to create the dialog box, and has a dialog box procedure which does all the usual things. The dialog box has some static text controls on it, and generally I'm showing text in these via SendDlgItemMessage() from within the dialog box procedure. However at one point the ...

Determine if Linux or Windows in C++

I am writing a cross-platform compatible function in C++ that creates directories based on input filenames. I need to know if the machine is Linux or windows and use the appropriate forward or back slash. For the following code below, if the machine is Linux then isLinux = true. How do I determine the OS? bool isLinux; std::string sla...

Compare unsigned char = 0x00 and signed char = '00'

How do i compare the following: unsigned char a = 0x00; char b = '0'; // signed char how do i write a comparison/conversion that matches a and b? thanks! ...

How to do Gtk TextIter arithmetic.

I am attempting to use Gtk TextIter objects to lift three-character slices out of a TextBuffer, but am having trouble with the arithmetic. I set up an iterator p to point to the start of the range and want q to point to three characters further on. I have tried... q = p + 3; // Doesn't compile q = p; q += 3; // Do...