py namespace
Python-like utilities and data structures for C++.
The py namespace contains implementations of Python-inspired data structures and utilities that make C++ programming more convenient and Python-like.
Classes
-
template<typename Vertex, typename Graph>class AtlasView
- Atlas view for vertex adjacency in Boost Graph Library graphs.
-
template<typename Key, typename T>class dict
- Python-like dictionary implementation.
-
template<typename Graph>class EdgeView
- Edge view for Boost Graph Library graphs.
-
template<typename _Graph>class GrAdaptor
- Graph adapter for Boost Graph Library integration.
-
template<typename Iter>struct key_iterator
- Iterator adapter for accessing keys in map-like containers.
-
template<typename T>class Lict
- Dict-like data structure by std::vector and Range.
-
template<typename T>struct Range
- Python-like range implementation.
-
template<typename T>struct RangeIterator
- Iterator for range-based sequences.
-
template<typename Key>class set
- Python-like set implementation.
-
template<typename Graph>class VertexView
- Vertex view for Boost Graph Library graphs.
Functions
-
template<typename Key, typename T>auto operator<(const Key& key, const dict<Key, T>& m) noexcept -> bool -> auto
- Check if a key is contained in a dictionary.
-
template<typename Key, typename T>auto len(const dict<Key, T>& m) noexcept -> size_t -> auto
- Get the number of key-value pairs in a dictionary.
-
template<typename T>auto enumerate(T& iterable) -> detail::EnumerateIterableWrapper< T > -> auto
- Create an enumerable wrapper for a container.
-
template<typename T>auto enumerate(const T& iterable) -> detail::EnumerateIterableWrapper< const T > -> auto
- Create an enumerable wrapper for a const container.
-
template<typename T>auto const_enumerate(const T& iterable) -> detail::EnumerateIterableWrapper< const T > -> auto deprecated
- (deprecated) Create an enumerable wrapper for a const container
-
template<typename T>auto range(T start, T stop) -> Range< T > -> CONSTEXPR14 auto
- range(T start, T stop)
-
template<typename T>auto range(T stop) -> Range< T > -> CONSTEXPR14 auto
- range(T stop)
-
template<typename Key>auto operator<(const Key& key, const set<Key>& m) -> bool -> auto
- Check if an element is contained in a set.
-
template<typename Key>auto len(const set<Key>& m) noexcept -> size_t -> auto
- Get the number of elements in a set.
Function documentation
template<typename Key, typename T>
auto py:: operator<(const Key& key,
const dict<Key, T>& m) noexcept -> bool
Check if a key is contained in a dictionary.
| Template parameters | |
|---|---|
| Key | The key type |
| T | The value type |
| Parameters | |
| key in | The key to check |
| m in | The dictionary to search |
| Returns | true if the key is contained in the dictionary, false otherwise |
template<typename T>
auto py:: enumerate(T& iterable) -> detail::EnumerateIterableWrapper< T >
Create an enumerable wrapper for a container.
| Template parameters | |
|---|---|
| T | The container type |
| Parameters | |
| iterable in | Reference to the container to enumerate |
| Returns | detail::EnumerateIterableWrapper<T> Wrapper for enumerated iteration |
Returns a wrapper that allows iteration over container elements with their indices, similar to Python's enumerate() function.
template<typename T>
auto py:: enumerate(const T& iterable) -> detail::EnumerateIterableWrapper< const T >
Create an enumerable wrapper for a const container.
| Template parameters | |
|---|---|
| T | The container type |
| Parameters | |
| iterable in | Const reference to the container to enumerate |
| Returns | detail::EnumerateIterableWrapper<const T> Wrapper for enumerated iteration |
Returns a wrapper that allows iteration over container elements with their indices, similar to Python's enumerate() function. Used for const containers.
template<typename T>
auto py:: const_enumerate(const T& iterable) -> detail::EnumerateIterableWrapper< const T >
(deprecated) Create an enumerable wrapper for a const container
| Template parameters | |
|---|---|
| T | The container type |
| Parameters | |
| iterable in | Const reference to the container to enumerate |
| Returns | detail::EnumerateIterableWrapper<const T> Wrapper for enumerated iteration |
template<typename T>
CONSTEXPR14 auto py:: range(T start,
T stop) -> Range< T >
| Template parameters | |
|---|---|
| T | The numeric type for the range values |
| Parameters | |
| start in | The starting value of the range (inclusive) |
| stop in | The ending value of the range (exclusive) |
| Returns | Range<T> |
The range(T start, T stop) function is creating a range of values from start to stop. It returns a Range<T> object that represents the range. The range includes all values from start up to, but not including, stop.
template<typename T>
CONSTEXPR14 auto py:: range(T stop) -> Range< T >
| Template parameters | |
|---|---|
| T | The numeric type for the range values |
| Parameters | |
| stop in | The ending value of the range (exclusive) |
| Returns | Range<T> |
The range(T stop) function is creating a range of values from 0 to stop. It returns a Range<T> object that represents the range. The range includes all values from 0 up to, but not including, stop.
template<typename Key>
auto py:: operator<(const Key& key,
const set<Key>& m) -> bool
Check if an element is contained in a set.
| Template parameters | |
|---|---|
| Key | The element type stored in the set |
| Parameters | |
| key in | The element to check |
| m in | The set to search |
| Returns | true if the set contains the element, false otherwise |