September 27, 2007 basic_static_string + some random questions | ||||
---|---|---|---|---|
| ||||
Attachments:
| Hi Mathew, I've been using basic_static_string<> class and I was trying to get a Starts With function like and I found this overload. So I just wondering what's the n parameter for since it's not being used [I copied the implementation below]? By the way would you consider adding an "attach constructor" to basic_static_string? (probably a change like that would be to much work with little gain) I have a class that implements some of the basic_string functionality and allows me to do something like this: wchar_t wch[20]; MyString<wchar_t> str(tch); str += L"hi"; I have this necessity because I have to work with a lot of POD types. Somewhere in Imperfect C++ you mentioned that you implemented a memory pool as part of a network server (just can't remember what page/chapter), I'm just wondering if is it a part of STLSoft libraries? Regards Cláudio Albuquerque inline ss_sint_t basic_static_string<C, CCH, T>::compare( ss_typename_type_k basic_static_string<C, CCH, T>::size_type pos, ss_typename_type_k basic_static_string<C, CCH, T>::size_type n, ss_typename_type_k basic_static_string<C, CCH, T>::value_type const* s) const { STLSOFT_ASSERT(is_valid()); size_type lhs_len = length(); if(!(pos < lhs_len)) { pos = lhs_len; } else { lhs_len -= pos; } if(cch < lhs_len) { lhs_len = cch; } size_type rhs_len = (s == 0) ? 0 : traits_type::length(s); STLSOFT_ASSERT(is_valid()); return compare_(m_buffer + pos, lhs_len, s, rhs_len); } |
Copyright © 1999-2021 by the D Language Foundation