Board index » cppbuilder » string vs stl::string

string vs stl::string

Hello,
        I ported a project from BC4.52 to BCB4. I use the hash method
from string (string::hash)in
the following function:

unsigned  HashValue(const string &t)
{
  return t.hash;

Quote
}

this does not work anymore since in the STL, hash is not a member of
string.

I found in OWL/SERVICES/PRIVATE a file called cstring.h wich contains
the
old string class. How can I force the compiler to use this class insead
of the STL?

Or is there any other way to solve this problem?

 

Re:string vs stl::string


Just include it. because of namespace the compiler will know wish string
youre
using.
You can safely include string.h and cstring.h in the same project.
Quote
Manfred Jaeggi wrote:
> Hello,
>         I ported a project from BC4.52 to BCB4. I use the hash method
> from string (string::hash)in
> the following function:

> unsigned  HashValue(const string &t)
> {
>   return t.hash;
> }

> this does not work anymore since in the STL, hash is not a member of
> string.

> I found in OWL/SERVICES/PRIVATE a file called cstring.h wich contains
> the
> old string class. How can I force the compiler to use this class insead
> of the STL?

> Or is there any other way to solve this problem?

Re:string vs stl::string


Manfred Jaeggi schrieb:

Quote

> Hello,
>         I ported a project from BC4.52 to BCB4. I use the hash method
> from string (string::hash)in
> the following function:

> unsigned  HashValue(const string &t)
> {
>   return t.hash;

Just to be sure (the country code of your E-Mail address tells me that I
might be affected by your software :-) ): is it as you wrote or rather

return t.hash();

Quote
> }

Re:string vs stl::string


Quote
Thomas Maeder wrote:
> Manfred Jaeggi schrieb:

> > Hello,
> >         I ported a project from BC4.52 to BCB4. I use the hash method
> > from string (string::hash)in
> > the following function:

> > unsigned  HashValue(const string &t)
> > {
> >   return t.hash;

> Just to be sure (the country code of your E-Mail address tells me that I
> might be affected by your software :-) ): is it as you wrote or rather

> return t.hash();

> > }

Yes Thomas, you're right - sorry

Re:string vs stl::string


Manfred Jaeggi schrieb:

Quote
> Hello,
>         I ported a project from BC4.52 to BCB4. I use the hash method
> from string (string::hash)in
> the following function:

> unsigned  HashValue(const string &t)
> {
>   return t.hash;
> }

> this does not work anymore since in the STL, hash is not a member of
> string.

> I found in OWL/SERVICES/PRIVATE a file called cstring.h wich contains
> the
> old string class. How can I force the compiler to use this class insead
> of the STL?

> Or is there any other way to solve this problem?

Hi,
i have the same problem with string and stl::string.
I have include the header "..\..\owlfiles\services\private\cstring.h" and
nothing happens. The error is the same. Can anybody help me?

Thanks a lot!

Other Threads