Improve performance of constructing filesystem::path from strings.

This patch fixes a performance bug when constructing or appending to a path
from a string or c-string. Previously we called 'push_back' to append every
single character. This caused multiple re-allocation and copies when at most
one reallocation is necessary. The new behavior is to simply call
`string::append` so it can correctly handle reallocation.

For large strings this change is a ~4x improvement. This also makes our path
faster to construct than libstdc++'s.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285530 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/experimental/filesystem b/include/experimental/filesystem
index 1a8dee9..c674a03 100644
--- a/include/experimental/filesystem
+++ b/include/experimental/filesystem
@@ -623,10 +623,10 @@
 
 template <>
 struct _PathCVT<char> {
+
     template <class _Iter>
     static void __append_range(string& __dest, _Iter __b, _Iter __e) {
-        for (; __b != __e; ++__b)
-            __dest.push_back(*__b);
+        __dest.append(__b, __e);
     }
 
     template <class _Iter>
@@ -640,7 +640,8 @@
     static void __append_source(string& __dest, _Source const& __s)
     {
         using _Traits = __is_pathable<_Source>;
-        __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s));
+        __append_range(__dest, _Traits::__range_begin(__s),
+                               _Traits::__range_end(__s));
     }
 };