c++

High-quality libraries for C++.

We all know about Boost. What other free C++ libraries are worth using? Why? Are they easily usable with common compilers? ...

desktopdock or stardock in Qt

Is there any opensource/sample application in qt/c++, just like desktopdock or objectdock..? ...

Where can I see the list of functions that interact with errno?

In the book "The C Programming Language" it says: "Many of the functions in the library set status indicators when error or end of file occur. These indicators may be set and tested explicitly. In addition, the integer expression errno (declared in <errno.h>) may contain an error number that gives further information about the mo...

Is returning by rvalue reference more efficient?

for example: Beta_ab&& Beta::toAB() const { return move(Beta_ab(1, 1)); } ...

Function template with an operator (C++)

In C++, can you have a templated operator on a class? Like so: class MyClass { public: template<class T> T operator()() { /* return some T */ }; } This actually seems to compile just fine, but the confusion comes in how one would use it: MyClass c; int i = c<int>(); // This doesn't work int i = (int)c(); // Neither does this*...

COM: how to get more details about COM errors?

Greets, When working with DirectX, you get this nice header to #include called DxErr9.h which has really helpful functions like: DXGetErrorString9 and DXGetErrorDescription9 They tell you everything you need to know about the error given the HR. But now working with COM and OLE, I find I'm kind of on my own with the HRESULTS th...

Collision detection of triangles in 3D with some movement

I'm looking for a pretty easy algorithm for a collision detection with two three-dimensional triangles, which can move constantly (rather better if the could accelerate, too). I've found a method to solve this problem but that's a difficult one with movement of the two three-dimensional triangles. ...

i++ less efficient than ++i, how to show this?

I am trying to show by example that the prefix increment is more efficient than the postfix increment. In theory this makes sense: i++ needs to be able to return the unincremented original value and therefore store it, whereas ++i can return the incremented value without storing the previous value. But is there a good example to show t...

using header files from another project (directory)

I am using visual studio 2008 and I need to use certain header files from another project. I have tried to do add the path in "Additional Include Directories" in C/C++ General properties pane but my project still puts out the same errors (fatal error C1083: Cannot open include file: 'tools/rcobject.h'. All the other cpp and header files...

installing c++ boost on mac osx leopard -- port fails

I'm not much of a c++ programmer, just an end-user trying to install an existing project from source. One of the project dependencies is the boost library. When I tried to install boost on my osx 10.5.7 using "sudo port install boost", I got the following error message: ---> Building boost with target all Error: Target org.macports.bui...

<list> throws unhandled exception when calling push_front()

I'm working on a GUI in SDL. I've created a slave/master class that contains a std::list of pointers to it's own slaves to create a heirarchy in the GUI (window containing buttons. Button a label and so on). It worked fine for a good while, until I edited a completely different class that doesn't effect the slave/master class directly. T...

compiling c++ code using gnu/c getline() on mac osx?

...

Best aproach to java like adapters event-handling in C++

I'm doing some research in how to implement a event-handling scheme in C++ that can be easyest as its to implements an adpter to a class in java. The problem is that with the approach shown below, I will need to have all adapters already implemented with its function overriding in the devived class (because the linker needs it). On the o...

C++ file parse number of arguments

Hi all! I got a pack of c++ files with static source code (already developped, not needed to do anything to them). There is an program/lib/way to get a list of the number of params each function withing one of those files? I mean, getting a result like: #File a.cpp ##a() -> 3 paramss ##foo() -> 0 params (void) #File b.cpp ##test() -...

What's the Right Way to use the rand() Function in C++?

I'm doing a book exercise that says to write a program that generates psuedorandom numbers. I started off simple with. #include "std_lib_facilities.h" int randint() { int random = 0; random = rand(); return random; } int main() { char input = 0; cout << "Press any character and enter to generate a random number." <...

Data structure similar to a 2-argument map

Is there a data structure (readily available in STL or boost), that accepts two arguments and maps it to a certain value? Examples would be for returning certain information in a coordinate grid or getting the weight of an edge in a graph: coordinate_quadrant(-1,-1) = 3 weight_of(u,v) = 10 The quadrant example could be done i...

Can the default destructor be generated as a virtual destructor automatically?

Can the default destructor be generated as a virtual destructor automatically? If I define a base class but no default destructor, is there a default virtual destructor generated automatically? ...

WinForm not receiving messages except right after creation

I've got some unmanaged code sitting in a DLL. It publishes some methods that my calling (managed) code uses to hook into some COM notifications. Rather than deal with unmanaged code calling back into managed code, I've created a hidden Control derived object and am passing its handle property which the unmanaged code then uses as a pa...

how to Improve DrawDIB's quality?

I am coding in c++, gdi I use stretchDIBits to draw Images to dc. ::SetStretchBltMode(hDC, HALFTONE); ::StretchDIBits( hDC, des.left,des.top,des.right - des.left,des.bottom - des.top, 0, 0, img.getWidth(), img.getHeight(), (img.accessPixels()), (img.getInfo()), DIB_RGB_COLORS...

C++ api to develop over Active Directory

I need to access the Active Directory data programmatically using a native C++ API because I like C++ and I think it is faster than any .NET programming language. I could not find a C++ API developed by Microsoft, it only has a C one (ADSI) and it is really an awful API. I found a C++ API in open LDAP but it has some errors and it seems ...