I have a class hierarchy and want to get rid of virtual method calls overhead using CRTP pattern. How to do this for my example classes, is it doable ?
class A
{
public:
virtual ~A();
virtual void foo();
};
class B : public A
{
public:
virtual ~B();
virtual void foo();
};
class C : public B
{
public:
virtual ~C();
...
hi,
i'm trying to learn c++, but i can not find if it's possible to extend a class in this way:
main.cc
#include "mWindow.h"
using namespace std;
int main( int argc, char* argv[] ) {
gtk_init( &argc, &argv );
mWindow win = mWindow();
gtk_main();
return 0;
}
mWindow.cc
#include "mWindow.h"
mWindow::mWindow() {
gtk...
Hi,
I need to pass a double [][6] to a method. But I don't know how to create that two-dimensional array.
6 is a fixed size (or a "literal constant", if my terminology is right), which the method accepts. I was trying something like this, but without success...
double *data[6] = new double[6][myVariableSize];
So, the method really ...
hi,
i use ATL macros like A2T and A2CW.
on the devel-computer everyhting works fine. when i use the application (visual studio 2008 pro) on another computer - the output of the ATL-macro-conversion is not readable.
i hope someone can help me to solve this problem. my application is finished - only the ATL conversion macros are the prob...
Reading C++ Templates: The Complete Guide and it says
Note that templates cannot be declared
in a function
It does not give explanation and/or cross reference to any other chapter in the book or external resource.
Could someone help in explaining this. Probably it is explained later in the book but not there yet. If explained ...
Hi,
In my new project I want to use a existing C C++ functions . For that I would need to add the C/C++ dlls to C# project.
My C/C++ projects is of type UnManaged and it is not a COM Project. I have seen few articles after from MSDN and tried:
[DllImport("user32.dll", EntryPoint="MessageBoxA")]
But I am not sure Where should I place...
I'm having 2 classes - one holding Entity information other holding Component information.
Now the problem is that the Entity class needs Component class already defined for using it in vector of children, but at the same time Component needs Entity to declare it as it's parent (I'm keeping everything linked in between). This puts out st...
Hi,
Sorry for my beginner's question...
What is the easiest way to define procedures, which are executed when MousePressEvent or MouseReleaseEvent occurs?
For now I am defining my own class (MyGraphicsView class), which inherits QGraphicsView and I am reimplementing mouse events (which are virtual functions). It works fine but is ther...
I wrote a bunch of unit tests to cover the windows registry reading/writing. They use the CRegKey ATL api.
These worked fine on my desktop machine of XP Pro, but when the tests came to run on the build machine - a Windows 2008 x64 Server - the tests fail with ERROR_ACCESS_DENIED when trying to create a key via Create.
The user who is ...
So, I'm finding the Eigen package crashes when I try to declare a matrix larger than 10000x10000. I need to declare a matrix like this.. about 13000x13000 elements reliably. I ran a test like:
for( int tortureEigen = 1 ; tortureEigen < 50000 ; tortureEigen++ )
{
printf( "Torturing Eigen with %dx%d..\n", tortureEigen, tortureEigen ) ...
So I'm trying to create a simple file transfer method. It's completely working for small files (a few bytes). But if I want to transfer a file with the size of 2 kB, it returns unicode characters instead of that what's inside the file.
Server:
void DownloadFile(SOCKET Socket){
if(Socket == NULL){
return;
}
while(1)...
Hello all. I'm posting my first question here after having viewed many useful exchanges by others; it's very exciting! I'm thinking that this question will be fairly straightforward to answer, but I hope that someone can shed some light on it since its vexing me.
I have a function that accepts an array of bytes passed in as a byte p...
I'm building a driver in C++ which relies heavily on another dll (surprise!). This dll comes with a header which contains a huge list of defines. Each define represents different return, message and error codes.
Each of these sets of defines has a prefix which differentiates it from the others. Something like:
MSG_GOOD... MSG_BAD.....
Hello,
I am trying to convert a RTF document to PDF. I have this code:
// TestCOMPDF.cpp : Defines the entry point for the console application.
//
#include <windows.h>
#include <tchar.h>
#include <objbase.h>
#include <atlbase.h>
#import "MSVBVM60.DLL" rename ( "EOF", "VBEOF" ), rename ( "RGB", "VBRGB" ) //if you don't use this you wi...
I know, the question has already been asked but the answer doesn't meet my requirements.
So is there is any way to import a Visual Studio project with all its parameters in Eclipse CDT ?
If yes, how could I do that ?
If you want to know more details about my situation, there it is :
I am joining a rather big collaborative C++ project,...
Why afx_msg is used in message handler function declarations?
...
... like Remoting or WCF in C# or Java RMI?
I am learning c++ and need a simple to use tcp service framework with built in binary serialization for c++ to c++ communication.
Thanks
...
I've recently started appreciating std::auto_ptr and now I read that it will be deprecated. I started using it for two situations:
Return value of a factory
Communicating ownership transfer
Examples:
// Exception safe and makes it clear that the caller has ownership.
std::auto_ptr<Component> ComponentFactory::Create() { ... }
// T...
I have never seen a class used as virtual and nonvirtual base (i.e. if some class is intended to be an ancestor then we usually know in advance about type of inheritance - virtual or nonvirtual).
So I suppose that there is an error-prone freedom in c++ to specialize "virtual" inheritance in base class list. It should be better to specif...
Hello,
I have a problem, downloaded curl developemnt package but if i
add in my visual studio .lib file form this program fail with
0xC000007b on startup.
I trying download all complete source in this i can download simple vs6
project but without errors i convert it to visual studio 2010, i compile
this solution normally, libcurl with...