Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arafatkatze/map_util
https://github.com/arafatkatze/map_util
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/arafatkatze/map_util
- Owner: arafatkatze
- Created: 2016-05-23T06:38:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-05-23T06:57:22.000Z (over 8 years ago)
- Last Synced: 2024-04-13T14:20:19.223Z (8 months ago)
- Language: C++
- Size: 180 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Try these commands
ruby extconf.rb
make
irb -r./exampleUsage
2.2.1 :001 > a = Example::IntMap.new
=> std::map,std::allocator< std::pair< int const,int > > > {}
2.2.1 :002 > a[1] = 2
=> 2
2.2.1 :003 > a[6] = -12
=> -12
2.2.1 :004 > a[4] = 92
=> 92
2.2.1 :005 > a
=> std::map,std::allocator< std::pair< int const,int > > > {1=>2,4=>92,6=>-12}
2.2.1 :006 > b = Example::FindWithDefault(a, 1, 92)
=> 2
2.2.1 :007 > b = Example::FindWithDefault(a, 2, 92)
=> 92
2.2.1 :008 > b = Example::FindWithDefault(a, 6, 62)
=> -12
2.2.1 :009 > b = Example::FindWithDefault(a, 4, 62)
=> 92
2.2.1 :010 > b = Example::FindWithDefault(a, 5, 62)
=> 62
2.2.1 :011 > b = Example::LookupOrInsert(a, 5, 62)
=> #
2.2.1 :012 > a
=> std::map,std::allocator< std::pair< int const,int > > > {1=>2,4=>92,5=>62,6=>-12}