|
From: <Wal...@va...> - 2002-04-22 15:04:33
Attachments:
pic06617.pcx
|
I am getting these errors/warnings, need some help please.
Walt
(Embedded image moved to file: pic06617.pcx)
This in .cpp file:
#include <iostream.h>
#include <stdlib.h>
#include <ctype.h>
#include "Temp.h"
void ShowCommands ();
int main ()
{
char command;
Queue<int>q;
queueElement item;
This is in the Temp.h file:
#include <iostream.h>
#include <stdlib.h>
#ifndef QUEUE
#define QUEUE
const int MAX=401;
int i;
template <class queueElement>
class Queue
{
private:
queueElement myArray[MAX];
int myFront;
int myBack;
public:
friend ostream& operator << (ostream&,
Queue<queueElement> &);
Queue(){myFront=0;myBack=0;};
bool empty();
void addQ(queueElement);
queueElement front();
void removeQ();
bool full();
};
#endif //end of class queu
"This e-mail message is intended only for the use of the named
recipient(s).
The information contained therein may be confidential or privileged, and
its
disclosure or reproduction is strictly prohibited. If you are not the named
recipient, please return it immediately to its sender at the above address
and destroy it."
|
|
From: Ioannis V. <no...@ho...> - 2003-02-06 12:08:14
|
I discussed templates with some other coder and here is a cool thing that=
we
discussed. A nice way of how to make calculations at compile time instead=
of
run-time. This method uses uses the template ability to pass *constant*
variables as template arguments:=0D
=0D
=0D
Check this out:=0D
=0D
#include <iostream>=0D
=0D
template<int N>=0D
struct factorial=0D
{=0D
static const int value =3D N*factorial<N-1>::value;=0D
};=0D
=0D
template<>=0D
struct factorial<0>=0D
{=0D
static const int value =3D 1;=0D
};=0D
=0D
=0D
int main()=0D
{=0D
std::cout<<factorial<5>::value<<std::endl;=0D
=0D
}=0D
=0D
=0D
I like this thing very much. We can reduce runtime space(recursions) /
time(recursions,iterations) costs elegantly (but increasing compile time)=
=2E=0D
=0D
=0D
Ioannis Vranos=0D
=0D
* Programming pages: http://www.noicys.freeurl.com=0D
* Alternative URL: http://run.to/noicys=20
|
|
From: Jason H. <jas...@bt...> - 2002-04-22 17:41:39
|
The queueElement idetifier has no relevance outside of the template class scope. Inside of the class
the compiler will sustitute the name for the relevent type that was specified for creation, in this
case it is int. You can treat the identifier as something similar to a typedef which is targeted at
that particular class.
There may also be a problem with the ostream friend declaration, but I'm not sure. I'd have to do
some research to figure it out.
Jason.
----- Original Message -----
From: <Wal...@va...>
To: <dev...@li...>
Sent: Monday, April 22, 2002 4:03 PM
Subject: [Dev-C++] templates
I am getting these errors/warnings, need some help please.
Walt
(Embedded image moved to file: pic06617.pcx)
This in .cpp file:
#include <iostream.h>
#include <stdlib.h>
#include <ctype.h>
#include "Temp.h"
void ShowCommands ();
int main ()
{
char command;
Queue<int>q;
queueElement item;
This is in the Temp.h file:
#include <iostream.h>
#include <stdlib.h>
#ifndef QUEUE
#define QUEUE
const int MAX=401;
int i;
template <class queueElement>
class Queue
{
private:
queueElement myArray[MAX];
int myFront;
int myBack;
public:
friend ostream& operator << (ostream&,
Queue<queueElement> &);
Queue(){myFront=0;myBack=0;};
bool empty();
void addQ(queueElement);
queueElement front();
void removeQ();
bool full();
};
#endif //end of class queu
"This e-mail message is intended only for the use of the named
recipient(s).
The information contained therein may be confidential or privileged, and
its
disclosure or reproduction is strictly prohibited. If you are not the named
recipient, please return it immediately to its sender at the above address
and destroy it."
|
|
From: Yeoh H. <ye...@ye...> - 2002-04-23 06:47:52
|
<begin extract> WASP Server for C++ is a small, embeddable solution that brings the advantages of Web Services to the world of C and C++. A flexible runtime framework based on standard SOAP and WSDL ensures seamless integration with existing solutions. WASP Server for C++ also includes a number of advanced features that set it above the competition, including security, rich type mapping, extensibility, remote references, extensibility, and portability. WASP Server for C++ performs dynamic and automatic data type mapping between C++ and XML, supporting simple and complex datatypes and objects. WASP Server for C++ supports a variety of configuration options and extensions. WASP services can run stand-alone, or they can be deployed within a Web server. The environment supports custom datatypes, custom encodings, custom serialization modules, and custom authentication and authorization mechanisms. A feature unique to WASP, remote references allow a Web Service to pass a reference to another Web Service over the SOAP. Remote references are critical to many distributed computing design patterns, particularly the Factory pattern, which is used in many enterprise-class application systems. WASP Server for C++ comes with a convenient API and a set of command-line code generation tools that give developers a strong foundation for building portable Web Services. WASP Server for C++ is supported on Microsoft Windows CE/95/98/NT/2000/XP, Linux, and Sun Solaris. The core SOAP stack is available as Open Source, allowing users to port WASP Server for C++ to additional platforms as desired. <end extract> The URL is: http://www.systinet.com/products/overview.html#c++ Regards, Yeoh ~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~ Author of "How to Create an eBook Using Visual C++" Free Downloads at http://www.yeohhs.com ICT eBooks by Yeoh HS ~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~ |
|
From: Ioannis V. <no...@ho...> - 2002-04-25 06:33:26
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Wal...@va...
> Sent: Monday, April 22, 2002 6:03 PM
> To: dev...@li...
> Subject: [Dev-C++] templates
>
>
> I am getting these errors/warnings, need some help please.
> Walt
>
> (Embedded image moved to file: pic06617.pcx)
>
>
> This in .cpp file:
>
> #include <iostream.h>
#include <iostream>
> #include <stdlib.h>
> #include <ctype.h>
> #include "Temp.h"
>
> void ShowCommands ();
>
> int main ()
> {
>
> char command;
> Queue<int>q;
> queueElement item;
There is no type queueElement.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|