Scenario: I have the following defined classes.
class Baseclass { };
class DerivedTypeA : public Baseclass { };
class DerivedTypeB : public Baseclass { };
// ... and so on ...
class Container
{
list<Baseclass*> stuff;
list<DerivedTypeA*> specific_stuff;
// ... initializing constructors and so on ...
public:
void add(Basecla...
Hi;
I have a C static library with,
A callback definition:
typedef void (*HandleEvents) (enum events eventID, int msgSize, char *msg);
A function in the library:
int init(HandleEvents _handleEvents)
And another C++ GUI developed in VS. which links this static lib and calls init function of the lib giving a function pointer.
ini...
Imagine you have a class with dozens of private member variables. Each member variable has a public getter and a setter function:
class Foo
{
public:
int GetA() const { return m_a; }
:
int GetZ() const { return m_z; }
void SetA(int val) { m_a = val; }
:
void SetZ(int val) { m_z = val; }
private:
int m_a;...
In Windows Vista SP2 and in Windows 7 there is a new item in the Start menu: Undock computer.
In respons to the DBT_QUERYCHANGECONFIG event I return BROADCAST_QUERY_DENY but the undocking function proceeds anyway. What is wrong?
Thanks in advance,
Lars
A simple WindowProc to illustrate the problem:
LRESULT CMainWindow::WindowProc(UIN...
I have a singleton that is the main engine container for my game.
I have several abstract classes that make the developer implement the different calls to what that specific object needs.
What I want to do is to make my singleton call those methods upon each given object, but avoiding unecessary calls.
Example so you can understand bet...
We need to develop an application which is going to be installed on Virtual Machine running Windows.
We all know the performance of the .Net is about the same as the native C/C++ code. Is it also true for Virtual Machines?
...
Basically, given a template class like this:
template< class Value > class Holder { };
I would like to be able to discover the type Value for a given Holder class. I thought that I would be able to make a simple metafunction that takes a template template argument, like this:
template< template< class Value > class Holder > class Ge...
Hi, this is a really simple question but I havn't done c++ properly for years and so I'm a little baffled by this. Also, it's not the easiest thing (for me at least) to look up on the internet, not for trying.
Why doesn't this use the new keyboard and how does it work?
Basically, what's going on here?
CPlayer newPlayer = CPlayer(posi...
I noticed that in visual studio (2005) you can right click and generate class diagram, however in C++ mode this option is not available.
How can I generate class diagram from C++ ?
I have a large C++ project and am looking for a tool to accomplish this task.
Are there any free tools to do it?
...
I've been writing a custom std::streambuf as part of a logging system. However, I'm having problems with the first piece of output from a stream not being formatted correctly.
Here's a reduced test-case that doesn't use any custom streambuf or ostream classes:
#include <iostream>
int main()
{
std::streambuf *coutbuf = std::cout.rd...
Not a terribly good question, sorry.
I have a program that needs to be alerted when a file is opened from explorer (i.e. ShellExecute(A/W) is called).
Unfortunately, Microsoft removed the COM interface (IShellExecuteHook) that allows you to hook these events in Vista and up, supposedly because older code could cause a crash due to chan...
I'm trying to convert the string produced from the __DATE__ macro into a time_t. I don't need a full-blown date/time parser, something that only handles the format of the __DATE__ macro would be great.
A preprocessor method would be nifty, but a function would work just as well. If it's relevant, I'm using MSVC.
...
I would like to add an unusual feature to a website that would allow the user to play a sound...a single sampled note. When the user moves a slider control the sound would go up or down in tone (seamlessly). So, as the user slides the button to the right the sound would rise in pitch, when moved to the left it would go down in pitch (fro...
My company uses an internally developed package to support internationalization/localization. However, it was developed some twenty years ago, and the libraries are restricted to one product line. I'm interested in where the state of the art stands. Is Unicode the base character set for all international efforts today? Do people still us...
Possible Duplicate:
Whats the right way to overload operator== for a class hierarchy?
In C++, how can derived classes override the base class equality test in a meaningful way?
For example, say I have a base class A. Classes B and C derive from A. Now given two pointers to two A objects, can I test if they are equal (including ...
Hey,
I know that you are supposed to use 0 instead of NULL in c++ (even though NULL is defined as 0 in c++ most of the time). Recently I came across some code where "0x0" was used instead though. What is the difference?
Thank you!
...
Is it possible to use fcntl() system call on a file to achieve thread/process synchronization (instead of semaphoress)?
...
I like C++ a lot and to be honest the Objective-C "super set" of C is more of a "super fail". Can an iPhone application be written in pure C++? Are there parts of the API that are unavailable from C++?
...
In C++, is it possible to define a sort order for pointers to member functions? It seems that the operator< is undefined. Also, it's illegal to cast to void*.
class A
{
public:
void Test1(){}
void Test2(){}
};
int main()
{
void (A::* const one)() = &A::Test1;
void (A::* const two)() = &A::Test2;
boo...
Hello, I have seen other people questions but found none that applied to what I'm trying to achieve here.
I'm trying to sort Entities via my EntityManager class using std::sort and a std::vector<Entity *>
/*Entity.h*/
class Entity
{
public:
float x,y;
};
struct compareByX{
bool operator()(const GameEntity &a, const GameEntity &b)
{...