Visual C ++ 2010 comments causing errors

The // hi comment causes red squigglies to appear under if , and in the expression below ItemType* , ItemType* and hashTableSize . if error is “an announcement is expected”, the hashTable error is “this declaration does not have a storage class or type specifier”, the ItemType* error is “expected by the type specifier” and the hashTableSize error “The identifier“ HashTableSize ”is undefined. Removing the comment removes squigglies. None the class in my project does not have this problem. What gives?

 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 ]; } 

Class declaration:

 #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 ); } 
+4
source share

All Articles