c++

Different implementation of a templated class method for a particular class template type

I have a templated class with a method for which I need a different implementation for a specific template type. How do i get it done? ...

Experiences using Wt C++ framework?

Has anyone actually used Wt? Did it work well? Did you experience certain limitations? Or advantages? Note: Please avoid the discussion of whether C++ is suited to be a web development language. I just want to give Wt a try because it seems like a fun thing to do. ...

How do I integrate Boost into a Visual C++ project?

Hi all, I'm trying to link up some of the boost stuff with a visual C++ project of mine and am not sure what the best way to do this is, I'm specifically interested in the singleton class. ...

Implemeting new facets in DLL under GCC/MingW

Hello I have problem with using std::locale::facets from DLL. It seems that locale "id" is not shared between DLL and the source. has_facet reports that "facet exists" on different kind of facet. And facet ids reported incorrectly. In the below example, foo::id and bar::id are seems to be the same and the has_facet reports true on uni...

How to perform RGB->YUV conversion in C/C++?

How to perform RGB->YUV conversion in C/C++? I have some Bitmap.. RGB I need to convert it to YUV Libs? Tuts? Articles? ...

C++ Data Structure for storing 3 dimensions of floats.

I've implemented a 3D strange attractor explorer which gives float XYZ outputs in the range 0-100, I now want to implement a colouring function for it based upon the displacement between two successive outputs. I'm not sure of the data structure to use to store the colour values for each point, using a 3D array I'm limited to rounding t...

C++ & MP3 equalizer question

I want a library or some sort of a command that takes an MP3 file location as an input (only MP3 I don't need WAV, OGG, or any other type) and plays the file to the end of it and make some sort of an equalizer output but only in frequencies as numbers like (31HZ, 62HZ, ..., 16 KHZ), all the 10 bands available but show them to me as ever ...

C++ How to read two lines from string to separate strings?

I got a string foo with 2 lines: string foo = "abc \n def"; How I can read this 2 lines from string foo: first line to string a1 and 2th line to string a2? I need in finish: string a1 = "abc"; string a2 = "def"; ...

Enum scoping issues

I try to keep things as local as possible, so I put enums at class scope, even if they are shared between two classes (I put it in the class that "goes better" with it.) This has worked out great, but I recently ran into an issue where a circular dependency will occur if I put the enum at class scope. The enum is going to be a construct...

matrix and vector template classes in c++

#include <array> template <typename T> class Vector4<T> { std::array<T, 4> _a; // or 'T _a[4];'? }; template <typename T> class Matrix4<T> { std::array<T, 16> _a; // or 'T _a[16];'? //Vector4<T> row0; // or should i use this instead //Vector4<T> row1; // it makes other code easier but how //Vector4<T> row2; // can i...

C++ Using Class Method as a Function Pointer Type

Hi, In a C lib, there is a function waiting a function pointer such that: lasvm_kcache_t* lasvm_kcache_create(lasvm_kernel_t kernelfunc, void *closure) where lasvm_kernel_t is defined as: typedef double (*lasvm_kernel_t)(int i, int j, void* closure); Now, if I send a method defined in a class to lasvm_kcache_create: double cls_las...

libtiff.3.dylib: unknown required load command 0x80000022

Has anyone found a fix for this? I read that it has something to do with new dylib format in Snow Leopard... (This is the lib I get back from MacPorts.) Thanks, rui ...

Abstract class in c++

Hi, Let's say I've got class: class Bad_Date { private: const char* _my_msg; public: const char* msg() const { return _my_msg; } }; And I would like to not be able to create any object of this class but I don't really want to put anything else there and make it pure virtual fnc. Is there any other way to make this class abstract or ...

OpenGL Keyboard Camera Controls

I have been following this tutorial series for OpenGL: GLUT: http://www.lighthouse3d.com/opengl/glut/ I have reached the stage of implementing camera controls using the keyboard: http://www.lighthouse3d.com/opengl/glut/index.php?8 When doing the advanced tutorial it stops working. I've pretty much just copied and pasted it. When I ...

How do I use merge sort to delete duplicates?

I use recursive merge sort for sorting a link list, but during the merge sort I would like to delete duplicates. Anyone has insight in how to accomplish this? I am using C code. ...

Pass enums by value or reference?

My general rule is to pass by value for primitive types and pass by reference for objects (obviously const'd if need be). However, I'm not sure what route to take with enumerated types. I'd assume that pass by value is preferred since they are seemingly small, but I'd like to hear others thoughts. ...

Streaming the desktop

I want to create a C++ cross-platform (Windows and MacOS X) application that sends the screen as a video stream to a server. The application is needed in the context of lecture capture. The end result will be a Flash based web page that plays back the lecture (presenter video and audio + slides/desktop). I am currently exploring a few ...

Build management in C++ & good IDEs on Linux

I am starting to write a moderately sized project in C++ requiring a fairly large amount of files and dependencies on other projects. Do you think manually maintaining a Makefile for this project is the best approach? Are there other better alternatives for C++ that make build management and dependency management of files really easy t...

Non-blocking socket on Windows doesn't return after send() call

I'm hoping someone can explain a situation -- any situation -- in which a non-blocking Windows socket would not immediately return after using send() on it. On other platforms, my code works as intended, so it appears to be a Windows-specific issue. The way I can tell it isn't returning is quite simple: I cout a message immediately befo...

Number of calls for nth Fibonacci number.

Consider the following code snippet: int fib(int N) { if(N<2) return 1; return (fib(N-1) + fib(N-2)); } Given that fib is called from main with N as 10,35,67,... (say), how many total calls are made to fib? Is there any relation for this problem? PS: This is a theoretical question and not supposed to be executed. EDIT: I am...