OON: RE: Barton & Nackman Trick

From: Gilbert, Peter (Peter.Gilbert@compaq.com)
Date: Fri Sep 07 2001 - 19:42:08 EST


Seems clear enough. I think you want:

class StructuredMesh : public Mesh<StructuredMesh<T_number,Dim> > {

-----Original Message-----
From: Luis Miguel De La Cruz Salas [mailto:lmd@labvis.unam.mx]
Sent: Thursday, September 06, 2001 1:51 PM
To: oon-list@oonumerics.org
Subject: OON: Barton & Nackman Trick

Hi,
        someone knows if the Barton & Nackman Trick works fine in SGI
MIPS
        Pro compiler?.

        I'm tryin to compile the next code:
---------------------------------------------------------------------
        template<class T_mesh>
        class Mesh {
        public:
                Mesh() {
                        Dimension = asLeaf().getDimension();
                            cout << " Mesh: Dimension = " << Dimension <<
endl; }

                    ~Mesh() {}

                    T_mesh& asLeaf() { return static_cast<T_mesh&>(*this); }

        protected:
                    int Dimension;
        };

        template<class T_number, int Dim>
        class StructuredMesh : public Mesh<StructuredMesh> {
        public:
                    StructuredMesh() {
                            Dimension = Dim;
                            cout << " StructuredMesh: Dimension = " <<
Dimension << endl; }

                    ~StructuredMesh() {};

                    int getDimension() { return Dim; }

        };

        // in main.cc
        ...
        StructuredMesh <double, 3> grid;
        ...
---------------------------------------------------------------------
        This is the error I get:

cc-1420 CC: ERROR File = ./../include/StructuredMesh.h, Line = 38
  An argument list for class template "StructuredMesh" is missing.

  class StructuredMesh : public Mesh<StructuredMesh>
                                     ^

cc-1420 CC: ERROR File = ./../include/StructuredMesh.h, Line = 38
  An argument list for class template "StructuredMesh" is missing.

  class StructuredMesh : public Mesh<StructuredMesh>
                                     ^
          detected during instantiation of class "StructuredMesh<double,
3>"
                    at line 32 of "./prueba.cpp"

2 errors detected in the compilation of "./prueba.cpp".
make: *** [prueba.o] Error 2

Thanks in advance,

Luis M. de la Cruz

--------------------- Object Oriented Numerics List
--------------------------
* To subscribe/unsubscribe: use the handy web form at
http://oonumerics.org/oon/
* If this doesn't work, please send a note to
owner-oon-list@oonumerics.org

--------------------- Object Oriented Numerics List --------------------------
* To subscribe/unsubscribe: use the handy web form at
http://oonumerics.org/oon/
* If this doesn't work, please send a note to owner-oon-list@oonumerics.org



This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 03:20:16 EST