* @return getAlias()+getCapacity()
*/
T *getArrayLimit() const { return getAlias()+capacity; }
+ // No "operator T *() const" because that can make
+ // expressions like mbs[index] ambiguous for some compilers.
/**
- * Access without ownership change. Same as getAlias().
- * A class instance can be used directly in expressions that take a T *.
- * @return the array pointer
+ * Array item access (const).
+ * No index bounds check.
+ * @param i array index
+ * @return reference to the array item
*/
- operator T *() const { return ptr; }
+ const T &operator[](ptrdiff_t i) const { return ptr[i]; }
/**
* Array item access (writable).
* No index bounds check.
DigitList numToConvert(*this);
numToConvert.reduce(); // Removes any trailing zeros, so that digit count is good.
numToConvert.round(MAX_DBL_DIGITS+3);
- uprv_decNumberToString(numToConvert.fDecNumber, s);
+ uprv_decNumberToString(numToConvert.fDecNumber, s.getAlias());
// TODO: how many extra digits should be included for an accurate conversion?
} else {
- uprv_decNumberToString(this->fDecNumber, s);
+ uprv_decNumberToString(this->fDecNumber, s.getAlias());
}
U_ASSERT(uprv_strlen(&s[0]) < MAX_DBL_DIGITS+18);
if (decimalSeparator != '.') {
- char *decimalPt = strchr(s, '.');
+ char *decimalPt = strchr(s.getAlias(), '.');
if (decimalPt != NULL) {
*decimalPt = decimalSeparator;
}
}
char *end = NULL;
- tDouble = uprv_strtod(s, &end);
+ tDouble = uprv_strtod(s.getAlias(), &end);
}
{
Mutex mutex;
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2002-2011, International Business Machines Corporation and
+ * Copyright (c) 2002-2012, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
}
// Buffer size is len+1 so that s.extract() will nul-terminate the string.
s.extract(0, len, buf.getAlias(), len+1, US_INV);
- this->set(buf, len);
+ this->set(buf.getAlias(), len);
}
capacity = requiredCapacity;
s.extract(0, len, buf.getAlias(), capacity);
}
- this->set(buf, requiredCapacity - 1);
+ this->set(buf.getAlias(), requiredCapacity - 1);
}