help-gplusplus
[Top][All Lists]
Advanced

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

Re: How to use a constructor of hashsets?


From: benjamin . bihler
Subject: Re: How to use a constructor of hashsets?
Date: Thu, 12 Jul 2007 05:10:23 -0700
User-agent: G2/1.0

#include <ext/hash_set>


template<class PointerTemplate> class CTWTHashSet
{

public:

        CTWTHashSet(void);
        ~CTWTHashSet(void);

private:

        class pointerEqualityFunction
        {
public:

                bool operator()(const PointerTemplate pPointer1,
                                const PointerTemplate pPointer2) const
                {
                        return (pPointer1 == pPointer2);
                }
        };

        class pointerHashFunction
        {
public:

                size_t operator()(const PointerTemplate pPointer) const
                {
                        return ( size_t )pPointer;
                }
        };

        __gnu_cxx::hash_set< PointerTemplate, pointerHashFunction,
pointerEqualityFunction >
                        m_hsPointerSet( 10 );
};

template<class PointerTemplate>
CTWTHashSet<PointerTemplate>::CTWTHashSet()
{
}

template<class PointerTemplate>
CTWTHashSet<PointerTemplate>::~CTWTHashSet()
{
}


int main( void )
{
        CTWTHashSet< int* > hsHashSet;
}



reply via email to

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