Sebastian,
Of course you can do PHP or Perl associative arrays
or hashes (string indexed arrays) in C++!
One uses the Standard Template Library map template
for that. STL map lets you construct a container in
which one type of thing is associated with another.
BTW, It might be a good idea to learn C++ templates and STL,
folks.
The SDK source code uses C++ templates to power the macro
LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName)
[util.h lines 84-94]. This macro invokes the templated function
GetClassPtr( some_class ) which acts as a sort of
universal constructor!
At 08:05 AM 05/07/2002 -0700, you wrote:
Message: 6
From: Sebastian Steinlechner [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: Re[2]: [hlcoders] string to #define
Date: Tue, 7 May 2002 13:56:16 +0200
Reply-To: [EMAIL PROTECTED]
Actually, I guess he's trying to do something different, perhaps inspired
from PHP or Perl. In these languages, you can do something like this:
$foo = What a nice test!;
$a = foo;
echo $$a;
Which then prints out What a nice test!. Another example of what is
possible in PHP:
$test['foo'] = bar;
echo $test['foo'];
But: this can only be done in scripting languages. Internally, the PHP
interpreter will have to do much the same things you have already posted
(setting up a hash-table, doing strcmps etc).
Hope that helps (well, it does not help at all actually, it simply says it's
not possible in C/C++).
TheTinySteini
Michael A. Hobson
Web Programmer
IBRC, Inc.
email: [EMAIL PROTECTED]
phone: (310) 338-9719 (home office - vm)
(310) 560-9968 (cell)
___
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders