array of char* -> list<string> ? 
Author Message
 array of char* -> list<string> ?

First of all, thanks for your help. :)

Quote:
> It could work in VC6, but std::list doesn't provide the necessary
> member template ctor.

Is that ctor template what GCC has and VC6 doesn't?

I thought this was a compiler specific-thing, like VC6 can just call the
default constructor in cases like this. And that is why std::list (or any
other template) doesn't know that std::string has a constructor which
accepts char*. One could say every std::string is a char* also. Am I wrong?

Ed



Tue, 11 May 2004 01:05:37 GMT  
 array of char* -> list<string> ?

Quote:

>First of all, thanks for your help. :)

No problem!

Quote:
>> It could work in VC6, but std::list doesn't provide the necessary
>> member template ctor.

>Is that ctor template what GCC has and VC6 doesn't?

Yes.

Quote:
>I thought this was a compiler specific-thing, like VC6 can just call the
>default constructor in cases like this. And that is why std::list (or any
>other template) doesn't know that std::string has a constructor which
>accepts char*. One could say every std::string is a char* also. Am I wrong?

std::string is not a char*. You can initialize a std::string from a
char* or assign a char* to it only because std::string defines the
appropriate conversion ctor and assignment operator. You can't
implicitly go the other way, however; you have to use string's c_str()
member for that.

--
Doug Harrison [VC++ MVP]
Eluent Software, LLC
http://www.eluent.com
Tools for Visual C++ and Windows



Tue, 11 May 2004 11:15:10 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. <<<<<<<Parsing help, please>>>>>>>>

2. File Format conversion, ascii freeform -->.csv <-->.wk1<-->dbf<-->?HELP

3. <<<>>>Need C code advice with functions and sorting.<<<>>>

4. <><><>HELP<><><> PCMCIA Motorola Montana 33.6

5. >>>Windows Service<<<

6. convert string to vector<char>

7. Parsing in basic_string<char> or string

8. proposal: <basic.h>, <pascal.h>, <fortran.h>, <cobol.h>

9. <<<< C Grammar for yacc needed >>>>

10. - - - = = =<><> W e b - U S A <><>= = = - - -

11. >>>> * Get keypress * <<<<

12. std::list<string>::sort (Cmp)

 

 
Powered by phpBB® Forum Software