Given an example class:
class Fred
{
public:
Fred()
{
func = &Fred::fa;
}
void run()
{
int foo, bar;
*func(foo,bar);
}
double fa(int x, int y);
double fb(int x, int y);
private:
double (Fred::*func)(int x, int y);
};
I get a compiler error at the line calling the member function through the pointer "*func(foo,bar)", ...
I tried calling an overridden method from a constructor of a parent class and noticed different behavior across languages.
C++ - echoes A.foo()
class A{
public:
A(){foo();}
virtual void foo(){cout<<"A.foo()";}
};
class B : public A{
public:
B(){}
void foo(){cout<<"B.foo()";}
};
int main(){
B *b = new B()...
Hello,
I have a python project that calls a c++ wrapper dll that calls a c# com interop dll.
In my computer, with all frameworks and programs installed, my project runs very well.
But in a computer that just got formatted it doesn't.
I allready installed c++ 2008 redistribute and the c++ part is working but when I call a function from ...
I have the command language part sorted out, I'm looking for good sample on how to build a custom console in Cocoa. Need features like copy/paste, command stack, ctrl-z processsing etc. Thanks in advance.
...
I have got 2 cpp files & a header file, which I have included in both cpp files. It's like this:
abc.h
extern uint32_t key;
a.cpp
#include "abc.h"
uint32_t key;
int main
{
.............
}
b.cpp
#include "abc.h"
int main
{
printf("Key: %.8x\n", key);
.............
}
Now when I compile a.cpp, there is no error. but when i compi...
Hello.
I am developing functional domain specific embedded language within C++ to translate formulas into working code as concisely and accurately as possible.
I posted a prototype in the comments, it is about two hundred lines long.
Right now my language looks something like this (well, actually is going to look like):
// implies tw...
I am running a BHO and i am trying to catch OnClick events using HTMLDocumentEvents2
however, the events never seem to reach the handler
this is what i am doing:
class ATL_NO_VTABLE CBlastBhoBHO :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CBlastBhoBHO, &CLSID_BlastBhoBHO>,
public IObjectWithSiteImpl<CBlas...
I looked all over the internet and there doesn't seem to be a decent solution that I could find. I want to be able to programmatically in C++ obtain the path "%ALLUSERSPROFILE%\Application Data" that explorer can translate into a real path.
Can I do this without relying on third-party code?
...
I've been tasked (coursework @ university) to implement a form of path-finding. Now, in-spec, I could just implement a brute force, since there's a limit on the number of nodes to search (begin, two in the middle, end), but I want to re-use this code and came to implement Dijkstra's algorithm.
I've seen the pseudo on Wikipedia and a fri...
I am using this sample to decode/encode some data I am retrieving/sending from/to a web server, and I want to use it like this:
BOOL HandleMessage(UINT uMsg,WPARAM wParam,LPARAM lParam,LRESULT* r)
{
if(uMsg == WM_DESTROY)
{
PostQuitMessage(0);
return TRUE;
}
else if(uMsg == WM_CREATE)
{
// Start timer
StartTime...
Hi everyone,
I'm working on a simulation in Qt (C++), and would like to make use of a Semaphore wrapper class I made for the sem_t type.
Although I am including semaphore.h in my wrapper class, running qmake provides the following error:
'sem_t does not name a type'
I believe this is a library/linking error, since I can compile the c...
Hi. I'm writing a game in C++, and I'm trying to get it to recognize keyboard and mouse events. Google tells me that boost.signal is suitable for event handling, but none of the code samples or tutorials I've found tell me how to associate a keypress or mouseclick with a function. Can anyone shed any light on this?
...
I am trying to capture screenshots using the BitBlt function. However, every single time I capture a screenshot, the non-client area NEVER changes no matter what I do. It's as if it's getting some cached copy of it. The client area is captured correctly.
If I close and then re-open the window, and take a screenshot, the non-client area ...
I'm using the Chromium port of WebKit on Windows and I'm trying to retrieve a list of all of the images in my document. I figured the best way to do this was to implement WebKit::WebFrameClient::didFinishLoading like so:
WebNodeList list = document->getElementsByTagName(L"img");
for (size_t i = 0; i < list.length(); ++i) {
// Manipul...
I have a Visual Studio 2008 C++ application where I would like to treat a stream as a set of iterators.
For example, if I were to receive an array of WIN32_FIND_DATA structures over the stream, I would like to be able to do something like this:
IStreamBuf< WIN32_FIND_DATA > sb( stream );
std::vector< WIN32_FIND_DATA > buffer;
std::copy...
Ok so I am learning C++ slowly. I am familiar with all the console syntax and everything, but now I'm moving on to windows programming. Now what im trying to do, is create a DLL that I inject into a process, so it's hooked in. All I want the C++ application to do, is have text in it, that says "Hooked" if it's successfully injected, and ...
So I have a series of global functions, say:
foo_f1(int a, int b, char *c);
foo_f2(int a);
foo_f3(char *a);
I want to make a C++ wrapper around these, something like:
MyFoo::f1(int a, int b, char* c);
MyFoo::f2(int a);
MyFoo::f3(char* a);
There's about 40 functions like this, 35 of them I just want to pass through to the global fu...
I am trying to create a piece of software that can be used to create VERY large (10000x10000) sized bitmaps. All I need is something that can work in monochrome, since the required output is a matrix containing details of black and white pixels in the bitmap. The closest thing I can think of is a font editor, but the size is a problem.
...
I've been thinking of how to implement a lock-free singly linked list. And to be honest, I don't see many bullet proof ways to do it. Even the more robust ways out there that use CAS end up having some degree of the ABA problem.
So I got to thinking. Wouldn't a partially lock-free system be better than always using locks? May some oper...
I am porting a project over to OS X. I am finding GDB debugging in the console to be woefully insufficient and really need a visual debugger. My project is built using Scons and as such, it sidesteps Xcode's IDE entirely. This is acceptable until I need to fire up a visual debugger and step through my code.
Aside from generating and ...