basic_string&
operator=(initializer_list<_CharT> __l)
{
- this->assign (__l.begin(), __l.end());
+ this->assign(__l.begin(), __l.size());
return *this;
}
#endif // __GXX_EXPERIMENTAL_CXX0X__
rend() const
{ return const_reverse_iterator(this->begin()); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * Returns a read-only (constant) iterator that points to the first
+ * character in the %string.
+ */
+ const_iterator
+ cbegin() const
+ { return const_iterator(this->_M_data()); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past the
+ * last character in the %string.
+ */
+ const_iterator
+ cend() const
+ { return const_iterator(this->_M_data() + this->size()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to the last character in the %string. Iteration is done in
+ * reverse element order.
+ */
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(this->end()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to one before the first character in the %string. Iteration
+ * is done in reverse element order.
+ */
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(this->begin()); }
+#endif
+
public:
// Capacity:
/// Returns the number of characters in the string, not including any
*/
basic_string&
operator+=(initializer_list<_CharT> __l)
- { return this->append(__l.begin(), __l.end()); }
+ { return this->append(__l.begin(), __l.size()); }
#endif // __GXX_EXPERIMENTAL_CXX0X__
/**
*/
basic_string&
append(initializer_list<_CharT> __l)
- { return this->append(__l.begin(), __l.end()); }
+ { return this->append(__l.begin(), __l.size()); }
#endif // __GXX_EXPERIMENTAL_CXX0X__
/**
*/
basic_string&
assign(initializer_list<_CharT> __l)
- { return this->assign(__l.begin(), __l.end()); }
+ { return this->assign(__l.begin(), __l.size()); }
#endif // __GXX_EXPERIMENTAL_CXX0X__
/**
*/
void
insert(iterator __p, initializer_list<_CharT> __l)
- { this->insert(__p, __l.begin(), __l.end()); }
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
+ this->insert(__p - _M_ibegin(), __l.begin(), __l.size());
+ }
#endif // __GXX_EXPERIMENTAL_CXX0X__
/**
static _CharT*
_S_construct_aux(_Integer __beg, _Integer __end,
const _Alloc& __a, __true_type)
- { return _S_construct(static_cast<size_type>(__beg), __end, __a); }
+ { return _S_construct(static_cast<size_type>(__beg),
+ static_cast<value_type>(__end), __a); }
template<class _InIterator>
static _CharT*
{ return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); }
// NB: (v)snprintf vs sprintf.
+
+ // DR 1261.
+ inline string
+ to_string(int __val)
+ { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(int),
+ "%d", __val); }
+
+ inline string
+ to_string(unsigned __val)
+ { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
+ 4 * sizeof(unsigned),
+ "%u", __val); }
+
+ inline string
+ to_string(long __val)
+ { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(long),
+ "%ld", __val); }
+
+ inline string
+ to_string(unsigned long __val)
+ { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
+ 4 * sizeof(unsigned long),
+ "%lu", __val); }
+
inline string
to_string(long long __val)
{ return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
"%llu", __val); }
inline string
+ to_string(float __val)
+ {
+ const int __n =
+ __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
+ return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
+ "%f", __val);
+ }
+
+ inline string
+ to_string(double __val)
+ {
+ const int __n =
+ __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
+ return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
+ "%f", __val);
+ }
+
+ inline string
to_string(long double __val)
{
const int __n =
stold(const wstring& __str, size_t* __idx = 0)
{ return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); }
+ // DR 1261.
+ inline wstring
+ to_wstring(int __val)
+ { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(int),
+ L"%d", __val); }
+
+ inline wstring
+ to_wstring(unsigned __val)
+ { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
+ 4 * sizeof(unsigned),
+ L"%u", __val); }
+
+ inline wstring
+ to_wstring(long __val)
+ { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(long),
+ L"%ld", __val); }
+
+ inline wstring
+ to_wstring(unsigned long __val)
+ { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
+ 4 * sizeof(unsigned long),
+ L"%lu", __val); }
+
inline wstring
to_wstring(long long __val)
{ return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
L"%llu", __val); }
inline wstring
+ to_wstring(float __val)
+ {
+ const int __n =
+ __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
+ return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
+ L"%f", __val);
+ }
+
+ inline wstring
+ to_wstring(double __val)
+ {
+ const int __n =
+ __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
+ return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
+ L"%f", __val);
+ }
+
+ inline wstring
to_wstring(long double __val)
{
const int __n =