| 57 | } ; |
| 58 | |
| 59 | class const_SlotProxy : public GenericProxy<const_SlotProxy> { |
| 60 | public: |
| 61 | const_SlotProxy( const CLASS& v, const std::string& name) : parent(v), slot_name(Rf_install(name.c_str())) { |
| 62 | if( !R_has_slot( v, slot_name) ){ |
| 63 | throw no_such_slot(name); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | template <typename T> operator T() const { |
| 68 | return as<T>( get() ); |
| 69 | } |
| 70 | inline operator SEXP() const { |
| 71 | return get() ; |
| 72 | } |
| 73 | |
| 74 | private: |
| 75 | const CLASS& parent; |
| 76 | SEXP slot_name ; |
| 77 | |
| 78 | SEXP get() const { |
| 79 | return R_do_slot( parent, slot_name ) ; |
| 80 | } |
| 81 | } ; |
| 82 | |
| 83 | SlotProxy slot(const std::string& name){ |
| 84 | SEXP x = static_cast<CLASS&>(*this) ; |