My question is best illustrated with a code sample, so let's just start off with that:
class Game
{
// All this vector does is establish ownership over the Card objects
// It is initialized with data when Game is created and then is never
// changed.
vector<shared_ptr<Card> > m_cards;
// And then we have a bunch of ...
I saw IsInRole method but I can't find information on how to use it with C++.
...
GCC has a very verbose format for certain template error messages:
... some_class<A,B,C> [with int A = 1, int B = 2, int C = 3]
Any chance to make it show something like:
... some_class<1,2,3>
...
I have a project for which optimization has been set to "-Os" for all files via gcc command line flags. However, I want to disable optimization for some methods in one of the source files. To accomplish that, I am trying to specify the optimization attribute for those methods. However, gcc says that it is ignoring optimize attribute duri...
Given an instance of an ActiveX control, how do I enumerate it's interfaces? (I'd like to get the names of the interfaces).
...
I got a structure like this:
struct bar {
char x;
char *y;
};
I can assume that on a 32 bit system, that padding for char will make it 4 bytes total, and a pointer in 32 bit is 4, so the total size will be 8 right?
I know it's all implementation specific, but I think if it's within 1-4, it should be padded to 4, within 5-8 to...
I am using Poco C++ libraries for accessing the database. Following is a query from the Poco::Data docs
ses << "INSERT INTO FORENAME VALUES(:name)", use(aName), now;
Given an SQL select query if it returns no tuples how do I detect that? Is there a flag which is set by the data base?
...
I have a main server and 4 computers connected. How can I learn which computer use how much cpu and disk.
I write code Qt and c++
Thans a lot.
...
I have dates in a bunch of formats.
Now i would like to have a function (from some library) in c++ that can parse these date/time string and give me some structure like a tm or convert them to some deterministic representation so that i can play around with the date/time.
Some formats that I see are as follows :
Tue, 19 Feb 2008 20:47:...
Hi, I have to create a simple application that displays an icon in the systray and a menu from which you can do some operations.
the problem is that statusicon is closed immediately after creation. What's missing?
I put the sleep to make sure it was created. for 3 seconds something appears in systray, even if it is not the icon that I se...
Hi,
I'm developing Qt/C++ application and I need simple function that retrive me User idle time in seconds on Mac OS X.
I found this code for detection User idle time.
#include <IOKit/IOKitLib.h>
/**
Returns the number of seconds the machine has been idle or -1 if an error occurs.
The code is compatible with Tiger/10.4 and later (b...
EDITED BELOW FOR UPDATES!!!
Thank you for the help, please by all means point out ALL mistakes , I don't care if it sounds rude or mean or whatever, emo junk. Just give it to me straight so I can understand what is going wrong.
Hi everyone!
I am a rookie C++ programmer trying to learn and gain some IRL exp for C++.
I am attempting the...
If I have a std::vector of objects containing a rotated / translates matrix, is there a way I can use that matrix to calculate a Z position so that I can sort the objects by depth?
...
i have a window service program and i need to start another executable from it ,but non of the functions are executed in SvcMain. I searched for the solution but found somewhere written that the initialization should be completed in less than one second or else it wont execute so was the failure of my createprocess
they say for this to...
In C++ is there a way to unconditionally kill a process?
No matter what state this process is in.
I know about TerminateProcess, but it can still fail. What if you don't want it to fail.
Like when you kill a process in Task Manager, it dies; no matter what. That's the kind of killing I'm looking for.
...
Hi guys,
It’s all the day that I’m trying to make this code working. It should be the same code presented in the QScript help page but unfortunately it doesn’t work at all!
class Person
{
public:
QString nm;
Person()
{
}
Person(QString& name)
:nm(name)
{
}
};
Q_DECLARE_METATYPE(Person)
Q_DECLARE_METATYPE(Person*)
QScriptV...
I have implemented signals for mousePressEvent() in a QGraphicsScene subclass, but I can't figure out how to use the class in a UI. I can add a QGraphicsView widget to my UI, but how do I then access the scene?
GraphicsScene *scene = new QGraphicsScene(this);
// Add pixmap, etc
ui->graphicsView->setScene(scene);
// Here's where I'm stuc...
I have an application X which uses shared libraries A,B and C. Shared library C also uses some symbols from Shared library A. Application X is linked against A and B during compile time and it does dlopen to load C at run time.
My question is
Is it a good idea to link C against A during link time or leave the symbol resolution for run...
I can deal with only the easiest case, when there are only 2 modules A and B
A is dependant on B, so I build B as a library and include B's header file in A, also link to B library when building A.
This won't work when A and B are inter-dependant, and even worse when the number of modules grow ..
So what's the general way to carry out...
I have two classes. One is a management class, which stores a bunch of worker classes. The workers are actually a templated class.
#include "worker.h"
class Management {
private:
worker<type1> worker1;
worker<type2> worker2;
...
};
The problem arises due to the fact that the templated classes needs to u...