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
+26
-2
@@ -15,6 +15,8 @@
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
test(const S& lhs, const typename S::value_type* rhs, bool x)
|
||||
@@ -22,10 +24,10 @@ test(const S& lhs, const typename S::value_type* rhs, bool x)
|
||||
assert((lhs <= rhs) == x);
|
||||
}
|
||||
|
||||
typedef std::string S;
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(""), "", true);
|
||||
test(S(""), "abcde", true);
|
||||
test(S(""), "abcdefghij", true);
|
||||
@@ -42,4 +44,26 @@ int main()
|
||||
test(S("abcdefghijklmnopqrst"), "abcde", false);
|
||||
test(S("abcdefghijklmnopqrst"), "abcdefghij", false);
|
||||
test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true);
|
||||
}
|
||||
#if __cplusplus >= 201103L
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(""), "", true);
|
||||
test(S(""), "abcde", true);
|
||||
test(S(""), "abcdefghij", true);
|
||||
test(S(""), "abcdefghijklmnopqrst", true);
|
||||
test(S("abcde"), "", false);
|
||||
test(S("abcde"), "abcde", true);
|
||||
test(S("abcde"), "abcdefghij", true);
|
||||
test(S("abcde"), "abcdefghijklmnopqrst", true);
|
||||
test(S("abcdefghij"), "", false);
|
||||
test(S("abcdefghij"), "abcde", false);
|
||||
test(S("abcdefghij"), "abcdefghij", true);
|
||||
test(S("abcdefghij"), "abcdefghijklmnopqrst", true);
|
||||
test(S("abcdefghijklmnopqrst"), "", false);
|
||||
test(S("abcdefghijklmnopqrst"), "abcde", false);
|
||||
test(S("abcdefghijklmnopqrst"), "abcdefghij", false);
|
||||
test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in new issue
Block a user