Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Template parrsing bug with non-type parameter
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Stephen
Tomato Guru

United Kingdom
781 Posts

Posted - Mar 01 2004 :  07:06:40 AM  Show Profile
I know there are a lot of template parsing bugs floating around, but I thought I'd throw another one into the mix. Apologies if it's already been reported.

Consider this code:
template<typename T, DWORD dwMaxElem>
class CSmallMap
{
private:
	CMap<DWORD, DWORD, T*, T*> m_map;

public:
	POSITION GetStartPosition() const
	{
		return m_map.GetStartPosition();
	}

	void GetNextAssoc(POSITION &pos, DWORD &dw, T*& t) const
	{
		m_map.GetNextAssoc(pos, dw, t);
	}
};

class CFoo;

int main()
{
	CSmallMap<CFoo, 512> smallmapFoo;
	POSITION pos = smallmapFoo.GetStartPosition();
	while (pos)
	{
		DWORD dw;
		T* pT;
		smallmapFoo.GetNextAssoc(


When you get that far, the tooltip and the definition bar both think that the prototype of smallmapFoo.GetNextAssoc() is
void GetNextAssoc (POSITION &pos, 512 &dw, CFoo*& CFoo) const
— actually, not true, the tooltip is missing the const as well. But they both have 512 instead of DWORD.

Originally, I had a default parameter DWORD dwMaxElem=512 in the template definition, and didn't include the 512 in the declaration of smallmapFoo. Then the prototype was
void GetNextAssoc (POSITION &pos, dwMaxElem &dw, CFoo*& CFoo) const

Stephen Turner
ClickTracks http://www.clicktracks.com/
Winner: ClickZ's Best Web Analytics Tool 2003 & 2004
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000