Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1553: understanding template specializations

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
.oisyn Posted - Apr 27 2007 : 11:08:53 AM
It seems that VA X is having problems understanding similar looking (partial and explicit) template specializations

template<class T> struct A;

struct B { int apple; };
struct C { int banana; };

template<> struct A<int>
{
	void func()
	{
		B var;
	}
};

template<> struct A<float>
{
	void func()
	{
		C var;
		var.  // #1
	}
};


After typing the code at #1, it comes up with a listbox containing the members of B rather than C (so it shows 'apple'). This is 100% reproducable as long as both specializations contain the same functions and the same variable name but with different types. If I rename 'var' in A<float>::func to 'var2', it does show 'banana' as expected.
1   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Apr 27 2007 : 12:46:38 PM
I am seeing the same effect here. Thank you for the clear description.

case=6266

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000