| 55 | |
| 56 | template <class Collection, class Key> |
| 57 | class keyref : public Value { |
| 58 | public: |
| 59 | keyref(Collection &coll, Key key) :Value(coll.get(key)), _coll(coll), _key(key) { } |
| 60 | template <class T> |
| 61 | void operator= (const keyref &ref) {_coll.set(_key, ref);} |
| 62 | template <class T> |
| 63 | void operator= (const T &value) {_coll.set(_key, value);} |
| 64 | void setData(slice value) {_coll.set(_key).setData(value);} |
| 65 | void remove() {_coll.remove(_key);} |
| 66 | |
| 67 | operator FLSlot() {return _coll.set(_key);} |
| 68 | private: |
| 69 | Collection _coll; |
| 70 | Key _key; |
| 71 | }; |
| 72 | |
| 73 | |
| 74 | /** A mutable form of Array. Its storage lives in the heap, not in the (immutable) Fleece |