help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Template Defintitions


From: mrobinson
Subject: Template Defintitions
Date: 9 Oct 2006 09:07:59 -0700
User-agent: G2/1.0

I am in the process of porting a C++ application built with MS Visual
Studio .NET to g++ 3.4.3 and am slowly moving thru the compilation
warnings and errors. I have come upon a error which I am trying to
solve (I believe related to Template defintion). In ArrayDataType.cxx
(at the bottom) the ArrayVector type is somehow not in scope (I assume
because the compiler reports a syntax error before the ; on the
ArrayVector::const_iterator itr; line in ArrayDataType.cpp). The
following source code extract defines the problem and I would
appreciate any recommendations.

ArrayDataType.h
==========================================
    namespace FAII
    {
        template <class T>
        class ArrayDataType : public DataType
            {
            public:
                typedef std::vector<T*> ArrayVector;

            // Constructors and destructor
            public:
                ArrayDataType(const FAIIstring& elementName);
                ArrayDataType(const ArrayDataType<T>& other);
                virtual ~ArrayDataType() = 0;

            private:
                // No default ctor
                ArrayDataType();

                // Attributes
            protected:

                // The array
                ArrayVector m_array;
            };
    };


-------------------------------------------------------------------------------------------------------
ArrayDataType.cxx
==========================================
#include "ArrayDataType.h"

template <class T>
FAII::ArrayDataType<T>::~ArrayDataType()
{
  ArrayVector::const_iterator itr;
  for (itr = m_array.begin(); itr != m_array.end(); itr++)
    delete (*itr);
  m_array.clear();
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]