Questions for c++


Quadtree and size of region in constructor

I was reading nice tutorial about Quadtree from

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...

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...

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:

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

I was reading a paper on "Perils of double check locking by Scott Meyers".

How to forbidden using object to static member function

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

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

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?...

C++ - Random seed at runtime

How can I generate different random numbers at runtime?

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

deleting a char array with cast to char*?

Which of these should be used?

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 :

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:

Multi Pointer X (MPX) support

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

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...

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:

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...

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.

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.

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

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...

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

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

C++: tall class hierarchies

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

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.

How to do a simple C++ generic callback?

Say I have the following code:

Call constructor from constructor in C++

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

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...

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...

how to convert unsigned char* to integer fast,

In my project i wrote such function for conversion:

Uncorrelated parallel random seeds with C++ 2011?

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

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?

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.

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.

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...

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.

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).

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?

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?...

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 ...

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

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

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?

QAbstractItemModel and QTreeView

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

Ambigous call to a function

I have four functions:

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?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.