What to do after Python?
Sheila King
sheila at spamcop.net
Mon Feb 19 13:23:24 EST 2001
On Mon, 19 Feb 2001 07:31:32 -0600, Kenneth Loafman <ken at lt.com> wrote in
comp.lang.python in article <mailman.982589543.7737.python-list at python.org>:
:Rainer Deyke wrote:
:> The following is the correct ways of doing this in C++:
:>
:> s = std::string(s.begin(), s.end() - 1);
:>
:> Not using 'std::string' in C++ is analogous to not using the built-in string
:> type in Python.
:
:They were using CString under M$VC. I don't think std::string existst
:on the M$ compilers. Would make it too easy to port to the heathen UNIX
:boxen <grin>.
I just ran this code on my Win98 box, using MetroWerks CW 5:
#include <iostream>
using namespace std; //introduces namespace std
int main ( void )
{
std::string s = "cat";
cout << "Length of s is " << s.length() << endl;
s = std::string(s.begin(), s.end() - 1);
cout << "here comes s: \n";
cout << s << endl;
return 0;
}
Here is the output:
Length of s is 3
here comes s:
ca
I think that the standard namespace is available on my Win98 machine.
Scary, huh?
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/
More information about the Python-list
mailing list