c++

symbol recognition

Does any one know how I can get a c++ class for symbol recognition.By symbol recognition I mean things like shaded/unshaded circles, ovals, rectangles, squares,triangles,rhombus , hexagon, octagon ,rhomboid, cross, star etc. What I am really interested in is writing a c++ program that can recognise such shapes in scanned documents. I...

slightly weird (imo) C++ code

Sorry if this is simple, my C++ is rusty. What is this doing? There is no assignment or function call as far as I can see. This code pattern is repeated many times in some code I inherited. If it matters it's embedded code. *(volatile UINT16 *)&someVar->something; edit: continuing from there, does the following additional code conf...

What does this warning message mean?

Product.cpp:34: warning: the address of ‘QTextStream& endl(QTextStream&)’, will always evaluate as ‘true’ Product.cpp: In member function ‘void Product::setProductToSold()’: Product.cpp:45: warning: the address of ‘QTextStream& endl(QTextStream&)’, will always evaluate as ‘true’ #include <string> #include <iostre...

Benefits of exporting a class from a dll vs. static library

I have a C++ class I'm writing now that will be used all over a project I'm working on. I have the option to put it in a static library, or export the class from a dll. What are the benefits/penalties for each approach. The only one I can think of is compiled code size which I don't really care about. Thanks! ...

C++ from C#: C++ function (in a DLL) returning false, but C# thinks it's true!

Hi everyone, I'm writing a little C# app that calls a few functions in a C++ API. I have the C++ code building into a DLL, and the C# code calls the API using DllImport. (I am using a .DEF file for the C++ DLL so I don't need extern "C".) So far the API has one function, which currently does absolutely nothing: bool Foo() { return f...

Wrapping a Lua object for use in C++ with SWIG

Currently I know how to have C++ objects instantiated and passed around in Lua using SWIG bindings, what I need is the reverse. I am using Lua & C++ & SWIG. I have interfaces in C++ and objects in lua, that implement methods which do the same job and have the same structure. I would like to be able to instantiate these objects in lua y...

Shader limitations

I've been tuning my game's renderer for my laptop, which has a Radeon HD 3850. This chip has a decent amount of processing power, but rather limited memory bandwidth, so I've been trying to move more shader work into fewer passes. Previously, I was using a simple multipass model: Bind and clear FP16 blend buffer (with depth buf...

How to dynamically create a union instance in c++?

I need to have several instances of a union as class variables, so how can I create a union instance in the heap? thank you ...

[C++] Map functions of a class while declaring the functions

Hi, My previous question about this subject was answered and I got some tests working nice. http://stackoverflow.com/questions/1786809/c-map-functions-of-a-class My question is now, if there is a way to while declaring the function, be able to register it in a map, like I realized in this question about namespaces and classes: http://s...

How can I solve this median programming problem in C++

Formulate the steps of identifying the median from five unique numbers and visualize them in flow chart. Develop an application that shows the median after getting five unique numbers from users. Extend the feature for allowing six unique numbers input and computing the median. Example: Input: 5 4 2 1 10 Output: Median = 4 I found th...

Distribute C++ application as .exe or .msi?

I am looking for a program that can take the program I made in Visual C++ 2008 and distribute it in a mature installer for Windows. I want an application that is FREE (or trial). The setup and deployment folder is not there when a select File-->Add-->New Project ...

Heap Implementations

In a heap implementation of the ADT priority queue, the item with the highest priority value is always in the front or root of the array? Or is it, where the ADT priority queue that has the highest priority value is in the n-1 slot of the array? ...

Overloading Default Construction with Initializer List

I need to know how to get something to work. I've got a class with a constructor and some constants initialized in the initializer list. What I want is to be able to create a different constructor that takes some extra params but still use the initializer list. Like so: class TestClass { const int cVal; int newX; TestClass(i...

C++ dynamic allocated array

Hi, I'm doing some assignment and got stuck at one point here. I am trying to write an list_add() function. The first functionality of it is to add values to the array. The second functionality for it is to increase the size of the array. So it works much like a vector. I dunno if I get it right though. What I tried is to create a new dy...

C++, an "impossible" behavior

If you've been programming for a while then you probably noticed something completely impossible occurs every now and then for which you are convinced there is no possible explanation ("IT'S A COMPILER BUG!!"). After you find out what it was caused by though you are like "oooohhh". Well, it just happened to me :( Here AuthDb is NOT NUL...

std::time(0) performance

I was wondering what the performance implications are of using std::time(0) to seed random number generators. I assume that it's a system call (if not please correct me), which generally isn't the best option regarding performance. Assuming std::time(0) is used many times throughout a program, will there be severe performance implication...

Can I redefine a c++ macro for a few includes and then define it back?

I am using both the JUCE Library and a number of Boost headers in my code. Juce defines "T" as a macro (groan), and Boost often uses "T" in it's template definitions. The result is that if you somehow include the JUCE headers before the Boost headers the preposser expands the JUCE macro in the Boost code, and then the compiler gets hop...

Declaring a variable in an if-else block in C++

I'm trying to declare a variable in an if-else block as follows: int main(int argc, char *argv[]) { if (argv[3] == string("simple")) { Player & player = *get_Simple(); } else if (argv[3] == string("counting")) { Player & player = *get_Counting(); } else if (argv[3] == string("competitor")) { Player &...

How can I convert MP3 to PCM with C++?

Possible Duplicate: C\C++ open source Mp3 to PCM convertor What I want is some kind of library that can take an MP3 file and return the PCM as values (as numbers like 15, 654, 110, 4, ... ). No matter how long. It just returns them as values on their own or in an array and I don't care about other types (e.g. Ogg and WAV) and t...

QComboBox with single value: Select this value

I have a QComboBox which changes its selection possibilities depending on certain conditions. Because of special combinations, it might have only one selection left over, which has to be "confirmed" by the user, preferably by looking at all possible selections, seeing that there is only one, and then selecting this. My problem: If a us...