1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_CODECVT
11#define _LIBCPP_CODECVT
12
13/*
14    codecvt synopsis
15
16namespace std
17{
18
19enum codecvt_mode
20{
21    consume_header = 4,
22    generate_header = 2,
23    little_endian = 1
24};
25
26template <class Elem, unsigned long Maxcode = 0x10ffff,
27          codecvt_mode Mode = (codecvt_mode)0>
28class codecvt_utf8
29    : public codecvt<Elem, char, mbstate_t>
30{
31    explicit codecvt_utf8(size_t refs = 0);
32    ~codecvt_utf8();
33};
34
35template <class Elem, unsigned long Maxcode = 0x10ffff,
36          codecvt_mode Mode = (codecvt_mode)0>
37class codecvt_utf16
38    : public codecvt<Elem, char, mbstate_t>
39{
40    explicit codecvt_utf16(size_t refs = 0);
41    ~codecvt_utf16();
42};
43
44template <class Elem, unsigned long Maxcode = 0x10ffff,
45          codecvt_mode Mode = (codecvt_mode)0>
46class codecvt_utf8_utf16
47    : public codecvt<Elem, char, mbstate_t>
48{
49    explicit codecvt_utf8_utf16(size_t refs = 0);
50    ~codecvt_utf8_utf16();
51};
52
53}  // std
54
55*/
56
57#include <__assert> // all public C++ headers provide the assertion handler
58#include <__config>
59#include <__locale>
60#include <version>
61
62#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
63#  pragma GCC system_header
64#endif
65
66_LIBCPP_BEGIN_NAMESPACE_STD
67
68enum codecvt_mode
69{
70    consume_header = 4,
71    generate_header = 2,
72    little_endian = 1
73};
74
75// codecvt_utf8
76
77template <class _Elem> class __codecvt_utf8;
78
79#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
80template <>
81class _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t>
82    : public codecvt<wchar_t, char, mbstate_t>
83{
84    unsigned long _Maxcode_;
85    codecvt_mode _Mode_;
86public:
87    typedef wchar_t   intern_type;
88    typedef char      extern_type;
89    typedef mbstate_t state_type;
90
91    _LIBCPP_INLINE_VISIBILITY
92    explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
93                            codecvt_mode _Mode)
94        : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
95          _Mode_(_Mode) {}
96protected:
97    virtual result
98        do_out(state_type& __st,
99               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
100               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
101    virtual result
102        do_in(state_type& __st,
103              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
104              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
105    virtual result
106        do_unshift(state_type& __st,
107                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
108    virtual int do_encoding() const _NOEXCEPT;
109    virtual bool do_always_noconv() const _NOEXCEPT;
110    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
111                          size_t __mx) const;
112    virtual int do_max_length() const _NOEXCEPT;
113};
114#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
115
116_LIBCPP_SUPPRESS_DEPRECATED_PUSH
117template <>
118class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t>
119    : public codecvt<char16_t, char, mbstate_t>
120{
121    unsigned long _Maxcode_;
122    codecvt_mode _Mode_;
123public:
124    typedef char16_t  intern_type;
125    typedef char      extern_type;
126    typedef mbstate_t state_type;
127
128    _LIBCPP_INLINE_VISIBILITY
129    explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
130                            codecvt_mode _Mode)
131        : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
132          _Mode_(_Mode) {}
133_LIBCPP_SUPPRESS_DEPRECATED_POP
134
135protected:
136    virtual result
137        do_out(state_type& __st,
138               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
139               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
140    virtual result
141        do_in(state_type& __st,
142              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
143              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
144    virtual result
145        do_unshift(state_type& __st,
146                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
147    virtual int do_encoding() const _NOEXCEPT;
148    virtual bool do_always_noconv() const _NOEXCEPT;
149    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
150                          size_t __mx) const;
151    virtual int do_max_length() const _NOEXCEPT;
152};
153
154_LIBCPP_SUPPRESS_DEPRECATED_PUSH
155template <>
156class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t>
157    : public codecvt<char32_t, char, mbstate_t>
158{
159    unsigned long _Maxcode_;
160    codecvt_mode _Mode_;
161public:
162    typedef char32_t  intern_type;
163    typedef char      extern_type;
164    typedef mbstate_t state_type;
165
166    _LIBCPP_INLINE_VISIBILITY
167    explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
168                            codecvt_mode _Mode)
169        : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
170          _Mode_(_Mode) {}
171_LIBCPP_SUPPRESS_DEPRECATED_POP
172
173protected:
174    virtual result
175        do_out(state_type& __st,
176               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
177               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
178    virtual result
179        do_in(state_type& __st,
180              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
181              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
182    virtual result
183        do_unshift(state_type& __st,
184                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
185    virtual int do_encoding() const _NOEXCEPT;
186    virtual bool do_always_noconv() const _NOEXCEPT;
187    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
188                          size_t __mx) const;
189    virtual int do_max_length() const _NOEXCEPT;
190};
191
192template <class _Elem, unsigned long _Maxcode = 0x10ffff,
193          codecvt_mode _Mode = (codecvt_mode)0>
194class _LIBCPP_TEMPLATE_VIS codecvt_utf8
195    : public __codecvt_utf8<_Elem>
196{
197public:
198    _LIBCPP_INLINE_VISIBILITY
199    explicit codecvt_utf8(size_t __refs = 0)
200        : __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
201
202    _LIBCPP_INLINE_VISIBILITY
203    ~codecvt_utf8() {}
204};
205
206// codecvt_utf16
207
208template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
209
210#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
211template <>
212class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false>
213    : public codecvt<wchar_t, char, mbstate_t>
214{
215    unsigned long _Maxcode_;
216    codecvt_mode _Mode_;
217public:
218    typedef wchar_t   intern_type;
219    typedef char      extern_type;
220    typedef mbstate_t state_type;
221
222    _LIBCPP_INLINE_VISIBILITY
223    explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
224                            codecvt_mode _Mode)
225        : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
226          _Mode_(_Mode) {}
227protected:
228    virtual result
229        do_out(state_type& __st,
230               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
231               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
232    virtual result
233        do_in(state_type& __st,
234              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
235              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
236    virtual result
237        do_unshift(state_type& __st,
238                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
239    virtual int do_encoding() const _NOEXCEPT;
240    virtual bool do_always_noconv() const _NOEXCEPT;
241    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
242                          size_t __mx) const;
243    virtual int do_max_length() const _NOEXCEPT;
244};
245
246template <>
247class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, true>
248    : public codecvt<wchar_t, char, mbstate_t>
249{
250    unsigned long _Maxcode_;
251    codecvt_mode _Mode_;
252public:
253    typedef wchar_t   intern_type;
254    typedef char      extern_type;
255    typedef mbstate_t state_type;
256
257    _LIBCPP_INLINE_VISIBILITY
258    explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
259                            codecvt_mode _Mode)
260        : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
261          _Mode_(_Mode) {}
262protected:
263    virtual result
264        do_out(state_type& __st,
265               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
266               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
267    virtual result
268        do_in(state_type& __st,
269              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
270              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
271    virtual result
272        do_unshift(state_type& __st,
273                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
274    virtual int do_encoding() const _NOEXCEPT;
275    virtual bool do_always_noconv() const _NOEXCEPT;
276    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
277                          size_t __mx) const;
278    virtual int do_max_length() const _NOEXCEPT;
279};
280#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
281
282_LIBCPP_SUPPRESS_DEPRECATED_PUSH
283template <>
284class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false>
285    : public codecvt<char16_t, char, mbstate_t>
286{
287    unsigned long _Maxcode_;
288    codecvt_mode _Mode_;
289public:
290    typedef char16_t  intern_type;
291    typedef char      extern_type;
292    typedef mbstate_t state_type;
293
294    _LIBCPP_INLINE_VISIBILITY
295    explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
296                            codecvt_mode _Mode)
297        : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
298          _Mode_(_Mode) {}
299_LIBCPP_SUPPRESS_DEPRECATED_POP
300
301protected:
302    virtual result
303        do_out(state_type& __st,
304               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
305               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
306    virtual result
307        do_in(state_type& __st,
308              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
309              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
310    virtual result
311        do_unshift(state_type& __st,
312                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
313    virtual int do_encoding() const _NOEXCEPT;
314    virtual bool do_always_noconv() const _NOEXCEPT;
315    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
316                          size_t __mx) const;
317    virtual int do_max_length() const _NOEXCEPT;
318};
319
320_LIBCPP_SUPPRESS_DEPRECATED_PUSH
321template <>
322class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true>
323    : public codecvt<char16_t, char, mbstate_t>
324{
325    unsigned long _Maxcode_;
326    codecvt_mode _Mode_;
327public:
328    typedef char16_t  intern_type;
329    typedef char      extern_type;
330    typedef mbstate_t state_type;
331
332    _LIBCPP_INLINE_VISIBILITY
333    explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
334                            codecvt_mode _Mode)
335        : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
336          _Mode_(_Mode) {}
337_LIBCPP_SUPPRESS_DEPRECATED_POP
338
339protected:
340    virtual result
341        do_out(state_type& __st,
342               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
343               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
344    virtual result
345        do_in(state_type& __st,
346              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
347              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
348    virtual result
349        do_unshift(state_type& __st,
350                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
351    virtual int do_encoding() const _NOEXCEPT;
352    virtual bool do_always_noconv() const _NOEXCEPT;
353    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
354                          size_t __mx) const;
355    virtual int do_max_length() const _NOEXCEPT;
356};
357
358_LIBCPP_SUPPRESS_DEPRECATED_PUSH
359template <>
360class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false>
361    : public codecvt<char32_t, char, mbstate_t>
362{
363    unsigned long _Maxcode_;
364    codecvt_mode _Mode_;
365public:
366    typedef char32_t  intern_type;
367    typedef char      extern_type;
368    typedef mbstate_t state_type;
369
370    _LIBCPP_INLINE_VISIBILITY
371    explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
372                            codecvt_mode _Mode)
373        : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
374          _Mode_(_Mode) {}
375_LIBCPP_SUPPRESS_DEPRECATED_POP
376
377protected:
378    virtual result
379        do_out(state_type& __st,
380               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
381               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
382    virtual result
383        do_in(state_type& __st,
384              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
385              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
386    virtual result
387        do_unshift(state_type& __st,
388                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
389    virtual int do_encoding() const _NOEXCEPT;
390    virtual bool do_always_noconv() const _NOEXCEPT;
391    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
392                          size_t __mx) const;
393    virtual int do_max_length() const _NOEXCEPT;
394};
395
396_LIBCPP_SUPPRESS_DEPRECATED_PUSH
397template <>
398class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true>
399    : public codecvt<char32_t, char, mbstate_t>
400{
401    unsigned long _Maxcode_;
402    codecvt_mode _Mode_;
403public:
404    typedef char32_t  intern_type;
405    typedef char      extern_type;
406    typedef mbstate_t state_type;
407
408    _LIBCPP_INLINE_VISIBILITY
409    explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
410                            codecvt_mode _Mode)
411        : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
412          _Mode_(_Mode) {}
413_LIBCPP_SUPPRESS_DEPRECATED_POP
414
415protected:
416    virtual result
417        do_out(state_type& __st,
418               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
419               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
420    virtual result
421        do_in(state_type& __st,
422              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
423              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
424    virtual result
425        do_unshift(state_type& __st,
426                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
427    virtual int do_encoding() const _NOEXCEPT;
428    virtual bool do_always_noconv() const _NOEXCEPT;
429    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
430                          size_t __mx) const;
431    virtual int do_max_length() const _NOEXCEPT;
432};
433
434template <class _Elem, unsigned long _Maxcode = 0x10ffff,
435          codecvt_mode _Mode = (codecvt_mode)0>
436class _LIBCPP_TEMPLATE_VIS codecvt_utf16
437    : public __codecvt_utf16<_Elem, _Mode & little_endian>
438{
439public:
440    _LIBCPP_INLINE_VISIBILITY
441    explicit codecvt_utf16(size_t __refs = 0)
442        : __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
443
444    _LIBCPP_INLINE_VISIBILITY
445    ~codecvt_utf16() {}
446};
447
448// codecvt_utf8_utf16
449
450template <class _Elem> class __codecvt_utf8_utf16;
451
452#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
453template <>
454class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t>
455    : public codecvt<wchar_t, char, mbstate_t>
456{
457    unsigned long _Maxcode_;
458    codecvt_mode _Mode_;
459public:
460    typedef wchar_t   intern_type;
461    typedef char      extern_type;
462    typedef mbstate_t state_type;
463
464    _LIBCPP_INLINE_VISIBILITY
465    explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
466                            codecvt_mode _Mode)
467        : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
468          _Mode_(_Mode) {}
469protected:
470    virtual result
471        do_out(state_type& __st,
472               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
473               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
474    virtual result
475        do_in(state_type& __st,
476              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
477              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
478    virtual result
479        do_unshift(state_type& __st,
480                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
481    virtual int do_encoding() const _NOEXCEPT;
482    virtual bool do_always_noconv() const _NOEXCEPT;
483    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
484                          size_t __mx) const;
485    virtual int do_max_length() const _NOEXCEPT;
486};
487#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
488
489_LIBCPP_SUPPRESS_DEPRECATED_PUSH
490template <>
491class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t>
492    : public codecvt<char32_t, char, mbstate_t>
493{
494    unsigned long _Maxcode_;
495    codecvt_mode _Mode_;
496public:
497    typedef char32_t  intern_type;
498    typedef char      extern_type;
499    typedef mbstate_t state_type;
500
501    _LIBCPP_INLINE_VISIBILITY
502    explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
503                            codecvt_mode _Mode)
504        : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
505          _Mode_(_Mode) {}
506_LIBCPP_SUPPRESS_DEPRECATED_POP
507
508protected:
509    virtual result
510        do_out(state_type& __st,
511               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
512               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
513    virtual result
514        do_in(state_type& __st,
515              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
516              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
517    virtual result
518        do_unshift(state_type& __st,
519                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
520    virtual int do_encoding() const _NOEXCEPT;
521    virtual bool do_always_noconv() const _NOEXCEPT;
522    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
523                          size_t __mx) const;
524    virtual int do_max_length() const _NOEXCEPT;
525};
526
527_LIBCPP_SUPPRESS_DEPRECATED_PUSH
528template <>
529class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t>
530    : public codecvt<char16_t, char, mbstate_t>
531{
532    unsigned long _Maxcode_;
533    codecvt_mode _Mode_;
534public:
535    typedef char16_t  intern_type;
536    typedef char      extern_type;
537    typedef mbstate_t state_type;
538
539    _LIBCPP_INLINE_VISIBILITY
540    explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
541                            codecvt_mode _Mode)
542        : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
543          _Mode_(_Mode) {}
544_LIBCPP_SUPPRESS_DEPRECATED_POP
545
546protected:
547    virtual result
548        do_out(state_type& __st,
549               const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
550               extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
551    virtual result
552        do_in(state_type& __st,
553              const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
554              intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
555    virtual result
556        do_unshift(state_type& __st,
557                   extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
558    virtual int do_encoding() const _NOEXCEPT;
559    virtual bool do_always_noconv() const _NOEXCEPT;
560    virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
561                          size_t __mx) const;
562    virtual int do_max_length() const _NOEXCEPT;
563};
564
565template <class _Elem, unsigned long _Maxcode = 0x10ffff,
566          codecvt_mode _Mode = (codecvt_mode)0>
567class _LIBCPP_TEMPLATE_VIS codecvt_utf8_utf16
568    : public __codecvt_utf8_utf16<_Elem>
569{
570public:
571    _LIBCPP_INLINE_VISIBILITY
572    explicit codecvt_utf8_utf16(size_t __refs = 0)
573        : __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
574
575    _LIBCPP_INLINE_VISIBILITY
576    ~codecvt_utf8_utf16() {}
577};
578
579_LIBCPP_END_NAMESPACE_STD
580
581#endif // _LIBCPP_CODECVT
582