I've got a struct with some members that I want to be able to get and set from a string. Given that C++ doesn't have any introspection I figure I need some creative solution with macros, the stringize operator and maybe boost::bind. I don't need full serialization or introspection, more an 'introspection-lite'
I'd like to have somethin...
I would like to be able to get a changed portion of the file from VSS snapshot? How it is possible?
...
I've been trying all night, and talk of maps, arrays, vectors and hash_maps have filled my head. im just confused now. i posted a previous question here: http://stackoverflow.com/questions/1687085/c-map-really-slow
problem was fixed but it seems map's are still not fast enough. i need to keep adding data. data is added ALOT during run t...
In MFC, I can edit the text of items in the list control but only for the first column by setting the Edit Labels to true. Now when I click the first column item to change its text, I'm able to change its text but when I hit Enter, its text isn't updated, why and how do I edit text for other columns?
...
Consider an example:
void main()
{
int *arr;
arr=new int[10];
}
How can I know the size of arr?
...
Hi everyone
We have a memory overwrite problem. At some point, during the course of our program, a memory location is being overwritten and causing our program to crash. the problem happens only in release mode. when in debug, all is well.
that is a classic C/C++ bug, and a very hard one to locate.
I wondered if there's a way to add s...
I get this error in visual studio and I don't know the reason. It doesn't even show the line number. Any clue?
Error 1 error LNK2028: unresolved
token (0A000041) "void __cdecl
free_img(struct Image *)"
(?free_img@@$$FYAXPAUImage@@@Z)
referenced in function "double *
__cdecl calc_zernike_moments(struct Image const *,int,stru...
Like in the example below, what is allowed, how and why?
class Shape {
public:
//...
virtual Shape *clone() const = 0; // Prototype
//...
};
class Circle : public Shape {
public:
Circle *clone() const;
//...
};
...
Background: So I'm working on a raytracer.. for my construction of the spatial partitioning scheme, I initially had some code like this:
if (msize <= 2) { // create a leaf node
Model **models = new Model*[msize];
for (uint i=0; i<msize; ++i)
models[i] = &mlist[i];
*arrayPtr = Node(models, msize); // class Node contai...
I have a big binary file with lots of files stored inside it. I'm trying to copy the data of a PCX image from the file and write it to a new file which I can then open in an image editor.
After obtaining the specs for the header of a PCX file I think that I've located the image in the big binary file. My problem is that I cannot figure ...
I managed to get a QPushButton to open a new window when pressed by using the following code (just snippets of code):
AppDialog::AppDialog(QWidget *parent)
: QDialog(parent)
{
QPushButton *button3 = new QPushButton(tr("Apps"));
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->addWidget(button3);
setLayout(hLayout...
I would like to use an API that is written in c++. It involves including header files and libraries. How can I use this API in a C# application?
...
I have a macro for a character string as follows:
#define APPNAME "MyApp"
Now I want to construct a wide string using this macro by doing something like:
const wchar_t *AppProgID = APPNAME L".Document";
However, this generates a "concatenating mismatched strings" compilation error.
Is there a way to convert the APPNAME macro to a ...
I have a few years of experience in cross-platform desktop development (Windows and MacOSX, not Linux (at least not for GUI apps)). Usually I create the GUI on MacOSX with Cocoa, and on Windows I use the old-fashioned Windows API. I have not used Qt because when I started it was still under the GPL license.
I find the native experience ...
I'm allocating a cl_mem buffer on a GPU and work on it, which works fine until a certain size is exceeded. In that case the allocation itself succeeds, but execution or copying does not. I do want to use the device's memory for faster operation so I allocate like:
buf = clCreateBuffer (cxGPUContext, CL_MEM_WRITE_ONLY, buf_size, NULL, &c...
I am trying to implement a DateTime class in C++:
class DateTime {
public:
DateTime();
DateTime(time_t ticks);
DateTime(int day, int month, int year);
DateTime(int day, int month, int year, int hour, int minute, int second);
//...
private:
time_t ticks;
int day;
int month;
//...
}
then in applicati...
I have a program that is supposed to read in values from user into a vector. My function is then supposed to keep a running sum and start from element 1 and compare element 2 to the sum(this point it is just element 1). Move to the next element, add element 2 to the sum and see if element 3 is greater than the sum of elements 1 and 2. ...
Suppose I have the following class hierarchy:
class A
{
int foo;
virtual ~A() = 0;
};
A::~A() {}
class B : public A
{
int bar;
};
class C : public A
{
int baz;
};
What's the right way to overload operator== for these classes? If I make them all free functions, then B and C can't leverage A's version without casting...
Hi,
Can you suggest a good book for learning Windows Services programming using C++?
Thanks,
...
#pragma once
#include "LudoCore/Singleton.h"
class LudoTimer : public Singleton<LudoTimer>
{
friend class Singleton<LudoTimer>;
public:
void Update();
void ShortenDay();
void LengthenDay();
UINT64 GetDeltaTime() const;
float GetPercentageOfDayElapsed() const;
private:
LudoTimer();
~LudoTimer();
UIN...