diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2018-02-22 05:14:20 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2018-02-22 05:14:20 +0000 |
commit | 3c83937370155ddf0a5fd117b817155a5cd978ff (patch) | |
tree | 7d5629460f797fe7a1bdd4714e5d844eb835edb0 /libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp | |
parent | e54a9ee8ac721a3ebf427f64b598154e1dda917b (diff) | |
download | bcm5719-llvm-3c83937370155ddf0a5fd117b817155a5cd978ff.tar.gz bcm5719-llvm-3c83937370155ddf0a5fd117b817155a5cd978ff.zip |
Add another test case to the deduction guide for basic_string.
llvm-svn: 325740
Diffstat (limited to 'libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp')
-rw-r--r-- | libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp index b83275a57c8..815b5600dd4 100644 --- a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp @@ -41,6 +41,17 @@ int main() { { const char* s = "12345678901234"; + std::basic_string s1(s, s+10); // Can't use {} here + using S = decltype(s1); // what type did we get? + static_assert(std::is_same_v<S::value_type, char>, ""); + static_assert(std::is_same_v<S::traits_type, std::char_traits<char>>, ""); + static_assert(std::is_same_v<S::allocator_type, std::allocator<char>>, ""); + assert(s1.size() == 10); + assert(s1.compare(0, s1.size(), s, s1.size()) == 0); + } + + { + const char* s = "12345678901234"; std::basic_string s1{s, s+10, std::allocator<char>{}}; using S = decltype(s1); // what type did we get? static_assert(std::is_same_v<S::value_type, char>, ""); |