mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 15:12:01 +00:00
5aa85be26e
This allows exposing a dict-like interface to python code, allowing iteration over keys via: for k in custommapping: ... while still allowing iteration over pairs, so that you can also implement 'dict.items()' functionality which returns a pair iterator, allowing: for k, v in custommapping.items(): ... example-sequences-and-iterators is updated with a custom class providing both types of iteration.
42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
### Sequence @ 0x1535b00 created of size 5
|
|
s = <example.Sequence object at 0x7efc73cfa4e0>
|
|
len(s) = 5
|
|
s[0], s[3] = 0.000000 0.000000
|
|
12.34 in s: False
|
|
12.34 in s: True
|
|
s[0], s[3] = 12.340000 56.779999
|
|
### Sequence @ 0x7fff22a45068 created of size 5
|
|
### Sequence @ 0x1538b90 created via move constructor
|
|
### Sequence @ 0x7fff22a45068 destroyed
|
|
### Sequence @ 0x1538bf0 created of size 5
|
|
rev[0], rev[1], rev[2], rev[3], rev[4] = 0.000000 56.779999 0.000000 0.000000 12.340000
|
|
0.0 56.779998779296875 0.0 0.0 12.34000015258789
|
|
0.0 56.779998779296875 0.0 0.0 12.34000015258789
|
|
True
|
|
### Sequence @ 0x1b4d1f0 created of size 3 from std::vector
|
|
### Sequence @ 0x1b4d1f0 destroyed
|
|
2.0 56.779998779296875 2.0 0.0 2.0
|
|
bye
|
|
2
|
|
white
|
|
banana
|
|
key = orange, value = banana
|
|
key = hi, value = bye
|
|
key = black, value = white
|
|
item: (orange, banana)
|
|
item: (hi, bye)
|
|
item: (black, white)
|
|
Instances not destroyed: 3
|
|
### Sequence @ 0x1535b00 destroyed
|
|
Instances not destroyed: 2
|
|
### Sequence @ 0x1538b90 destroyed
|
|
Instances not destroyed: 1
|
|
### Sequence @ 0x1538bf0 destroyed
|
|
Instances not destroyed: 0
|
|
Constructor values: ['of size', '5', 'of size', '5', 'of size', '5', 'of size', '3', 'from std::vector']
|
|
Default constructions: 0
|
|
Copy constructions: 0
|
|
Move constructions: True
|
|
Copy assignments: 0
|
|
Move assignments: 0
|