General C++ Programming - July 2010 (Page 9)

Operator function taking references shall accept literals too
 
Hi, I'm working on an output stream class just like ostream. For formatted output I use the << operator taking a reference as argument (e.g. "&int"). Now ...
[9 replies] Last: In the documentation of this site it looks like it did use references... (by Bazzy)
by export
Drawing shapes in OpenGL
 
I have the following code which draws a ball and a cube. The ball works perfectly, but the cube wont show in the top half of the screen. #include <GL/glut.h> ...
[3 replies] Last: Now the cube is very low below the camera. Try changing line 2 to (0, ... (by hamsterman)
static and extern keywords
 
I am confused in static and extern keywords When we declare static variable i in one file a.cpp and then use extern THAT VARIABLE i in b.cpp than what ope...
[1 reply] : FileA.cpp #include <iostream> static int i; // This variable rest... (by guestgulkan)
by NGen
Processing Lists
 
In my game I'm taking a list of function pointers that are called within a loop to get everything processed correctly. My problem occurs when a function calls ...
[3 replies] Last: What you could do is set your list element to a null function pointer,... (by Galik)
C++ instance class changing?
 
Ok so I'm writing a chess game- which you can see here https://sourceforge.net/projects/ultifi-chess/ Essentially my problem is with the pawn...
[3 replies] Last: That is EXACTLY what I was looking for! Thank you so much! (by ultifinitus)
sfml multithreading
 
I'm currently working on a CLI based audio player. But I'm having trouble with sfml's threading class. I've privately inherited sf::Thread and overridden th...
[1 reply] : Nevermind, I fixed it. The main thread was finishing before the input ... (by Seraphimsan)
template question
 
bool Compare2( S * s1, S * s2) You need to pass pointers as you can see, so this should fix it; a.STest(&d1, &d2); and also; static bool STest( ...
[5 replies] Last: Can we delete a particular row from a 3*3 dimensional vector?? if yes ... (by sshresth01)
error C2228: left of '.b' must have class/struct/union type
 
Dear experts, I am getting the error mentioned in the Title. #include<iostream.h> struct ABC { ABC() { } int a; }; templa...
[1 reply] : 1) The header is called iostream, not iostream.h 2a) "class interface... (by Athar)
Problem with template classes
 
I have this classes: class FunctMenuScreen { public: virtual ~FunctMenuScreen() = 0; virtual void operator()() = 0; }; template<class FunctObj> ...
[4 replies] Last: Thank you. How could I possible forget that!!! Thank you very much. (by fisher55)
by jwolfe
Dynamic memory issues
 
I'm working on a dynamic stack, and I keep getting a heap corruption error when expandStack() is called. const int INIT_STACK = 200; class stack { private...
[4 replies] Last: Awesome. Thanks for your help! For anyone interested, the final versi... (by jwolfe)
How to Compare two strings??
 
I want a method to compare two strings in c++. Is there a method like ".equals()" in java to compare strings in c++?? I got stuck with this matter in my prog...
[3 replies] Last: Yes you can do it like that. You can also use the built in comparison ... (by mcleano)
by Null
uncaught exception handler?
 
Is it possible to write a custom exception handler for uncaught exceptions? I have this code: #include <exception> using namespace std; class exception:...
[2 replies] Last: OK, thanks. (by Null)
by amiref
What is the problem of my code ?
 
In this code , Although I dont use from reference (&) in overloading "=" operator but my code doing correct . what is problem ?
[3 replies] Last: Well, since you're passing op2 by value in operator=, the object is co... (by Athar)
by amiref
friend function and operator overloading
 
hi my friend why we can not use friend function to overload the "=" operator ? tnx
[3 replies] Last: Because operators are meant to keep their original meaning, this way y... (by Bazzy)
no heap memory for short strings? 0-short?
 
I was reading something like 'std::string doesn't use free store (heap storage) for short strings'. It made me question if it's been implemented in any of STL i...
[4 replies] Last: The implementers are free to make it as they wish. E.g. this way: ... (by xoreaxeax)
by amiref
&&& BIG Problem In Operator Overloading &&&
 
Hello Everybody I Have A Question . Suppose That We Have This Class : ///////////////////////////////////////////////////////////////////////////// clas...
[9 replies] Last: I have question in that link that Grey Wolf said in above topic : W... (by amiref)
splitting a string into sub strings( word segments)
 
I have used a method called istringstream to split the string input into word segements.And it was successful. But the problem is it displays the end word seg...
[2 replies] Last: Thanks a lot. It works. I have just understood the mistake i have done... (by rutharanga)
Parsing command line arguments to main and for a function other than main
 
hey guys, this programme works when I'm not using a separate function 'genWordSeg' and writing it only using main(). But when i'm going to do it according ...
[3 replies] Last: Thanks a lot you both.... Actually these are the only errors that i c... (by rutharanga)
Objective - C
 
My primary goal is to work on macintosh and iphone application development. I currently know basic C++ and I was wondering if I should move to Objective - C.
[10 replies] Last: hey OP...and everyone else for that matter, have you guys not heard of... (by cole321)
Hashtables: Any optimization when objects are not deleted ?
 
I recently read about perfect hashtables which guarentee O(1) worst case time. But I was crushed on reading that it requires that all the objects be known in ad...
[6 replies] Last: @DexterMorgan The two classes differ in the internal data structure th... (by mtrenkmann)
July 2010 Pages: 1... 7891011... 20
  Archived months: [jun2010] [aug2010]

This is an archived page. To post a new message, go to the current page.