Raised This Month: $32 Target: $400
 8% 

StringMapSnapshot has error index


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LinLinLin
Senior Member
Join Date: Sep 2021
Old 09-21-2022 , 18:02   StringMapSnapshot has error index
Reply With Quote #1

PHP Code:
StringMap g_map;
StringMapSnapshot g_mapsnap;
void CreateStringMap()
{
    
g_map CreateTrie();

    
g_map.SetString("a","11111");
    
g_map.SetString("b","11111");
    
g_map.SetString("c","11111");
    
g_map.SetString("d","11111");

    
g_mapsnap g_map.Snapshot();

i try something like this,but when i use snap.GetKey() from 0 to snap.length , it comes with c a b d , not a b c d.
Is there something wrong?
LinLinLin is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 09-21-2022 , 20:49   Re: StringMapSnapshot has error index
Reply With Quote #2

the order doesn't matter much if you are using a StringMap, but still curious
__________________
Marttt is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 09-22-2022 , 02:00   Re: StringMapSnapshot has error index
Reply With Quote #3

Maybe this:
Quote:
CreateTrieSnapshot Function
Creates a snapshot of all keys in the map. If the map is changed after this call, the changes are not reflected in the snapshot. Keys are not sorted.
__________________
Grey83 is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 09-22-2022 , 06:02   Re: StringMapSnapshot has error index
Reply With Quote #4

Quote:
Originally Posted by Grey83 View Post
Maybe this:
Ok, thanks for reply , i use ArrayList instead .
LinLinLin is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:46.


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