c++

dot asterisk operator in c++

is there, and if, what it does? .* ...

C++ programming for clusters and HPC

I need to write a scientific application in C++ doing a lot of computations and using a lot of memory. I have part of the job but due to high requirements in terms of resources I was thinking to start moving to OpenMPI. Before doing that I have a simple curiosity: If I understood the principle of OpenMPI correctly it is the developer t...

C++: String and unions

I'm having a (design) problem: I'm building an interpreter and I need some storage for variables. There are basically two types of content a variable here can have: string or int. I'm using a simple class for the variables, all variables are then stored in a vector. However, as a variable can hold a number or a string, I don't want C++...

0 not a valid FILE* when provided as a template argument

The following code #include <stdio.h> template <typename T, T v> class Tem { T t; Tem() { t = v; } }; typedef Tem<FILE*,NULL> TemFile; when compiled in a .mm file (Objective C++) by Xcode on MacOS X, throws the following error: error: could not convert template argument '0' to 'FILE*'. What's going on, pleas...

Iterating backward

Suppose I have a vector<int> myvec and I want to loop through all of the elements in reverse. I can think of a few ways of doing this: for (vector<int>::iterator it = myvec.end() - 1; it >= myvec.begin(); --it) { // do stuff here } for (vector<int>::reverse_iterator rit = myvec.rbegin(); rit != myvec.rend(); ++rit) { // do stuf...

Is there any Graph Builder for GStreamer?

Is there any Graph Builder for GStreamer? So to say you build graph you get code ...

How to launch a browser with a given URL within the same tab

Here is some code to launch S60 browser with a given url. // use the StartDocument api param->Des().Format( _L( "4 %S" ),&aUrl ); TUid id( TUid::Uid( browserUid ) ); TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); TApaTask task = taskList.FindApp( id ); if ( task.Exists() ) { HBufC8* param8 = HBufC8::NewL( pa...

Finding a MIME type for a file on windows

Is there a way to get a file's MIME type using some system call on Windows? I'm writing an IIS extension in C++, so it must be callable from C++, and I do have access to IIS if there is some functionality exposed. Obviously, IIS itself must be able to do this, but my googling has been unable to find out how. I did find this .net relat...

How to avoid namespace content indentation in vim?

How to set vim to not indent namespace content in C++? namespace < identifier > { < statement_list > // Unwanted indentation } Surprisingly, 'cinoptions' doesn't provide a way to edit namespace content indentation. ...

Sample the deltas between values using boost::accumulators

I have a data set with N samples (say, 13, 16, 17, 20) where each next sample is incremented by some value (3, 1, 3 in this case) and I want to find various statistics of the second sequence . Samples are timestamps that are collected incrementally (i.e. not all samples are available at once), hence I want to use boost::accumulators::ac...

Qt Stylesheets with derived classes

Can I use Qt stylesheets with a derived widget? I'd like to be able to define some custom properties on the widget (like various colors) and be able to define their value in a stylesheet. Is this possible? ...

C++ Memory Allocation & Linked List Implementation

I'm writing software to simulate the "first-fit" memory allocation schema. Basically, I allocate a large X megabyte chunk of memory and subdivide it into blocks when chunks are requested according to the schema. I'm using a linked list called "node" as a header for each block of memory (so that we can find the next block without tediou...

boost pool_alloc

Why is the boost::fast_pool_allocator built on top of a singleton pool, and not a separate pool per allocator instance? Or to put it another way, why only provide that, and not the option of having a pool per allocator? Would having that be a bad idea? I have a class that internally uses about 10 different boost::unordered_map types. If...

Is there any g++ option to dump class layout and vtables?

Hi I want to see how g++ lays out memory for classes and virtual tables. Is there a way to dump this information, using g++'s options? Thanks ...

Setting up boost filesystem

I've been having serious problems trying to set up boost. I must have installed and uninstalled the libraries a dozen times. In my most recent attempt, I followed these instructions: Download the zip and unzip it. Get the prebuilt jam executable and unzip it. Put that directory in your path. (Edit Path by using Control Panel...System.....

Boost C++ Singleton error LNK2001: unresolved external symbol "private: static long Nsp::HL::flag" (?flag@HL@Nsp@@0JA)

I try to create a multi-threaded singleton pattern class. Header: class HL{ public: static HL* getInstance(); ......... private: static HL* instance; static boost::once_flag flag; HL(); static void initOnce(); } CPP: HL* HL::instance = NULL; HL* HL::getInstance(){ if(instance...

C++ instantiating a class within a method, then altering member variables from a different method?

Say I have a method, and within that method it instantiates a Person class: void methodA() { Person personObject; } How would I access that object's methods from within another method? I.e. something like: void methodB() { personObject.someMethod(); } I realise it's a painfully nooby question :P ...

how to get AutoIncrement value after JetUpdate() in Extensible Storage Engine (JetBlue)

after calling JetSetColumns() and then JetUpdate() how do I retrieve the values for any freshly assigned autoincrement values? ...

How do interpreters functions written in the class C++ in the main

Hi I'm working on a project about Data structures. In the first , I wrote everything in main but it sounds like C . But as I learned, I tried to thinkk OOP and do as little as possible in my main() methods. I've implemented some opertation in my class like add,delet,find.it's too easy to implement its . class ARB { private: ...

Good Package for Fitting Polynomial Trend Lines

Given a simple data set, I would like to be able to calculate a trending formula given it's a second order polynomial regression. In fact, it would be great if one could even forecast X periods during calculation (similar to what Excel does). I'm looking for a portable C/C++ package that's relatively easy to use, and allows it to spit ...