Commit cd3a0079 authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2467 from gabrieldemarmiesse/note_slicing

docs: Added a note about the performance of slicing C++ stl containers.
parents 7332cf1b 4fb37598
......@@ -423,6 +423,14 @@ comprehensions). For example, one can write::
If the loop target variable is unspecified, an assignment from type
``*container.begin()`` is used for :ref:`type inference <compiler-directives>`.
.. note::
Slicing stl containers is supported,
you can do ``for x in my_vector[:5]: ...`` but unlike pointers slices,
it will create a temporary Python object and iterate over it. Thus
making the iteration very slow. You might want to avoid slicing
C++ containers for performance reasons.
Simplified wrapping with default constructor
--------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment