mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-12-05 19:31:49 +00:00
Implement full support for non-pointer pointers in custom allocators for string. This completes the custom pointer support for the entire library.
llvm-svn: 185167
This commit is contained in:
1 parent
e852add40e
commit
eec721826c
151 files changed
+5125
-645
No files matched your search
@@ -18,6 +18,8 @@
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../min_allocator.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
@@ -64,4 +66,52 @@ int main()
|
||||
in >> s;
|
||||
assert(in.fail());
|
||||
}
|
||||
#if __cplusplus >= 201103L
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
std::istringstream in("a bc defghij");
|
||||
S s("initial text");
|
||||
in >> s;
|
||||
assert(in.good());
|
||||
assert(s == "a");
|
||||
assert(in.peek() == ' ');
|
||||
in >> s;
|
||||
assert(in.good());
|
||||
assert(s == "bc");
|
||||
assert(in.peek() == ' ');
|
||||
in.width(3);
|
||||
in >> s;
|
||||
assert(in.good());
|
||||
assert(s == "def");
|
||||
assert(in.peek() == 'g');
|
||||
in >> s;
|
||||
assert(in.eof());
|
||||
assert(s == "ghij");
|
||||
in >> s;
|
||||
assert(in.fail());
|
||||
}
|
||||
{
|
||||
typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, min_allocator<wchar_t>> S;
|
||||
std::wistringstream in(L"a bc defghij");
|
||||
S s(L"initial text");
|
||||
in >> s;
|
||||
assert(in.good());
|
||||
assert(s == L"a");
|
||||
assert(in.peek() == L' ');
|
||||
in >> s;
|
||||
assert(in.good());
|
||||
assert(s == L"bc");
|
||||
assert(in.peek() == L' ');
|
||||
in.width(3);
|
||||
in >> s;
|
||||
assert(in.good());
|
||||
assert(s == L"def");
|
||||
assert(in.peek() == L'g');
|
||||
in >> s;
|
||||
assert(in.eof());
|
||||
assert(s == L"ghij");
|
||||
in >> s;
|
||||
assert(in.fail());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in new issue
Block a user