Commit 4fb37598 authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

docs: Added a note about the performance of slicing C++ stl containers.

parent 084a25f5
...@@ -423,6 +423,14 @@ comprehensions). For example, one can write:: ...@@ -423,6 +423,14 @@ comprehensions). For example, one can write::
If the loop target variable is unspecified, an assignment from type If the loop target variable is unspecified, an assignment from type
``*container.begin()`` is used for :ref:`type inference <compiler-directives>`. ``*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 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