Questions for c++


8697

Quadtree and size of region in constructor

I was reading nice tutorial about Quadtree from
4994

Is it good practice to bind shared pointers returned by functions to lvalue references to const?

Although it took me a while to get used to it, I now grew the habit of letting my functions take shared pointer parameters by lvalue-reference to const rather than by value (unless I need to modify...
5591

How to extend and use members of a superclass in c++?

I'm trying to code a class to handle joystick input (irrelevant), and being rusty on inheritance and new to c++ I'm having some confusion while trying to create a subclass of my joystick class. Her...
8921

Creating own float structure in C++

Yet my lectures in C++ at university began yet i got my first problems. Our task was it to implement a self made structure in C++ for floating points via the IEEE 754 standard:
7941

C++ and the Perils of Double-Checked Locking : Workaround?

I was reading a paper on "Perils of double check locking by Scott Meyers". http://www.aristeia.com/Papers/DDJ_Jul_Aug_2004_revised.pdf
5973

How to forbidden using object to static member function

I have a simple class, and a static member function:
9159

Escape sequence \f - form feed - what exactly is it?

\f is said to be the form feed. \t is a tab, \a is a beep, \n is a newline. What exactly is a form feed - \f? The following program
939

Creating a 6 bit crc using boost

I'm new to CRCs, boost and more of a java developer for that matter. I'm trying to use the the crc.hpp boost library to create a 6 bit crc calculated based on only two bits. First is this possible?...
7069

C++ - Random seed at runtime

How can I generate different random numbers at runtime?
4176
653

protected ifstream member

I am close to completion of my first OOP project, coming from a C background. I was wondering a design issue related to some ifstream object that I use in the base class to open a file. After that I
737

deleting a char array with cast to char*?

Which of these should be used?
1436

Swap elements in array to reverse an array

I got an assignment to reverse an dynamic array in C++. So far, from my logic, I thinking of loop thru the array to reverse it. And here comes my code :
7359

Use value of string for wide string when declaring constants in C++

Using defines I am able to declare a wide string that uses the value of regular string as follows:
3353

Multi Pointer X (MPX) support

I'm wondering how multiple pointers should/could be handled by a high level application.
3359

How to use makefiles in Visual Studio?

I heard a lot about makefiles and how they simplify the compilation process. I'm using VS2008. Can somebody please suggest some online references or books where I can find out more about how to d...
1356

What am I doing wrong with this pointer cast?

I'm building a GUI class for C++ and dealing a lot with pointers. An example call:
674

c++ registry not getting second value

why is this not working? the first RegGetValue puts correct values in value variable, the second doesn't, however if I comment the first RegGetValue the second will then work and put the correct co...
9604

Read char from txt file in C++

I have a program that will read the number of rows and columns from a txt file. Also, the program has to read the contents of a 2D array from the same file.
7729

Saving pointers to file in C++

I'm developing a game for a course at my school. One of the assignments is to enable saving the game to a file and later load the game from the same file.
9922

Is porting from Android to Windows Phone possible without using emulator?

I have a C++ source code of the game for Android. I want to port it to a Windows Phone. I hope it mean only change an API for platform-specific calls. The problem is that I cannot use SDK 8 Emulator
201

Timeouts on read and writes

I have been searching for a way to cancel a Boost ASIO read or write operation if it takes over a certain amount of time. My server is sending out HTTP requests, and reading results from those req...
3001

How to allocate from heap with the correct memory alignment for InterlockedIncrement function?

This code seems to work, but have I used the InterlockedIncrement function correctly? The correct memory alignment of m_count is of my primary concern. Assume we're on a x86-64 system and compile a
4005

C++ design - Network packets and serialization

I have, for my game, a Packet class, which represents network packet and consists basically of an array of data, and some pure virtual functions
4750

C++: tall class hierarchies

What are the run time disadvantages of having a tall class hierarchy?
6389

c++ std::vector.insert crashes on debug but works on release

My program crashes on this line but only in debug build, it works fine in release build.
4845

How to do a simple C++ generic callback?

Say I have the following code:
5394
1035

Call constructor from constructor in C++

As a C# developer I'm used to run through constructors:
6370

How to decide when to implement a C++ template?

I'm coming from C, and getting deeper and deeper into C++. Using the container classes of the standard library, as-well as the smart pointer classes from the boost library, I've had my first introd...
7407

C++ symbol referencing error

I've been trying to find what the problem is to this following code part. I've written a custom exception class where I have a base class for stack errors, and then some classes deriving from it on...
9805

how to convert unsigned char* to integer fast,

In my project i wrote such function for conversion:
9209

Uncorrelated parallel random seeds with C++ 2011?

Currently, I have a main application in Fortran that need a seed to generate pseudo-random numbers.
7337

Borland / Delphi alternative to __super keyword

Keyword __super is Microsoft specific. It is used to access virtual methods of parent class. Do you know alternative keywords for borland c++ / delphi compilers?
6280

learn C or C++ - best methods?

I want to learn computer vision using specifically C or C++. I am a pretty strong coder, but I'm used to high level languages like python, etc.
7203

Qt Application hangs on exit (after QDialog exec)

I'm using Qt to build a UI and I need to have a dialog window show up before the main app window, so that the user can select some files to load ans things like that.
8419

Not Able to Install when Newer Version of Prerequisites are Present

I have a c# solution that includes a c++ project accessed as a COM object. I am building this in VS 2010, and have created a Windows Installer to install the program. The application is 64 bit, and...
7080

C++ Templates: Pass Type, not instance?

Templates may not be the answer here but I tried some inheritance and that didn't work so here is where I am at.
1168

How do I change the ACLs on a registry key? (C++)

I need to delete a regsitry key. It has a deny ACL on Set Value (I need this permission to delete it).
9523

Calling c function in a lib file from c++

I have to call a c function declared in a lib file from c++. What instructions/attributes/configuration I have to set for this?
3445

C++ abstract classes

I am new to C++, I coded in Java for an year. The equivalent in C++ for interfaces and abstract classes alike is only abstract classes. Is that supposed to be a handicap while doing factory design?...
694

How to get input from audio jack in Windows?

I'm attempting to create a Windows application that will allow the controls on earbuds/headphones that have them (such as the Nokia Purity earbuds) to work on Windows. I would think that there are ...
6579

Is there any way to use operator overloading in dynamic C++ object

I want to use operator overloading with dynamic object in C++
9066

implementation of the set

Is it possible to find in the net the full implementation of the STL Set, particularly I'm interested in the iterator?
5096

QAbstractItemModel and QTreeView

I need working examples (c++) of show own data model in QtreeView.
3982

Ambigous call to a function

I have four functions:
8744

Multiple QMainWindow instances?

The QMainWindow is the main window in a Qt application. So usually you'd have only one, but would it be possible at all to have multiple QMainWindow instances in your application?