diff options
Diffstat (limited to 'test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp')
-rw-r--r-- | test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp new file mode 100644 index 000000000000..20455b258c0a --- /dev/null +++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <string> + +// basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<charT> il); + +#include <string> +#include <cassert> + +#include "min_allocator.h" + +int main() +{ +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + { + std::string s("123def456"); + s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); + assert(s == "123abc456"); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + S s("123def456"); + s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); + assert(s == "123abc456"); + } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +} |