Merge pull request #3085 from apense/patch-10
Update sets documentation. Fixes #3058
This commit is contained in:
commit
ae0cb7e014
1 changed files with 12 additions and 2 deletions
|
|
@ -1,6 +1,16 @@
|
||||||
The set type models the mathematical notion of a set. The set's
|
The set type models the mathematical notion of a set. The set's
|
||||||
basetype can only be an ordinal type. The reason is that sets are implemented
|
basetype can only be an ordinal type of a certain size, namely:
|
||||||
as high performance bit vectors.
|
* ``int8``-``int16``
|
||||||
|
* ``uint8``/``byte``-``uint16``
|
||||||
|
* ``char``
|
||||||
|
* ``enum``
|
||||||
|
or equivalent. The reason is that sets are implemented as high
|
||||||
|
performance bit vectors. Attempting to declare a set with a larger type will
|
||||||
|
result in an error:
|
||||||
|
|
||||||
|
.. code-block:: nim
|
||||||
|
|
||||||
|
var s: set[int64] # Error: set is too large
|
||||||
|
|
||||||
Sets can be constructed via the set constructor: ``{}`` is the empty set. The
|
Sets can be constructed via the set constructor: ``{}`` is the empty set. The
|
||||||
empty set is type compatible with any concrete set type. The constructor
|
empty set is type compatible with any concrete set type. The constructor
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue