c++

Multiple Partial specialization and full specialization required <> after type definition

I'm using an C++ "event" class that allowed one or two arguments in the to be called delegates. Lately I've added support for delegates that don't require arguments, however when I specialze the class to use no template arguments I'm still required to add <> afther the class definition. Example usage with one/two arguments: class Exam...

I want to allow an xml file concurrent read accesses

Hello I want to allow an xml document, that contains some configuration items, concurrent read-accesses (no write access) from several machines on a domain. Could a simple DOMDocument30 be just what I need. Or do you think FreeThreadedDOMDocument xml document template should be sufficient. Or do you think of other xml document types ...

sort of arguments

i have following code #include <stdio.h> #include <stdlib.h> #include <string.h> int comp(const void *a, const void *b){ char *const *aa=a; char *const *bb=b; return strcmp(*aa,*bb): } int main(int argc,char **argv){ int i; qsort(argv+1,argc-1,sizeof *argv,comp); for (i=1;i<argc;i++) printf("i: %d==> '%s'\n",i,argv[i]); ...

What is the difference between -0 and 0?

In C++, for example fmod(-2,2) returns -0. The expression -0 == 0 is true, but the bits are different. What is the purpose of having something like -0 which should be 0 but is represented differently? Is -0 used exactly the same way as 0 in any computations? ...

Cross-platform GUI toolkit in C or C++?

I'm looking to write some simple GUI applications in C or C++, and am stuck for choice between the cross-platform toolkits. Keep in mind that I am developing in Ubuntu, preferably without an IDE, and preferably with good cross-platform support. What are the pros and cons of some of these toolkits? Which have you had the best experience ...

pointer to void

This is kind of basic but I can't seem to get a hold on this one. Reference here Are void *p and const void *p sufficiently different? Why would a function use const void * instead of void *? ...

Package accessibility for function and/or class

In Java they have package access specifier which enables the function to be used only by classes from this same "package" (namespace) and I see good things about it. Especially when design of models are in play. Do you think that something like this could be useful in C++? Thanks. ...

CLR Controls in MFC

I'm using CLR control in MFC application and after while the dialog get hang. I don't know why and I don't know how to cover it. Could you please help me ? ...

SCons: expanding library dependencies recursively

I am currently using an SCons-based build system that I am not repsonsible for maintaining but can provide input to the maintainer. One of the problems it has is in dealing with dependencies between C++ source packages. In the system, each source package is built to a DLL on Windows or shared library on Linux. Let's say that packa...

c++ array class problems

Alright, so without going into detail on why I'm writing this class, here it is. template<class aType> class nArray { public: aType& operator[](int i) { return Array[i]; } nArray() { aType * Array = new aType[0]; _Size = 0; _MaxSize = 0; _Count = 0; } nArray(int Count) { aType * Arra...

What is the effect of InterlockedIncrement argument declared as volatile

InterlockedIncrement and other Interlocked operations declare their arguments as volatile. Why? What is the intention and effect of this? ...

Exceptions - c++

Hi, I'm trying to understand the behavior of exceptions in c++. I wrote the following code: class A{ public: A(){ }; ~A(){ cout<<"hello"; }; }; int exceptionTest(){ throw "blablabla"; }; int main(){ A sd; int test = exceptionTest(); return 0; } I've noticed that in this case the distr...

Dealing with the example.cpp in CRF++ toolkit

Hi, I am just starting to learn about the use of CRF++ toolkit. I downloaded the linux version of CRF++ 0.54 , When i try to compile the example.cpp under sdk/ with the command g++ -o example example.cpp there comes the problem: hpl@hpl-desktop:~/Documents/CRF/CRF++-0.54$ g++ -o a example.cpp /tmp/ccmJQgGu.o: In function main': exampl...

C++ MFC: How to open immediately a secondary dialog after the first modal dialog was created.

Hi, how can I open a secondary modal dialog in C++ MFC from a dialog without pressing any button? (If I create a dialog in OnInitDialog(), the first dialog won't appear.) ...

In C++, are changes to pointers passed to a function reflected in the calling function?

If I pass a pointer P from function f1 to function f2, and modify the contents of P in f2, will these modifications be reflected in f1 automatically? For example, if I need to delete the first node in a linked list: void f2( Node *p) { Node *tmp = p; p = p -> next; delete tmp; } Will the changes made to P be reflected in ...

Installing OpenCV on OSX 10.6 using MacPorts

Hi, I tried installing OpenCV following the instructions for a MacPorts install on http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port, typing sudo port install opencv in the terminal. The install/compilation seemed to go fine, and the files are in /opt/local subdirectories as they should be. As a first test, I then tried inclu...

Does SQLite3 change databases even if every statement is "SELECT"

Hi everyone, we try to deploy our software on Windows 7, and there are several sqlite3 db files around. But, these are all read-only and we execute only "SELECT" statements. However, we have observed that Windows 7 also make virtualization on these files, which means file structure or content is changed. What do you think of it? What cha...

C++ structs Interdependency

Hello i have structures declared in the same Header file that need eachother. struct A; // ignored by the compiler struct B{ A _iNeedA; //Compiler error Here }; struct A { B _iNeedB; }; this work normally class A; class B{ A _iNeedA; }; class A { B _iNeedB; }; // everything is good Thank you very much! ...

Alternative to template declaration of typedef

I'm trying to accomplish namespace NTL { typedef std::valarray vector; } through standard C++. I know it's not allowed, but I need a quick and easy way (without reimplementing all functions, operators, overloads, etc.) to get a template typedef. I am now doing a template class Vector which has a valarray as data member, but that ...

Boost xpressive ! operator not working

I just started using Boost::xpressive and find it an excellent library... I went through the documentation and tried to use the ! operator (zero or one) but it doesn't compile (VS2008). I want to match a sip address which may or may not start with "sip:" #include <iostream> #include <boost/xpressive/xpressive.hpp> using namespace boos...