I have setup the following header file to create a Stack which uses an Array. I get the following at line 7:
error: ISO C++ forbids declaration of 'Stack" with no type.
I thought the type was the input value. Appreciate your help. Thank you.
#ifndef ARRAYSTACKER_H_INCLUDED
#define ARRAYSTACKER_H_INCLUDED
// ArrayStacker.h: ...
I'm using Visual Studio 2008 with Feature Pack 1.
I have a typedef like this typedef std::tr1::tuple<std::string, std::string, int> tileInfo
with a function like this const tileInfo& GetTile( int x, int y ) const.
In the implementation file the function has the exact same signature (with the added class name qualifier) and I am gettin...
Hi,
On page 57 of The Design and Evolution of C++, Dr. Stroustrup talks about a feature that was initially part of C with Classes, but it isn't part of modern C++(standard C++). The feature is called call/return. This is an example:
class myclass
{
call() { /* do something before each call to a function. */ }
return() { /* do somet...
Is this possible? I wanted to convert this into a char* so I could later retrieve this values.
...
I created a ActiveX control using ATL, already package it with signature.
I want to use it on the webpage, but at the install window the name is MyActiveX.cab with no link. the MyActiveX.cab name can be changed by modifying the html page's tag codebase attribute. but the name is still format like "XXX.cab" with no hyperlink.
I find a a...
This might be a dumb question but I've spent some time asking Google and haven't been able to find anything.
I have an an OSX OpenGL app I'm trying to modify. When I create the app a whole
bunch of initialisation functions are called -- including methods where I can specify my own mouse and keyboard handlers etc. For example:
glutInit(...
C# has generic function types such as Action<T> or Func<T,U,V,...>
With the advent of C++0x and the ability to have template typedef's and variadic template parameters, it seems this should be possible.
The obvious solution to me would be this:
template <typename T>
using Action<T> = void (*)(T);
however, this does not accommodate f...
Does anyone know of a good c++ library that can provide a line-based unified diff?
...
I have a section of code where the user enters input from the keyboard. I want to do something when ENTER is pressed. I am checking for '\n' but it's not working. How do you check if the user pressed the ENTER key?
if( shuffle == false ){
int i=0;
string line;
while( i<20){
cout << "Playing: ";
songs[i]->prin...
Possible Duplicates:
C++ method only visible when object cast to base class?!
Why does an overridden function in the derived class hide other overloads of the base class?
#include <iostream>
using namespace std;
class A
{
public:
virtual void foo(void) const { cout << "A::foo(void)" << endl; }
virtual void foo(int ...
Possible Duplicate:
Uses for multiple levels of pointer dereferences?
I have used functions with doubly dereferenced pointers (**var) to return values. However, I was recently asked a question to figure out a use-case where a triple dereferencing (***var) may be needed. I couldn't think of any practical scenario. Does anyone h...
Hello,
I have a complex grammar (in antlr 2.7) which I need to extend. Having never used antlr before, I wanted to write a very simple Lexer and Parser first.
I found a very good explanation for antlr3 and tried to adapt it:
header{
#include <iostream>
using namespace std;
}
options {
language="Cpp";
}
class P2 extends...
Here is the program...
class CopyCon
{
public:
char *name;
CopyCon()
{
name = new char;
}
CopyCon(const CopyCon &objCopyCon)
{
name = new char;
_tcscpy(name,objCopyCon.name);
}
~CopyCon()
{
if( name != NULL )
{
delete name;
name = NULL;
}
}
};
int main()
{
CopyCon objCopyCon1;
objCop...
I was just checking an answer and realized that CHAR_BIT isn't defined by headers as I'd expect, not even by #include <bitset>, on newer GCC.
Do I really have to #include <climits> just to get the "functionality" of CHAR_BIT?
...
I have a Point2D class as follows:
class Point2D{
int x;
int y;
public:
Point2D(int inX, int inY){
x = inX;
y = inY;
};
int getX(){return x;};
int getY(){return y;};
};
Now I have defined a class Line as:
class Line {
Point2D p1,p2;
public:
LineVector(c...
I am trying to open a file which normally has content, for the purpose of testing i will like to initialize the program without the files being available/existing so then the program should create empty ones, but am having issues implementing it. This is my code originally
void loadFiles() {
fstream city;
city.open("city.txt", ios::...
I've been given some Symbian C++ code to port over for use with the Android NDK.
The code has lots of Symbian specific code in it and I have very little experience of C++ so its not going very well.
The main thing that is slowing me down is trying to figure out the alternatives to use in normal C++ for the Symbian specific code.
At th...
Hello all.
I'm trying to find a good and effective way to parse an XML data structure that different API calls are returning. The problem is that each time I need different data and each time I'm getting a different XML structure. Which is better: to use the SAX approach or The DOM approach? Does QT 4.6 recommend or work better with o...
I read this typedef line in a C++ book, but I couldn't resolve its meaning:
typedef Shape* (*CreateShapeCallBack)();
Now, CreateShapeCallBack stands for what, any idea?
Thanks.
...
hello,
I am signaling my Qt GUI thread from a boost::thread, and I am using a Qt::QueuedConnection,
connect(src, SIGNAL(signal-signature), dest, SLOT(slot-signature), Qt::QueuedConnection);
and still, when I emit the signal my slot does not get called.
edit: I found the problem, it seems that I was connecting the signal later then ...