Topic: ? const char* const&, cast from char[]


Author: zhou@tidmmpl.csc.ti.com (Tonghang Zhou)
Date: 30 Dec 1994 08:22:40 GMT
Raw View
 I've having some difficulty with g++2.6.3 on automatic
 type conversion lately. I wonder if this is because I misunderstood
 the C++ typing.

 I have this template class member
  foo(const T&);
 and an instantiation with T being const char*.
 Now I do
  object.foo("hello")
 and g++ complains that char[] is incompatible with const char* const &
 (Of course it takes foo(char_pointer) fine, where char_pointer is char*)

 g++2.6.0 is happy with foo("hello")? Why doesn't g++2.5.3?
 Can someone point out my problem? If I really want to do
  object.foo("hello")
 how should I declare foo in the template?

 Please send email to me.

--
 Regards, Tonghang
________________________________________________________________________________
Tonghang Zhou ("Zhou" is pronounced "Joe")
zhou@daLdd.sc.ti.com, W:(214)997-3933, H:(214)458-7565, IMS ID THZH, M/S 8316