c++

Use a Graph Library/Node Network Library or Write My Own?

I'm trying to decide between going with a pre-made graph/node network library or to roll my own. I'm implementing some graph search algorithms which might require some significant customization to the class structure of the node and/or edges. The reason I'm not sure what to do is that I'm unsure if customization of a pre-made might be...

Sphere online judge finds my code wrong although its working correct for hundreds of test cases.

Question goes like this.. Input n [the number of multiplications <= 1000] l1 l2 [numbers to multiply (at most 10000 decimal digits each)] Text grouped in [ ] does not appear in the input file. Output The results of multiplications. My code.. #include<iostream> #include<vector> using namespace std; int main() { long int n,a,b,...

Audio Processing - Tone Recognition

I've started developing a simple guitar tuner as a learning project for audio processing programs. Could someone recommend me an adequate library for this? Here's basically what I'm looking for: Microphone input. Real-time processing of the signal. I need to be able to perform note recognition on whatever is being played to the mic. C...

Renaming first and second of a map iterator

Is there any way to rename the first and second accessor functions of a map iterator. I understand they have these names because of the underlying pair which represents the key and value, but I'd like the iterators to be a little more readable. I think this might be possible using an iterator adaptor, but I'm not sure how to implement ...

How can I get a libtiff TIFF object from a MagickWand object (in C)?

How can I get a libtiff TIFF object from a MagickWand object (in C)? I want to open any given image type with ImageMagick and run tesseract on it. Tesseract seems to use libtiff for it's IO, ImageMagick seems to use libtiff for it's tiff handling, so I figured I should somehow be able to use ImageMagick with tesseract without meddling i...

copy constructors and base classes C++

Hi, I'd like to be able to initialize a derived class from a base class, like so: class X { public: X() : m(3) {} int m; }; class Y : public X { public: Y() {} Y(const & X a) : X(a) {} }; Is there anything dangerous or unusual by doing that? I want it because I'm deserializing a bunch of objects who's type I don't...

Nested std::maps

Supposed I have a type I'll call NamedNestedMap std::map<std::string, std::map<std::string, NamedNestedMap> > In this case each second (value) of the pair is the same kind or type as the parent object. What I can't figure out is how to declare it. This will allows a recursive algorithm to walk down thru the "tree" of maps. The Va...

Is there a way to create a view in a CSplitterWnd without using (MFC) dynamic object creation?

Hi, I was previously using a CSplitterWnd in a MFC application, using it's CreateView function. Everything was working fine but now I would like to pass a parameter to the constructor of my views, so I cannot use MFC dynamic object creation (DECLARE_DYNCREATE and IMPLEMENT_DYNCREATE) because they require an empty constructor. After sear...

Issues with build in Carbide C++ 2.0

I'm building my application and when I try to run it on the emulator, I get this error. Creation Time Description Resource Path Location Type 1254339868582 BLDMAKE ERROR: Directory "\S60\devices\Nokia_N97_SDK_v1.0\epoc32\" does not exist ZeFirst Unknown C/C++ Problem The folder does exist and does have the necessary rights. The ...

Is there a faster and object orientated alternative to SDL for C++ ?

The current version of libsdl (1.2.x branch) is very, very slow with blending and per pixel alpha (as it uses software blending). Is there any other good alternative to it? ...

Compile time sizeof_array without using a macro

This is just something that has bothered me for the last couple of days, I don't think it's possible to solve but I've seen template magic before. Here goes: To get the number of elements in a standard C++ array I could use either a macro (1), or a typesafe inline function (2): (1) #define sizeof_array(ARRAY) (sizeof(ARRAY)/sizeof(AR...

Array of Objects/Classes fails for user defined Class

Hello, I am hoping someone with some more C++ knowledge might be able to help me. I am trying to create an array of objects in C# from a Class I've created in a Managed C++ DLL. I haven't any clue what is going on. I am able to run the application and build it setting up the array of classes appears to work perfectly fine but when I cal...

How to build wxmathPlot for win32?

I downloaded the latest wxmathplot but the readme is a bit sparse with instructions on how to build on win32 platform. Has anyone used this library for win32? Can someone point me to the docs or give some hints/advice on how to build for win32 targets. We'll eventually use this for cross platform stuff, for now it is just win32 until ...

Performance difference between C++ and C# for mathematics

I would like to preface this with I'm not trying to start a fight. I was wondering if anyone had any good resources that compared C++ and C# for mathematically intensive code? My gut impression is that C# should be significantly slower, but I really have no evidence for this feeling. I was wondering if anyone here has ever run across a ...

C++ Templates type casting with derivates

Hi, I'm trying to cast from one generic to another, say: myClass<MoreAbstract> anItem = myclass<DerivateFromMoreAbstract> anotherObject; Or do something like aFunction(anotherObject); // myclass<DerivateFromMoreAbstract> anotherObject where aFunction signature is aFunction(myClass<MoreAbstract> item); In fact, myClass is actual...

dynamic linking woes using c++

main.cpp <- line 106 to 164 invoke dlopen/dlsym/dlclose basefilter.hpp <- naked abstract base class basefilter.cpp examplefilter.hpp <- a test plugin examplefilter.cpp everything <- the repository Running the whole thing will result in the following error: Cannot open library "./libexamplefilter.so" ./libexamplefilter.so: undefined s...

Gnu Makefile - Handling dependencies

What approach do C++ programmers on Unix platform use to create and manage Makefiles? I was using hand made Makefiles for my projects but they don't handle header file changes and other dependencies. I googled around and found a good solution here. But I ran into a problem here in the sed command - sed -e 's/#.*//' -e 's/^[^:]*: ...

Duplicating base-class constructors to subclass?

I have a large set classes which I need to "wrap" in a very thin subclass. The functionality of the base classes doesn't change, and their interface remains intact. The problem is, that in order to use the base classes's constructors (and most of them have more than one), I need to decalre an identical constructor in each of the subclas...

Boost equivalent of ManualResetEvent?

Hello, I'm wondering if there is a boost equivalent of ManualResetEvent? Basically, I'd like a cross-platform implementation... Or, could someone help me mimic ManualResetEvent's functionality using Boost::thread? Thanks guys ...

Translating code from C++ to Delphi

Hi dudes, I have the next code in C++: for (long i=0; i < num_iter ; i++) { bp->bpgt(data[i%8], &data[i%8][3]); if( bp->mse(&data[i%8][3]) < thresh) break; } where bpgt is a procedure, and mse is a function, thresh is a Double type, data is a bi-dimensional matrix of Double types. void bpgt(double *in,double *tgt); ...