1 #ifndef __MYSTRING_H__ // -*- tab-width: 2 mode: c++ -*-
4 struct char_traits_strid
:public std::char_traits
<strid
>
6 typedef strid char_type
;
8 //typedef streampos pos_type;
9 //typedef streamoff off_type;
10 //typedef mbstate_t state_type;
13 assign(char_type
& __c1
, const char_type
& __c2
)
17 eq(const char_type
& __c1
, const char_type
& __c2
)
18 { return __c1
== __c2
; }
21 lt(const char_type
& __c1
, const char_type
& __c2
)
22 { return __c1
< __c2
; }
25 compare(const char_type
* __s1
, const char_type
* __s2
, size_t __n
)
26 { return memcmp((const char*)__s1
, (const char*)__s2
, __n
*sizeof(char_type
)); }
28 static size_t length(const char_type
* __s
)
37 static const char_type
*
38 find(const char_type
* __s
, size_t __n
, const char_type
& __a
)
40 for (size_t i
= 0;i
< __n
;i
++)
47 move(char_type
* __s1
, const char_type
* __s2
, size_t __n
)
48 { return static_cast<char_type
*>(memmove(__s1
, __s2
, __n
*sizeof(char_type
))); }
51 copy(char_type
* __s1
, const char_type
* __s2
, size_t __n
)
52 { return static_cast<char_type
*>(memcpy(__s1
, __s2
, __n
*sizeof(char_type
))); }
55 assign(char_type
* __s
, size_t __n
, char_type __a
)
57 for (size_t i
= 0;i
< __n
;i
++)
63 to_char_type(const int_type
& __c
)
64 { return static_cast<char_type
>(__c
); }
66 // To keep both the byte 0xff and the eof symbol 0xffffffff
67 // from ending up as 0xffffffff.
69 to_int_type(const char_type
& __c
)
70 { return static_cast<int_type
>(static_cast<unsigned char>(__c
)); }
73 eq_int_type(const int_type
& __c1
, const int_type
& __c2
)
74 { return __c1
== __c2
; }
77 eof() { return static_cast<int_type
>(EOF
); }
80 not_eof(const int_type
& __c
)
81 { return (__c
== eof()) ? 0 : __c
; }
83 typedef std::basic_string
<strid
,char_traits_strid
> strid_string
;