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
diff --git a/libcxx/test/strings/basic.string/string.capacity/capacity.pass.cpp b/libcxx/test/strings/basic.string/string.capacity/capacity.pass.cpp
index 67ef152..22ca1f3 100644
--- a/libcxx/test/strings/basic.string/string.capacity/capacity.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.capacity/capacity.pass.cpp
@@ -15,6 +15,7 @@
 #include <cassert>
 
 #include "../test_allocator.h"
+#include "../min_allocator.h"
 
 template <class S>
 void
@@ -36,6 +37,7 @@
 
 int main()
 {
+    {
     typedef std::basic_string<char, std::char_traits<char>, test_allocator<char> > S;
     S s;
     test(s);
@@ -45,4 +47,12 @@
     s.assign(100, 'a');
     s.erase(50);
     test(s);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+    S s;
+    assert(s.capacity() > 0);
+    }
+#endif
 }
diff --git a/libcxx/test/strings/basic.string/string.capacity/clear.pass.cpp b/libcxx/test/strings/basic.string/string.capacity/clear.pass.cpp
index 5f8cf6f..ba8ba24 100644
--- a/libcxx/test/strings/basic.string/string.capacity/clear.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.capacity/clear.pass.cpp
@@ -14,6 +14,8 @@
 #include <string>
 #include <cassert>
 
+#include "../min_allocator.h"
+
 template <class S>
 void
 test(S s)
@@ -24,6 +26,7 @@
 
 int main()
 {
+    {
     typedef std::string S;
     S s;
     test(s);
@@ -35,4 +38,20 @@
     s.assign(100, 'a');
     s.erase(50);
     test(s);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+    S s;
+    test(s);
+
+    s.assign(10, 'a');
+    s.erase(5);
+    test(s);
+
+    s.assign(100, 'a');
+    s.erase(50);
+    test(s);
+    }
+#endif
 }
diff --git a/libcxx/test/strings/basic.string/string.capacity/empty.pass.cpp b/libcxx/test/strings/basic.string/string.capacity/empty.pass.cpp
index c79ac77..29f62cd 100644
--- a/libcxx/test/strings/basic.string/string.capacity/empty.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.capacity/empty.pass.cpp
@@ -14,6 +14,8 @@
 #include <string>
 #include <cassert>
 
+#include "../min_allocator.h"
+
 template <class S>
 void
 test(const S& s)
@@ -23,8 +25,18 @@
 
 int main()
 {
+    {
     typedef std::string S;
     test(S());
     test(S("123"));
     test(S("12345678901234567890123456789012345678901234567890"));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+    test(S());
+    test(S("123"));
+    test(S("12345678901234567890123456789012345678901234567890"));
+    }
+#endif
 }
diff --git a/libcxx/test/strings/basic.string/string.capacity/length.pass.cpp b/libcxx/test/strings/basic.string/string.capacity/length.pass.cpp
index 756c141..5ddb5c1 100644
--- a/libcxx/test/strings/basic.string/string.capacity/length.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.capacity/length.pass.cpp
@@ -14,6 +14,8 @@
 #include <string>
 #include <cassert>
 
+#include "../min_allocator.h"
+
 template <class S>
 void
 test(const S& s)
@@ -23,8 +25,18 @@
 
 int main()
 {
+    {
     typedef std::string S;
     test(S());
     test(S("123"));
     test(S("12345678901234567890123456789012345678901234567890"));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+    test(S());
+    test(S("123"));
+    test(S("12345678901234567890123456789012345678901234567890"));
+    }
+#endif
 }
diff --git a/libcxx/test/strings/basic.string/string.capacity/max_size.pass.cpp b/libcxx/test/strings/basic.string/string.capacity/max_size.pass.cpp
index 59387c6..e016bba 100644
--- a/libcxx/test/strings/basic.string/string.capacity/max_size.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.capacity/max_size.pass.cpp
@@ -14,6 +14,8 @@
 #include <string>
 #include <cassert>
 
+#include "../min_allocator.h"
+
 template <class S>
 void
 test(const S& s)
@@ -23,8 +25,18 @@
 
 int main()
 {
+    {
     typedef std::string S;
     test(S());
     test(S("123"));
     test(S("12345678901234567890123456789012345678901234567890"));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+    test(S());
+    test(S("123"));
+    test(S("12345678901234567890123456789012345678901234567890"));
+    }
+#endif
 }
diff --git a/libcxx/test/strings/basic.string/string.capacity/reserve.pass.cpp b/libcxx/test/strings/basic.string/string.capacity/reserve.pass.cpp
index 0689a8b..6fdb457 100644
--- a/libcxx/test/strings/basic.string/string.capacity/reserve.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.capacity/reserve.pass.cpp
@@ -15,6 +15,8 @@
 #include <stdexcept>
 #include <cassert>
 
+#include "../min_allocator.h"
+
 template <class S>
 void
 test(S s)
@@ -50,6 +52,7 @@
 
 int main()
 {
+    {
     typedef std::string S;
     {
     S s;
@@ -78,4 +81,37 @@
     test(s, 100);
     test(s, S::npos);
     }
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+    {
+    S s;
+    test(s);
+
+    s.assign(10, 'a');
+    s.erase(5);
+    test(s);
+
+    s.assign(100, 'a');
+    s.erase(50);
+    test(s);
+    }
+    {
+    S s;
+    test(s, 5);
+    test(s, 10);
+    test(s, 50);
+    }
+    {
+    S s(100, 'a');
+    s.erase(50);
+    test(s, 5);
+    test(s, 10);
+    test(s, 50);
+    test(s, 100);
+    test(s, S::npos);
+    }
+    }
+#endif
 }
diff --git a/libcxx/test/strings/basic.string/string.capacity/resize_size.pass.cpp b/libcxx/test/strings/basic.string/string.capacity/resize_size.pass.cpp
index 723c125..d1b66a4 100644
--- a/libcxx/test/strings/basic.string/string.capacity/resize_size.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.capacity/resize_size.pass.cpp
@@ -15,6 +15,8 @@
 #include <stdexcept>
 #include <cassert>
 
+#include "../min_allocator.h"
+
 template <class S>
 void
 test(S s, typename S::size_type n, S expected)
@@ -34,6 +36,7 @@
 
 int main()
 {
+    {
     typedef std::string S;
     test(S(), 0, S());
     test(S(), 1, S(1, '\0'));
@@ -51,4 +54,26 @@
     test(S("12345678901234567890123456789012345678901234567890"), 60,
          S("12345678901234567890123456789012345678901234567890\0\0\0\0\0\0\0\0\0\0", 60));
     test(S(), S::npos, S("not going to happen"));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+    test(S(), 0, S());
+    test(S(), 1, S(1, '\0'));
+    test(S(), 10, S(10, '\0'));
+    test(S(), 100, S(100, '\0'));
+    test(S("12345"), 0, S());
+    test(S("12345"), 2, S("12"));
+    test(S("12345"), 5, S("12345"));
+    test(S("12345"), 15, S("12345\0\0\0\0\0\0\0\0\0\0", 15));
+    test(S("12345678901234567890123456789012345678901234567890"), 0, S());
+    test(S("12345678901234567890123456789012345678901234567890"), 10,
+         S("1234567890"));
+    test(S("12345678901234567890123456789012345678901234567890"), 50,
+         S("12345678901234567890123456789012345678901234567890"));
+    test(S("12345678901234567890123456789012345678901234567890"), 60,
+         S("12345678901234567890123456789012345678901234567890\0\0\0\0\0\0\0\0\0\0", 60));
+    test(S(), S::npos, S("not going to happen"));
+    }
+#endif
 }
diff --git a/libcxx/test/strings/basic.string/string.capacity/resize_size_char.pass.cpp b/libcxx/test/strings/basic.string/string.capacity/resize_size_char.pass.cpp
index f217765..9fb0c8c 100644
--- a/libcxx/test/strings/basic.string/string.capacity/resize_size_char.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.capacity/resize_size_char.pass.cpp
@@ -15,6 +15,8 @@
 #include <stdexcept>
 #include <cassert>
 
+#include "../min_allocator.h"
+
 template <class S>
 void
 test(S s, typename S::size_type n, typename S::value_type c, S expected)
@@ -34,6 +36,7 @@
 
 int main()
 {
+    {
     typedef std::string S;
     test(S(), 0, 'a', S());
     test(S(), 1, 'a', S("a"));
@@ -51,4 +54,26 @@
     test(S("12345678901234567890123456789012345678901234567890"), 60, 'a',
          S("12345678901234567890123456789012345678901234567890aaaaaaaaaa"));
     test(S(), S::npos, 'a', S("not going to happen"));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+    test(S(), 0, 'a', S());
+    test(S(), 1, 'a', S("a"));
+    test(S(), 10, 'a', S(10, 'a'));
+    test(S(), 100, 'a', S(100, 'a'));
+    test(S("12345"), 0, 'a', S());
+    test(S("12345"), 2, 'a', S("12"));
+    test(S("12345"), 5, 'a', S("12345"));
+    test(S("12345"), 15, 'a', S("12345aaaaaaaaaa"));
+    test(S("12345678901234567890123456789012345678901234567890"), 0, 'a', S());
+    test(S("12345678901234567890123456789012345678901234567890"), 10, 'a',
+         S("1234567890"));
+    test(S("12345678901234567890123456789012345678901234567890"), 50, 'a',
+         S("12345678901234567890123456789012345678901234567890"));
+    test(S("12345678901234567890123456789012345678901234567890"), 60, 'a',
+         S("12345678901234567890123456789012345678901234567890aaaaaaaaaa"));
+    test(S(), S::npos, 'a', S("not going to happen"));
+    }
+#endif
 }
diff --git a/libcxx/test/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp b/libcxx/test/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
index e756f3c..310ccec 100644
--- a/libcxx/test/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
@@ -14,6 +14,8 @@
 #include <string>
 #include <cassert>
 
+#include "../min_allocator.h"
+
 template <class S>
 void
 test(S s)
@@ -29,6 +31,7 @@
 
 int main()
 {
+    {
     typedef std::string S;
     S s;
     test(s);
@@ -40,4 +43,20 @@
     s.assign(100, 'a');
     s.erase(50);
     test(s);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+    S s;
+    test(s);
+
+    s.assign(10, 'a');
+    s.erase(5);
+    test(s);
+
+    s.assign(100, 'a');
+    s.erase(50);
+    test(s);
+    }
+#endif
 }
diff --git a/libcxx/test/strings/basic.string/string.capacity/size.pass.cpp b/libcxx/test/strings/basic.string/string.capacity/size.pass.cpp
index 0acbefb..9d51ca1 100644
--- a/libcxx/test/strings/basic.string/string.capacity/size.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.capacity/size.pass.cpp
@@ -14,6 +14,8 @@
 #include <string>
 #include <cassert>
 
+#include "../min_allocator.h"
+
 template <class S>
 void
 test(const S& s, typename S::size_type c)
@@ -23,8 +25,18 @@
 
 int main()
 {
+    {
     typedef std::string S;
     test(S(), 0);
     test(S("123"), 3);
     test(S("12345678901234567890123456789012345678901234567890"), 50);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+    test(S(), 0);
+    test(S("123"), 3);
+    test(S("12345678901234567890123456789012345678901234567890"), 50);
+    }
+#endif
 }