File: make_iterator.h

package info (click to toggle)
gemmi 0.7.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,644 kB
  • sloc: cpp: 64,445; python: 5,425; ansic: 4,545; sh: 374; makefile: 112; javascript: 86; f90: 42
file content (10 lines) | stat: -rw-r--r-- 438 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
#include "common.h"
#include <nanobind/make_iterator.h>

// This wrapper simplifies the call to nb::make_iterator (by assuming
// the name "iterator") and changes the default rv_policy to what it was
// in pybind11 and nanobind<2.0.
template<nb::rv_policy Policy = nb::rv_policy::reference_internal, typename S, typename T>
auto usual_iterator(const S&, T& value) {
  return nb::make_iterator<Policy>(nb::type<S>(), "iterator", value);
}