Borland C++ Builder issues

I cannot compile this code using Borland C++ Builder 5 Enterprise edition. The existing code was built using Borland C++ Builder 4 Enterprise edition. I get the error:
[C++ Error] Option.h(10): E2015 Ambiguity between 'TStack<T>' and 'Contnrs::TStack'
The offending line is:
This file that has the offending code is option.h
// Stack of boolean pointers.
// eg Utilised by TOptions::FEnterAsTab which keeps a stack of flags
// which determines if the numeric keypad's enter key should be used
// as a tab key. This stack allows for the nesting of forms.
class PACKAGE TBoolStack : public TStack<bool*> {
  public:
    TBoolStack();
    ~TBoolStack();
};

The cpp file that is being compiled has the below code:
#include "HsComponents.h"
#pragma hdrstop
USEFORM("HsDatePickFrm.cpp", HsDatePickForm);
USEFORM("Notice.cpp", NoticeForm);
USEFORM("FindF.cpp", FindForm);
USEFORM("FEditMacro.cpp", frmEditMacro);
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------

// MacroRecord
// MacroRecord
/* AW */
/*
TMacroRecord MacroRecord;
int MacroRecording;
TString Data;
EVENTMSG EventMsg;
long Bytes;
*/
/* AW delete above */
TMacros *Macros = NULL;
THistorys *HistoryFile = NULL;
TOptionsFile *OptionsFile = NULL;

TOptions *Options = NULL;
TBasePtr<TAgentInfo> AgentInfo;
TBasePtr<TProgram> Program;

const TString BlankString;

//---------------------------------------------------------------------------
//   Package source.
//---------------------------------------------------------------------------
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
  return 1;
}
//---------------------------------------------------------------------------

Can you please help urgently:

The attached code snippet is the declaration of the TStack.

I will also display the option.h file code:
//---------------------------------------------------------------------------
#ifndef OptionsH
#define OptionsH

//---------------------------------------------------------------------------
// Stack of boolean pointers.
// eg Utilised by TOptions::FEnterAsTab which keeps a stack of flags
// which determines if the numeric keypad's enter key should be used
// as a tab key. This stack allows for the nesting of forms.
class PACKAGE TBoolStack : public TStack<bool*> {
  public:
    TBoolStack();
    ~TBoolStack();
};

//---------------------------------------------------------------------------
// User options support class that encapsulates access to the user options
// (TOptionsTable) stored in the user options file (TOptionsFile).
// Each program will inherit from this class, and instantiate a global object at program startup.
// Each program will specify options which are for that program only.
// This class contains options that are common to all HandiSoft programs.
class PACKAGE TOptions {
  public:
    enum oClientNameStyle {
      oLastNameLong,
      oLastNameMedium,
      oLastNameShort,
      oOrderedNameLong,
      oOrderedNameMedium,
      oOrderedNameShort,
      oBizName1,
      oBizName2,
      oCasualName,
      oCasualDearName,
      oFormalDearName,
      oTotClientNameStyle
    };

 
    enum oClientsOrder {
      oRef,
      oName,
      oTfn,
      oTotClientsOrder
    };

  private:
    TOptionsTableList OptionsList;
    THsProgram FProgram;
    TString FUserName;

    // User options.
    int FClientsOrder;
    int FClientNameStyle;
    int FTextCapitals;
    char FCliRefStart;
    TString FLabelSetup;
    TString FFontSetup;
    TString FPageSetup;
    TString FDocuments;
    TString FWordDirectory;
    bool FUseEnterAsTab;
    TBoolStack FEnterAsTab;
    bool FViewOutputExport;

    // Common options.
    TString FSuperPassword;
    TString FOpPassword;
    TString FReportUpdate;
    int FLogLimit;
    bool FEnableSecurity;

    void UpdateFontSetup();
    void SetGlobalTextCapitals();

     // ELS Modem Options
    TString FModemDeviceName;
    bool FModemLogFile;
    bool FModemHexLog;
    TString FModemPhoneNo;
    bool FElsShowDetails;

    // ELS Security
    int FSecurityPassword;
    int FSecurityAustpac;
    int FSecurityCeg;
    TString FSecurityNewPassword;
    TString FSecurityCurrentPassword;
    TString FSecurityPasswordAt;
    TString FSecurityPasswordOn;
    TString FSecurityNewNui;
    TString FSecurityCurrentNui;
    TString FSecurityNuiAt;
    TString FSecurityNuiOn;
    TString FSecurityUserId;
    TString FSecurityUserIdAt;
    TString FSecurityUserIdOn;
    TString FSecurityCegNo;
    // Agents
    int FAgents;
    TString FAgentsInfo[4];

    // Registration details
    TString FOfficeLodgment;
    int FOfficeLodgmentIndex;
    bool FTestLodge;
    bool FDefaultTestLodge;
    int FTransmitterNo;

    bool FImportedDosTaxOptions;


    // Change Client Reference
    bool FChangeClientRef;

    // Main form's state, position and size.
    int FMainFormLeft;
    int FMainFormTop;
    int FMainFormHeight;
    int FMainFormWidth;
    bool FMainFormStateNormal;

    TString FHtmlSetup, FRichTextPrefs;
    TString FReportFormPos, FClientsFormPos;

    // Grid setup
    bool FColoredRows, FHorGridlines, FVerGridlines;
    int FGridCol1, FGridCol2, FGridlinesCol;
    TString FCustomCol;
    int FEditCol, FIconBarCol;

    // document manager
    bool FUseDocMan;
    bool FUseMyDocs;
    TString FMyDocsDirectory;
    bool FIsProspective;

  protected:
    // Available options styles.
    // 1. User:        Separate options for each user in each program (eg. Selected client).
    // 2. Common:      Common to a program (eg. HandiMan Units Per Hour).
    // 3. CommonBase:  All users share a common option for all programs (eg. Supervisor password).
    // 4. CommonUser:  Each user has a common option for all programs (eg. HandiContact selected client).
    enum TOptionsStyle {
      osUser,
      osCommon,
      osCommonBase,
      osCommonUser
    };

    TString GetName(TOptionsStyle Style);
    char GetProgram(TOptionsStyle Style);

    virtual void ReadUserOptions();
    virtual void WriteUserOptions();

    THsProgram GetCurrentProgram() {return FProgram;}

    bool BaseRead(TOptionsStyle Style, const char *Key, TString &Value);
    void ReadBool(TOptionsStyle Style, const char *Key, bool &Value);
    void ReadString(TOptionsStyle Style, const char *Key, TString &Value);
    void ReadShort(TOptionsStyle Style, const char *Key, short &Value);
    void ReadInt(TOptionsStyle Style, const char *Key, int &Value);
    void ReadLong(TOptionsStyle Style, const char *Key, long &Value);
    void ReadMoney(TOptionsStyle Style, const char *Key, TMoney &Value);
    void ReadDouble(TOptionsStyle Style, const char *Key, double &Value);
    void ReadDate(TOptionsStyle Style, const char *Key, THsDate &Value);
    void ReadTime(TOptionsStyle Style, const char *Key, THsTime &Value);
    void ReadChar(TOptionsStyle Style, const char *Key, char &Value);

    void BaseWrite(TOptionsStyle Style, const char *Key, TString OrigValue, TString NewValue);
    void WriteBool(TOptionsStyle Style, const char *Key, bool OrigValue, bool NewValue);
    void WriteString(TOptionsStyle Style, const char *Key, TString OrigValue, TString NewValue);
    void WriteShort(TOptionsStyle Style, const char *Key, short OrigValue, short NewValue);
    void WriteInt(TOptionsStyle Style, const char *Key, int OrigValue, int NewValue);
    void WriteLong(TOptionsStyle Style, const char *Key, long OrigValue, long NewValue);
    void WriteMoney(TOptionsStyle Style, const char *Key, TMoney OrigValue, TMoney NewValue);
    void WriteDouble(TOptionsStyle Style, const char *Key, double OrigValue, double NewValue);
    void WriteDate(TOptionsStyle Style, const char *Key, THsDate OrigValue, THsDate NewValue);
    void WriteTime(TOptionsStyle Style, const char *Key, THsTime OrigValue, THsTime NewValue);
    void WriteChar(TOptionsStyle Style, const char *Key, char OrigValue, char NewValue);
  public:
    TOptions(THsProgram Program, TString UserName);
    virtual ~TOptions();

    void Load();

    // User specific option: Returns the current index order to be used for client browsing.
    int GetClientsOrder() { return ((FClientsOrder >= 0) && (FClientsOrder < oTotClientsOrder)) ? FClientsOrder : 0; }
    // User specific option: Returns the current name style to be used for client names (eg John Smith, or Smith John, etc).
    int GetClientNameStyle() { return ((FClientNameStyle >= 0) && (FClientNameStyle < oTotClientNameStyle)) ? FClientNameStyle : 0; }
    int GetTextCapitals();
    // User specific option: Returns the fifth character to be used in automatically generated client references.
    char GetCliRefStart() { return FCliRefStart; }
    // User specific option: Returns mailing labels setup.
    TString GetLabelSetup() { return FLabelSetup; }
    TString GetFonts(bool DefaultOnly = false);
    // User specific option: Returns available fonts.
    TString GetFontSetup() { return FFontSetup; }
    // User specific option: Returns a particular font's name.
    TString GetFontName(int Font, const TString &FontSetup) { return FontSetup.AsciiWord(Font, ';').AsciiWord(1, ','); }
    // User specific option: Returns a particular font's size.
    TString GetFontSize(int Font, const TString &FontSetup) { return FontSetup.AsciiWord(Font, ';').AsciiWord(2, ','); }
    // User specific option: Returns a particular font's attributes (eg bold).
    TString GetFontAttributes(int Font, const TString &FontSetup) { return FontSetup.AsciiWord(Font, ';').AsciiWord(3, ','); }
    // User specific option: Returns the number of fonts.
    int GetFontCount(const TString &FontSetup) { return FontSetup.AsciiWords(';'); }
    void SetFontCombo(TComboBox *ComboBox);
    TString GetPages(bool DefaultOnly = false);
    // User specific option: Returns the page setup.
    TString GetPageSetup() { return FPageSetup; }
    // User specific option: Returns a particular page name.
    TString GetPageName(int Page, const TString &PageSetup) { return PageSetup.AsciiWord(Page, ';').AsciiWord(0, ','); }
    // User specific option: Returns a particular page printer.
    TString GetPagePrinter(int Page, const TString &PageSetup) { return PageSetup.AsciiWord(Page, ';').AsciiWord(1, ','); }
    // User specific option: Returns a particular page size.
    int GetPageSize(int Page, const TString &PageSetup) { return atoi(PageSetup.AsciiWord(Page, ';').AsciiWord(2, ',')); }
    // User specific option: Returns a particular page count.
    int GetPageCount(const TString &PageSetup) { return PageSetup.AsciiWords(';'); }
    // User specific option: Returns the HTML setup.
    TString GetHtmlSetup() { return FHtmlSetup; }
    TString GetRichTextPrefs() { return FRichTextPrefs; }
    TString GetReportFormPos() { return FReportFormPos; }
    TString GetClientsFormPos() { return FClientsFormPos; }
    bool HasPageSetup(const TString &SetupName, TString &Setup);
    bool HasPageSetup(const TString &SetupName);
    void SetPageCombo(TComboBox *ComboBox);
    // User specific option: Returns the default documents directory.
    TString GetDocuments() { return FDocuments; }
    // User specific option: Returns the default MicroSoft Word documents directory.
    TString GetWordDirectory() { return FWordDirectory; }
    // User specific option: Returns whether or not to use the numberic keypad's enter key as a tab key.
    bool GetUseEnterAsTab() { return FUseEnterAsTab; }
    // User specific: Indicates whether export output file should be viewed after it is generated
    bool GetViewOutputExport() { return FViewOutputExport; }

    // User specific option: Saves the current index order to be used for client browsing.
    void SetClientsOrder(int Order) { FClientsOrder = Order; }
    // User specific option: Saves the current name style to be used for client names (eg John Smith, or Smith John, etc).
    void SetClientNameStyle(int Style) { FClientNameStyle = Style; }
    void SetTextCapitals(int Capitals);
    // User specific option: Saves the fifth character to be used in automatically generated client references.
    void SetCliRefStart(char CliRefStart) { FCliRefStart = CliRefStart; }
    // User specific option: Saves the mailing labels setup.
    void SetLabelSetup(TString LabelSetup) { FLabelSetup = LabelSetup; }
    // User specific option: Saves the available fonts.
    void SetFontSetup(TString FontSetup) { FFontSetup = FontSetup; }
    // User specific option: Saves the page setup.
    void SetPageSetup(TString PageSetup) { FPageSetup = PageSetup; }
    // User specific option: Saves the default documents directory.
    void SetDocuments(TString Documents) { FDocuments = Documents; }
    // User specific option: Saves the default MicroSoft Word documents directory.
    void SetWordDirectory(TString WordDirectory) { FWordDirectory = WordDirectory; }
    // User specific option: Saves whether or not to use the numberic keypad's enter key as a tab key.
    void SetUseEnterAsTab(bool UseEnterAsTab) { FUseEnterAsTab = UseEnterAsTab; }
    // User specific: Indicates whether export output file should be viewed after it is generated
    void SetViewOutputExport(bool ViewOutputExport) { FViewOutputExport = ViewOutputExport; }
    // User specific option: Saves the HTML setup.
    void SetHtmlSetup(const TString &Value) { FHtmlSetup = Value; }
    void SetRichTextPrefs(const TString &Value) { FRichTextPrefs = Value; }
    void SetReportFormPos(const TString &Value) { FReportFormPos = Value; }
    void SetClientsFormPos(const TString &Value) { FClientsFormPos = Value; }

    // Returns whether or not there is a value stored on the EnterAsTab stack (TBoolStack).
    bool HasCurrentEnterAsTab() { return FEnterAsTab.Level(); }
    // Returns the top-most value stored on the EnterAsTab stack (TBoolStack).
    bool PopCurrentEnterAsTab() { return FEnterAsTab.Level() ? *(FEnterAsTab.Top()) : false; }
    void SetCurrentEnterAsTab(bool EnterAsTab);
    // Removes the top-most value stored on the EnterAsTab stack (TBoolStack).
    void UnSetCurrentEnterAsTab() { delete FEnterAsTab.Pop(); }

    TString GetSuperPassword();
    TString GetOpPassword();
    TString GetReportUpdate();
    int GetLogLimit();
    bool GetEnableSecurity();

    void SetSuperPassword(const TString &Value);
    void SetOpPassword(const TString &Value);
    void SetReportUpdate(TString Value);
    void SetLogLimit(int Value);
    void SetEnableSecurity(bool Value);

    TString GetModemDeviceName();
    bool GetModemLogFile();
    bool GetModemHexLog();
    TString GetModemPhoneNo();
    bool GetElsShowDetails();

    // Common option: Modem.
    void SetModemDeviceName(TString Value) {  WriteString(osCommonBase, "DeviceName", FModemDeviceName, Value); }
    void SetModemLogFile(bool Value) {  WriteBool(osCommonBase, "LogFile", FModemLogFile, Value); }
    void SetModemHexLog(bool Value) {  WriteBool(osCommonBase, "HexLog", FModemHexLog, Value); }
    void SetModemPhoneNo(TString Value) {  WriteString(osCommonBase, "PhoneNo", FModemPhoneNo, Value); }
    void SetElsShowDetails(bool Value) {  WriteBool(osCommonBase, "ElsShowDetails", FElsShowDetails, Value); }

    int GetSecurityPassword();
    int GetSecurityAustpac();
    int GetSecurityCeg();
    TString GetSecurityNewPassword();
    TString GetSecurityCurrentPassword();
    TString GetSecurityPasswordAt();
    TString GetSecurityPasswordOn();
    TString GetSecurityNewNui();
    TString GetSecurityCurrentNui();
    TString GetSecurityNuiAt();
    TString GetSecurityNuiOn();
    TString GetSecurityUserId();
    TString GetSecurityUserIdAt();
    TString GetSecurityUserIdOn();
    TString GetSecurityCegNo();
    bool GetChangeClientRef();

    // Common option: Els setup security.
    void SetSecurityPassword(int Value) {  WriteInt(osCommonBase, "Password", FSecurityPassword, Value); }
    // Common option: Els setup security.
    void SetSecurityAustpac(int Value) {  WriteInt(osCommonBase, "Austpac", FSecurityAustpac, Value); }
    // Common option: Els setup security.
    void SetSecurityCeg(int Value) {  WriteInt(osCommonBase, "Ceg", FSecurityCeg, Value);FSecurityCeg = Value; }
    // Common option: Els setup security.
    void SetSecurityNewPassword(TString Value) {  WriteString(osCommonBase, "PasswordNew", FSecurityNewPassword, Value); }
    // Common option: Els setup security.
    void SetSecurityCurrentPassword(TString Value) {  WriteString(osCommonBase, "PasswordCur", FSecurityCurrentPassword, Value); }
    // Common option: Els setup security.
    void SetSecurityPasswordAt(TString Value) {  WriteString(osCommonBase, "PasswordAt", FSecurityPasswordAt, Value); }
    // Common option: Els setup security.
    void SetSecurityPasswordOn(TString Value) {  WriteString(osCommonBase, "PasswordOn", FSecurityPasswordOn, Value); }
    // Common option: Els setup security.
    void SetSecurityNewNui(TString Value) {  WriteString(osCommonBase, "NewNui", FSecurityNewNui, Value); }
    // Common option: Els setup security.
    void SetSecurityCurrentNui(TString Value) {  WriteString(osCommonBase, "CurrentNui", FSecurityCurrentNui, Value); }
    // Common option: Els setup security.
    void SetSecurityNuiAt(TString Value) {  WriteString(osCommonBase, "NuiAt", FSecurityNuiAt, Value); }
    // Common option: Els setup security.
    void SetSecurityNuiOn(TString Value) {  WriteString(osCommonBase, "NuiOn", FSecurityNuiOn, Value); }
    // Common option: Els setup security.
    void SetSecurityUserId(TString Value) {  WriteString(osCommonBase, "UserId", FSecurityUserId, Value); }
    // Common option: Els setup security.
    void SetSecurityUserIdAt(TString Value) {  WriteString(osCommonBase, "UserIdAt", FSecurityUserIdAt, Value); }
    // Common option: Els setup security.
    void SetSecurityUserIdOn(TString Value) {  WriteString(osCommonBase, "UserIdOn", FSecurityUserIdOn, Value); }
    // Common option: Els setup security.
    void SetSecurityCegNo(TString Value) {  WriteString(osCommonBase, "CegNo", FSecurityCegNo, Value); }

    // Registration Options
    TString GetOfficeLodgment();
    int GetOfficeLodgmentIndex();
    bool GetTestLodge();
    bool GetDefaultTestLodge();
    int GetTransmitterNo();

    void SetOfficeLodgment(TString Value)  { WriteString(osCommonBase, "OfficeLodg", FOfficeLodgment, Value); }
    void SetOfficeLodgmentIndex(int Value) { WriteInt(osCommonBase, "OfficeLodgInd", FOfficeLodgmentIndex, Value);}
    void SetTestLodge(bool Value)          { WriteBool(osCommonBase, "TestLodge", FTestLodge, Value); }
    void SetDefaultTestLodge(bool Value)          { WriteBool(osCommonBase, "DefTestLdge", FDefaultTestLodge, Value); }
    void SetTransmitterNo(int Value)       { WriteInt(osCommonBase, "TransNo", FTransmitterNo, Value);}

    // Agents
    int GetAgents();
    void SetAgents(int Value) { WriteInt(osCommonBase, "Agents", FAgents, Value); }
    TString GetAgentsInfo(int Value);
    void SetAgentsInfo(TString Value, int IValue);

    bool GetImportedDosTaxOptions();
    void SetImportedDosTaxOptions(bool Value) { WriteBool(osCommonBase, "ImprtDos", FImportedDosTaxOptions, Value); }

    // Common option: Saves whether or not the client reference may be changed.
    void SetChangeClientRef(bool Value) { WriteBool(osCommonBase,"ChngCliRef", FChangeClientRef, Value); }

    void RestoreMainFormStatePositionSize(TForm &Form);
    void SaveMainFormStatePositionSize(TForm &Form);

    // Returns the default main form height (465 pixels).
    int GetDefaultMainFormHeight() { return 465; }
    // Returns the default main form height (640 pixels).
    int GetDefaultMainFormWidth() { return 640; }
    // Returns the default main form state (maximised).
    bool GetDefaultMainFormStateNormal() { return false; }

    // Grid setup
    void SetGridColoredRows(bool Value) { WriteBool(osCommonUser, "GridColoredRows", FColoredRows, Value); }
    void SetGridHorGridlines(bool Value) { WriteBool(osCommonUser, "HorGridlines", FHorGridlines, Value); }
    void SetGridVerGridlines(bool Value) { WriteBool(osCommonUser, "VerGridlines", FVerGridlines, Value); }
    void SetGridCol1(int Value) { WriteInt(osCommonUser, "GridCol1", FGridCol1, Value); }
    void SetGridCol2(int Value) { WriteInt(osCommonUser, "GridCol2", FGridCol2, Value); }
    void SetGridlinesCol(int Value) { WriteInt(osCommonUser, "GridlinesCol", FGridlinesCol, Value); }
    void SetCustomCol(TString Value) { WriteString(osCommonUser, "CustomCol", FCustomCol, Value); }
    void SetEditCol(TString Value) { WriteString(osCommonUser, "EditCol", FEditCol, Value); }
    void SetIconBarCol(TString Value) { WriteString(osCommonUser, "IconBarCol", FIconBarCol, Value); }
    void SetGridColWidths(const TString &Key, const TString &Value);

    bool GetUseGridSetup();
    bool GetGridColoredRows();
    bool GetGridHorGridlines();
    bool GetGridVerGridlines();
    int GetGridCol1();
    int GetGridCol2();
    int GetGridlinesCol();
    TString GetCustomCol();
    int GetEditCol();
    int GetIconBarCol();
    TString GetGridColWidths(const TString &Key);

    // document manager
    bool    GetDefaultUseDocMan()          {FUseDocMan = false; return FUseDocMan;}
    bool    GetDefaultUseMyDocs()          {FUseMyDocs = true; return FUseMyDocs;}
    TString GetDefaultMyDocsDirectory()    {FMyDocsDirectory = ""; return FMyDocsDirectory;}
    bool    GetDefaultIsProspective()      {FIsProspective = false; return FIsProspective;}

    bool    GetUseDocMan()                 {ReadBool(osCommonBase, "UseDocMan", FUseDocMan); return FUseDocMan;}
    bool    GetUseMyDocs()                 {ReadBool(osCommonUser, "UseMyDocs", FUseMyDocs); return FUseMyDocs;}
    TString GetMyDocsDirectory()           {ReadString(osCommonUser, "MyDocsDir", FMyDocsDirectory); return FMyDocsDirectory;}
    bool    GetIsProspective()             {ReadBool(osCommonUser, "IsProspective", FIsProspective); return FIsProspective;}

    void SetUseDocMan(bool Value)          {ReadBool(osCommonBase, "UseDocMan", FUseDocMan);  WriteBool(osCommonBase, "UseDocMan", FUseDocMan, Value);}
    void SetUseMyDocs(bool Value)          {ReadBool(osCommonUser, "UseMyDocs", FUseMyDocs); WriteBool(osCommonUser, "UseMyDocs", FUseMyDocs, Value);}
    void SetMyDocsDirectory(TString Value) {ReadString(osCommonUser, "MyDocsDir", FMyDocsDirectory); WriteString(osCommonUser, "MyDocsDir", FMyDocsDirectory, Value);}
    void SetIsProspective(bool Value)      {ReadBool(osCommonUser, "IsProspective", FIsProspective); WriteBool(osCommonUser, "IsProspective", FIsProspective, Value);}

    TString GetMyDocumentsDirectory();
};

extern TOptions PACKAGE *Options;

#endif



#ifndef _LIST_CLASS
#define _LIST_CLASS

// **********************************************************************
// This template list class can make a double linked list of any type of pointers.
// The list can own the pointers & destroy them on removal.
// This is a type safe wrapper around 'TPointerLinkList' with no overhead.
// eg TLinkList<TString *> Strings
template <class T>
class TLinkList : public TPointerLinkList {
  protected:
    // A pointer to this function is passed to 'Remove()' to destroy elements.
    static void destroy (void *el);

  public:
    // Constructs a list setting ownership by 'list_owns_pointers'.
    TLinkList (bool list_owns_pointers) : TPointerLinkList () {
      if (list_owns_pointers) destroy_fn = TLinkList<T>::destroy;
    }

    // Adds 'new_element' and returns the index of its position in the list.
    int Add (T new_element) { return (add_ptr ((void *) new_element, FElements)); }
    // Adds 'new_element' at index 'el' and returns 'el' (the index of its position in the list).
    int Add (T new_element, int el) { return (add_ptr ((void *) new_element, el)); }

    // Removes the element at index 'el' & destroys it if the list owns the elements.
    void Remove (int el) { remove_ptr (el); }
    // Removes the the last element & destroys it if the list owns the elements.
    void Remove () { remove_ptr (FElements - 1); }
    // Removes all the elements & destroys them if the list owns the elements.
    void RemoveAll () { remove_all_ptrs (); }

    // Moves the element at index 'el' to index 0 (the head).
    void MoveToHead (int el) { TPointerLinkList::move_ptr_to_head (el); }

    // Returns the element at index 'el'.
    T operator[] (int el) { return (T) node (el)->FElement; }
    // Returns the first element in the list.
    T First (TLinkListIterator &iterator) const { return (T) first_ptr (iterator); }
    // Returns the next element in the list.
    T Next (TLinkListIterator &iterator) const { return (T) next_ptr (iterator); }
};
template <class T> void TLinkList<T>::destroy (void *el) { delete (T) el; }

// **********************************************************************
// This template list class can make a sorted double linked list of any type of pointers.
// The list can own the pointers & destroy them on removal.
// This is a type safe wrapper around 'TPointerLinkList' with no overhead.
// eg TSortList<TString *> Strings
template <class T>
class TSortList : public TPointerLinkList {
  protected:
    // A pointer to this function is passed to 'Remove()' to destroy elements.
    static void destroy (void *el);
    // A pointer to this function is passed to the search functions.
    static int compare (T key, T elem) { return ((*key > *elem) ? 1 : ((*key == *elem) ? 0 : -1)); }
    // Can enforce uniqueness of items in the list.
    bool FUniqueItems;
    // Ownership
    bool FOwnsPointers;
  public:
    // Constructs a list setting ownership by 'list_owns_pointers'.
    // Uniqueness of elements is set with 'UniqueItems'.
    TSortList (bool list_owns_pointers, bool UniqueItems = false) : TPointerLinkList () {
      FUniqueItems = UniqueItems;
      FOwnsPointers = list_owns_pointers;
      if(FOwnsPointers)
        destroy_fn = TSortList<T>::destroy;
      cmp_fn = (fnCompare) TSortList<T>::compare;
    }

    // Adds 'new_element' and returns the index of its position in the list.
    int Add (T new_element) {
      int el_to_find;
      if(Find (new_element, el_to_find) && FUniqueItems) {
        if(FOwnsPointers)
          delete new_element;
        return el_to_find;
      }
      return add_ptr (new_element, el_to_find);
    }

    // Removes the element at index 'el' & destroys it if the list owns the elements.
    void Remove (int el) { remove_ptr (el); }
    // Removes the the last element & destroys it if the list owns the elements.
    void Remove () { remove_ptr (FElements - 1); }
    // Removes all the elements & destroys them if the list owns the elements.
    void RemoveAll () { remove_all_ptrs (); }

    // Returns the first element in the list.
    T First (TLinkListIterator &iterator) const { return (T) first_ptr (iterator); }
    // Returns the next element in the list.
    T Next (TLinkListIterator &iterator) const { return (T) next_ptr (iterator); }
    // Returns the element at index 'el'.
    T operator[] (int el) { return ((T) node (el)->FElement); }
    // Returns true if the element matching 'key' is found.
    // Sets 'pos' top the index if found.
    bool Find (T key, int &pos) { return (find_ptr (key, pos)); }
    // Returns true if the element matching 'key' is found.
    bool Contains (T key) {
      int pos;
      return (find_ptr (key, pos));
    }
};
template <class T> void TSortList<T>::destroy (void *el) { delete (T) el; }

// **********************************************************************
// This template container class can make a dynamic vector of any type of pointers.
// It grows double when its size is exceeded.
// It can own the pointers & destroy them on removal.
template <class T>
class TVector : public TPointerVector {
  protected:
    // A pointer to this function is passed to 'Remove()' to destroy elements.
    static void destroy (void *el) { delete (T) el; }

  public:
    // Constructs a vector setting ownership by 'list_owns_pointers'.
    TVector(bool list_owns_pointers = true) : TPointerVector (szHysteresis) {
      if(list_owns_pointers) destroy_fn = TVector<T>::destroy;
    }
    // Constructs a vector with initial size 'new_start_size'.
    // The ownership is set by 'list_owns_pointers'.
    TVector(int new_start_size, bool list_owns_pointers) : TPointerVector (new_start_size) {
      if(list_owns_pointers) destroy_fn = TVector<T>::destroy;
    }

    // Adds 'new_element' and returns the index of its position.
    int Add(T new_element) { return (add_ptr ((void *) new_element, FElements)); }
    // Adds 'new_element' at index 'el' and returns 'el' (the index of its position).
    int Add(T new_element, int el) { return (add_ptr ((void *) new_element, el)); }

    // Removes the element at index 'el' & destroys it if the vector owns the elements.
    void Remove(int el) { remove_ptr (el); }
    // Removes the the last element & destroys it if the list vector the elements.
    void Remove() { Remove (FElements - 1); }
    // Removes all the elements & destroys them if the vector owns the elements.
    void RemoveAll() { remove_all_ptrs (); }

    // Moves the element at 'From' to index 'To'.
    void MoveElement(int From, int To) { MovePtr(From, To); }
    // Moves the element at index 'el' to index 0 (the head).
    void MoveToHead (int el) { TPointerVector::move_ptr_to_head (el); }

    // Returns the element at index 'el'.
    T operator[] (int el) const { return ((T) FElement [el]); }
    // Returns the index of the element 'Item'.
    int GetIndex(const T Item) const { return GetPtrIndex(Item); }
};

// *************************************************************************
// This template container class can make a stack based on a dynamic vector.
// It grows double when its size is exceeded.
// It does NOT own the elements, so they can they can be used on removal.
template <class T>
class TStack : protected TVector<T> {
  public:
    // Default constructor.
    TStack () : TVector<T> (false) {}

    // Pushes 'NewElement' onto the top of the stack.
    void Push (T NewElement) { Add(NewElement); }
    // Pops an element' off the stack & returns it.
    T Pop () { T Temp = (*this) [FElements - 1]; Remove(); return Temp; }
    // Returns the element' on the top of the stack.
    T Top () const { return (*this) [FElements - 1]; }
    // Returns the height of the stack.
    int Level () const { return Count (); }
};

// *************************************************************************
// This template container class can make a sortable dynamic vector of any type of pointers.
// It grows double when its size is exceeded.
// It can own the pointers & destroy them on removal.
// The elements must be sorted by an explicit call to 'Sort()'.
template <class T>
class TSortableVector : public TVector<T> {
  protected:
    // A pointer to this function is passed to the sort & search functions.
    static int Compare (T *key, T *elem) { return ((**key > **elem) ? 1 : ((**key == **elem) ? 0 : -1)); }
    // A pointer to this function is passed to the reverse sort & search functions.
    static int ReverseCompare (T *key, T *elem) { return ((**key > **elem) ? -1 : ((**key == **elem) ? 0 : 1)); }
    // Sorting can be in reverse order.
    bool FReverse;
  public:
    // Constructs a sortable vector setting ownership by 'list_owns_pointers'.
    TSortableVector(bool list_owns_pointers = true) : TVector<T> (list_owns_pointers) { FReverse = false; }
    // Constructs a sortable vector with initial size 'new_start_size'.
    // The setting of ownership is by 'list_owns_pointers'.
    TSortableVector(int new_start_size, bool list_owns_pointers) : TVector<T> (new_start_size, list_owns_pointers) {}

    // Sort the elements in order set by 'Reverse'.
    void Sort(bool Reverse = false) { FReverse = Reverse; SortPtrs((fnPtrCompare)(Reverse ? ReverseCompare : Compare)); }
    // Sort the elements using 'cmp_fn'.
    void Sort(fnPtrCompare cmp_fn) { FReverse = false; SortPtrs(cmp_fn); }

    // Returns the index of the element matching 'key' using a binary search.
    // 'Sort()' must be called first.
    int BinaryFind(T Key) { return BinaryFindPtrIndex(Key, (fnPtrCompare)(FReverse ? ReverseCompare : Compare)); }
    // Returns the index of the element matching 'key' with 'cmp_fn', using a binary search.
    // 'Sort()' must be called first.
    int BinaryFind(T Key, fnPtrCompare cmp_fn) { return BinaryFindPtrIndex(Key, cmp_fn); }
    // Returns true if the element matching 'key' is found using a binary search.
    // 'Sort()' must be called first.
    bool BinaryContains(T Key) { return BinaryContainsPtr(Key, (fnPtrCompare)(FReverse ? ReverseCompare : Compare)); }

    // Returns the index of the element matching 'key' using a linear search.
    // 'Sort()' need NOT be called first.
    int Find(T Key) { return LinearFindPtrIndex(Key, (fnPtrCompare)Compare); }
    // Returns the index of the element matching 'key' with 'cmp_fn', using a linear search.
    // 'Sort()' need NOT be called first.
    int Find(T Key, fnPtrCompare cmp_fn) { return LinearFindPtrIndex(Key, cmp_fn); }
    // Returns true if the element matching 'key' is found using a linear search.
    // 'Sort()' need NOT be called first.
    bool Contains(T Key) { return LinearContainsPtr(Key, (fnPtrCompare)Compare); }
};

// **********************************************************************
// This template container class can make a dynamic array of any type of objects.
// It does NOT own the elements.
template <class T>
class TArray {
  protected:
    // Default start size.
    enum {
      DefaultSize = 4
    };

    // Array of elements
    TArrayPtr<T> FElement;
    // Start size.
    int FStartSize;
    // Current array size.
    int FArraySize;

    // Changes the size of the array to 'Size'.
    void ResizeTo(int Size);

  public:
    // Constructs an array with initial size of 'StartSize'.
    TArray(int StartSize = DefaultSize);

    // Expands the array to 'Size'.
    void GrowTo(int Size);
    // Shrinks the array to 'Size'.
    void ShrinkTo(int Size);
    // Returns the array size (not necessarily the number of elements).
    int Count() const { return FArraySize; }

    // Returns the element at 'Position'.
    T& operator[] (int Position);
};
template <class T> TArray<T>::TArray(int StartSize)
{
  FStartSize = StartSize;
  FArraySize = 0;
}
template <class T> void TArray<T>::ResizeTo(int Size) {
  if(!Size) {
    // Blank array.
    FElement.Destroy();
    FArraySize = 0;
  }
  else {
    // Create a new array & copy the elements.
    TArrayPtr<T> NewElement(Size);
    for(int n = 0; n < min(FArraySize, Size); n++)
      NewElement[n] = FElement[n];
    FElement.Destroy();
    FElement = NewElement.GetPointer();
    FArraySize = Size;
  }
}
template <class T> void TArray<T>::GrowTo(int Size) {
  if(Size > FArraySize)
    ResizeTo(Size);
}
template <class T> void TArray<T>::ShrinkTo(int Size) {
  if(Size < FArraySize)
    ResizeTo(Size);
}
template <class T> T& TArray<T>::operator[] (int Position) {
  if(Position >= FArraySize) {
    int Size = max(Position + 1, max(FStartSize, FArraySize * 2));
    GrowTo(Size);
  }
  return FElement[Position];
}

#endif

Open in new window

darrylf290567Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
You are getting a conflict between your definition of TStack and a Borland supplied TStack that v5 must now be implementing. You have a few options:

1) Rename your TStack to something slightly different
2) Declare your TStack to be within a namespace in this way...

namespace myRoutines
{
   class TStack
   {
       // Class definition here
   };
}

and then when you refer to your class you need to use

myRoutines::TStack    instead of just    TStack

Unfortunately, I don't know of a way to have Builder stop "using" the certain namespaces that it does by default (like Contnrs) so as far as I know you always have to fully qualify your TStack definition
0
darrylf290567Author Commented:
Hi mccarl,

Sorry to be a pain.
Where are the changes needed to be made or replaced in the code that I had supplied to you in the question?

Thank you kindly.
darrylf290567

0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
If you go with option 2) that I described, firstly put the namespace declaration around your TStack definition, lines 155 - 170 in the code that you attached. (Hopefully it is obvious that you can change the example namespace from "myRoutines" to whatever you want)

And then the best way (because you have a lot of "code" included with the question, and it is a little hard to work out what is what) is to just try to compile your program, and then everywhere you get the Ambiguity error put myRoutines::TStack in place of just TStack (or whatever namespace name you come up with). You will at least need it on line 10 of options.h where it is currently complaining, but there may be more. Eg line 10 will change from

class PACKAGE TBoolStack : public TStack<bool*> {

to

class PACKAGE TBoolStack : public myRoutines::TStack<bool*> {
0
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

darrylf290567Author Commented:
Hi mccarl,
I placed this code change in the List.h file:
template <class T>
//dpf-28042010
namespace TStackRoutines
{
class TStack : protected TVector<T> {
  public:
    // Default constructor.
    TStack () : TVector<T> (false) {}

    // Pushes 'NewElement' onto the top of the stack.
    void Push (T NewElement) { Add(NewElement); }
    // Pops an element' off the stack & returns it.
    T Pop () { T Temp = (*this) [FElements - 1]; Remove(); return Temp; }
    // Returns the element' on the top of the stack.
    T Top () const { return (*this) [FElements - 1]; }
    // Returns the height of the stack.
    int Level () const { return Count (); }
};
};

I get the following errors:
[C++ Error] List.h(166): E2040 Declaration terminated incorrectly

The file options.h
//dpf-28042010
class PACKAGE TBoolStack : public TStackRoutines::TStack<bool*> {
  public:
    TBoolStack();
    ~TBoolStack();
};

There seems to be a problem in what I have done abovementioned. Please help.

Cheers
darrylf290567
0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Move the "template <class T>" line down 2 lines so that it is also within the namespace scope and remove the semicolon after the namespace's closing brace. It should end up like this...


//dpf-28042010
namespace TStackRoutines
{
template <class T>
class TStack : protected TVector<T> {
  public:
    // Default constructor.
    TStack () : TVector<T> (false) {}

    // Pushes 'NewElement' onto the top of the stack.
    void Push (T NewElement) { Add(NewElement); }
    // Pops an element' off the stack & returns it.
    T Pop () { T Temp = (*this) [FElements - 1]; Remove(); return Temp; }
    // Returns the element' on the top of the stack.
    T Top () const { return (*this) [FElements - 1]; }
    // Returns the height of the stack.
    int Level () const { return Count (); }
};
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
darrylf290567Author Commented:
Thank you mccarl.
Your service was absolutely impeccable.

Kind Regards
darrylf290567
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.