Implement full support for non-pointer pointers in custom allocators for string. This completes the custom pointer support for the entire library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185167 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
test(S s, typename S::difference_type pos, S expected)
|
||||
@@ -27,6 +29,7 @@ test(S s, typename S::difference_type pos, S expected)
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S("abcde"), 0, S("bcde"));
|
||||
test(S("abcde"), 1, S("acde"));
|
||||
@@ -40,4 +43,22 @@ int main()
|
||||
test(S("abcdefghijklmnopqrst"), 1, S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, S("abcdefghijklmnopqrs"));
|
||||
}
|
||||
#if __cplusplus >= 201103L
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S("abcde"), 0, S("bcde"));
|
||||
test(S("abcde"), 1, S("acde"));
|
||||
test(S("abcde"), 2, S("abde"));
|
||||
test(S("abcde"), 4, S("abcd"));
|
||||
test(S("abcdefghij"), 0, S("bcdefghij"));
|
||||
test(S("abcdefghij"), 1, S("acdefghij"));
|
||||
test(S("abcdefghij"), 5, S("abcdeghij"));
|
||||
test(S("abcdefghij"), 9, S("abcdefghi"));
|
||||
test(S("abcdefghijklmnopqrst"), 0, S("bcdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 1, S("acdefghijklmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 10, S("abcdefghijlmnopqrst"));
|
||||
test(S("abcdefghijklmnopqrst"), 19, S("abcdefghijklmnopqrs"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user