Click here to Skip to main content
15,893,904 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to set a socket's Ethernet adapter? Pin
Mark Salsbery9-Jan-08 6:53
Mark Salsbery9-Jan-08 6:53 
GeneralRe: How to set a socket's Ethernet adapter? Pin
cmk9-Jan-08 9:45
cmk9-Jan-08 9:45 
QuestionHelp with Driver Development Kit [modified] Pin
tibiz9-Jan-08 5:08
tibiz9-Jan-08 5:08 
GeneralRe: Help with Driver Development Kit Pin
JudyL_MD9-Jan-08 7:13
JudyL_MD9-Jan-08 7:13 
QuestionCurrency Formatting Pin
littleGreenDude9-Jan-08 3:50
littleGreenDude9-Jan-08 3:50 
GeneralRe: Currency Formatting Pin
David Crow9-Jan-08 4:10
David Crow9-Jan-08 4:10 
GeneralRe: Currency Formatting Pin
Hamid_RT9-Jan-08 18:39
Hamid_RT9-Jan-08 18:39 
GeneralCasting with templates problem Pin
Vics9-Jan-08 3:49
Vics9-Jan-08 3:49 
Hi again.
I always have problems with templates Frown | :( . I'm not able to create two template classes with an implicit cast from one to the other (for the same template type). Without the template there are no problems:

// WITHOUT TEMPLATE
class Class1
{
	public:
	Class1(){};
};

class Class2
{
	public:
	Class2(){};
	Class2(Class1 &mat){};
};

void main()
{
	Class1 C1;
	fun(C1);// implicit cast,OK
}

But with the template:
void fun(Class2 a){};

// WITH TEMPLATE
template <class T> class TClass1
{
	public:
	TClass1(){};
};

template <class T> class TClass2
{
	public:
	TClass2(){};
	TClass2(TClass1<T> &mat){};
};

template <class T>  void funT(TClass2<T> a){};

void main()
{
	TClass1<int> TC1;
	funT((TClass2<int> )TC1); // only explicit cast
	funT(TC1); // error C2784: 'void __cdecl funT(class TClass1<T> )' : could not deduce template argument for 'class TClass1<T>' from 'class TClass2<int>' 
}

The compiler is Visual C++ 6.0.
Does anyone know the reason and/or an alternative solution to do this?
Thanks
GeneralRe: Casting with templates problem Pin
CPallini9-Jan-08 4:09
mveCPallini9-Jan-08 4:09 
QuestionSetting File Properties programmatically Pin
feather9-Jan-08 3:41
feather9-Jan-08 3:41 
GeneralRe: Setting File Properties programmatically Pin
David Crow9-Jan-08 4:13
David Crow9-Jan-08 4:13 
Generalworking set, virtual bytes and private bytes Pin
George_George9-Jan-08 3:27
George_George9-Jan-08 3:27 
GeneralRe: working set, virtual bytes and private bytes Pin
led mike9-Jan-08 5:11
led mike9-Jan-08 5:11 
GeneralRe: working set, virtual bytes and private bytes Pin
toxcct9-Jan-08 5:19
toxcct9-Jan-08 5:19 
GeneralRe: working set, virtual bytes and private bytes Pin
George_George9-Jan-08 16:27
George_George9-Jan-08 16:27 
GeneralRe: working set, virtual bytes and private bytes Pin
toxcct9-Jan-08 21:43
toxcct9-Jan-08 21:43 
GeneralRe: working set, virtual bytes and private bytes Pin
George_George9-Jan-08 16:25
George_George9-Jan-08 16:25 
GeneralRe: working set, virtual bytes and private bytes Pin
led mike10-Jan-08 6:40
led mike10-Jan-08 6:40 
GeneralRe: working set, virtual bytes and private bytes Pin
George_George10-Jan-08 18:37
George_George10-Jan-08 18:37 
GeneralRe: working set, virtual bytes and private bytes Pin
led mike11-Jan-08 9:17
led mike11-Jan-08 9:17 
GeneralRe: working set, virtual bytes and private bytes Pin
George_George12-Jan-08 4:10
George_George12-Jan-08 4:10 
GeneralRe: working set, virtual bytes and private bytes Pin
led mike15-Jan-08 6:13
led mike15-Jan-08 6:13 
GeneralRe: working set, virtual bytes and private bytes Pin
George_George15-Jan-08 6:23
George_George15-Jan-08 6:23 
GeneralRe: working set, virtual bytes and private bytes Pin
led mike15-Jan-08 7:50
led mike15-Jan-08 7:50 
GeneralRe: working set, virtual bytes and private bytes Pin
George_George15-Jan-08 19:17
George_George15-Jan-08 19:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.