[EMAIL PROTECTED] wrote:
> namespace FAII
> {
> template <class T>
> class ArrayDataType : public DataType
> {
> public:
> typedef std::vector<T*> ArrayVector;
Note that ArrayVector is a "dependant type".
> ArrayDataType(const FAIIstring& elementName);
Just as a side notice: this should be 'explicit'.
> };
^ right&necessary
> };
^ wrong (probably ignored by the compiler nonetheless)
> #include "ArrayDataType.h"
>
> template <class T>
> FAII::ArrayDataType<T>::~ArrayDataType()
> {
> ArrayVector::const_iterator itr;
Okay, here's the problem: since 'ArrayVector' is a dependant type, you need
to use 'typename' here:
typename ArrayVector::const_iterator itr;
> for (itr = m_array.begin(); itr != m_array.end(); itr++)
> delete (*itr);
> m_array.clear();
> }
BTW: I think you would be better off using a ready-made container like e.g.
those in Boost. Also, prefer putting indices/iterators into the loop's
header and use prefix increment rather than postfix, but that's just
common C++ sanity.
Uli
--
http://gcc.gnu.org/faq.html
http://parashift.com/c++-faq-lite/
_______________________________________________
help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus