Skip to content

Latest commit

 

History

History
433 lines (225 loc) · 7.05 KB

2-16-map.md

File metadata and controls

433 lines (225 loc) · 7.05 KB

Dale

Previous | Next

2.16 map

Details

Module: map

Description

Concept macro for a map. Apart from the Map macro and concept macro, the documentation in this module is for a generated set instance mapping from type Tk to type Tv.

All of the functions that take Iterator arguments are defined for ReverseIterators as well, notwithstanding that there is no documentation for those instances.

The Map type implements the following concepts:

  • PairAssociativeContainer;
  • SortedAssociativeContainer; and
  • UniqueAssociativeContainer.

Its iterators implement ForwardIterator.

Structs

(Map Tk Tv)

Linkage: extern Members: N/A

The core map structure type.

(Iterator (Map Tk) (Map Tv))

Linkage: extern Members: N/A

(ReverseIterator (Map Tk Tv))

Linkage: extern Members:

  • (mapp (p (Map Tk Tv)))
  • (setiter (ReverseIterator (Set (value-type (nullptr (Map Tk Tv))))))

Functions

init

Linkage: extern Returns: bool Parameters:

  • (mapp (ref (Map Tk Tv))): A map reference.

Initialise a map.

size

Linkage: extern Returns: size Parameters:

  • (mapp (ref (Map Tk Tv))): A map reference.

Return the number of elements in the map.

max-size

Linkage: extern Returns: size Parameters:

  • (mapp (ref (const (Map Tk Tv)))): A map reference.

Returns the number of elements that can be accommodated by the map.

empty

Linkage: extern Returns: bool Parameters:

  • (mapp (ref (const (Map Tk Tv)))): A map reference.

Determine whether the map is empty.

end

Linkage: extern Returns: (Iterator (Map Tk Tv)) Parameters:

  • (mapp (ref (Map Tk Tv))): A map reference.

Returns the iterator representing the end of the map (sentinel).

begin

Linkage: extern Returns: (Iterator (Map Tk Tv)) Parameters:

  • (mapp (ref (Map Tk Tv))): A map reference.

Returns the iterator for the first map element.

source

Linkage: extern Returns: (p (value-type (nullptr (Map Tk Tv)))) Parameters:

  • (iter (Iterator (Map Tk Tv))): An iterator.

Returns a pointer to the iterator's value.

successor

Linkage: extern Returns: (Iterator (Map Tk Tv)) Parameters:

  • (iter (Iterator (Map Tk Tv))): An iterator.

Returns the iterator for the position that follows the argument iterator.

=

Linkage: extern Returns: bool Parameters:

  • (a (Iterator (Map Tk Tv))): The first iterator.
  • (b (Iterator (Map Tk Tv))): The second iterator.

<

Linkage: extern Returns: bool Parameters:

  • (a (Iterator (Map Tk Tv))): The first iterator.
  • (b (Iterator (Map Tk Tv))): The second iterator.

rend

Linkage: extern Returns: (ReverseIterator (Map Tk Tv)) Parameters:

  • (mapp (ref (Map Tk Tv))): A map reference.

Returns the iterator representing the beginning of the map (sentinel).

rbegin

Linkage: extern Returns: (ReverseIterator (Map Tk Tv)) Parameters:

  • (mapp (ref (Map Tk Tv))): A map reference.

Returns the iterator for the last map element.

clear

Linkage: extern Returns: void Parameters:

  • (mapp (ref (Map Tk Tv))): The map reference.

Remove all of the elements from the map.

insert

Linkage: extern Returns: bool Parameters:

  • (mapp (ref (Map Tk Tv))): A map reference.
  • (valt (value-type (nullptr (Map Tk Tv)))): The value to insert into the map.

Insert a new element into the map.

insert

Linkage: extern Returns: bool Parameters:

  • (mapp (ref (Map Tk Tv))): A map reference.
  • (key Tk): The key for the new map element.
  • (value Tv): The value for the new map element.

Insert a new element into the map.

find

Linkage: extern Returns: (Iterator (Map Tk Tv)) Parameters:

  • (mapp (ref (Map Tk Tv))): A map reference.
  • (key Tk): The value to find in the set.

Find an element within the map, and return the iterator for its position.

erase

Linkage: extern Returns: bool Parameters:

  • (iter (Iterator (Map Tk Tv))): The iterator.

Erase an element from the map, by specifying the iterator for its position.

erase

Linkage: extern Returns: bool Parameters:

  • (mapp (ref (Map Tk Tv))): A map reference.
  • (key Tk): The value to remove from the set.

Erase an element from the map by value.

count

Linkage: extern Returns: size Parameters:

  • (mapp (ref (Map Tk Tv))): A map reference.
  • (key Tk): The value for which the count should be determined.

Return the number of times that the value appears in the map. For a UniqueAssociativeContainer such as Map, this can only return 1 or 0, depending on whether the element is present in the set.

lower-bound

Linkage: extern Returns: (Iterator (Map Tk Tv)) Parameters:

  • (mapp (ref (Map Tk Tv))): A map reference.
  • (key Tk): The value for which the lower bound should be found.

Find the lower bound for a given value.

upper-bound

Linkage: extern Returns: (Iterator (Map Tk Tv)) Parameters:

  • (mapp (ref (Map Tk Tv))): A map reference.
  • (key Tk): The value for which the upper bound should be found.

Find the upper bound for a given value.

Concept macros

Map

Linkage: extern Parameters:

  • (Tk EqualityComparable): The key type node.
  • (Tv Type): The value type node.

Expands to a Set definition over the relevant type. Note that Tk must also implement LessThanComparable.

Macros

Map

Linkage: extern Parameters:

  • Tk: The key type node.
  • Tv: The value type node.

Expands to the concrete type name of the Map generated by way of the concept macro.

key-type

Linkage: extern Parameters:

  • (mapp (p (Map Tk Tv))): A type node.

Expands to the underlying key type of the map (i.e. Tk). This only uses the type node for dispatch purposes, so it's safe to call this with e.g. (nullptr (Map Tk Tv)) as the argument.

data-type

Linkage: extern Parameters:

  • (mapp (p (Map Tk Tv))): A type node.

Expands to the underlying data type (i.e. Tv) of the map.

value-type

Linkage: extern Parameters:

  • (mapp (p (Map Tk Tv))): A type node.

Expands to the underlying value type of the set. Note that for maps, the value type is a specially-constructed pair type that is not otherwise accessible. However, it is guaranteed to be a struct that has the members first and second, with those members mapping to Tk and Tv respectively.

size-type

Linkage: extern Parameters:

  • (mapp (p (Map Tk Tv))): A type node.

Expands to the underlying size type of the map.

difference-type

Linkage: extern Parameters:

  • (mapp (p (Map Tk Tv))): A type node.

Expands to the underlying iterator difference type of the map.

value-type

Linkage: extern Parameters:

  • (mapiter (p (Iterator (Map Tk Tv)))): A type node.

Expands to the underlying value type of the iterator. This is the same as that of value-type for the container.

Previous | Next