AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Coding MM:S Plugins & SM Extensions (https://forums.alliedmods.net/forumdisplay.php?f=75)
-   -   SourceMod Std (https://forums.alliedmods.net/showthread.php?t=39023)

c0ldfyr3 09-17-2005 16:01

SourceMod Std
 
Hey Bail

I was wondering how hard would it be to convert my plugins string referances to your std library ?

The only problem I could see was the way it returns w_char for c_str...Is it possible to convert that to char ?

Also, what are the namespaces needed ?

Thanks again,
c0ld

BAILOPAN 09-17-2005 16:16

SourceHook:: is the namespace. None of the string stuff returns wchar:

Code:

const char *c_str() { return v?v:""; }
It's not "std," by the way, it's "STL" (Standard Template Library). I guess we should call SourceHook the SourceHook Library (SHL and SHTL).

Conversion is not too hard, especially if you've done things like this:
Code:

typedef std::list<int> IntList;
Because then you can just change it to:
Code:

typedef SourceHook::List<int> IntList;
The advantage is you don't have to link to libstdc++.so. However, please note, only List is truly compatible with STL. CVector and String make some deviations that, if you use some of their detailed features, you might have to work around. And TinyHash is not a replacement for map, although it can be (as it's a dictionary template).

c0ldfyr3 09-17-2005 17:37

Ok, it was just going on what was happening that time after you updated the CVS to 1.1, all my std::strings changed to yours which was very strange.

string is not a member of my SourceHook namespace o.O

I dont do anything other than append, substr, compare and find with it so it shouldnt be a problem.

String manipulation comes ez to me in any language once I get the basics right so a workaround wouldnt be a problem on my side, but C++ is still new to me, your talking to a guy who came from VB->PHP->Java and now C++, none of the others go as deep as C++ so sorry if i seem a lil slow sometimes.

sslice 09-17-2005 18:31

I believe it's String (not string) in the SourceHook namespace.

c0ldfyr3 09-17-2005 20:55

Sorry my mistake.

Im using VS 8 so it gives me a list of everything contained in the namespace and String is not there.

BAILOPAN 09-17-2005 21:10

VS8 is beta, VS7 shows everything fine for me. You might want to try Visual Assist X.

c0ldfyr3 09-17-2005 21:12

Im a dufus, I just included <sourcehook\sh_string.h> and it worked fine.

Sorry for the trouble :oops:


All times are GMT -4. The time now is 12:21.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.