Giter Site home page Giter Site logo

bimap's Introduction

This is an implementation of a bimap done using two hashmaps.

I cannot speak to its speed or size or any characteristics you care about if you care about code metrics. Use this when you need a bimap, and performance doesn't matter.

If another bimap implementation comes outs by somebody else, it'll probably be better than this. If you want to make a better one, feel free to decide upon iface characteristics. If you want to improve this one, send a pull request.

Iface: bimap

  • get_key(V) -> K;
  • find_key(V) -> option;
  • remove_key(V) -> option;

These three methods are the same as their map counterparts, except they return or remove entries based on known values.

In this library, only hashbimap implements bimap.

Type: hashbimap

  • Implements std::map::map
  • Implements bimap::bimap
  • { kv: hashmap<K, V>, vk: hashmap<V, K> }

Basic implementation of a bimap using two hashmaps. Not very efficient, but real easy to write.

Functions

fn bimap<K: const copy, V: const copy> (fn (K) -> uint, fn (K, K) -> bool, fn (V) -> uint, fn (V, V) -> bool) -> hashbimap<K, V>

The functions in order, are hash_key, eql_key, hash_value, eql_value.

Thanks

The following people have helped me out with the bimap:

  • z0w0
  • ehold
  • jld
  • nmatsakis

bimap's People

Contributors

brson avatar havvy avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.