Hi,
I'm using the STL map data structure, and at the moment my code first invokes find(): if the key was not previously in the map, it calls insert() it, otherwise it does nothing.
map<Foo*, string>::iterator it;
it = my_map.find(foo_obj); // 1st lookup
if(it == my_map.end()){
my_map[foo_obj] = "some value"; // 2nd lookup
}else{
...
I am doing work on project. In which I have developed a full size screen displaying images using XCreateWindow. Now I want to display a dialog on this screen. I have created a QDialog it does'nt show on the full size screen but it is displayed on screen when it is not full size. Any Help. My code for creating screen and dialogbox is as f...
In a quest for handling events (like mouse moves and clicks) not by subclassing, one has to use installEventFilter and provide an event handler. While doing so, I've encountered a problem with RTTI support, meaning that typeid().name() gives QObject * all the time, no matter on which object event was triggered. There is, of course, anoth...
Core problem:
I want to be able to take an instance of a templated class, say:
template<class a, class b, class c> class foo;
foo<int, float, double>;
and then do something like:
foo<int, float, double>::value; //Evaluates to a unique number
foo<long, float, double>::value; //Evaluates to a different unique number
foo<int, float, d...
Hi,
I have 10 processes running, each writing to the same file. I don't want multiple writers, so basically I am looking for a mutex/binary semaphore to protect file writes. The problem is I can't share the semaphore amongst 10 processes, so I am looking at using shared memory between 10 processes, and putting the semaphore inside share...
Hi,
I once saw a programming pattern (not design), how to implement a fast copy of buffers. It included an interleaved loop and switch. The thing was, it copied 4 bytes most of the time, only the last few bytes of the buffer were copied using smaller datatypes.
Can someone tell me the name of it? It's named after a person. It's done in...
Hi,
I'm working on porting a windows-only application to Linux, and eventually to Mac OSX. Part of this program is a remote-desktop-like feature - you can share a desktop space with several clients. The network protocol is very similar to the RDP protocol. The original author wrote everything from scratch. It works very well, but large ...
If C++, if I write:
int i = 0;
int& r = i;
then are i and r exactly equivalent?
...
Hi,
What is runtime type control in C++?
P.Gopalakrishnan.
...
I want to develop a small tool which for open XML file and launch Excel automatically.
The benefit for user who could save the excel file to .xls format very conveniently.
My Dev IDE: Windows XP pro & Visual Studio 2005.
The tool will running at Windows 2000 & Excel 2000. and there is no .net framework installed.
That means i can't c...
I have a main thread that invokes a child thread function at different times but I am not sure whether that is right way of doing it in Qt.What is wrong with the below code and looking for better alternative
There is a main thread running infinitly when ever main thread releases the lock child does a piece of work.
#include <QtCore/QC...
I want to add values to combobox in C++ builder 6.
I know I can add string to combobox by string list editor.
For example, I have added this list to combobox:
car
ball
apple
bird
I want behind each text, it has their own value, so I can get the value rahter than the text when user selected a text. Just like HTML select.
But when I t...
Imagine the following:
you read in a string with scanf() but you only need a few of the datapoints in the string.
Is there an easy way to throw away the extraneous information, without losing the ability to check if the appropriate data is there so you can still reject malformed strings easily?
example:
const char* store = "Get: 15 b...
I've started using C++ exceptions in a uniform manner, and now I'd like the compiler (g++) to check that there are no "exception leaks". The throw decoration should do this, like const does for constness of class methods.
Well, it doesn't.
Using throw is still documentary, but may even be dangerously misleading if others think a functi...
I am maintaining an OpenGL port of a computer game classic (Descent). It controls sound via SDL_mixer. On Windows 7 the following problem has appeared: Whenever the midi volume is changed, the overall sound volume changes as well. This was not the case on Windows XP. Is there a way to decouple the sound volume from the midi volume, be it...
As title says, the meaning of both eludes me.
...
We use Rendezvous to send information from one thread to another in the same process. It seems that we drop a few messages per session (hundreds of thousands or millions of messages). I could not find any obvious fault in our own code, so I am asking the community: Rendezvous is not a guaranteed delivery service (unless you specify that ...
I'm looking for a way to wait for multiple condition variables.
ie. something like:
boost::condition_variable cond1;
boost::condition_variable cond2;
void wait_for_data_to_process()
{
boost::unique_lock<boost::mutex> lock(mut);
wait_any(lock, cond1, cond2); //boost only provides cond1.wait(lock);
process_data();
}
...
Consider this bit of code:
LARGE_INTEGER l;
size_t s;
if (s < l.QuadPart) return 1;
return 0;
When this is compiled under x64 it generates the C4018 signed/unsigned mismatch compiler warning (Ignore the uninitialized local variable warning).
The warning is fine, since QuadPart is LONGLONG which is signed and size_t is unsigned.
But ...
I'm maintaining a tool which can convert ELF32 relocatables to RDOFF2 format.
For this process to work I need to pre-link the input files currently using the ld-script shown below:
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
FORCE_COMMON_ALLOCATION
SECTIONS {
.text : {
/* collect .init / .f...