1 // This file is part of the ustl library, an STL implementation.
3 // Copyright (C) 2005 by Mike Sharov <msharov@users.sourceforge.net>
4 // This file is free software, distributed under the MIT License.
9 void WriteCML (const cmemlink
& l
)
11 cout
.format ("cmemlink{%zu}: ", l
.size());
12 const void* pv
= l
.cdata();
13 const char* pc
= reinterpret_cast<const char*>(pv
);
17 cout
.write (l
.begin(), nc
);
23 const char hello
[] = "Hello world!";
24 const char* phello
= hello
; // const storage is sometimes copied on pointing
27 a
.link (phello
, VectorSize(hello
));
28 if (a
.begin() != phello
)
29 cout
.format ("a.begin() failed: %p != %p\n", a
.begin(), phello
);
30 a
.link (VectorRange (hello
));
31 if (*(const char*)(a
.begin() + 5) != hello
[5])
32 cout
.format ("begin()[5] failed: %c != %c\n", *(const char*)(a
.begin() + 5), VectorElement(hello
,5));
33 if (a
.size() != VectorSize(hello
))
34 cout
<< "link to VectorRange doesn't work\n";
35 if (0 != memcmp (a
.begin(), hello
, VectorSize(hello
)))
36 cout
<< "memcmp failed on cmemlink\n";
37 b
.static_link (hello
);
41 cout
<< "operator== failed on cmemlink\n";
42 b
.resize (VectorSize(hello
) - 5);