51 List(
bool needsMarking);
54 List(
const List &b) : _impBase(b._impBase), _needsMarking(
false) {
56 if (!_impBase->valueRefCount) refValues();
57 ++_impBase->valueRefCount;
81 List copyTail()
const;
86 bool isEmpty()
const {
return _impBase->size == 0; }
90 int size()
const {
return _impBase->size; }
120 static const List &empty();
122 void mark() {
if (_impBase->valueRefCount == 0) markValues(); }
124 ListImpBase *_impBase;
127 void deref() {
if (!_needsMarking && --_impBase->valueRefCount == 0) derefValues();
if (--_impBase->refCount == 0) release(); }
151 Value operator*()
const {
return Value(_list->impAt(_i)); }
189 inline List &List::operator=(
const List &b)
191 ListImpBase *bImpBase = b._impBase;
192 ++bImpBase->refCount;
195 if (!_needsMarking) {
196 if (!_impBase->valueRefCount) {
199 _impBase->valueRefCount++;