I have a base class and several classes derived from it. The base class has a typeID that all derived classes get assigned so I can differentiate. I wish to create a search function that looks through vector lists but using a generic vector::iterator. I am unable to static_cast to the base-class iterator though and I get the error above.
I have developed an alternative solution, however I would like to know what mechanic of the language is preventing me from doing this?
    class CItem {
    public:
        enum ItemType { enumed types here };
        CItem();
        CItem(const string Name, ItemType itemType, const float cost, const float weight);
        virtual ~CItem();
        CItem(const CItem &);
        CItem& operator=(const CItem &);
        int itemID() const { return m_itemID; }
        void itemID(const int id) { m_itemID = id; }
    protected:
        ItemType m_Type;
    };
    class CDerivedClassA: public CItem {
    public:
        CDerivedClassA() {};
        virtual ~CDerivedClassA() {};
    protected:
    private:
    };
class CDerivedClassB: public CItem {
public:
    CDerivedClassB() {};
    virtual ~CDerivedClassB() {};
protected:
private:
};
void CContainer::Search(ItemType it) {
    vector<CItem>::iterator iter;
    switch (it) {
        case IT_GENERAL:
            iter = m_GeneralItemList.begin();
            break;
        case IT_A:
            iter = (static_cast<vector<CItem>>(m_DerivedListA)).begin();
            break;
        case IT_B:
            iter = (static_cast<vector<CItem>>(m_DerivedListB)).begin();
            break;
    }
}
 
    