SparseVector concept

Description

Refinement of

Vector and SparseCollection

Associated types

Notation

X Type that is a model of the SparseVector concept
v object of type X
a object of type X::value_type
i object of type X::size_type

Definitions

Valid expressions

None in addition to those of Vector and SparseCollection.
Name Expression Type requirements Return type
Insert v.insert(i,a,f)
Sort v.sort(f)
Check if sorted v.is_sorted() bool

Expression semantics

In addition to those of Vector and SparseCollection.
Name Expression Preconditions Semantics Postconditions
Insert v.insert(i,a,f) The functor f describes what needs to happen with duplicates. E.g. f can be std::plus
Sort a.sort(f) The functor f describes what needs to happen with duplicates. E.g. f can be std::plus a.is_sorted()
Check if sorted a.is_sorted()
Equality v==w Although SparseVector is a refinement of EqualityComparable, extra semantics is added here: the vectors can only be equal if the structures are also equal.
InEquality v!=w Although SparseVector is a refinement of EqualityComparable, extra semantics is added here: the vectors can only be equal if the structures are also equal.

Complexity guarantees

Invariants

Models

Notes