mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-29 19:01:41 +00:00
Fix PR32642 - string::insert and string::append don't work with move_iterator.
llvm-svn: 300397
This commit is contained in:
1 parent
4d53a1cb31
commit
e84fcb5f3d
3 files changed
+51
-6
No files matched your search
@@ -204,4 +204,20 @@ int main()
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
|
||||
{ // test with a move iterator that returns char&&
|
||||
typedef forward_iterator<const char*> It;
|
||||
typedef std::move_iterator<It> MoveIt;
|
||||
const char p[] = "ABCD";
|
||||
std::string s;
|
||||
s.append(MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1)));
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
{ // test with a move iterator that returns char&&
|
||||
typedef const char* It;
|
||||
typedef std::move_iterator<It> MoveIt;
|
||||
const char p[] = "ABCD";
|
||||
std::string s;
|
||||
s.append(MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1)));
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user