1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <locale>
10 
11 // template <> class codecvt<char, char, mbstate_t>
12 
13 // result out(stateT& state,
14 //            const internT* from, const internT* from_end, const internT*& from_next,
15 //            externT* to, externT* to_end, externT*& to_next) const;
16 
17 #include <locale>
18 #include <string>
19 #include <vector>
20 #include <cassert>
21 
22 #include "test_macros.h"
23 
24 typedef std::codecvt<char, char, std::mbstate_t> F;
25 
main(int,char **)26 int main(int, char**)
27 {
28     std::locale l = std::locale::classic();
29     const std::basic_string<F::intern_type> from("some text");
30     std::vector<char> to(from.size());
31     const F& f = std::use_facet<F>(l);
32     std::mbstate_t mbs = {};
33     const char* from_next = 0;
34     char* to_next = 0;
35     assert(f.out(mbs, from.data(), from.data() + from.size(), from_next,
36                       to.data(), to.data() + to.size(), to_next) == F::noconv);
37     assert(from_next == from.data());
38     assert(to_next == to.data());
39 
40   return 0;
41 }
42