LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
Wrapper around std::map providing syntactic sugar for any mapping of types manipulation. More...
#include <map.hh>
Public Types | |
typedef map_type::key_type | key_type |
The map's key type. | |
typedef map_type::mapped_type | mapped_type |
The type of object associated with the keys. | |
typedef map_type::value_type | value_type |
typedef map_type::key_compare | key_compare |
Type of the function object that compares two keys for ordering. | |
typedef map_type::iterator | iterator |
Iterator used to iterate through a map. | |
typedef map_type::const_iterator | const_iterator |
Const iterator used to iterate through a map. |
Public Member Functions | |
virtual map * | clone () const |
Return a duplicate of this. | |
key_compare | key_comp () const |
Returns the key_compare object used by the map. | |
virtual N | operator[] (const T &t) const |
Lookup for the value associated to t. | |
N & | operator[] (const T &t) |
Return a reference to the value associated to t. | |
virtual N | operator() (const T &t) const |
Lookup for t, throwing std::range_error if it is not found. | |
virtual std::list< N > | operator() (const std::list< T > &ts) const |
virtual std::pair< iterator, bool > | insert (const std::pair< const T, N > &x) |
Inserts x into the map. | |
virtual void | insert (const map &other) |
Copy the contents of other to this. | |
template<class... Args> | |
std::pair< iterator, bool > | emplace (Args &&...args) |
Insert a new element built in-place using args into the map. | |
virtual bool | empty () const |
Is the map empty ? | |
virtual size_t | size () const |
Number of known identifiers. | |
virtual N | take (const T &t) |
Remove and return mapping for t from the map. | |
virtual void | clear () |
Erase all of the elements. | |
virtual std::ostream & | print (std::ostream &ostr) const |
Description of known mappings. | |
Constructors and destructor. | |
map () | |
virtual | ~map () |
Return a duplicate of this. | |
virtual iterator | find (const T &t) |
virtual const_iterator | find (const T &t) const |
virtual iterator | xfind (const T &t) |
virtual const_iterator | xfind (const T &t) const |
Iterating. | |
virtual iterator | begin () |
virtual iterator | end () |
virtual const_iterator | begin () const |
virtual const_iterator | end () const |
virtual iterator | lower_bound (const T &k) |
virtual const_iterator | lower_bound (const T &k) const |
Protected Types | |
typedef std::map< T, N > | map_type |
Protected Attributes | |
map_type | map_ |
Mapping from T to N. |
Wrapper around std::map providing syntactic sugar for any mapping of types manipulation.
typedef map_type::const_iterator misc::map< T, N >::const_iterator |
Const iterator used to iterate through a map.
Iterator used to iterate through a map.
typedef map_type::key_compare misc::map< T, N >::key_compare |
Type of the function object that compares two keys for ordering.
The map's key type.
typedef map_type::mapped_type misc::map< T, N >::mapped_type |
The type of object associated with the keys.
typedef map_type::value_type misc::map< T, N >::value_type |
The type of object, std::pair<const key_type, data_type>, stored in the map.
Referenced by misc::map< T, N >::insert().
|
virtual |
|
virtual |
Erase all of the elements.
Return a duplicate of this.
Reimplemented in misc::endo_map< T >, and misc::endo_map< Temp >.
std::pair< typename map< T, N >::iterator, bool > misc::map< T, N >::emplace | ( | Args &&... | args | ) |
Insert a new element built in-place using args into the map.
Referenced by misc::map< T, N >::insert(), and object::DesugarVisitor::variant_exp().
|
virtual |
Lookup for t.
Referenced by object::DesugarVisitor::variant_exp().
|
virtual |
|
virtual |
Inserts x into the map.
Referenced by regalloc::RegisterAllocator::operator()().
Copy the contents of other to this.
References misc::map< T, N >::begin(), and misc::map< T, N >::end().
map< T, N >::key_compare misc::map< T, N >::key_comp | ( | ) | const |
Returns the key_compare object used by the map.
|
virtual |
Finds the first element whose key is not less than k.
|
virtual |
|
virtual |
Lookup for t, throwing std::range_error if it is not found.
Reimplemented in misc::endo_map< T >, and misc::endo_map< Temp >.
|
virtual |
Lookup for a list ts of T's, throwing std::range_error if one or several elements are not found.
|
virtual |
Lookup for the value associated to t.
N & misc::map< T, N >::operator[] | ( | const T & | t | ) |
Return a reference to the value associated to t.
This method is not virtual, so that it is not automatically instantiated at the instantiation of misc::map. This way, there won't be errors from the compiler about N not being a model of the concept Default Constructible. This is needed for some instantiations of misc::map, notably the ones that uses a symbol::Symbol as mapped type, which has no default constructor (note that in this case everything will be fine as long as this method is not called – compile errors will occur otherwise).
We might want to provide two flavors of misc::map, one that requires that its second parameter is a model of Default Constructible and that provides an operator[] similar to std::map's; and another one that doesn't.
Reimplemented in misc::endo_map< T >, and misc::endo_map< Temp >.
|
virtual |
Description of known mappings.
References misc::iendl().
|
virtual |
Number of known identifiers.
|
virtual |
Remove and return mapping for t from the map.
Lookup for t and throw an exception if not available.
References misc::find().
|
virtual |
References misc::find().