MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / tuple

Class tuple

extern/pybind/include/pybind11/pytypes.h:2114–2134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2112};
2113
2114class tuple : public object {
2115public:
2116 PYBIND11_OBJECT_CVT(tuple, object, PyTuple_Check, PySequence_Tuple)
2117 template <typename SzType = ssize_t,
2118 detail::enable_if_t<std::is_integral<SzType>::value, int> = 0>
2119 // Some compilers generate link errors when using `const SzType &` here:
2120 explicit tuple(SzType size = 0) : object(PyTuple_New(ssize_t_cast(size)), stolen_t{}) {
2121 if (!m_ptr) {
2122 pybind11_fail("Could not allocate tuple object!");
2123 }
2124 }
2125 size_t size() const { return (size_t) PyTuple_Size(m_ptr); }
2126 bool empty() const { return size() == 0; }
2127 detail::tuple_accessor operator[](size_t index) const { return {*this, index}; }
2128 template <typename T, detail::enable_if_t<detail::is_pyobject<T>::value, int> = 0>
2129 detail::item_accessor operator[](T &&o) const {
2130 return object::operator[](std::forward<T>(o));
2131 }
2132 detail::tuple_iterator begin() const { return {*this, 0}; }
2133 detail::tuple_iterator end() const { return {*this, PyTuple_GET_SIZE(m_ptr)}; }
2134};
2135
2136// We need to put this into a separate function because the Intel compiler
2137// fails to compile enable_if_t<all_of<is_keyword_or_ds<Args>...>::value> part below

Callers 9

cxx_stdMethod · 0.85
_version.pyFile · 0.85
make_tupleFunction · 0.85
dispatcherMethod · 0.85
printFunction · 0.85
loadMethod · 0.85
loadMethod · 0.85
loadFunction · 0.85
make_new_python_typeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected