www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - basic_static_string + some random questions

Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


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]?=20

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:=20
    wchar_t wch[20];

    MyString<wchar_t> str(tch);

    str +=3D 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=20
Cl=E1udio 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,=20
                                                                         =
             ss_typename_type_k basic_static_string<C, CCH, =
T>::size_type n,=20
                                                                         =
             ss_typename_type_k basic_static_string<C, CCH, =
T>::value_type const* s) const

{

    STLSOFT_ASSERT(is_valid());

    size_type lhs_len =3D length();

    if(!(pos < lhs_len))
    {
        pos =3D lhs_len;
    } else
    {
        lhs_len -=3D pos;
    }

    if(cch < lhs_len)
    {
        lhs_len =3D cch;
    }

    size_type rhs_len =3D (s =3D=3D 0) ? 0 : traits_type::length(s);

    STLSOFT_ASSERT(is_valid());

    return compare_(m_buffer + pos, lhs_len, s, rhs_len);

}
Sep 27 2007