Visual C ++ 2010注释导致错误

时间:2013-04-08 04:59:27

标签: c++ comments

// hi评论会导致红色波浪线出现在if下方,并在其下方的语句中显示hashTableItemType*hashTableSizeif错误是“预期的声明”,hashTable错误是“此声明没有存储类或类型说明符”,ItemType*错误是“预期的类型说明符”,并且hashTableSize错误是“标识符'HashTableSize'是未定义的。删除注释会消除波形。我的项目中没有其他类有这个问题。什么给出了?

template <class ItemType>
HashedDictionary( const unsigned & p_hashTableSize = DEFAULT_SIZE ) : hashTable( NULL ), hashTableSize( p_hashTableSize ), itemCount( 0 )
{
    // hi

    if ( hashTableSize < 0 )
        throw PrecondViolatedExcep( "Hash table size must be greater than or equal to zero." );

    hashTable = new ItemType*[ hashTableSize ]; 

}

班级声明:

#include "HashedEntry.h"

template< class ItemType>

    class HashedDictionary
    {
    private:
        HashedEntry<ItemType>** hashTable;
        unsigned hashTableSize;
        unsigned itemCount;
        static const unsigned DEFAULT_SIZE = 101;

        int getHashIndex( const ItemType & newEntry );
        int computeIndex( const ItemType & newEntry );
    public:
        HashedDictionary( const unsigned & p_hashTableSize );
        bool add( const ItemType & newItem );

    }

0 个答案:

没有答案