RE: FW: compile fails with g++ 3.4.3

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

 



I have not written the code and cannot answer specific questions - just building it as a shared library that I then call from within a java app using JNI. Here's how the template class is set up:

template <class T>
class SiteClusterFinder
{
private:

    // Entry 
    class E
    {
    public:
        // Constructor
        E(double _x, double _y, T _userData, SiteClusterFinder *finder)
            : x(_x), y(_y), userData(_userData), finder(finder) 
        {}

        // Less operator
        bool operator < (const E& e) const
        {
            if(finder->sortByX)
                return (x < e.x); 
            else
                return (y < e.y);
        }
        
        // x and y coordinates
        double x, y;

        // User data (keys)
        T userData;

        // Cluster finder
        SiteClusterFinder *finder;
    };

    typedef std::list<E> L;
    typedef L::iterator I;   // The error happens here
    typedef std::list<L> LL;
    typedef LL::iterator II;

public:

    friend class E;

    /**
     * Adds point to a cluster finder
     *
     * @param _x x coordinate of a new point
     * @param _y y coordinate of a new point
     * @param _userData data that identify a point to a user
     * @param _finder site cluster finder
     */
    void add(double _x, double _y, T _userData, SiteClusterFinder *_finder) 
    { 
        data.push_back(E(_x, _y, _userData, _finder)); 
    }

    /**
     * Removes all points from a cluster finder
     */
    void clear() { data.clear(); }

private:
    
    // Indicates how sorting has to be done in E
    bool sortByX;

    // Storage of points
    L data;

    //
    // More methods/members
    //
};

#endif


>How did you declare the iterator?
>
>corey

On 6/17/05, Kolev, Nik <NKolev@xxxxxxxxxxxxxxxx> wrote:
> Hi,
> 
> I am trying to build a shared library using g++ 3.4.3
> Up until now I was successfully building with 3.2.3 version of the compiler.
> 
> Since I do not have much time fixing the code to please 3.4.3 is there a way to tell 3.4.3 (via an option) to ignore certain "flaws" in the code? The first error I am getting is:
> 
> SiteClusterFinder.h:62: error: type `std::list<SiteClusterFinder<T>::E, std::allocator<SiteClusterFinder<T>::E> >' is not derived from type `SiteClusterFinder<T>'
> SiteClusterFinder.h:62: error: ISO C++ forbids declaration of `iterator' with no type
> 
> thanks,
> nik
> 
>




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux