S
Sabrina
Can someone help? I have been trying to get the hash_map
in C++ for .NET to work with strings and const char*. I
am using the const char* as the key and a pointer to
another class as the data type. I would like to be able
to assign unique names to each key and allow the user to
be able to search the hash_map to find that key and in so
doing, retrieve the information that is being pointed to
by the other class' pointer(data type). I can hard code
values of const char* into the hash_map key and retrieve
them through testing and modifying the source code,
however when I try allowing for user input to find a
particular key this does not work. 1) "cin" does not
allow for "const char*" so I must use string 2) even when
I use "string str; const char* nme; nme = str.c_str();"
and then pass this into the function to "find" the key in
the hash_map it will not work. Yet, as said, hardcoding
all values of const char* will work. Can anyone help? I
would be very grateful! Thank you!
in C++ for .NET to work with strings and const char*. I
am using the const char* as the key and a pointer to
another class as the data type. I would like to be able
to assign unique names to each key and allow the user to
be able to search the hash_map to find that key and in so
doing, retrieve the information that is being pointed to
by the other class' pointer(data type). I can hard code
values of const char* into the hash_map key and retrieve
them through testing and modifying the source code,
however when I try allowing for user input to find a
particular key this does not work. 1) "cin" does not
allow for "const char*" so I must use string 2) even when
I use "string str; const char* nme; nme = str.c_str();"
and then pass this into the function to "find" the key in
the hash_map it will not work. Yet, as said, hardcoding
all values of const char* will work. Can anyone help? I
would be very grateful! Thank you!