#include "python.h" namespace python { template seqref::seqref (SeqBase& seq, sequence_index_type j) : s(seq), offset(j), the_item (s.getItem(j)){} template seqref::seqref (const seqref& r) : s(r.s), offset(r.offset), the_item(r.the_item) {} // template // seqref::~seqref() {} template seqref::operator T() const { // rvalue return the_item; } template seqref& seqref::operator=(const seqref& rhs) { //used as lvalue the_item = rhs.the_item; s.setItem(offset, the_item); return *this; } template seqref& seqref::operator=(const T& ob){ // used as lvalue the_item = ob; s.setItem(offset, ob); return *this; } // forward everything else to the item template PyObject* seqref::ptr () const { return the_item.ptr(); } template int seqref::reference_count () const { // the reference count return the_item.reference_count(); } template Type seqref::type () const { return the_item.type(); } template String seqref::str () const { return the_item.str(); } template String seqref::repr () const { return the_item.repr(); } template bool seqref::has_attr (const std::string& attr_name) const { return the_item.has_attr(attr_name); } template Object seqref::get_attr (const std::string& attr_name) const { return the_item.get_attr(attr_name); } template Object seqref::get_item (const Object& key) const { return the_item.get_item(key); } template long seqref::hash_value () const { return the_item.hash_value(); } template bool seqref::is_callable () const { return the_item.is_callable(); } template bool seqref::is_dict () const { return the_item.is_dict(); } template bool seqref::is_list () const { return the_item.is_list(); } template bool seqref::is_mapping () const { return the_item.is_mapping(); } template bool seqref::is_numeric () const { return the_item.is_numeric(); } template bool seqref::is_sequence () const { return the_item.is_sequence(); } template bool seqref::is_true () const { return the_item.is_true(); } template bool seqref::is_type (const Type& t) const { return the_item.is_type (t); } template bool seqref::is_tuple() const { return the_item.is_tuple(); } template bool seqref::is_string() const { return the_item.is_string(); } // Commands template void seqref::set_attr (const std::string& attr_name, const Object& value) { the_item.set_attr(attr_name, value); } template void seqref::del_attr (const std::string& attr_name) { the_item.del_attr(attr_name); } template void seqref::del_item (const Object& key) { the_item.del_item(key); } template bool seqref::operator==(const Object& o2) const { return the_item == o2; } template bool seqref::operator!=(const Object& o2) const { return the_item != o2; } template bool seqref::operator>=(const Object& o2) const { return the_item >= o2; } template bool seqref::operator<=(const Object& o2) const { return the_item <= o2; } template bool seqref::operator<(const Object& o2) const { return the_item < o2; } template bool seqref::operator>(const Object& o2) const { return the_item > o2; } }