c++

Including Templated C++ in Objective C

Hello all, I am trying to include a C++ library with quite a few templates into an objective C application. It seems to perpetually choke on a few inline statements inside a shared library: template <class T> inline T MIN(T a, T b) { return a > b ? b : a; } template <class T> inline T MAX(T a, T b) { return a > b ? a : b; } yieldin...

Fail to CoCreateInstance an EXE COM server

Hi, I have an EXE COM server (used to elevate our application to a higher integrity level) which is downloaded to %temp% and registered by an ActiveX control. This COM server works pretty well on Vista machines. On Window 7 machines I got something wired: the COM server can be downloaded and registered successfully, but I got the error ...

Where can I find open source projects which want help from a developer?

Possible Duplicate: Finding an Open Source Project to work on I am C++ developer and I want to find a project that accept me as one of its developers. I am not an expert developer but I think I can do some help to a project in C++. Is there a forum or a web site that lists projects which want more developer? ...

Is unsigned char('0') legal C++

The following compiles in Visual Studio but fails to compile under g++. int main() { int a = unsigned char('0'); return 0; } Is unsigned char() a valid way to cast in C++? ...

How to change buffer size with boost::iostreams?

My program reads dozens of very large files in parallel, just one line at a time. It seems like the major performance bottleneck is HDD seek time from file to file (though I'm not completely sure how to verify this), so I think it would be faster if I could buffer the input. I'm using C++ code like this to read my files through boost::i...

Large scale Machine Learning

I need to run various machine learning techniques on a big dataset (10-100 billions records) The problems are mostly around text mining/information extraction and include various kernel techniques but are not restricted to them (we use some bayesian methods, bootstrapping, gradient boosting, regression trees -- many different problems an...

How to keep a list of instances of a class?

I'm writing a raytracer in C++ and need to be able to check intersections with every object in a scene (optimizations will come later), and to do this, I need to keep a running list of class instances. A list of pointers, updated when a new instance is created, won't work because as far as I know there is no way to increase the size of t...

Strange enable_if behaviour using nested classes (MSVC compiler bug or feature?)

After quite some time debugging my code, I tracked down the reason for my problems to some unexpected template specialization results using enable_if: The following code fails the assertion in DoTest() in Visual Studio 2010 (and 2008), while it doesn't in g++ 3.4.5. However, when i remove the template from SomeClass or move *my_conditio...

Up and Down icons in CListCtrl

I have a CListCtrl with multiple columns, all of which are able to be sorted by. I would like to add up and down icons so that it is clear which column is currently sorted upon, and in which direction; much like Windows Explorer. My thought was to add a solid up/down arrow to the column name. I tried using the extended ASCII chars 30/31;...

Is there a way to speed up C++ compilation times in Solaris Sun Studio 12?

Since I am compiling my C++ code on a very server box (32 or 64 cores in total), is there a way of tweaking compiler options to speed up the compilation times? E.g. to tell compiler to compile independent .cpp files using multiple threads. ...

How to pass a method pointer as a template parameter

Hi, I am trying to write a code that calls a class method given as template parameter. To simplify, you can suppose the method has a single parameter (of an arbitraty type) and returns void. The goal is to avoid boilerplate in the calling site by not typing the parameter type. Here is a code sample: template <class Method> class WrapMe...

how to add one exception handler for a class?

Hi, I am trying to use one exception handler to handle all exceptions raised by a C++ class. is there a simple way, instead of adding the code to every member function? Thanks ...

C++ Class Pointer Deletion (Segmentation Fault Issue)

SOLVED Well, it seems that I'm receiving a segmentation fault when I try deleting my class pointer. I've tried many things, but yet haven't got it to work. Anyways, here is my main.cpp: (this segmentation fault is occurring when I delete 'm') /* * Copyright(c)Fellixombc 2010 * * TextToSqlRs is free software: you can redistribut...

Why doesn't Direct3D have it's own vertex structure?

I've always wondered the reasoning behind why we must always define D3DVERTEX. Is it because Microsoft wants to allow the opportunity to put this in a class and overload operators, or is there another reason? Thanks ...

Launching external application and block current application till the launched application quit

I am not sure whether there is a way to Launch an external application, and block current application till the launched application had quit. Currently, I am using the following non-blocking method (MFC) to launch std::string str = "Notepad2.exe"; // Non-blocking. Return immediately. WinExec(str.c_str(), SW_SHOW); ...

Does putting data into std::vector in C++ create a copy of the data?

I am interested if creating a new std::vector (or calling its assign method) creates a copy of the data? For example, void fun(char *input) { std::vector<char> v(input, input+strlen(input)); // is it safe to assume that the data input points to was COPIED into v? } Thanks, Boda Cydo. ...

Error building GLib

Im trying to build GLib-2.4.0 using the makefile. I get this error: gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -DG_LOG_DOMAIN=\"GLib\" -DG_DISABLE_CAST_CHECKS -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION -pthreads -g -O2 -Wall -MT gatomic.lo -MD -MP -MF .deps/gatomic.Tpo -c gatomic.c -fno-common -DPIC -o .libs/gatomic.o /var/tmp//cctTs...

Show message when close program in Qt/C++

Qt - c++ Show message when user close program Thanks ...

How to implement an Exchanger (Rendezvous Pattern) in C++?

In Java, there is an Exchanger class (http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Exchanger.html). How to implement something like that in C++ (using boost) ...

In Objective-C, How one can forward method to specific super class.

All I knew is this: Objective-c allows us to forward method invocation to its super class by [super method] However I want forward the invocation to super.super; Skipping the immediately super class. In c++ we can easily do these by typecasting ((GrandSuper*)object).method(). Is their any provision to do the same in objective c ...