MongoDB  2.7.0
Classes | Public Types | Public Member Functions | Public Attributes | Friends | List of all members
mongo::mapsf< M > Struct Template Reference

Thread safe map. More...

#include <mapsf.h>

Inheritance diagram for mongo::mapsf< M >:

Classes

struct  ref
 

Public Types

typedef M::const_iterator const_iterator
 
typedef M::key_type key_type
 
typedef M::mapped_type mapped_type
 

Public Member Functions

void swap (M &rhs)
 
bool empty ()
 
mapped_type get (key_type k)
 

Public Attributes

SimpleMutex m
 
val
 

Friends

struct ref
 

Detailed Description

template<class M>
struct mongo::mapsf< M >

Thread safe map.

Be careful not to use this too much or it could make things slow; if not a hot code path no problem. Examples:

mapsf< map<int,int>, int, int > mp;

int x = mp.get();

map< map<int,int>, int, int > two; mp.swap(two);

{ mapsf< map<int,int>, int, int >::ref r(mp); r[9] = 1; map<int,int>::iterator i = r.r.begin(); }


The documentation for this struct was generated from the following file: