Last change
on this file since 2368 was 1571, checked in by ansari, 24 years ago |
Compil avec SunOS-CC et ajout test vector,map de la STL (vecmapstl.cc) - Reza 12/7/2001
|
File size:
809 bytes
|
Rev | Line | |
---|
[989] | 1 | #include <iostream.h>
|
---|
| 2 | #include <exception>
|
---|
| 3 | #include <string>
|
---|
[1571] | 4 | using namespace std;
|
---|
[989] | 5 |
|
---|
| 6 | #define ExcLongMessage(a) BuildFLExcMsg(a,__FILE__,__LINE__)
|
---|
| 7 |
|
---|
| 8 | inline string BuildFLExcMsg(const char * s, const char *file, int line)
|
---|
| 9 | {
|
---|
| 10 | char buff[32];
|
---|
| 11 | sprintf(buff," Line=%d", line);
|
---|
| 12 | string rs=s;
|
---|
| 13 | rs += " File="; rs += file; rs += buff;
|
---|
| 14 | return(rs);
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | class myException {
|
---|
| 18 | public:
|
---|
| 19 | myException(const char * s) {_msg= s;}
|
---|
| 20 | myException(string const & s) {_msg =s; }
|
---|
| 21 | // ~myExecption() {}
|
---|
| 22 | string Msg() { return _msg; }
|
---|
| 23 | private:
|
---|
| 24 | string _msg;
|
---|
| 25 | };
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 | class Toto {
|
---|
| 29 | public:
|
---|
| 30 | Toto(int n);
|
---|
| 31 | virtual ~Toto();
|
---|
| 32 | inline double Value(int k)
|
---|
| 33 | { if ((k<0) || (k>=size) )
|
---|
| 34 | throw( myException(ExcLongMessage("Toto::Value()-OutOfBound")) ) ;
|
---|
| 35 | else return(data[k]);
|
---|
| 36 | }
|
---|
| 37 | protected:
|
---|
| 38 | int size;
|
---|
| 39 | double * data;
|
---|
| 40 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.