c++

What thing hash_map stores as keys?

Hi all, I have an infinite streams of numbers coming and I have to detect the first duplicate element. I think of using hash table for the above problem i.e whenever a number arrives, check whether it is already there in the hash table or not. In case it has, stop otherwise add that number to hash table. Now my question is does hash tab...

Building xalana 1.11 using ICU - Mac

Hi Everybody, Has anybody compiled xalan 1.11 using ICU? I am building it using ICU and its generating one library called libxalanMsg.111.0.dylib and its being generated using the below mentioned steps ============ /tmp/brijesh/ICU//bin/genrb -p xalanMsg -d ../../../nls/icu-i ../../../nls/icu ../../../nls/icu/en_US.txt echo ../....

Duplicate literals and hard-coding.

I see the follow pattern occurring quite frequently: b->last = ngx_cpymem(b->last, "</pre><hr>", sizeof("</pre><hr>") - 1); Notice that the literal string is used twice. The extract is from the nginx source-base. The compiler should be able to merge these literals when it is encountered within the compilation unit. My questions a...

IPv6 Zone index and scope_id

How does the zone index relate to the scope_id in the sockaddr_in6 structure? The functionality appears to differ between platforms and I'd love to know how they relate. Windows for example has a SCOPE_ID structure (as well as just a 32-bit value). Mac OSX only has a 32-bit value. Obviously the 32-bit value is the way to go but how e...

_bstr_t to char pointer and calling atof(...)

Is this code not going to produce an error: _bstr_t text=n.GetText(); atof((char*)text) Where text is a double value. I know that the _bstr_t produces a const char* in the conversion; so I'm not sure if the atof() is going to work? ...

C++ tree of pointers template question

I've just come across a nice STL-like tree container class written by Kasper Peeters: http://tree.phi-sci.com/ However, because it's STL-like, it's geared towards having a single class type in the tree; i.e. template <class T>. The trouble is, like STL-lists, if it suffers from the polymorphic class problem, in that the objects in the...

Understanding template classes in c++ - problem with new-operator

Dear all, I've been stuck with this problem now for a few days and my searches were not successful. What I am trying to do: I want a template reader class (VariableReader) to handle different types of variables (usually unsigned int and pointers to vector). I started with #ifndef READER_H_ #define READER_H_ #include <string> namespa...

Iterating over 2-dimensional STL vector c++

I'm currently trying to print out a history of movements for players in a game I am working on. At the end of each round every player has moved some amount in the positive or negative direction and this gets recorded as an int in the movement vector. Eventually I'm wanting to plot the directions moved vs time for each player but I'm havi...

Where to download all needed OpenGL libraries, includes and compiled dll's to make up-to-date games?

Is there any packages for this purpose, one download link? Edit: got VBO working now, so this question is useless for me atm, i can accept answers though if there ever comes one. ...

question about 128 bit number

can i represent 128 bit number in java? or in c++? ...

[Qt/Maemo5/N900] QMaemoListPickSelector not showing anything ..

Alright I tried using a QMaemo5ListPickSelector together with a QMaemo5ValueButton, but when I click on the button, a popup dialog box does come up, but it doesnt any list .. Here is a picture of what I mean: This is the code I'm using to start up the above mentioned two components and to populate the lists: QMaemo5ValueButton *x = ...

casting pointers

Hello, I'm using ptr_map for storing different types of pointers. boost::ptr_map<string, any> someMap; I store there some templated class objects: someMap.insert("1", new SomeClass<int>()); someMap.insert("2", new SomeClass<float>()); Now I want to get values from map. Here is a sample with references: template<typename T> T &get(...

How can i optimize this dijkstra structure code?

This is the dijkstra structure i am using :(however the MAXV(which is maximum number of vertices is maximum at 500 and every time i try to change it to something more than this it generates and error when running ) -I want to use this way to represent a graph with 10000 vertices, does anyone know how to optimize it ? #include<iostream>...

MessageInterceptor object

MessageInterceptor object is available in c#....can anone tell me how can i use it in c++....or any equivalent object in c++ thanks ...

sizeof(blank class) == 1. why???

Possible Duplicate: C++: What is the size of an object of an empty class? #include <iostream> class C { }; int main() { std::cout << sizeof(C) << std::endl; return 0; } output: 1 Why 1, but not zero ? ...

Static class variable--use with constructors

Hi all, I have a class with a static variable: null. static Pointer<Value> Null; Pointer is a class which uses reference count memory management. However, I get an error: no matching function for call to Pointer::Pointer() On the line: Pointer<Value> Value::Null(new Value()); Thanks. Excerpt of Pointer class: template <typenam...

Multi-Threading on multi core architecture

When you have a situation where Thread A reads some global variable and Thread B writes to the same variable, now unless read/write is not atomic on a single core, you can do it without synchronizing, however what happens when running on a multi-core machine? ...

Borland Warning 8092

Regarding the following C++ code, LengthAlphabeticalSort lengthAlphabeticalSort; outputList.sort(lengthAlphabeticalSort); // causes borland 8092 error, guaranteed stable_sort. class LengthAlphabeticalSort { public: bool operator() (std::string str1, std::string str2) { if(str1.length() < str2.length()) ...

how to get message of catch-all exception

If I want to write useful info to a file whenever i caught a catch-all exception, how to do it? try { //call dll from other company } catch(...) { //how to write info to file here??????? } ...

how to catch exception in C# which call a C++ dll

My C# called a method from a C++ dll, after the call returned, my application just gone without any message. want to add try catch to get the reason. how can I do it. Just a try-catch in the method call? EDIT: the [HandledProcessCorruptedStateExceptions] is not belong to C#? ...