Py2Cpp 1.6.3; VERSION ${PROJECT_VERSION}
Loading...
Searching...
No Matches
Namespaces | Classes | Functions
py Namespace Reference

Python-like utilities and data structures for C++. More...

Namespaces

namespace  detail
 

Classes

class  AtlasView
 Atlas view for vertex adjacency in Boost Graph Library graphs. More...
 
class  dict
 Python-like dictionary implementation. More...
 
class  EdgeView
 Edge view for Boost Graph Library graphs. More...
 
class  Generator
 Minimal generator using C++20 coroutines. More...
 
class  GrAdaptor
 Graph adapter for Boost Graph Library integration. More...
 
struct  key_iterator
 Iterator adapter for accessing keys in map-like containers. More...
 
struct  Range
 Python-like range implementation. More...
 
struct  RangeIterator
 Iterator for range-based sequences. More...
 
class  RecursiveGenerator
 Recursive generator using C++20 coroutines with symmetric transfer. More...
 
class  set
 Python-like set implementation. More...
 
class  VertexView
 Vertex view for Boost Graph Library graphs. More...
 

Functions

template<typename Key , typename T >
auto operator< (const Key &key, const dict< Key, T > &m) noexcept -> bool
 Check if a key is contained in a dictionary.
 
template<typename Key , typename T >
auto len (const dict< Key, T > &m) noexcept -> size_t
 Get the number of key-value pairs in a dictionary.
 
template<typename T >
auto enumerate (T &iterable) -> detail::EnumerateIterableWrapper< T >
 Create an enumerable wrapper for a container.
 
template<typename T >
auto enumerate (const T &iterable) -> detail::EnumerateIterableWrapper< const T >
 Create an enumerable wrapper for a const container.
 
template<typename T >
auto const_enumerate (const T &iterable) -> detail::EnumerateIterableWrapper< const T >
 (deprecated) Create an enumerable wrapper for a const container
 
template<typename T >
CONSTEXPR14 auto range (T start, T stop) -> Range< T >
 range(T start, T stop)
 
template<typename T >
CONSTEXPR14 auto range (T stop) -> Range< T >
 range(T stop)
 
template<typename T >
void swap (RecursiveGenerator< T > &a, RecursiveGenerator< T > &b) noexcept
 
template<typename Key >
auto operator< (const Key &key, const set< Key > &m) -> bool
 Check if an element is contained in a set.
 
template<typename Key >
auto len (const set< Key > &m) noexcept -> size_t
 Get the number of elements in a set.
 

Detailed Description

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.

Function Documentation

◆ const_enumerate()

template<typename T >
auto py::const_enumerate ( const T &  iterable) -> detail::EnumerateIterableWrapper<const T>
inline

(deprecated) Create an enumerable wrapper for a const container

Deprecated:
Use enumerate() instead. This function is provided for backward compatibility.
Template Parameters
TThe container type
Parameters
[in]iterableConst reference to the container to enumerate
Returns
detail::EnumerateIterableWrapper<const T> Wrapper for enumerated iteration

◆ enumerate() [1/2]

template<typename T >
auto py::enumerate ( const T &  iterable) -> detail::EnumerateIterableWrapper<const T>
inline

Create an enumerable wrapper for a const container.

Returns a wrapper that allows iteration over container elements with their indices, similar to Python's enumerate() function. Used for const containers.

Template Parameters
TThe container type
Parameters
[in]iterableConst reference to the container to enumerate
Returns
detail::EnumerateIterableWrapper<const T> Wrapper for enumerated iteration

◆ enumerate() [2/2]

template<typename T >
auto py::enumerate ( T &  iterable) -> detail::EnumerateIterableWrapper<T>
inline

Create an enumerable wrapper for a container.

Returns a wrapper that allows iteration over container elements with their indices, similar to Python's enumerate() function.

Template Parameters
TThe container type
Parameters
[in]iterableReference to the container to enumerate
Returns
detail::EnumerateIterableWrapper<T> Wrapper for enumerated iteration

◆ len() [1/2]

template<typename Key , typename T >
auto py::len ( const dict< Key, T > &  m) -> size_t
inlinenoexcept

Get the number of key-value pairs in a dictionary.

Template Parameters
KeyThe key type
TThe value type
Parameters
[in]mThe dictionary
Returns
size_t Number of key-value pairs

◆ len() [2/2]

template<typename Key >
auto py::len ( const set< Key > &  m) -> size_t
inlinenoexcept

Get the number of elements in a set.

Template Parameters
KeyThe element type stored in the set
Parameters
[in]mThe set
Returns
size_t Number of elements in the set

◆ operator<() [1/2]

template<typename Key , typename T >
auto py::operator< ( const Key &  key,
const dict< Key, T > &  m 
) -> bool
inlinenoexcept

Check if a key is contained in a dictionary.

Template Parameters
KeyThe key type
TThe value type
Parameters
[in]keyThe key to check
[in]mThe dictionary to search
Returns
true if the key is contained in the dictionary, false otherwise

◆ operator<() [2/2]

template<typename Key >
auto py::operator< ( const Key &  key,
const set< Key > &  m 
) -> bool
inline

Check if an element is contained in a set.

Template Parameters
KeyThe element type stored in the set
Parameters
[in]keyThe element to check
[in]mThe set to search
Returns
true if the set contains the element, false otherwise

◆ range() [1/2]

template<typename T >
CONSTEXPR14 auto py::range ( start,
stop 
) -> Range<T>

range(T start, T stop)

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 Parameters
TThe numeric type for the range values
Parameters
[in]startThe starting value of the range (inclusive)
[in]stopThe ending value of the range (exclusive)
Returns
Range<T>

◆ range() [2/2]

template<typename T >
CONSTEXPR14 auto py::range ( stop) -> Range<T>

range(T stop)

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 Parameters
TThe numeric type for the range values
Parameters
[in]stopThe ending value of the range (exclusive)
Returns
Range<T>

◆ swap()

template<typename T >
void py::swap ( RecursiveGenerator< T > &  a,
RecursiveGenerator< T > &  b 
)
noexcept