[Plugin] unordered_map
#1

unordered_map for SA:MP


Description
This plugin allows you working with unordered_map

Natives
PHP Code:
native map:Map_New(type);
native Map_Emplace(typemap:mapkeystring[]="",keyint=0,valuestring[]="",valueint=0);
native Map_Find(typemap:mapkeystring[]=""keyint=0dest[]=""size=sizeof dest);
native Map_Size(typemap:map);
native Map_Clear(typemap:map);
native Map_Erase(typemap:mapkeystring[]=""keyint=0);
native Map_Empty(typemap:map);
native Map_Load_Factor(typemap:map);
native Map_Bucket_Count(typemap:map); 
Example code
PHP Code:
#include <unordered_map>
main()
{
  
/*
  Types:
  Map_SS = <string,string>
  Map_II = <int,int>
  Map_SI = <string, int>
  Map_IS = <int,string>
  */
  // example code with <string, string>
  
new map:Map Map_New(Map_SS); // Create a new map
  
Map_Emplace(Map_SSMap"hello", .valuestring="hi"// Insert a new element
  
new value[3];
  if(
Map_Find(Map_SSMap"hello", .dest=value) != -1// Search our element
  
{
    
printf("Value: %s",value); // Output: Value: hi
  
}
  
// example code with <int,int>
  
new map:Map Map_New(Map_II);
  
Map_Emplace(Map_IIMap, .keyint=45, .valueint=10);
  new 
value Map_Find(Map_IIMap, .keyint=45);
  if(
value != -1)
  {
    
printf("Value: %d"value); // Output: Value: 10
  
}
  
  
// example code with <string,int>
  
new map:Map Map_New(Map_SI);
  
Map_Emplace(Map_SIMap"number", .valueint=15);
  new 
value Map_Find(Map_SIMap"number");
  if(
value != -1)
  {
    
printf("Value: %d",value); // Output: Value: 15
  
}

Installing
1. Download unordered_map from Releases page
2. Extract unordered_map.inc to pawno/include folder
3. In your mode include unordered_map.inc
4. Extract unordered_map.dll or unordered_map.so to plugins folder
5. In the server.cfg on line plugins add unordered_map.dll or unordered_map.so

Releases:
https://github.com/AnveSamp/unordered_map/releases

Source code:
https://github.com/AnveSamp/unordered_map

Happy new year
Reply


Messages In This Thread
unordered_map - by ShapeGaz - 31.12.2017, 10:34
Re: unordered_map - by AnGeL_KRAMER - 31.12.2017, 10:40
Re: unordered_map - by ShapeGaz - 31.12.2017, 11:21
Re: unordered_map - by Yashas - 31.12.2017, 13:57
Re: unordered_map - by ShapeGaz - 31.12.2017, 14:59
Re: unordered_map - by chneubeul - 31.12.2017, 18:14
Re: unordered_map - by NaS - 31.12.2017, 18:48
Re: unordered_map - by ShapeGaz - 31.12.2017, 19:02
Re: unordered_map - by chneubeul - 31.12.2017, 19:17
Re: unordered_map - by ShapeGaz - 31.12.2017, 19:39

Forum Jump:


Users browsing this thread: 2 Guest(s)