c++

C++ -- Should the subclass destructor explicitly call base class destructor?

Possible Duplicate: Do I need to explicitly call the base virtual destructor? Hello all, I would like to know whether or not a sub-class destructor should call base-class destructor explicitly. My answer is NO. For example, class A { public: A() {...} virtual ~A() {...} protected: ... private: ... }; class B:...

How to open a file with it's relative path in Linux?

I have a program which opens a file by using a relative path (for instance '..'). Now the problem is, when I execute the program from another directory, the relative path is not relative to the program but relative to the working directory. Thus, if I start the program with '/path/to/program/myprog' it fails to find the file. Is there ...

sproxy for vs2008?

Hi, I'm trying to create WCF proxy in unmanaged C++ (No .NET framework is installed on the client). I've found the website "http://icoder.wordpress.com/2007/07/25/consuming-a-wcf-service-with-an-unmanaged-c-client-with-credential-passing/" which teaches how to generate such a proxy. The problem is that I've found the sproxy.exe only i...

How much is the memory allocated for a user-defined class in C++

I understand that certain data type object have certain buffer size. E.g. a char is 1byte. So, when creating a self-defined class object, How much memory is allocated to the object a? Is the amount of memory allocated different if the object is created on stack, or heap? Is the amount of memory allocated fixed, or can be changed? Cre...

C++ Thread Pool

What is a good open source implementation of a thread pool for C++ to use in production code (something like boost)? Please provide either your own example code or a link to example code usage. ...

Injecting Ctrl+C into target process

Hello, I have a process that has a CtrlBreak handler by calling SetConsoleCtrlHandler. This handler listens for CTRL_BREAK_EVENT and performs some action (without quitting). This process is not attached to a console. Let's call this the target process. Next, I have written a separate program which takes a PID and I'd like to start a rem...

SWIG: C++, Python. Single Interface for different shared libraries(sharing common base class)

Environment : C++, Python, SWIG Problem : C++ : I have different shared library(.so) files which share common base class. SWIG: I can have a wrapper for each .so file & can use corresponding .py in python module. But, this makes lot of interface files & also lot of import statements in python. Expected: I would like to have best poss...

TinyXpath v_get_xpath_base, second parameter...

What do I pass here as the second parameter to v_get_xpath_base in order to get it to work, no matter what I try, there always seems to be a problem. Either the class is a base class and cannot be instantiated or the class cannot be casted. I'm at a loss, someone help me please? TiXmlElement* outputnode = new TiXmlElement("tes...

Why must loop variables be signed in a parallel for?

I'm just learning OpenMP from online tutorials and resources. I want to square a matrix (multiply it with itself) using a parallel for loop. In IBM compiler documentation, I found the requirement that "the iteration variable must be a signed integer." Is this also true in the GCC implementation? Is it specified in the OpenMP standard? If...

MFC - Is there any way to load a png resource into picture control on a dialog box?

I tried the following code on OnInitDialog() but nothing was shown. m_staticLogo.SetBitmap(::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_LOGO))); where m_staticLogo is the static picture control and IDB_LOGO is the resource ID of the png file. ...

Unresolved External Symbol?

I am terrible at reading c++ errors, but obviously Unresolved External Symbol means the function I am using isn't defined. The error I am getting is... 1>WorldState.obj : error LNK2001: unresolved external symbol "public: class Brutal::GameObject * __thiscall Brutal::GameObjectManager::createObject<class Player>(class Ogre::Vector3,clas...

How can I add a package to Qt

I downloaded a package called QtIOCompressor, I need to use the functionality like zipping a directory gzipping a directory etc etc in a application I am coding. But I dont know how to add this package into Qt or how to configure this package by which i can use it with my application which i may code in future! InfO: http://doc.qt.nokia...

Lexically-scoped ordering behavior

I have a class with two definitions of ordering. (In the real problem, one is a total order and one is a semiorder.) But it's nice to be able to use the comparison operators rather than always having to use an explicit comparison function or functor object. So I figured I'd provide some comparison operators like this: class C; names...

c++ vector How to change internal pointer

hi guys, I would like to serialize vector. And dunno how to change pointer of vector.. To make it simple let's say I have a vector smt like: vector<char> v; And I have this pointer: char* c = { 'v', 'e', 'c', 't', 'o', 'r' }; And I would like my vector v's internal pointer points my char* c: &v[0] -> c How can I adjust vector...

C++ lambda operator ==

How do I compare two lambda functions in C++ (Visual Studio 2010)? std::function<void ()> lambda1 = []() {}; std::function<void ()> lambda2 = []() {}; bool eq1 = (lambda1 == lambda1); bool eq2 = (lambda1 != lambda2); I get a compilation error claiming that operator == is inaccessible. EDIT: I'm trying to compare the function instance...

C++ How can achieve this Interface configuration?

Hi, I certainly don't know how to title this question, sorry. I'm having some problems to design the following system. I need a class which will make some work, but this work can be done in a bunch of different ways, say that this work will be made through "drivers". These drivers can have different interfaces and because of that I ne...

UMFPACK and BOOST's uBLAS Sparse Matrix

I am using Boost's uBLAS in a numerical code and have a 'heavy' solver in place: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?LU_Matrix_Inversion The code works excellently, however, it is painfully slow. After some research, I found UMFPACK, which is a sparse matrix solver (among other things). My code generates la...

Char* vs String Speed in C++

I have a C++ program that will read in data from a binary file and originally I stored data in std::vector<char*> data. I have changed my code so that I am now using strings instead of char*, so that std::vector<std::string> data. Some changes I had to make was to change from strcmp to compare for example. However I have seen my execut...

What do I often see references in operator overloading definitions ?

For example, in the OGRE3D engine, I often see things like class_name class_name :: operator + (class_name & object) Instead of class_name class_name :: operator + (class_name object) Well it's not that I prefer the second form, but is there a particular reason to use a reference in the input ? Does it has special cases where it is...

Why do I get missing symbols for an explicit template specialization in a static library?

If I compile the following code: // // g++ static.cpp -o static.o // ar rcs libstatic.a static.o // #include <iostream> template < typename T > struct TemplatedClass { void Test( T value ) { std::cout << "Foobar was: " << value << std::endl; } }; template struct TemplatedClass < long >; I get a static library and if I run ...