MCPcopy Create free account
hub / github.com/chokkan/crfsuite / SwigPyIterator_T

Class SwigPyIterator_T

swig/python/export_wrap.cpp:4406–4446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4404namespace swig {
4405 template<typename OutIterator>
4406 class SwigPyIterator_T : public SwigPyIterator
4407 {
4408 public:
4409 typedef OutIterator out_iterator;
4410 typedef typename std::iterator_traits<out_iterator>::value_type value_type;
4411 typedef SwigPyIterator_T<out_iterator> self_type;
4412
4413 SwigPyIterator_T(out_iterator curr, PyObject *seq)
4414 : SwigPyIterator(seq), current(curr)
4415 {
4416 }
4417
4418 const out_iterator& get_current() const
4419 {
4420 return current;
4421 }
4422
4423
4424 bool equal (const SwigPyIterator &iter) const
4425 {
4426 const self_type *iters = dynamic_cast<const self_type *>(&iter);
4427 if (iters) {
4428 return (current == iters->get_current());
4429 } else {
4430 throw std::invalid_argument("bad iterator type");
4431 }
4432 }
4433
4434 ptrdiff_t distance(const SwigPyIterator &iter) const
4435 {
4436 const self_type *iters = dynamic_cast<const self_type *>(&iter);
4437 if (iters) {
4438 return std::distance(current, iters->get_current());
4439 } else {
4440 throw std::invalid_argument("bad iterator type");
4441 }
4442 }
4443
4444 protected:
4445 out_iterator current;
4446 };
4447
4448 template <class ValueType>
4449 struct from_oper

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected