CppStd:depr

From emmtrix Wiki
Jump to navigation Jump to search
[edit]

Source: https://timsong-cpp.github.io/cppwp/n3337/depr

List of Tables [tab]
List of Figures [fig]
1 General [intro]
2 Lexical conventions [lex]
3 Basic concepts [basic]
4 Standard conversions [conv]
5 Expressions [expr]
6 Statements [stmt.stmt]
7 Declarations [dcl.dcl]
8 Declarators [dcl.decl]
9 Classes [class]
10 Derived classes [class.derived]
11 Member access control [class.access]
12 Special member functions [special]
13 Overloading [over]
14 Templates [temp]
15 Exception handling [except]
16 Preprocessing directives [cpp]
17 Library introduction [library]
18 Language support library [language.support]
19 Diagnostics library [diagnostics]
20 General utilities library [utilities]
21 Strings library [strings]
22 Localization library [localization]
23 Containers library [containers]
24 Iterators library [iterators]
25 Algorithms library [algorithms]
26 Numerics library [numerics]
27 Input/output library [input.output]
28 Regular expressions library [re]
29 Atomic operations library [atomics]
30 Thread support library [thread]
Annex A (informative) Grammar summary [gram]
Annex B (informative) Implementation quantities [implimits]
Annex C (informative) Compatibility [diff]
Annex D (normative) Compatibility features [depr]
D.1 Increment operator with bool operand [depr.incr.bool]
D.2 register keyword [depr.register]
D.3 Implicit declaration of copy functions [depr.impldec]
D.4 Dynamic exception specifications [depr.except.spec]
D.5 C standard library headers [depr.c.headers]
D.6 Old iostreams members [depr.ios.members]
D.7 char* streams [depr.str.strstreams]
D.8 Function objects [depr.function.objects]
D.9 Binders [depr.lib.binders]
D.10 auto_ptr [depr.auto.ptr]
D.11 Violating exception-specifications [exception.unexpected]
Annex E (normative) Universal character names for identifier characters [charname]
Index [generalindex]
Index of library names [libraryindex]
Index of implementation-defined behavior [impldefindex]

Annex D (normative) Compatibility features [depr]

1 This Clause describes features of the C++ Standard that are specified for compatibility with existing implementations.
2 These are deprecated features, where deprecated is defined as: Normative for the current edition of the Standard, but not guaranteed to be part of the Standard in future revisions.

D.1 Increment operator with bool operand [depr.incr.bool]

1 The use of an operand of type bool with the ++ operator is deprecated (see [expr.pre.incr] and [expr.post.incr]).

D.2 register keyword [depr.register]

1 The use of the register keyword as a storage-class-specifier ([dcl.stc]) is deprecated.

D.3 Implicit declaration of copy functions [depr.impldec]

1 The implicit definition of a copy constructor as defaulted is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor. The implicit definition of a copy assignment operator as defaulted is deprecated if the class has a user-declared copy constructor or a user-declared destructor ([class.dtor], [class.copy]). In a future revision of this International Standard, these implicit definitions could become deleted ([dcl.fct.def]).

D.4 Dynamic exception specifications [depr.except.spec]

1 The use of dynamic-exception-specifications is deprecated.

D.5 C standard library headers [depr.c.headers]

1 For compatibility with the C standard library and the C Unicode TR, the C++ standard library provides the 25 C headers, as shown in Table [tab:future.c.headers].
Table 154 — C headers
<assert.h> <inttypes.h> <signal.h> <stdio.h> <wchar.h>
<complex.h> <iso646.h> <stdalign.h> <stdlib.h> <wctype.h>
<ctype.h> <limits.h> <stdarg.h> <string.h>
<errno.h> <locale.h> <stdbool.h> <tgmath.h>
<fenv.h> <math.h> <stddef.h> <time.h>
<float.h> <setjmp.h> <stdint.h> <uchar.h>
2 Every C header, each of which has a name of the form name.h, behaves as if each name placed in the standard library namespace by the corresponding cname header is placed within the global namespace scope. It is unspecified whether these names are first declared or defined within namespace scope ([basic.scope.namespace]) of the namespace std and are then injected into the global namespace scope by explicit using-declarations ([namespace.udecl]).
3
ExampleThe header <cstdlib> assuredly provides its declarations and definitions within the namespace std. It may also provide these names within the global namespace. The header <stdlib.h> assuredly provides the same declarations and definitions within the global namespace, much as in the C Standard. It may also provide these names within the namespace std.

D.6 Old iostreams members [depr.ios.members]

1 The following member names are in addition to names specified in Clause [input.output]:
namespace std {
  class ios_base {
  public:
    typedef T1 io_state;
    typedef T2 open_mode;
    typedef T3 seek_dir;
    typedef implementation-defined streamoff;
    typedef implementation-defined streampos;
    // remainder unchanged
  };
}
2 The type io_state is a synonym for an integer type (indicated here as T1 ) that permits certain member functions to overload others on parameters of type iostate and provide the same behavior.
3 The type open_mode is a synonym for an integer type (indicated here as T2 ) that permits certain member functions to overload others on parameters of type openmode and provide the same behavior.
4 The type seek_dir is a synonym for an integer type (indicated here as T3 ) that permits certain member functions to overload others on parameters of type seekdir and provide the same behavior.
5 The type streamoff is an implementation-defined type that satisfies the requirements of off_type in [iostreams.limits.pos].
6 The type streampos is an implementation-defined type that satisfies the requirements of pos_type in [iostreams.limits.pos].
7 An implementation may provide the following additional member function, which has the effect of calling sbumpc() ([streambuf.pub.get]):
namespace std {
  template<class charT, class traits = char_traits<charT> >
  class basic_streambuf {
  public:
    void stossc();
    // remainder unchanged
  };
}
8 An implementation may provide the following member functions that overload signatures specified in Clause [input.output]:
namespace std {
  template<class charT, class traits> class basic_ios {
  public:
    void clear(io_state state);
    void setstate(io_state state);
    void exceptions(io_state);
    // remainder unchanged
  };

  class ios_base {
  public:
    // remainder unchanged
  };

  template<class charT, class traits = char_traits<charT> >
  class basic_streambuf {
  public:
    pos_type pubseekoff(off_type off, ios_base::seek_dir way,
              ios_base::open_mode which = ios_base::in | ios_base::out);
    pos_type pubseekpos(pos_type sp,
              ios_base::open_mode which);
    // remainder unchanged
  };

  template <class charT, class traits = char_traits<charT> >
  class basic_filebuf : public basic_streambuf<charT,traits> {
  public:
    basic_filebuf<charT,traits>* open
    (const char* s, ios_base::open_mode mode);
    // remainder unchanged
  };

  template <class charT, class traits = char_traits<charT> >
  class basic_ifstream : public basic_istream<charT,traits> {
  public:
    void open(const char* s, ios_base::open_mode mode);
    // remainder unchanged
  };

  template <class charT, class traits = char_traits<charT> >
  class basic_ofstream : public basic_ostream<charT,traits> {
  public:
    void open(const char* s, ios_base::open_mode mode);
    // remainder unchanged
  };
}
9 The effects of these functions is to call the corresponding member function specified in Clause [input.output].

D.7 char* streams [depr.str.strstreams]

1 The header <strstream> defines three types that associate stream buffers with character array objects and assist reading and writing such objects.

D.7.1 Class strstreambuf [depr.strstreambuf]

namespace std {
  class strstreambuf : public basic_streambuf<char> {
  public:
    explicit strstreambuf(streamsize alsize_arg = 0);
    strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
    strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0);
    strstreambuf(const char* gnext_arg, streamsize n);

    strstreambuf(signed char* gnext_arg, streamsize n,
                 signed char* pbeg_arg = 0);
    strstreambuf(const signed char* gnext_arg, streamsize n);
    strstreambuf(unsigned char* gnext_arg, streamsize n,
                 unsigned char* pbeg_arg = 0);
    strstreambuf(const unsigned char* gnext_arg, streamsize n);

    virtual ~strstreambuf();

    void  freeze(bool freezefl = true);
    char* str();
    int   pcount();

  protected:
    virtual int_type overflow (int_type c = EOF);
    virtual int_type pbackfail(int_type c = EOF);
    virtual int_type underflow();
    virtual pos_type seekoff(off_type off, ios_base::seekdir way,
                             ios_base::openmode which
                               = ios_base::in | ios_base::out);
    virtual pos_type seekpos(pos_type sp, ios_base::openmode which
                               = ios_base::in | ios_base::out);
    virtual streambuf* setbuf(char* s, streamsize n);

  private:
    typedef T1 strstate;              // exposition only
    static const strstate allocated;  //  exposition only
    static const strstate constant;   // exposition only
    static const strstate dynamic;    // exposition only
    static const strstate frozen;     // exposition only
    strstate strmode;                 // exposition only
    streamsize alsize;                // exposition only
    void* (*palloc)(size_t);          // exposition only
    void (*pfree)(void*);             // exposition only
  };
}
1 The class strstreambuf associates the input sequence, and possibly the output sequence, with an object of some character array type, whose elements store arbitrary values. The array object has several attributes.
2
Note-
3
Note-
4 Each object of class strstreambuf has a seekable area, delimited by the pointers seeklow and seekhigh. If gnext is a null pointer, the seekable area is undefined. Otherwise, seeklow equals gbeg and seekhigh is either pend, if pend is not a null pointer, or gend.
D.7.1.1 strstreambuf constructors [depr.strstreambuf.cons]
explicit strstreambuf(streamsize alsize_arg = 0);
1 Effects: Constructs an object of class strstreambuf, initializing the base class with streambuf(). The postconditions of this function are indicated in Table [tab:future.strstreambuf.effects].
Table 155strstreambuf(streamsize) effects
Element Value
strmode dynamic
alsize alsize_arg
palloc a null pointer
pfree a null pointer

strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));

2 Effects: Constructs an object of class strstreambuf, initializing the base class with streambuf(). The postconditions of this function are indicated in Table [tab:future.strstreambuf1.effects].
Table 156strstreambuf(void* (*)(size_t), void (*)(void*)) effects
Element Value
strmode dynamic
alsize an unspecified value
palloc palloc_arg
pfree pfree_arg

strstreambuf(char* gnext_arg, streamsize n, char *pbeg_arg = 0); strstreambuf(signed char* gnext_arg, streamsize n, signed char *pbeg_arg = 0); strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char *pbeg_arg = 0);

3 Effects: Constructs an object of class strstreambuf, initializing the base class with streambuf(). The postconditions of this function are indicated in Table [tab:future.strstreambuf2.effects].
Table 157strstreambuf(charT*, streamsize, charT*) effects
Element Value
strmode 0
alsize an unspecified value
palloc a null pointer
pfree a null pointer
4 gnext_arg shall point to the first element of an array object whose number of elements N is determined as follows:
(4.1)
  • If n > 0, N is n.

(4.2)
  • If n == 0, N is std::strlen(gnext_arg).

(4.3)
5 If pbeg_arg is a null pointer, the function executes:

setg(gnext_arg, gnext_arg, gnext_arg + N);

6 Otherwise, the function executes:
setg(gnext_arg, gnext_arg, pbeg_arg);
setp(pbeg_arg,  pbeg_arg + N);

strstreambuf(const char* gnext_arg, streamsize n);
strstreambuf(const signed char* gnext_arg, streamsize n);
strstreambuf(const unsigned char* gnext_arg, streamsize n);
7 Effects: Behaves the same as strstreambuf((char*)gnext_arg,n), except that the constructor also sets constant in strmode.

virtual ~strstreambuf();

8 Effects: Destroys an object of class strstreambuf. The function frees the dynamically allocated array object only if strmode & allocated != 0 and strmode & frozen == 0. ([depr.strstreambuf.virtuals] describes how a dynamically allocated array object is freed.)

The function signature strlen(const char*) is declared in <cstring>. ([c.strings]). The macro INT_MAX is defined in <climits> ([support.limits]).

D.7.1.2 Member functions [depr.strstreambuf.members]
void freeze(bool freezefl = true);
1 Effects: If strmode & dynamic is non-zero, alters the freeze status of the dynamic array object as follows:
(1.1)
  • If freezefl is true, the function sets frozen in strmode.

(1.2)
  • Otherwise, it clears frozen in strmode.

    char* str();

2 Effects: Calls freeze(), then returns the beginning pointer for the input sequence, gbeg.
3 Remarks: The return value can be a null pointer.

int pcount() const;

4 Effects: If the next pointer for the output sequence, pnext, is a null pointer, returns zero. Otherwise, returns the current effective length of the array object as the next pointer minus the beginning pointer for the output sequence, pnext - pbeg.
D.7.1.3 strstreambuf overridden virtual functions [depr.strstreambuf.virtuals]
int_type overflow(int_type c = EOF);
1 Effects: Appends the character designated by c to the output sequence, if possible, in one of two ways:
(1.1)
  • If c != EOF and if either the output sequence has a write position available or the function makes a write position available (as described below), assigns c to *pnext++.

    Returns (unsigned char)c.

(1.2)
  • If c == EOF, there is no character to append.

    Returns a value other than EOF.

2 Returns EOF to indicate failure.
3 Remarks: The function can alter the number of write positions available as a result of any call.
4 To make a write position available, the function reallocates (or initially allocates) an array object with a sufficient number of elements n to hold the current array object (if any), plus at least one additional write position. How many additional write positions are made available is otherwise unspecified.[cpp11 2] If palloc is not a null pointer, the function calls (*palloc)(n) to allocate the new dynamic array object. Otherwise, it evaluates the expression new charT[n]. In either case, if the allocation fails, the function returns EOF. Otherwise, it sets allocated in strmode.
5 To free a previously existing dynamic array object whose first element address is p: If pfree is not a null pointer, the function calls (*pfree)(p). Otherwise, it evaluates the expression delete[]p.
6 If strmode & dynamic == 0, or if strmode & frozen != 0, the function cannot extend the array (reallocate it with greater length) to make a write position available.

int_type pbackfail(int_type c = EOF);

7 Puts back the character designated by c to the input sequence, if possible, in one of three ways:
(7.1)
  • If c != EOF, if the input sequence has a putback position available, and if (char)c == gnext[-1], assigns gnext - 1 to gnext.

    Returns c.

(7.2)
  • If c != EOF, if the input sequence has a putback position available, and if strmode & constant is zero, assigns c to *--gnext.

    Returns c.

(7.3)
  • If c == EOF and if the input sequence has a putback position available, assigns gnext - 1 to gnext.

    Returns a value other than EOF.

8 Returns EOF to indicate failure.
9 Remarks: If the function can succeed in more than one of these ways, it is unspecified which way is chosen. The function can alter the number of putback positions available as a result of any call.

int_type underflow();

10 Effects: Reads a character from the input sequence, if possible, without moving the stream position past it, as follows:
(10.1)
  • If the input sequence has a read position available, the function signals success by returning (unsigned char)*gnext.

(10.2)
  • Otherwise, if the current write next pointer pnext is not a null pointer and is greater than the current read end pointer gend, makes a read position available by assigning to gend a value greater than gnext and no greater than pnext.

    Returns (unsigned char*)gnext.

11 Returns EOF to indicate failure.
12 Remarks: The function can alter the number of read positions available as a result of any call.

pos_type seekoff(off_type off, seekdir way, openmode which = in | out);

13 Effects: Alters the stream position within one of the controlled sequences, if possible, as indicated in Table [tab:future.seekoff.positioning].
Table 158seekoff positioning
Conditions Result
(which & ios::in) != 0 positions the input sequence
(which & ios::out) != 0 positions the output sequence
(which & (ios::in |

ios::out)) == (ios::in |
ios::out)) and
way == either
ios::beg or
ios::end

positions both the input and the output sequences
Otherwise the positioning operation fails.
14 For a sequence to be positioned, if its next pointer is a null pointer, the positioning operation fails. Otherwise, the function determines newoff as indicated in Table [tab:future.newoff.values].
Table 159newoff values
Condition newoff Value
way == ios::beg 0
way == ios::cur the next pointer minus the beginning pointer (xnext - xbeg).
way == ios::end seekhigh minus the beginning pointer (seekhigh - xbeg).
If (newoff + off) <

(seeklow - xbeg),
or (seekhigh - xbeg) <
(newoff + off)

the positioning operation fails
15 Otherwise, the function assigns xbeg + newoff + off to the next pointer xnext.
16 Returns:

pos_type(newoff), constructed from the resultant offset newoff (of type off_type), that stores the resultant stream position, if possible. If the positioning operation fails, or if the constructed object cannot represent the resultant stream position, the return value is pos_type(off_type(-1)).

pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out);

17 Effects: Alters the stream position within one of the controlled sequences, if possible, to correspond to the stream position stored in sp (as described below).
(17.1)
  • If (which & ios::in) != 0, positions the input sequence.

(17.2)
  • If (which & ios::out) != 0, positions the output sequence.

(17.3)
  • If the function positions neither sequence, the positioning operation fails.

    For a sequence to be positioned, if its next pointer is a null pointer, the positioning operation fails. Otherwise, the function determines newoff from sp.offset():

(17.4)
  • If newoff is an invalid stream position, has a negative value, or has a value greater than (seekhigh - seeklow), the positioning operation fails

(17.5)
  • Otherwise, the function adds newoff to the beginning pointer xbeg and stores the result in the next pointer xnext.

18 Returns:

pos_type(newoff), constructed from the resultant offset newoff (of type off_type), that stores the resultant stream position, if possible. If the positioning operation fails, or if the constructed object cannot represent the resultant stream position, the return value is pos_type(off_type(-1)).

streambuf<char>* setbuf(char* s, streamsize n);

19 Effects: Implementation defined, except that setbuf(0, 0) has no effect.

D.7.2 Class istrstream [depr.istrstream]

namespace std {
  class istrstream : public basic_istream<char> {
  public:
    explicit istrstream(const char* s);
    explicit istrstream(char* s);
    istrstream(const char* s, streamsize n);
    istrstream(char* s, streamsize n);
    virtual ~istrstream();

    strstreambuf* rdbuf() const;
    char *str();
  private:
    strstreambuf sb;  // exposition only
  };
}
1 The class istrstream supports the reading of objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.7.2.1 istrstream constructors [depr.istrstream.cons]
explicit istrstream(const char* s); explicit istrstream(char* s);
1 Effects: Constructs an object of class istrstream, initializing the base class with istream(&sb) and initializing sb with strstreambuf(s,0)). s shall designate the first element of an ntbs.

istrstream(const char* s, streamsize n);

2 Effects: Constructs an object of class istrstream, initializing the base class with istream(&sb) and initializing sb with strstreambuf(s,n)). s shall designate the first element of an array whose length is n elements, and n shall be greater than zero.
D.7.2.2 Member functions [depr.istrstream.members]
strstreambuf* rdbuf() const;
1 Returns:

const_cast<strstreambuf*>(&sb).

char* str();

2 Returns:

rdbuf()->str().

D.7.3 Class ostrstream [depr.ostrstream]

namespace std {
  class ostrstream : public basic_ostream<char> {
  public:
    ostrstream();
    ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
    virtual ~ostrstream();

    strstreambuf* rdbuf() const;
    void freeze(bool freezefl = true);
    char* str();
    int pcount() const;
  private:
    strstreambuf sb;  // exposition only
  };
}
1 The class ostrstream supports the writing of objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.7.3.1 ostrstream constructors [depr.ostrstream.cons]
ostrstream();
1 Effects: Constructs an object of class ostrstream, initializing the base class with ostream(&sb) and initializing sb with strstreambuf()).

ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);

2 Effects: Constructs an object of class ostrstream, initializing the base class with ostream(&sb), and initializing sb with one of two constructors:
(2.1)
  • If (mode & app) == 0, then s shall designate the first element of an array of n elements.

    The constructor is strstreambuf(s, n, s).

(2.2)
  • If (mode & app) != 0, then s shall designate the first element of an array of n elements that contains an ntbs whose first element is designated by s. The constructor is strstreambuf(s, n, s + std::strlen(s)).

D.7.3.2 Member functions [depr.ostrstream.members]
strstreambuf* rdbuf() const;
1 Returns:

(strstreambuf*)&sb .

void freeze(bool freezefl = true);

2 Effects: Calls rdbuf()->freeze(freezefl).

char* str();

3 Returns:

rdbuf()->str().

int pcount() const;

4 Returns:

rdbuf()->pcount().

D.7.4 Class strstream [depr.strstream]

namespace std {
  class strstream
    : public basic_iostream<char> {
  public:
    // Types
    typedef char                                char_type;
    typedef typename char_traits<char>::int_type int_type;
    typedef typename char_traits<char>::pos_type pos_type;
    typedef typename char_traits<char>::off_type off_type;

    // constructors/destructor
    strstream();
    strstream(char* s, int n,
              ios_base::openmode mode = ios_base::in|ios_base::out);
    virtual ~strstream();

    // Members:
    strstreambuf* rdbuf() const;
    void freeze(bool freezefl = true);
    int pcount() const;
    char* str();

  private:
  strstreambuf sb;  // exposition only
  };
}
1 The class strstream supports reading and writing from objects of classs strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as
(1.1)
  • sb, the strstreambuf object.

D.7.4.1 strstream constructors [depr.strstream.cons]
strstream();
1 Effects: Constructs an object of class strstream, initializing the base class with iostream(&sb).

strstream(char* s, int n, ios_base::openmode mode = ios_base::in|ios_base::out);

2 Effects: Constructs an object of class strstream, initializing the base class with iostream(&sb) and initializing sb with one of the two constructors:
(2.1)
  • If (mode & app) == 0, then s shall designate the first element of an array of n elements. The constructor is strstreambuf(s,n,s).

(2.2)
  • If (mode & app) != 0, then s shall designate the first element of an array of n elements that contains an ntbs whose first element is designated by s. The constructor is strstreambuf(s,n,s + std::strlen(s)).

D.7.4.2 strstream destructor [depr.strstream.dest]
virtual ~strstream()
1 Effects: Destroys an object of class strstream.

strstreambuf* rdbuf() const;

2 Returns:

&sb.

D.7.4.3 strstream operations [depr.strstream.oper]
void freeze(bool freezefl = true);
1 Effects: Calls rdbuf()->freeze(freezefl).

char* str();

2 Returns:

rdbuf()->str().

int pcount() const;

3 Returns:

rdbuf()->pcount().

D.8 Function objects [depr.function.objects]

D.8.1 Base [depr.base]

1 The class templates unary_function and binary_function are deprecated. A program shall not declare specializations of these templates.
namespace std {
  template <class Arg, class Result>
  struct unary_function {
    typedef Arg    argument_type;
    typedef Result result_type;
  };
}
namespace std {
  template <class Arg1, class Arg2, class Result>
  struct binary_function {
    typedef Arg1   first_argument_type;
    typedef Arg2   second_argument_type;
    typedef Result result_type;
  };
}

D.8.2 Function adaptors [depr.adaptors]

1 The adaptors ptr_fun, mem_fun, mem_fun_ref, and their corresponding return types are deprecated. NoteThe function template bind [func.bind] provides a better solution.
D.8.2.1 Adaptors for pointers to functions [depr.function.pointer.adaptors]
1 To allow pointers to (unary and binary) functions to work with function adaptors the library provides:

template <class Arg, class Result> class pointer_to_unary_function : public unary_function<Arg, Result> { public: explicit pointer_to_unary_function(Result (*f)(Arg)); Result operator()(Arg x) const; };

2 operator() returns f(x).

template <class Arg, class Result> pointer_to_unary_function<Arg, Result> ptr_fun(Result (*f)(Arg));

3 Returns:

pointer_to_unary_function<Arg, Result>(f).

template <class Arg1, class Arg2, class Result> class pointer_to_binary_function : public binary_function<Arg1,Arg2,Result> { public: explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2)); Result operator()(Arg1 x, Arg2 y) const; };

4 operator() returns f(x,y).

template <class Arg1, class Arg2, class Result> pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1, Arg2));

5 Returns:

pointer_to_binary_function<Arg1,Arg2,Result>(f).

6
Example
int compare(const char*, const char*);
replace_if(v.begin(), v.end(),
  not1(bind2nd(ptr_fun(compare), "abc")), "def");
replaces each abc with def in sequence v.
D.8.2.2 Adaptors for pointers to members [depr.member.pointer.adaptors]
1 The purpose of the following is to provide the same facilities for pointer to members as those provided for pointers to functions in [depr.function.pointer.adaptors].

template <class S, class T> class mem_fun_t : public unary_function<T*, S> { public: explicit mem_fun_t(S (T::*p)()); S operator()(T* p) const; };

2 mem_fun_t calls the member function it is initialized with given a pointer argument.

template <class S, class T, class A> class mem_fun1_t : public binary_function<T*, A, S> { public: explicit mem_fun1_t(S (T::*p)(A)); S operator()(T* p, A x) const; };

3 mem_fun1_t calls the member function it is initialized with given a pointer argument and an additional argument of the appropriate type.

template<class S, class T> mem_fun_t<S,T> mem_fun(S (T::*f)()); template<class S, class T, class A> mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A));

4 mem_fun(&X::f) returns an object through which X::f can be called given a pointer to an X followed by the argument required for f (if any).

template <class S, class T> class mem_fun_ref_t : public unary_function<T, S> { public: explicit mem_fun_ref_t(S (T::*p)()); S operator()(T& p) const; };

5 mem_fun_ref_t calls the member function it is initialized with given a reference argument.

template <class S, class T, class A> class mem_fun1_ref_t : public binary_function<T, A, S> { public: explicit mem_fun1_ref_t(S (T::*p)(A)); S operator()(T& p, A x) const; };

6 mem_fun1_ref_t calls the member function it is initialized with given a reference argument and an additional argument of the appropriate type.

template<class S, class T> mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)()); template<class S, class T, class A> mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A));

7 mem_fun_ref(&X::f) returns an object through which X::f can be called given a reference to an X followed by the argument required for f (if any).

template <class S, class T> class const_mem_fun_t : public unary_function<const T*, S> { public: explicit const_mem_fun_t(S (T::*p)() const); S operator()(const T* p) const; };

8 const_mem_fun_t calls the member function it is initialized with given a pointer argument.

template <class S, class T, class A> class const_mem_fun1_t : public binary_function<const T*, A, S> { public: explicit const_mem_fun1_t(S (T::*p)(A) const); S operator()(const T* p, A x) const; };

9 const_mem_fun1_t calls the member function it is initialized with given a pointer argument and an additional argument of the appropriate type.

template<class S, class T> const_mem_fun_t<S,T> mem_fun(S (T::*f)() const); template<class S, class T, class A> const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const);

10 mem_fun(&X::f) returns an object through which X::f can be called given a pointer to an X followed by the argument required for f (if any).

template <class S, class T> class const_mem_fun_ref_t : public unary_function<T, S> { public: explicit const_mem_fun_ref_t(S (T::*p)() const); S operator()(const T& p) const; };

11 const_mem_fun_ref_t calls the member function it is initialized with given a reference argument.

template <class S, class T, class A> class const_mem_fun1_ref_t : public binary_function<T, A, S> { public: explicit const_mem_fun1_ref_t(S (T::*p)(A) const); S operator()(const T& p, A x) const; };

12 const_mem_fun1_ref_t calls the member function it is initialized with given a reference argument and an additional argument of the appropriate type.

template<class S, class T> const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const); template<class S, class T, class A> const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const);

13 mem_fun_ref(&X::f) returns an object through which X::f can be called given a reference to an X followed by the argument required for f (if any).

D.9 Binders [depr.lib.binders]

The binders binder1st, bind1st, binder2nd, and bind2nd are deprecated. NoteThe function template bind ([bind]) provides a better solution.

D.9.1 Class template binder1st [depr.lib.binder.1st]

template <class Fn> class binder1st : public unary_function<typename Fn::second_argument_type, typename Fn::result_type> { protected: Fn op; typename Fn::first_argument_type value; public: binder1st(const Fn& x, const typename Fn::first_argument_type& y); typename Fn::result_type operator()(const typename Fn::second_argument_type& x) const; typename Fn::result_type operator()(typename Fn::second_argument_type& x) const; };
1 The constructor initializes op with x and value with y.
2 operator() returns op(value,x).

D.9.2 bind1st [depr.lib.bind.1st]

template <class Fn, class T> binder1st<Fn> bind1st(const Fn& fn, const T& x);
1 Returns:

binder1st<Fn>(fn, typename Fn::first_argument_type(x)).

D.9.3 Class template binder2nd [depr.lib.binder.2nd]

template <class Fn> class binder2nd : public unary_function<typename Fn::first_argument_type, typename Fn::result_type> { protected: Fn op; typename Fn::second_argument_type value; public: binder2nd(const Fn& x, const typename Fn::second_argument_type& y); typename Fn::result_type operator()(const typename Fn::first_argument_type& x) const; typename Fn::result_type operator()(typename Fn::first_argument_type& x) const; };
1 The constructor initializes op with x and value with y.
2 operator() returns op(x,value).

D.9.4 bind2nd [depr.lib.bind.2nd]

template <class Fn, class T> binder2nd<Fn> bind2nd(const Fn& op, const T& x);
1 Returns:

binder2nd<Fn>(op, typename Fn::second_argument_type(x)).

2
Example
find_if(v.begin(), v.end(), bind2nd(greater<int>(), 5));

finds the first integer in vector v greater than 5;

find_if(v.begin(), v.end(), bind1st(greater<int>(), 5));
finds the first integer in v less than 5.

D.10 auto_ptr [depr.auto.ptr]

The class template auto_ptr is deprecated. NoteThe class template unique_ptr ([unique.ptr]) provides a better solution.

D.10.1 Class template auto_ptr [auto.ptr]

1 The class template auto_ptr stores a pointer to an object obtained via new and deletes that object when it itself is destroyed (such as when leaving block scope [stmt.dcl]).
2 The class template auto_ptr_ref is for exposition only. An implementation is permitted to provide equivalent functionality without providing a template with this name. The template holds a reference to an auto_ptr. It is used by the auto_ptr conversions to allow auto_ptr objects to be passed to and returned from functions.
namespace std {
  template <class Y> struct auto_ptr_ref;   // exposition only

  template <class X> class auto_ptr {
  public:
    typedef X element_type;

    // [auto.ptr.cons] construct/copy/destroy:
    explicit auto_ptr(X* p =0) throw();
    auto_ptr(auto_ptr&) throw();
    template<class Y> auto_ptr(auto_ptr<Y>&) throw();
    auto_ptr& operator=(auto_ptr&) throw();
    template<class Y> auto_ptr& operator=(auto_ptr<Y>&) throw();
    auto_ptr& operator=(auto_ptr_ref<X> r) throw();
   ~auto_ptr() throw();

    // [auto.ptr.members] members:
    X& operator*() const throw();
    X* operator->() const throw();
    X* get() const throw();
    X* release() throw();
    void reset(X* p =0) throw();

    // [auto.ptr.conv] conversions:
    auto_ptr(auto_ptr_ref<X>) throw();
    template<class Y> operator auto_ptr_ref<Y>() throw();
    template<class Y> operator auto_ptr<Y>() throw();
  };

  template <> class auto_ptr<void>
  {
  public:
    typedef void element_type;
  };
}
3 The class template auto_ptr provides a semantics of strict ownership. An auto_ptr owns the object it holds a pointer to. Copying an auto_ptr copies the pointer and transfers ownership to the destination. If more than one auto_ptr owns the same object at the same time the behavior of the program is undefined. NoteThe uses of auto_ptr include providing temporary exception-safety for dynamically allocated memory, passing ownership of dynamically allocated memory to a function, and returning dynamically allocated memory from a function. Instances of auto_ptr meet the requirements of MoveConstructible and MoveAssignable, but do not meet the requirements of CopyConstructible and CopyAssignable.
D.10.1.1 auto_ptr constructors [auto.ptr.cons]
explicit auto_ptr(X* p =0) throw();
1 Postconditions:

*this holds the pointer p.

auto_ptr(auto_ptr& a) throw();

2 Effects: Calls a.release().
3 Postconditions:

*this holds the pointer returned from a.release().

template<class Y> auto_ptr(auto_ptr<Y>& a) throw();

4 Requires:

Y* can be implicitly converted to X*.

5 Effects: Calls a.release().
6 Postconditions:

*this holds the pointer returned from a.release().

auto_ptr& operator=(auto_ptr& a) throw();

7 Requires: The expression delete get() is well formed.
8 Effects:

reset(a.release()).

9 Returns:

*this.

template<class Y> auto_ptr& operator=(auto_ptr<Y>& a) throw();

10 Requires:

Y* can be implicitly converted to X*. The expression delete get() is well formed.

11 Effects:

reset(a.release()).

12 Returns:

*this.

~auto_ptr() throw();

13 Requires: The expression delete get() is well formed.
14 Effects:

delete get().

D.10.1.2 auto_ptr members [auto.ptr.members]
X& operator*() const throw();
1 Requires:

get() != 0

2 Returns:

*get()

X* operator->() const throw();

3 Returns:

get()

X* get() const throw();

4 Returns: The pointer *this holds.

X* release() throw();

5 Returns:

get()

6 Postcondition:

*this holds the null pointer.

void reset(X* p=0) throw();

7 Effects: If get() != p then delete get().
8 Postconditions:

*this holds the pointer p.

D.10.1.3 auto_ptr conversions [auto.ptr.conv]
auto_ptr(auto_ptr_ref<X> r) throw();
1 Effects: Calls p.release() for the auto_ptr p that r holds.
2 Postconditions:

*this holds the pointer returned from release().

template<class Y> operator auto_ptr_ref<Y>() throw();

3 Returns: An auto_ptr_ref<Y> that holds *this.

template<class Y> operator auto_ptr<Y>() throw();

4 Effects: Calls release().
5 Returns: An auto_ptr<Y> that holds the pointer returned from release().

auto_ptr& operator=(auto_ptr_ref<X> r) throw()

6 Effects: Calls reset(p.release()) for the auto_ptr p that r holds a reference to.
7 Returns:

*this

D.11 Violating exception-specifications [exception.unexpected]

D.11.1 Type unexpected_handler [unexpected.handler]

typedef void (*unexpected_handler)();
1 The type of a handler function to be called by unexpected() when a function attempts to throw an exception not listed in its dynamic-exception-specification.
2 Required behavior: An unexpected_handler shall not return. See also [except.unexpected].
3 Default behavior: The implementation's default unexpected_handler calls std::terminate().

D.11.2 set_unexpected [set.unexpected]

unexpected_handler set_unexpected(unexpected_handler f) noexcept;
1 Effects: Establishes the function designated by f as the current unexpected_handler.
2 Remark: It is unspecified whether a null pointer value designates the default unexpected_handler.
3 Returns: The previous unexpected_handler.

D.11.3 get_unexpected [get.unexpected]

unexpected_handler get_unexpected() noexcept;
1 Returns: The current unexpected_handler. NoteThis may be a null pointer value.

D.11.4 unexpected [unexpected]

noreturn void unexpected();
1 Remarks: Called by the implementation when a function exits via an exception not allowed by its exception-specification ([except.unexpected]), in effect after evaluating the throw-expression ([unexpected.handler]). May also be called directly by the program.
2 Effects: Calls the current unexpected_handler function. NoteA default unexpected_handler is always considered a callable handler in this context.

  1. An implementation should consider alsize in making this decision.
  2. The function signature strlen(const char*) is declared in <cstring> ([c.strings]).


[edit]

Source: https://timsong-cpp.github.io/cppwp/n4140/depr

List of Tables [tab]
List of Figures [fig]
1 General [intro]
2 Lexical conventions [lex]
3 Basic concepts [basic]
4 Standard conversions [conv]
5 Expressions [expr]
6 Statements [stmt.stmt]
7 Declarations [dcl.dcl]
8 Declarators [dcl.decl]
9 Classes [class]
10 Derived classes [class.derived]
11 Member access control [class.access]
12 Special member functions [special]
13 Overloading [over]
14 Templates [temp]
15 Exception handling [except]
16 Preprocessing directives [cpp]
17 Library introduction [library]
18 Language support library [language.support]
19 Diagnostics library [diagnostics]
20 General utilities library [utilities]
21 Strings library [strings]
22 Localization library [localization]
23 Containers library [containers]
24 Iterators library [iterators]
25 Algorithms library [algorithms]
26 Numerics library [numerics]
27 Input/output library [input.output]
28 Regular expressions library [re]
29 Atomic operations library [atomics]
30 Thread support library [thread]
Annex A (informative) Grammar summary [gram]
Annex B (informative) Implementation quantities [implimits]
Annex C (informative) Compatibility [diff]
Annex D (normative) Compatibility features [depr]
D.1 Increment operator with bool operand [depr.incr.bool]
D.2 register keyword [depr.register]
D.3 Implicit declaration of copy functions [depr.impldec]
D.4 Dynamic exception specifications [depr.except.spec]
D.5 C standard library headers [depr.c.headers]
D.6 Old iostreams members [depr.ios.members]
D.7 char* streams [depr.str.strstreams]
D.8 Function objects [depr.function.objects]
D.9 Binders [depr.lib.binders]
D.10 auto_ptr [depr.auto.ptr]
D.11 Violating exception-specifications [exception.unexpected]
D.12 Random shuffle [depr.alg.random.shuffle]
Annex E (normative) Universal character names for identifier characters [charname]
Index [generalindex]
Index of library names [libraryindex]
Index of implementation-defined behavior [impldefindex]

Annex D (normative) Compatibility features [depr]

1 This Clause describes features of the C++ Standard that are specified for compatibility with existing implementations.
2 These are deprecated features, where deprecated is defined as: Normative for the current edition of the Standard, but having been identified as a candidate for removal from future revisions. An implementation may declare library names and entities described in this section with the deprecated attribute ([dcl.attr.deprecated]).

D.1 Increment operator with bool operand [depr.incr.bool]

1 The use of an operand of type bool with the ++ operator is deprecated (see [expr.pre.incr] and [expr.post.incr]).

D.2 register keyword [depr.register]

1 The use of the register keyword as a storage-class-specifier ([dcl.stc]) is deprecated.

D.3 Implicit declaration of copy functions [depr.impldec]

1 The implicit definition of a copy constructor as defaulted is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor. The implicit definition of a copy assignment operator as defaulted is deprecated if the class has a user-declared copy constructor or a user-declared destructor ([class.dtor], [class.copy]). In a future revision of this International Standard, these implicit definitions could become deleted ([dcl.fct.def]).

D.4 Dynamic exception specifications [depr.except.spec]

1 The use of dynamic-exception-specifications is deprecated.

D.5 C standard library headers [depr.c.headers]

1 For compatibility with the C standard library and the C Unicode TR, the C++ standard library provides the 26 C headers, as shown in Table [tab:future.c.headers].
Table 155 — C headers
<assert.h> <inttypes.h> <signal.h> <stdio.h> <wchar.h>
<complex.h> <iso646.h> <stdalign.h> <stdlib.h> <wctype.h>
<ctype.h> <limits.h> <stdarg.h> <string.h>
<errno.h> <locale.h> <stdbool.h> <tgmath.h>
<fenv.h> <math.h> <stddef.h> <time.h>
<float.h> <setjmp.h> <stdint.h> <uchar.h>
2 Every C header, each of which has a name of the form name.h, behaves as if each name placed in the standard library namespace by the corresponding cname header is placed within the global namespace scope. It is unspecified whether these names are first declared or defined within namespace scope ([basic.scope.namespace]) of the namespace std and are then injected into the global namespace scope by explicit using-declarations ([namespace.udecl]).
3
ExampleThe header <cstdlib> assuredly provides its declarations and definitions within the namespace std. It may also provide these names within the global namespace. The header <stdlib.h> assuredly provides the same declarations and definitions within the global namespace, much as in the C Standard. It may also provide these names within the namespace std.

D.6 Old iostreams members [depr.ios.members]

1 The following member names are in addition to names specified in Clause [input.output]:
namespace std {
  class ios_base {
  public:
    typedef T1 io_state;
    typedef T2 open_mode;
    typedef T3 seek_dir;
    typedef implementation-defined streamoff;
    typedef implementation-defined streampos;
    // remainder unchanged
  };
}
2 The type io_state is a synonym for an integer type (indicated here as T1 ) that permits certain member functions to overload others on parameters of type iostate and provide the same behavior.
3 The type open_mode is a synonym for an integer type (indicated here as T2 ) that permits certain member functions to overload others on parameters of type openmode and provide the same behavior.
4 The type seek_dir is a synonym for an integer type (indicated here as T3 ) that permits certain member functions to overload others on parameters of type seekdir and provide the same behavior.
5 The type streamoff is an implementation-defined type that satisfies the requirements of off_type in [iostreams.limits.pos].
6 The type streampos is an implementation-defined type that satisfies the requirements of pos_type in [iostreams.limits.pos].
7 An implementation may provide the following additional member function, which has the effect of calling sbumpc() ([streambuf.pub.get]):
namespace std {
  template<class charT, class traits = char_traits<charT> >
  class basic_streambuf {
  public:
    void stossc();
    // remainder unchanged
  };
}
8 An implementation may provide the following member functions that overload signatures specified in Clause [input.output]:
namespace std {
  template<class charT, class traits> class basic_ios {
  public:
    void clear(io_state state);
    void setstate(io_state state);
    void exceptions(io_state);
    // remainder unchanged
  };

  class ios_base {
  public:
    // remainder unchanged
  };

  template<class charT, class traits = char_traits<charT> >
  class basic_streambuf {
  public:
    pos_type pubseekoff(off_type off, ios_base::seek_dir way,
              ios_base::open_mode which = ios_base::in | ios_base::out);
    pos_type pubseekpos(pos_type sp,
              ios_base::open_mode which);
    // remainder unchanged
  };

  template <class charT, class traits = char_traits<charT> >
  class basic_filebuf : public basic_streambuf<charT,traits> {
  public:
    basic_filebuf<charT,traits>* open
    (const char* s, ios_base::open_mode mode);
    // remainder unchanged
  };

  template <class charT, class traits = char_traits<charT> >
  class basic_ifstream : public basic_istream<charT,traits> {
  public:
    void open(const char* s, ios_base::open_mode mode);
    // remainder unchanged
  };

  template <class charT, class traits = char_traits<charT> >
  class basic_ofstream : public basic_ostream<charT,traits> {
  public:
    void open(const char* s, ios_base::open_mode mode);
    // remainder unchanged
  };
}
9 The effects of these functions is to call the corresponding member function specified in Clause [input.output].

D.7 char* streams [depr.str.strstreams]

1 The header <strstream> defines three types that associate stream buffers with character array objects and assist reading and writing such objects.

D.7.1 Class strstreambuf [depr.strstreambuf]

namespace std {
  class strstreambuf : public basic_streambuf<char> {
  public:
    explicit strstreambuf(streamsize alsize_arg = 0);
    strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
    strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0);
    strstreambuf(const char* gnext_arg, streamsize n);

    strstreambuf(signed char* gnext_arg, streamsize n,
                 signed char* pbeg_arg = 0);
    strstreambuf(const signed char* gnext_arg, streamsize n);
    strstreambuf(unsigned char* gnext_arg, streamsize n,
                 unsigned char* pbeg_arg = 0);
    strstreambuf(const unsigned char* gnext_arg, streamsize n);

    virtual ~strstreambuf();

    void  freeze(bool freezefl = true);
    char* str();
    int   pcount();

  protected:
    virtual int_type overflow (int_type c = EOF);
    virtual int_type pbackfail(int_type c = EOF);
    virtual int_type underflow();
    virtual pos_type seekoff(off_type off, ios_base::seekdir way,
                             ios_base::openmode which
                               = ios_base::in | ios_base::out);
    virtual pos_type seekpos(pos_type sp, ios_base::openmode which
                               = ios_base::in | ios_base::out);
    virtual streambuf* setbuf(char* s, streamsize n);

  private:
    typedef T1 strstate;              // exposition only
    static const strstate allocated;  //  exposition only
    static const strstate constant;   // exposition only
    static const strstate dynamic;    // exposition only
    static const strstate frozen;     // exposition only
    strstate strmode;                 // exposition only
    streamsize alsize;                // exposition only
    void* (*palloc)(size_t);          // exposition only
    void (*pfree)(void*);             // exposition only
  };
}
1 The class strstreambuf associates the input sequence, and possibly the output sequence, with an object of some character array type, whose elements store arbitrary values. The array object has several attributes.
2
Note-
3
Note-
4 Each object of class strstreambuf has a seekable area, delimited by the pointers seeklow and seekhigh. If gnext is a null pointer, the seekable area is undefined. Otherwise, seeklow equals gbeg and seekhigh is either pend, if pend is not a null pointer, or gend.
D.7.1.1 strstreambuf constructors [depr.strstreambuf.cons]
explicit strstreambuf(streamsize alsize_arg = 0);
1 Effects: Constructs an object of class strstreambuf, initializing the base class with streambuf(). The postconditions of this function are indicated in Table [tab:future.strstreambuf.effects].
Table 156strstreambuf(streamsize) effects
Element Value
strmode dynamic
alsize alsize_arg
palloc a null pointer
pfree a null pointer

strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));

2 Effects: Constructs an object of class strstreambuf, initializing the base class with streambuf(). The postconditions of this function are indicated in Table [tab:future.strstreambuf1.effects].
Table 157strstreambuf(void* (*)(size_t), void (*)(void*)) effects
Element Value
strmode dynamic
alsize an unspecified value
palloc palloc_arg
pfree pfree_arg

strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0); strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = 0); strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = 0);

3 Effects: Constructs an object of class strstreambuf, initializing the base class with streambuf(). The postconditions of this function are indicated in Table [tab:future.strstreambuf2.effects].
Table 158strstreambuf(charT*, streamsize, charT*) effects
Element Value
strmode 0
alsize an unspecified value
palloc a null pointer
pfree a null pointer
4 gnext_arg shall point to the first element of an array object whose number of elements N is determined as follows:
(4.1)
  • If n > 0, N is n.

(4.2)
  • If n == 0, N is std::strlen(gnext_arg).

(4.3)
5 If pbeg_arg is a null pointer, the function executes:

setg(gnext_arg, gnext_arg, gnext_arg + N);

6 Otherwise, the function executes:
setg(gnext_arg, gnext_arg, pbeg_arg);
setp(pbeg_arg,  pbeg_arg + N);

strstreambuf(const char* gnext_arg, streamsize n);
strstreambuf(const signed char* gnext_arg, streamsize n);
strstreambuf(const unsigned char* gnext_arg, streamsize n);
7 Effects: Behaves the same as strstreambuf((char*)gnext_arg,n), except that the constructor also sets constant in strmode.

virtual ~strstreambuf();

8 Effects: Destroys an object of class strstreambuf. The function frees the dynamically allocated array object only if strmode & allocated != 0 and strmode & frozen == 0. ([depr.strstreambuf.virtuals] describes how a dynamically allocated array object is freed.)

The function signature strlen(const char*) is declared in <cstring>. ([c.strings]). The macro INT_MAX is defined in <climits> ([support.limits]).

D.7.1.2 Member functions [depr.strstreambuf.members]
void freeze(bool freezefl = true);
1 Effects: If strmode & dynamic is non-zero, alters the freeze status of the dynamic array object as follows:
(1.1)
  • If freezefl is true, the function sets frozen in strmode.

(1.2)
  • Otherwise, it clears frozen in strmode.

    char* str();

2 Effects: Calls freeze(), then returns the beginning pointer for the input sequence, gbeg.
3 Remarks: The return value can be a null pointer.

int pcount() const;

4 Effects: If the next pointer for the output sequence, pnext, is a null pointer, returns zero. Otherwise, returns the current effective length of the array object as the next pointer minus the beginning pointer for the output sequence, pnext - pbeg.
D.7.1.3 strstreambuf overridden virtual functions [depr.strstreambuf.virtuals]
int_type overflow(int_type c = EOF);
1 Effects: Appends the character designated by c to the output sequence, if possible, in one of two ways:
(1.1)
  • If c != EOF and if either the output sequence has a write position available or the function makes a write position available (as described below), assigns c to *pnext++.

    Returns (unsigned char)c.

(1.2)
  • If c == EOF, there is no character to append.

    Returns a value other than EOF.

2 Returns EOF to indicate failure.
3 Remarks: The function can alter the number of write positions available as a result of any call.
4 To make a write position available, the function reallocates (or initially allocates) an array object with a sufficient number of elements n to hold the current array object (if any), plus at least one additional write position. How many additional write positions are made available is otherwise unspecified.[cpp14 2] If palloc is not a null pointer, the function calls (*palloc)(n) to allocate the new dynamic array object. Otherwise, it evaluates the expression new charT[n]. In either case, if the allocation fails, the function returns EOF. Otherwise, it sets allocated in strmode.
5 To free a previously existing dynamic array object whose first element address is p: If pfree is not a null pointer, the function calls (*pfree)(p). Otherwise, it evaluates the expression delete[]p.
6 If strmode & dynamic == 0, or if strmode & frozen != 0, the function cannot extend the array (reallocate it with greater length) to make a write position available.

int_type pbackfail(int_type c = EOF);

7 Puts back the character designated by c to the input sequence, if possible, in one of three ways:
(7.1)
  • If c != EOF, if the input sequence has a putback position available, and if (char)c == gnext[-1], assigns gnext - 1 to gnext.

    Returns c.

(7.2)
  • If c != EOF, if the input sequence has a putback position available, and if strmode & constant is zero, assigns c to *--gnext.

    Returns c.

(7.3)
  • If c == EOF and if the input sequence has a putback position available, assigns gnext - 1 to gnext.

    Returns a value other than EOF.

8 Returns EOF to indicate failure.
9 Remarks: If the function can succeed in more than one of these ways, it is unspecified which way is chosen. The function can alter the number of putback positions available as a result of any call.

int_type underflow();

10 Effects: Reads a character from the input sequence, if possible, without moving the stream position past it, as follows:
(10.1)
  • If the input sequence has a read position available, the function signals success by returning (unsigned char)*gnext.

(10.2)
  • Otherwise, if the current write next pointer pnext is not a null pointer and is greater than the current read end pointer gend, makes a read position available by assigning to gend a value greater than gnext and no greater than pnext.

    Returns (unsigned char*)gnext.

11 Returns EOF to indicate failure.
12 Remarks: The function can alter the number of read positions available as a result of any call.

pos_type seekoff(off_type off, seekdir way, openmode which = in | out);

13 Effects: Alters the stream position within one of the controlled sequences, if possible, as indicated in Table [tab:future.seekoff.positioning].
Table 159seekoff positioning
Conditions Result
(which & ios::in) != 0 positions the input sequence
(which & ios::out) != 0 positions the output sequence
(which & (ios::in |

ios::out)) == (ios::in |
ios::out)) and
way == either
ios::beg or
ios::end

positions both the input and the output sequences
Otherwise the positioning operation fails.
14 For a sequence to be positioned, if its next pointer is a null pointer, the positioning operation fails. Otherwise, the function determines newoff as indicated in Table [tab:future.newoff.values].
Table 160newoff values
Condition newoff Value
way == ios::beg 0
way == ios::cur the next pointer minus the beginning pointer (xnext - xbeg).
way == ios::end seekhigh minus the beginning pointer (seekhigh - xbeg).
15 If (newoff + off) < (seeklow - xbeg) or (seekhigh - xbeg) < (newoff + off), the positioning operation fails. Otherwise, the function assigns xbeg + newoff + off to the next pointer xnext.
16 Returns:

pos_type(newoff), constructed from the resultant offset newoff (of type off_type), that stores the resultant stream position, if possible. If the positioning operation fails, or if the constructed object cannot represent the resultant stream position, the return value is pos_type(off_type(-1)).

pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out);

17 Effects: Alters the stream position within one of the controlled sequences, if possible, to correspond to the stream position stored in sp (as described below).
(17.1)
  • If (which & ios::in) != 0, positions the input sequence.

(17.2)
  • If (which & ios::out) != 0, positions the output sequence.

(17.3)
  • If the function positions neither sequence, the positioning operation fails.

18 For a sequence to be positioned, if its next pointer is a null pointer, the positioning operation fails. Otherwise, the function determines newoff from sp.offset():
(18.1)
  • If newoff is an invalid stream position, has a negative value, or has a value greater than (seekhigh - seeklow), the positioning operation fails

(18.2)
  • Otherwise, the function adds newoff to the beginning pointer xbeg and stores the result in the next pointer xnext.

19 Returns:

pos_type(newoff), constructed from the resultant offset newoff (of type off_type), that stores the resultant stream position, if possible. If the positioning operation fails, or if the constructed object cannot represent the resultant stream position, the return value is pos_type(off_type(-1)).

streambuf<char>* setbuf(char* s, streamsize n);

20 Effects: Implementation defined, except that setbuf(0, 0) has no effect.

D.7.2 Class istrstream [depr.istrstream]

namespace std {
  class istrstream : public basic_istream<char> {
  public:
    explicit istrstream(const char* s);
    explicit istrstream(char* s);
    istrstream(const char* s, streamsize n);
    istrstream(char* s, streamsize n);
    virtual ~istrstream();

    strstreambuf* rdbuf() const;
    char* str();
  private:
    strstreambuf sb;  // exposition only
  };
}
1 The class istrstream supports the reading of objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.7.2.1 istrstream constructors [depr.istrstream.cons]
explicit istrstream(const char* s); explicit istrstream(char* s);
1 Effects: Constructs an object of class istrstream, initializing the base class with istream(&sb) and initializing sb with strstreambuf(s,0)). s shall designate the first element of an ntbs.

istrstream(const char* s, streamsize n);

2 Effects: Constructs an object of class istrstream, initializing the base class with istream(&sb) and initializing sb with strstreambuf(s,n)). s shall designate the first element of an array whose length is n elements, and n shall be greater than zero.
D.7.2.2 Member functions [depr.istrstream.members]
strstreambuf* rdbuf() const;
1 Returns:

const_cast<strstreambuf*>(&sb).

char* str();

2 Returns:

rdbuf()->str().

D.7.3 Class ostrstream [depr.ostrstream]

namespace std {
  class ostrstream : public basic_ostream<char> {
  public:
    ostrstream();
    ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
    virtual ~ostrstream();

    strstreambuf* rdbuf() const;
    void freeze(bool freezefl = true);
    char* str();
    int pcount() const;
  private:
    strstreambuf sb;  // exposition only
  };
}
1 The class ostrstream supports the writing of objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.7.3.1 ostrstream constructors [depr.ostrstream.cons]
ostrstream();
1 Effects: Constructs an object of class ostrstream, initializing the base class with ostream(&sb) and initializing sb with strstreambuf()).

ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);

2 Effects: Constructs an object of class ostrstream, initializing the base class with ostream(&sb), and initializing sb with one of two constructors:
(2.1)
  • If (mode & app) == 0, then s shall designate the first element of an array of n elements.

    The constructor is strstreambuf(s, n, s).

(2.2)
  • If (mode & app) != 0, then s shall designate the first element of an array of n elements that contains an ntbs whose first element is designated by s. The constructor is strstreambuf(s, n, s + std::strlen(s)).

D.7.3.2 Member functions [depr.ostrstream.members]
strstreambuf* rdbuf() const;
1 Returns:

(strstreambuf*)&sb .

void freeze(bool freezefl = true);

2 Effects: Calls rdbuf()->freeze(freezefl).

char* str();

3 Returns:

rdbuf()->str().

int pcount() const;

4 Returns:

rdbuf()->pcount().

D.7.4 Class strstream [depr.strstream]

namespace std {
  class strstream
    : public basic_iostream<char> {
  public:
    // Types
    typedef char                                char_type;
    typedef typename char_traits<char>::int_type int_type;
    typedef typename char_traits<char>::pos_type pos_type;
    typedef typename char_traits<char>::off_type off_type;

    // constructors/destructor
    strstream();
    strstream(char* s, int n,
              ios_base::openmode mode = ios_base::in|ios_base::out);
    virtual ~strstream();

    // Members:
    strstreambuf* rdbuf() const;
    void freeze(bool freezefl = true);
    int pcount() const;
    char* str();

  private:
  strstreambuf sb;  // exposition only
  };
}
1 The class strstream supports reading and writing from objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.7.4.1 strstream constructors [depr.strstream.cons]
strstream();
1 Effects: Constructs an object of class strstream, initializing the base class with iostream(&sb).

strstream(char* s, int n, ios_base::openmode mode = ios_base::in|ios_base::out);

2 Effects: Constructs an object of class strstream, initializing the base class with iostream(&sb) and initializing sb with one of the two constructors:
(2.1)
  • If (mode & app) == 0, then s shall designate the first element of an array of n elements. The constructor is strstreambuf(s,n,s).

(2.2)
  • If (mode & app) != 0, then s shall designate the first element of an array of n elements that contains an ntbs whose first element is designated by s. The constructor is strstreambuf(s,n,s + std::strlen(s)).

D.7.4.2 strstream destructor [depr.strstream.dest]
virtual ~strstream();
1 Effects: Destroys an object of class strstream.

strstreambuf* rdbuf() const;

2 Returns:

&sb.

D.7.4.3 strstream operations [depr.strstream.oper]
void freeze(bool freezefl = true);
1 Effects: Calls rdbuf()->freeze(freezefl).

char* str();

2 Returns:

rdbuf()->str().

int pcount() const;

3 Returns:

rdbuf()->pcount().

D.8 Function objects [depr.function.objects]

D.8.1 Base [depr.base]

1 The class templates unary_function and binary_function are deprecated. A program shall not declare specializations of these templates.
namespace std {
  template <class Arg, class Result>
  struct unary_function {
    typedef Arg    argument_type;
    typedef Result result_type;
  };
}
namespace std {
  template <class Arg1, class Arg2, class Result>
  struct binary_function {
    typedef Arg1   first_argument_type;
    typedef Arg2   second_argument_type;
    typedef Result result_type;
  };
}

D.8.2 Function adaptors [depr.adaptors]

1 The adaptors ptr_fun, mem_fun, mem_fun_ref, and their corresponding return types are deprecated. NoteThe function template bind [func.bind] provides a better solution.
D.8.2.1 Adaptors for pointers to functions [depr.function.pointer.adaptors]
1 To allow pointers to (unary and binary) functions to work with function adaptors the library provides:

template <class Arg, class Result> class pointer_to_unary_function : public unary_function<Arg, Result> { public: explicit pointer_to_unary_function(Result (*f)(Arg)); Result operator()(Arg x) const; };

2 operator() returns f(x).

template <class Arg, class Result> pointer_to_unary_function<Arg, Result> ptr_fun(Result (*f)(Arg));

3 Returns:

pointer_to_unary_function<Arg, Result>(f).

template <class Arg1, class Arg2, class Result> class pointer_to_binary_function : public binary_function<Arg1,Arg2,Result> { public: explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2)); Result operator()(Arg1 x, Arg2 y) const; };

4 operator() returns f(x,y).

template <class Arg1, class Arg2, class Result> pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1, Arg2));

5 Returns:

pointer_to_binary_function<Arg1,Arg2,Result>(f).

6
Example
int compare(const char*, const char*);
replace_if(v.begin(), v.end(),
  not1(bind2nd(ptr_fun(compare), "abc")), "def");
replaces each abc with def in sequence v.
D.8.2.2 Adaptors for pointers to members [depr.member.pointer.adaptors]
1 The purpose of the following is to provide the same facilities for pointer to members as those provided for pointers to functions in [depr.function.pointer.adaptors].

template <class S, class T> class mem_fun_t : public unary_function<T*, S> { public: explicit mem_fun_t(S (T::*p)()); S operator()(T* p) const; };

2 mem_fun_t calls the member function it is initialized with given a pointer argument.

template <class S, class T, class A> class mem_fun1_t : public binary_function<T*, A, S> { public: explicit mem_fun1_t(S (T::*p)(A)); S operator()(T* p, A x) const; };

3 mem_fun1_t calls the member function it is initialized with given a pointer argument and an additional argument of the appropriate type.

template<class S, class T> mem_fun_t<S,T> mem_fun(S (T::*f)()); template<class S, class T, class A> mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A));

4 mem_fun(&X::f) returns an object through which X::f can be called given a pointer to an X followed by the argument required for f (if any).

template <class S, class T> class mem_fun_ref_t : public unary_function<T, S> { public: explicit mem_fun_ref_t(S (T::*p)()); S operator()(T& p) const; };

5 mem_fun_ref_t calls the member function it is initialized with given a reference argument.

template <class S, class T, class A> class mem_fun1_ref_t : public binary_function<T, A, S> { public: explicit mem_fun1_ref_t(S (T::*p)(A)); S operator()(T& p, A x) const; };

6 mem_fun1_ref_t calls the member function it is initialized with given a reference argument and an additional argument of the appropriate type.

template<class S, class T> mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)()); template<class S, class T, class A> mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A));

7 mem_fun_ref(&X::f) returns an object through which X::f can be called given a reference to an X followed by the argument required for f (if any).

template <class S, class T> class const_mem_fun_t : public unary_function<const T*, S> { public: explicit const_mem_fun_t(S (T::*p)() const); S operator()(const T* p) const; };

8 const_mem_fun_t calls the member function it is initialized with given a pointer argument.

template <class S, class T, class A> class const_mem_fun1_t : public binary_function<const T*, A, S> { public: explicit const_mem_fun1_t(S (T::*p)(A) const); S operator()(const T* p, A x) const; };

9 const_mem_fun1_t calls the member function it is initialized with given a pointer argument and an additional argument of the appropriate type.

template<class S, class T> const_mem_fun_t<S,T> mem_fun(S (T::*f)() const); template<class S, class T, class A> const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const);

10 mem_fun(&X::f) returns an object through which X::f can be called given a pointer to an X followed by the argument required for f (if any).

template <class S, class T> class const_mem_fun_ref_t : public unary_function<T, S> { public: explicit const_mem_fun_ref_t(S (T::*p)() const); S operator()(const T& p) const; };

11 const_mem_fun_ref_t calls the member function it is initialized with given a reference argument.

template <class S, class T, class A> class const_mem_fun1_ref_t : public binary_function<T, A, S> { public: explicit const_mem_fun1_ref_t(S (T::*p)(A) const); S operator()(const T& p, A x) const; };

12 const_mem_fun1_ref_t calls the member function it is initialized with given a reference argument and an additional argument of the appropriate type.

template<class S, class T> const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const); template<class S, class T, class A> const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const);

13 mem_fun_ref(&X::f) returns an object through which X::f can be called given a reference to an X followed by the argument required for f (if any).

D.9 Binders [depr.lib.binders]

The binders binder1st, bind1st, binder2nd, and bind2nd are deprecated. NoteThe function template bind ([func.bind.bind]) provides a better solution.

D.9.1 Class template binder1st [depr.lib.binder.1st]

template <class Fn> class binder1st : public unary_function<typename Fn::second_argument_type, typename Fn::result_type> { protected: Fn op; typename Fn::first_argument_type value; public: binder1st(const Fn& x, const typename Fn::first_argument_type& y); typename Fn::result_type operator()(const typename Fn::second_argument_type& x) const; typename Fn::result_type operator()(typename Fn::second_argument_type& x) const; };
1 The constructor initializes op with x and value with y.
2 operator() returns op(value,x).

D.9.2 bind1st [depr.lib.bind.1st]

template <class Fn, class T> binder1st<Fn> bind1st(const Fn& fn, const T& x);
1 Returns:

binder1st<Fn>(fn, typename Fn::first_argument_type(x)).

D.9.3 Class template binder2nd [depr.lib.binder.2nd]

template <class Fn> class binder2nd : public unary_function<typename Fn::first_argument_type, typename Fn::result_type> { protected: Fn op; typename Fn::second_argument_type value; public: binder2nd(const Fn& x, const typename Fn::second_argument_type& y); typename Fn::result_type operator()(const typename Fn::first_argument_type& x) const; typename Fn::result_type operator()(typename Fn::first_argument_type& x) const; };
1 The constructor initializes op with x and value with y.
2 operator() returns op(x,value).

D.9.4 bind2nd [depr.lib.bind.2nd]

template <class Fn, class T> binder2nd<Fn> bind2nd(const Fn& op, const T& x);
1 Returns:

binder2nd<Fn>(op, typename Fn::second_argument_type(x)).

2
Example
find_if(v.begin(), v.end(), bind2nd(greater<int>(), 5));

finds the first integer in vector v greater than 5;

find_if(v.begin(), v.end(), bind1st(greater<int>(), 5));
finds the first integer in v less than 5.

D.10 auto_ptr [depr.auto.ptr]

The class template auto_ptr is deprecated. NoteThe class template unique_ptr ([unique.ptr]) provides a better solution.

D.10.1 Class template auto_ptr [auto.ptr]

1 The class template auto_ptr stores a pointer to an object obtained via new and deletes that object when it itself is destroyed (such as when leaving block scope [stmt.dcl]).
2 The class template auto_ptr_ref is for exposition only. An implementation is permitted to provide equivalent functionality without providing a template with this name. The template holds a reference to an auto_ptr. It is used by the auto_ptr conversions to allow auto_ptr objects to be passed to and returned from functions.
namespace std {
  template <class Y> struct auto_ptr_ref;   // exposition only

  template <class X> class auto_ptr {
  public:
    typedef X element_type;

    // [auto.ptr.cons] construct/copy/destroy:
    explicit auto_ptr(X* p =0) throw();
    auto_ptr(auto_ptr&) throw();
    template<class Y> auto_ptr(auto_ptr<Y>&) throw();
    auto_ptr& operator=(auto_ptr&) throw();
    template<class Y> auto_ptr& operator=(auto_ptr<Y>&) throw();
    auto_ptr& operator=(auto_ptr_ref<X> r) throw();
   ~auto_ptr() throw();

    // [auto.ptr.members] members:
    X& operator*() const throw();
    X* operator->() const throw();
    X* get() const throw();
    X* release() throw();
    void reset(X* p =0) throw();

    // [auto.ptr.conv] conversions:
    auto_ptr(auto_ptr_ref<X>) throw();
    template<class Y> operator auto_ptr_ref<Y>() throw();
    template<class Y> operator auto_ptr<Y>() throw();
  };

  template <> class auto_ptr<void>
  {
  public:
    typedef void element_type;
  };
}
3 The class template auto_ptr provides a semantics of strict ownership. An auto_ptr owns the object it holds a pointer to. Copying an auto_ptr copies the pointer and transfers ownership to the destination. If more than one auto_ptr owns the same object at the same time the behavior of the program is undefined. NoteThe uses of auto_ptr include providing temporary exception-safety for dynamically allocated memory, passing ownership of dynamically allocated memory to a function, and returning dynamically allocated memory from a function. Instances of auto_ptr meet the requirements of MoveConstructible and MoveAssignable, but do not meet the requirements of CopyConstructible and CopyAssignable.
D.10.1.1 auto_ptr constructors [auto.ptr.cons]
explicit auto_ptr(X* p =0) throw();
1 Postconditions:

*this holds the pointer p.

auto_ptr(auto_ptr& a) throw();

2 Effects: Calls a.release().
3 Postconditions:

*this holds the pointer returned from a.release().

template<class Y> auto_ptr(auto_ptr<Y>& a) throw();

4 Requires:

Y* can be implicitly converted to X*.

5 Effects: Calls a.release().
6 Postconditions:

*this holds the pointer returned from a.release().

auto_ptr& operator=(auto_ptr& a) throw();

7 Requires: The expression delete get() is well formed.
8 Effects:

reset(a.release()).

9 Returns:

*this.

template<class Y> auto_ptr& operator=(auto_ptr<Y>& a) throw();

10 Requires:

Y* can be implicitly converted to X*. The expression delete get() is well formed.

11 Effects:

reset(a.release()).

12 Returns:

*this.

~auto_ptr() throw();

13 Requires: The expression delete get() is well formed.
14 Effects:

delete get().

D.10.1.2 auto_ptr members [auto.ptr.members]
X& operator*() const throw();
1 Requires:

get() != 0

2 Returns:

*get()

X* operator->() const throw();

3 Returns:

get()

X* get() const throw();

4 Returns: The pointer *this holds.

X* release() throw();

5 Returns:

get()

6 Postcondition:

*this holds the null pointer.

void reset(X* p=0) throw();

7 Effects: If get() != p then delete get().
8 Postconditions:

*this holds the pointer p.

D.10.1.3 auto_ptr conversions [auto.ptr.conv]
auto_ptr(auto_ptr_ref<X> r) throw();
1 Effects: Calls p.release() for the auto_ptr p that r holds.
2 Postconditions:

*this holds the pointer returned from release().

template<class Y> operator auto_ptr_ref<Y>() throw();

3 Returns: An auto_ptr_ref<Y> that holds *this.

template<class Y> operator auto_ptr<Y>() throw();

4 Effects: Calls release().
5 Returns: An auto_ptr<Y> that holds the pointer returned from release().

auto_ptr& operator=(auto_ptr_ref<X> r) throw()

6 Effects: Calls reset(p.release()) for the auto_ptr p that r holds a reference to.
7 Returns:

*this

D.11 Violating exception-specifications [exception.unexpected]

D.11.1 Type unexpected_handler [unexpected.handler]

typedef void (*unexpected_handler)();
1 The type of a handler function to be called by unexpected() when a function attempts to throw an exception not listed in its dynamic-exception-specification.
2 Required behavior: An unexpected_handler shall not return. See also [except.unexpected].
3 Default behavior: The implementation's default unexpected_handler calls std::terminate().

D.11.2 set_unexpected [set.unexpected]

unexpected_handler set_unexpected(unexpected_handler f) noexcept;
1 Effects: Establishes the function designated by f as the current unexpected_handler.
2 Remark: It is unspecified whether a null pointer value designates the default unexpected_handler.
3 Returns: The previous unexpected_handler.

D.11.3 get_unexpected [get.unexpected]

unexpected_handler get_unexpected() noexcept;
1 Returns: The current unexpected_handler. NoteThis may be a null pointer value.

D.11.4 unexpected [unexpected]

noreturn void unexpected();
1 Remarks: Called by the implementation when a function exits via an exception not allowed by its exception-specification ([except.unexpected]), in effect after evaluating the throw-expression ([unexpected.handler]). May also be called directly by the program.
2 Effects: Calls the current unexpected_handler function. NoteA default unexpected_handler is always considered a callable handler in this context.

D.12 Random shuffle [depr.alg.random.shuffle]

The function templates random_shuffle are deprecated.

template<class RandomAccessIterator> void random_shuffle(RandomAccessIterator first, RandomAccessIterator last); template<class RandomAccessIterator, class RandomNumberGenerator> void random_shuffle(RandomAccessIterator first, RandomAccessIterator last, RandomNumberGenerator&& rng);

1 Effects: Permutes the elements in the range [first,last) such that each possible permutation of those elements has equal probability of appearance.
2 Requires:

RandomAccessIterator shall satisfy the requirements of ValueSwappable ([swappable.requirements]). The random number generating function object rng shall have a return type that is convertible to iterator_traits<RandomAccessIterator>::difference_type, and the call rng(n) shall return a randomly chosen value in the interval [0,n), for n > 0 of type iterator_traits<RandomAccessIterator>::difference_type.

3 Complexity: Exactly (last - first) - 1 swaps.
4 Remarks: To the extent that the implementation of these functions makes use of random numbers, the implementation shall use the following sources of randomness:

The underlying source of random numbers for the first form of the function is implementation-defined. An implementation may use the rand function from the standard C library.

In the second form of the function, the function object rng shall serve as the implementation's source of randomness.


  1. An implementation should consider alsize in making this decision.
  2. The function signature strlen(const char*) is declared in <cstring> ([c.strings]).


[edit]

Source: https://timsong-cpp.github.io/cppwp/n4659/depr

List of Tables [tab]
List of Figures [fig]
1 Scope [intro.scope]
2 Normative references [intro.refs]
3 Terms and definitions [intro.defs]
4 General principles [intro]
5 Lexical conventions [lex]
6 Basic concepts [basic]
7 Standard conversions [conv]
8 Expressions [expr]
9 Statements [stmt.stmt]
10 Declarations [dcl.dcl]
11 Declarators [dcl.decl]
12 Classes [class]
13 Derived classes [class.derived]
14 Member access control [class.access]
15 Special member functions [special]
16 Overloading [over]
17 Templates [temp]
18 Exception handling [except]
19 Preprocessing directives [cpp]
20 Library introduction [library]
21 Language support library [language.support]
22 Diagnostics library [diagnostics]
23 General utilities library [utilities]
24 Strings library [strings]
25 Localization library [localization]
26 Containers library [containers]
27 Iterators library [iterators]
28 Algorithms library [algorithms]
29 Numerics library [numerics]
30 Input/output library [input.output]
31 Regular expressions library [re]
32 Atomic operations library [atomics]
33 Thread support library [thread]
Annex A (informative) Grammar summary [gram]
Annex B (informative) Implementation quantities [implimits]
Annex C (informative) Compatibility [diff]
Annex D (normative) Compatibility features [depr]
D.1 Redeclaration of static constexpr data members [depr.static_constexpr]
D.2 Implicit declaration of copy functions [depr.impldec]
D.3 Deprecated exception specifications [depr.except.spec]
D.4 C++standard library headers [depr.cpp.headers]
D.5 C standard library headers [depr.c.headers]
D.6 char* streams [depr.str.strstreams]
D.7 uncaught_­exception [depr.uncaught]
D.8 Old adaptable function bindings [depr.func.adaptor.binding]
D.9 The default allocator [depr.default.allocator]
D.10 Raw storage iterator [depr.storage.iterator]
D.11 Temporary buffers [depr.temporary.buffer]
D.12 Deprecated type traits [depr.meta.types]
D.13 Deprecated iterator primitives [depr.iterator.primitives]
D.14 Deprecated shared_­ptr observers [depr.util.smartptr.shared.obs]
D.15 Deprecated standard code conversion facets [depr.locale.stdcvt]
D.16 Deprecated convenience conversion interfaces [depr.conversions]
Index [generalindex]
Index of library names [libraryindex]
Index of implementation-defined behavior [impldefindex]

Annex D (normative) Compatibility features [depr]

1 This Clause describes features of the C++ Standard that are specified for compatibility with existing implementations.
2 These are deprecated features, where deprecated is defined as: Normative for the current edition of this International Standard, but having been identified as a candidate for removal from future revisions. An implementation may declare library names and entities described in this section with the deprecated attribute.

D.1 Redeclaration of static constexpr data members [depr.static_constexpr]

1 For compatibility with prior C++ International Standards, a constexpr static data member may be redundantly redeclared outside the class with no initializer. This usage is deprecated.
Example
struct A {
  static constexpr int n = 5;  // definition (declaration in C++ 2014)
};

constexpr int A::n;  // redundant declaration (definition in C++ 2014)

D.2 Implicit declaration of copy functions [depr.impldec]

1 The implicit definition of a copy constructor as defaulted is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor. The implicit definition of a copy assignment operator as defaulted is deprecated if the class has a user-declared copy constructor or a user-declared destructor ([class.dtor], [class.copy]). In a future revision of this International Standard, these implicit definitions could become deleted ([dcl.fct.def]).

D.3 Deprecated exception specifications [depr.except.spec]

1 The noexcept-specifier throw() is deprecated.

D.4 C++standard library headers [depr.cpp.headers]

1 For compatibility with prior C++International Standards, the C++standard library provides headers <ccomplex> ([depr.ccomplex.syn]), <cstdalign> ([depr.cstdalign.syn]), <cstdbool> ([depr.cstdbool.syn]), and <ctgmath> ([depr.ctgmath.syn]). The use of these headers is deprecated.

D.4.1 Header <ccomplex> synopsis [depr.ccomplex.syn]

#include <complex>
1 The header <ccomplex> behaves as if it simply includes the header <complex> ([complex.syn]).

D.4.2 Header <cstdalign> synopsis [depr.cstdalign.syn]

#define __alignas_is_defined 1
1 The contents of the header <cstdalign> are the same as the C standard library header <stdalign.h>, with the following changes: The header <cstdalign> and the header <stdalign.h> shall not define a macro named alignas.

See also: ISO C 7.15.

D.4.3 Header <cstdbool> synopsis [depr.cstdbool.syn]

#define __bool_true_false_are_defined 1
1 The contents of the header <cstdbool> are the same as the C standard library header <stdbool.h>, with the following changes: The header <cstdbool> and the header <stdbool.h> shall not define macros named bool, true, or false.

See also: ISO C 7.18.

D.4.4 Header <ctgmath> synopsis [depr.ctgmath.syn]

#include <complex>
#include <cmath>
1 The header <ctgmath> simply includes the headers <complex> ([complex.syn]) and <cmath> ([cmath.syn]).
2 NoteThe overloads provided in C by type-generic macros are already provided in <complex> and <cmath> by “sufficient” additional overloads.

D.5 C standard library headers [depr.c.headers]

1 For compatibility with the C standard library, the C++ standard library provides the C headers shown in Table 141.
Table 141 — C headers
<assert.h> <inttypes.h> <signal.h> <stdio.h> <wchar.h>
<complex.h> <iso646.h> <stdalign.h> <stdlib.h> <wctype.h>
<ctype.h> <limits.h> <stdarg.h> <string.h>
<errno.h> <locale.h> <stdbool.h> <tgmath.h>
<fenv.h> <math.h> <stddef.h> <time.h>
<float.h> <setjmp.h> <stdint.h> <uchar.h>
2 The header <complex.h> behaves as if it simply includes the header <ccomplex>. The header <tgmath.h> behaves as if it simply includes the header <ctgmath>.
3 Every other C header, each of which has a name of the form name.h, behaves as if each name placed in the standard library namespace by the corresponding cname header is placed within the global namespace scope, except for the functions described in [sf.cmath], the declaration of std​::​byte ([cstddef.syn]), and the functions and function templates described in [support.types.byteops]. It is unspecified whether these names are first declared or defined within namespace scope ([basic.scope.namespace]) of the namespace std and are then injected into the global namespace scope by explicit using-declarations.
4
ExampleThe header <cstdlib> assuredly provides its declarations and definitions within the namespace std. It may also provide these names within the global namespace. The header <stdlib.h> assuredly provides the same declarations and definitions within the global namespace, much as in the C Standard. It may also provide these names within the namespace std.

D.6 char* streams [depr.str.strstreams]

1 The header <strstream> defines three types that associate stream buffers with character array objects and assist reading and writing such objects.

D.6.1 Class strstreambuf [depr.strstreambuf]

namespace std {
  class strstreambuf : public basic_streambuf<char> {
  public:
    explicit strstreambuf(streamsize alsize_arg = 0);
    strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
    strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0);
    strstreambuf(const char* gnext_arg, streamsize n);

    strstreambuf(signed char* gnext_arg, streamsize n,
                 signed char* pbeg_arg = 0);
    strstreambuf(const signed char* gnext_arg, streamsize n);
    strstreambuf(unsigned char* gnext_arg, streamsize n,
                 unsigned char* pbeg_arg = 0);
    strstreambuf(const unsigned char* gnext_arg, streamsize n);

    virtual ~strstreambuf();

    void  freeze(bool freezefl = true);
    char* str();
    int   pcount();

  protected:
    int_type overflow (int_type c = EOF) override;
    int_type pbackfail(int_type c = EOF) override;
    int_type underflow() override;
    pos_type seekoff(off_type off, ios_base::seekdir way,
                     ios_base::openmode which
                      = ios_base::in | ios_base::out) override;
    pos_type seekpos(pos_type sp,
                     ios_base::openmode which
                      = ios_base::in | ios_base::out) override;
    streambuf* setbuf(char* s, streamsize n) override;

  private:
    using strstate = T1;              // exposition only
    static const strstate allocated;  // exposition only
    static const strstate constant;   // exposition only
    static const strstate dynamic;    // exposition only
    static const strstate frozen;     // exposition only
    strstate strmode;                 // exposition only
    streamsize alsize;                // exposition only
    void* (*palloc)(size_t);          // exposition only
    void (*pfree)(void*);             // exposition only
  };
}
1 The class strstreambuf associates the input sequence, and possibly the output sequence, with an object of some character array type, whose elements store arbitrary values. The array object has several attributes.
2
Note-
3
Note-
4 Each object of class strstreambuf has a seekable area, delimited by the pointers seeklow and seekhigh. If gnext is a null pointer, the seekable area is undefined. Otherwise, seeklow equals gbeg and seekhigh is either pend, if pend is not a null pointer, or gend.
D.6.1.1 strstreambuf constructors [depr.strstreambuf.cons]
explicit strstreambuf(streamsize alsize_arg = 0);
1 Effects: Constructs an object of class strstreambuf, initializing the base class with streambuf(). The postconditions of this function are indicated in Table 142.
Table 142strstreambuf(streamsize) effects
Element Value
strmode dynamic
alsize alsize_arg
palloc a null pointer
pfree a null pointer

strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));

2 Effects: Constructs an object of class strstreambuf, initializing the base class with streambuf(). The postconditions of this function are indicated in Table 143.
Table 143strstreambuf(void* (*)(size_t), void (*)(void*)) effects
Element Value
strmode dynamic
alsize an unspecified value
palloc palloc_arg
pfree pfree_arg

strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0); strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = 0); strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = 0);

3 Effects: Constructs an object of class strstreambuf, initializing the base class with streambuf(). The postconditions of this function are indicated in Table 144.
Table 144strstreambuf(charT*, streamsize, charT*) effects
Element Value
strmode 0
alsize an unspecified value
palloc a null pointer
pfree a null pointer
4 gnext_arg shall point to the first element of an array object whose number of elements N is determined as follows:
(4.1)
  • If n > 0, N is n.

(4.2)
  • If n == 0, N is std​::​strlen(gnext_arg).

(4.3)
5 If pbeg_arg is a null pointer, the function executes:
setg(gnext_arg, gnext_arg, gnext_arg + N);
6 Otherwise, the function executes:
setg(gnext_arg, gnext_arg, pbeg_arg);
setp(pbeg_arg,  pbeg_arg + N);

strstreambuf(const char* gnext_arg, streamsize n); strstreambuf(const signed char* gnext_arg, streamsize n); strstreambuf(const unsigned char* gnext_arg, streamsize n);

7 Effects: Behaves the same as strstreambuf((char*)gnext_arg,n), except that the constructor also sets constant in strmode.

virtual ~strstreambuf();

8 Effects: Destroys an object of class strstreambuf. The function frees the dynamically allocated array object only if (strmode & allocated) != 0 and (strmode & frozen) == 0. ([depr.strstreambuf.virtuals] describes how a dynamically allocated array object is freed.)
D.6.1.2 Member functions [depr.strstreambuf.members]
void freeze(bool freezefl = true);
1 Effects: If strmode & dynamic is nonzero, alters the freeze status of the dynamic array object as follows:
(1.1)
  • If freezefl is true, the function sets frozen in strmode.

(1.2)
  • Otherwise, it clears frozen in strmode.

    char* str();

2 Effects: Calls freeze(), then returns the beginning pointer for the input sequence, gbeg.
3 Remarks: The return value can be a null pointer.

int pcount() const;

4 Effects: If the next pointer for the output sequence, pnext, is a null pointer, returns zero. Otherwise, returns the current effective length of the array object as the next pointer minus the beginning pointer for the output sequence, pnext - pbeg.
D.6.1.3 strstreambuf overridden virtual functions [depr.strstreambuf.virtuals]
int_type overflow(int_type c = EOF) override;
1 Effects: Appends the character designated by c to the output sequence, if possible, in one of two ways:
(1.1)
  • If c != EOF and if either the output sequence has a write position available or the function makes a write position available (as described below), assigns c to *pnext++.

    Returns (unsigned char)c.

(1.2)
  • If c == EOF, there is no character to append.

    Returns a value other than EOF.

2 Returns EOF to indicate failure.
3 Remarks: The function can alter the number of write positions available as a result of any call.
4 To make a write position available, the function reallocates (or initially allocates) an array object with a sufficient number of elements n to hold the current array object (if any), plus at least one additional write position. How many additional write positions are made available is otherwise unspecified.[cpp17 2] If palloc is not a null pointer, the function calls (*palloc)(n) to allocate the new dynamic array object. Otherwise, it evaluates the expression new charT[n]. In either case, if the allocation fails, the function returns EOF. Otherwise, it sets allocated in strmode.
5 To free a previously existing dynamic array object whose first element address is p: If pfree is not a null pointer, the function calls (*pfree)(p). Otherwise, it evaluates the expression delete[]p.
6 If (strmode & dynamic) == 0, or if (strmode & frozen) != 0, the function cannot extend the array (reallocate it with greater length) to make a write position available.

int_type pbackfail(int_type c = EOF) override;

7 Puts back the character designated by c to the input sequence, if possible, in one of three ways:
(7.1)
  • If c != EOF, if the input sequence has a putback position available, and if (char)c == gnext[-1], assigns gnext - 1 to gnext.

    Returns c.

(7.2)
  • If c != EOF, if the input sequence has a putback position available, and if strmode & constant is zero, assigns c to *--gnext.

    Returns c.

(7.3)
  • If c == EOF and if the input sequence has a putback position available, assigns gnext - 1 to gnext.

    Returns a value other than EOF.

8 Returns EOF to indicate failure.
9 Remarks: If the function can succeed in more than one of these ways, it is unspecified which way is chosen. The function can alter the number of putback positions available as a result of any call.

int_type underflow() override;

10 Effects: Reads a character from the input sequence, if possible, without moving the stream position past it, as follows:
(10.1)
  • If the input sequence has a read position available, the function signals success by returning (unsigned char)​*gnext.

(10.2)
  • Otherwise, if the current write next pointer pnext is not a null pointer and is greater than the current read end pointer gend, makes a read position available by assigning to gend a value greater than gnext and no greater than pnext.

    Returns (unsigned char)*gnext.

11 Returns EOF to indicate failure.
12 Remarks: The function can alter the number of read positions available as a result of any call.

pos_type seekoff(off_type off, seekdir way, openmode which = in | out) override;

13 Effects: Alters the stream position within one of the controlled sequences, if possible, as indicated in Table 145.
Table 145seekoff positioning
Conditions Result
(which & ios​::​in) != 0 positions the input sequence
(which & ios​::​out) != 0 positions the output sequence
(which & (ios​::​in |

ios​::​out)) == (ios​::​in |
ios​::​out)) and
way == either
ios​::​beg or
ios​::​end

positions both the input and the output sequences
Otherwise the positioning operation fails.
14 For a sequence to be positioned, if its next pointer is a null pointer, the positioning operation fails. Otherwise, the function determines newoff as indicated in Table 146.
Table 146newoff values
Condition newoff Value
way == ios​::​beg 0
way == ios​::​cur the next pointer minus the beginning pointer (xnext - xbeg).
way == ios​::​end seekhigh minus the beginning pointer (seekhigh - xbeg).
15 If (newoff + off) < (seeklow - xbeg) or (seekhigh - xbeg) < (newoff + off), the positioning operation fails. Otherwise, the function assigns xbeg + newoff + off to the next pointer xnext.
16 Returns:

pos_type(newoff), constructed from the resultant offset newoff (of type off_type), that stores the resultant stream position, if possible. If the positioning operation fails, or if the constructed object cannot represent the resultant stream position, the return value is pos_type(off_type(-1)).

pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out) override;

17 Effects: Alters the stream position within one of the controlled sequences, if possible, to correspond to the stream position stored in sp (as described below).
(17.1)
  • If (which & ios​::​in) != 0, positions the input sequence.

(17.2)
  • If (which & ios​::​out) != 0, positions the output sequence.

(17.3)
  • If the function positions neither sequence, the positioning operation fails.

18 For a sequence to be positioned, if its next pointer is a null pointer, the positioning operation fails. Otherwise, the function determines newoff from sp.offset():
(18.1)
  • If newoff is an invalid stream position, has a negative value, or has a value greater than (seekhigh - seeklow), the positioning operation fails

(18.2)
  • Otherwise, the function adds newoff to the beginning pointer xbeg and stores the result in the next pointer xnext.

19 Returns:

pos_type(newoff), constructed from the resultant offset newoff (of type off_type), that stores the resultant stream position, if possible. If the positioning operation fails, or if the constructed object cannot represent the resultant stream position, the return value is pos_type(off_type(-1)).

streambuf<char>* setbuf(char* s, streamsize n) override;

20 Effects: Implementation defined, except that setbuf(0, 0) has no effect.

D.6.2 Class istrstream [depr.istrstream]

namespace std {
  class istrstream : public basic_istream<char> {
  public:
    explicit istrstream(const char* s);
    explicit istrstream(char* s);
    istrstream(const char* s, streamsize n);
    istrstream(char* s, streamsize n);
    virtual ~istrstream();

    strstreambuf* rdbuf() const;
    char* str();
  private:
    strstreambuf sb;  // exposition only
  };
}
1 The class istrstream supports the reading of objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.6.2.1 istrstream constructors [depr.istrstream.cons]
explicit istrstream(const char* s); explicit istrstream(char* s);
1 Effects: Constructs an object of class istrstream, initializing the base class with istream(&sb) and initializing sb with strstreambuf(s,0). s shall designate the first element of an ntbs.

istrstream(const char* s, streamsize n); istrstream(char* s, streamsize n);

2 Effects: Constructs an object of class istrstream, initializing the base class with istream(&sb) and initializing sb with strstreambuf(s,n). s shall designate the first element of an array whose length is n elements, and n shall be greater than zero.
D.6.2.2 Member functions [depr.istrstream.members]
strstreambuf* rdbuf() const;
1 Returns:

const_cast<strstreambuf*>(&sb).

char* str();

2 Returns:

rdbuf()->str().

D.6.3 Class ostrstream [depr.ostrstream]

namespace std {
  class ostrstream : public basic_ostream<char> {
  public:
    ostrstream();
    ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
    virtual ~ostrstream();

    strstreambuf* rdbuf() const;
    void freeze(bool freezefl = true);
    char* str();
    int pcount() const;
  private:
    strstreambuf sb;  // exposition only
  };
}
1 The class ostrstream supports the writing of objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.6.3.1 ostrstream constructors [depr.ostrstream.cons]
ostrstream();
1 Effects: Constructs an object of class ostrstream, initializing the base class with ostream(&sb) and initializing sb with strstreambuf().

ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);

2 Effects: Constructs an object of class ostrstream, initializing the base class with ostream(&sb), and initializing sb with one of two constructors:
(2.1)
  • If (mode & app) == 0, then s shall designate the first element of an array of n elements.

    The constructor is strstreambuf(s, n, s).

(2.2)
  • If (mode & app) != 0, then s shall designate the first element of an array of n elements that contains an ntbs whose first element is designated by s. The constructor is strstreambuf(s, n, s + std​::​strlen(s)).[cpp17 3]

D.6.3.2 Member functions [depr.ostrstream.members]
strstreambuf* rdbuf() const;
1 Returns:

(strstreambuf*)&sb.

void freeze(bool freezefl = true);

2 Effects: Calls rdbuf()->freeze(freezefl).

char* str();

3 Returns:

rdbuf()->str().

int pcount() const;

4 Returns:

rdbuf()->pcount().

D.6.4 Class strstream [depr.strstream]

namespace std {
  class strstream
    : public basic_iostream<char> {
  public:
    // Types
    using char_type = char;
    using int_type  = char_traits<char>::int_type;
    using pos_type  = char_traits<char>::pos_type;
    using off_type  = char_traits<char>::off_type;

    // constructors/destructor
    strstream();
    strstream(char* s, int n,
              ios_base::openmode mode = ios_base::in|ios_base::out);
    virtual ~strstream();

    // Members:
    strstreambuf* rdbuf() const;
    void freeze(bool freezefl = true);
    int pcount() const;
    char* str();

  private:
  strstreambuf sb;  // exposition only
  };
}
1 The class strstream supports reading and writing from objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.6.4.1 strstream constructors [depr.strstream.cons]
strstream();
1 Effects: Constructs an object of class strstream, initializing the base class with iostream(&sb).

strstream(char* s, int n, ios_base::openmode mode = ios_base::in|ios_base::out);

2 Effects: Constructs an object of class strstream, initializing the base class with iostream(&sb) and initializing sb with one of the two constructors:
(2.1)
  • If (mode & app) == 0, then s shall designate the first element of an array of n elements. The constructor is strstreambuf(s,n,s).

(2.2)
  • If (mode & app) != 0, then s shall designate the first element of an array of n elements that contains an ntbs whose first element is designated by s. The constructor is strstreambuf(s,n,s + std​::​strlen(s)).

D.6.4.2 strstream destructor [depr.strstream.dest]
virtual ~strstream();
1 Effects: Destroys an object of class strstream.
D.6.4.3 strstream operations [depr.strstream.oper]
strstreambuf* rdbuf() const;
1 Returns:

&sb.

void freeze(bool freezefl = true);

2 Effects: Calls rdbuf()->freeze(freezefl).

char* str();

3 Returns:

rdbuf()->str().

int pcount() const;

4 Returns:

rdbuf()->pcount().

D.7 uncaught_exception [depr.uncaught]

1 The header <exception> has the following addition:
namespace std {
  bool uncaught_exception() noexcept;
}

bool uncaught_exception() noexcept;

2 Returns: uncaught_exceptions() > 0.

D.8 Old adaptable function bindings [depr.func.adaptor.binding]

D.8.1 Weak result types [depr.weak.result_type]

1 A call wrapper may have a weak result type. If it does, the type of its member type result_type is based on the type T of the wrapper's target object:
(1.1)
  • if T is a pointer to function type, result_type shall be a synonym for the return type of T;

(1.2)
  • if T is a pointer to member function, result_type shall be a synonym for the return type of T;

(1.3)
  • if T is a class type and the qualified-id T​::​result_type is valid and denotes a type ([temp.deduct]), then result_type shall be a synonym for T​::​result_type;

(1.4)
  • otherwise result_type shall not be defined.

D.8.2 Typedefs to support function binders [depr.func.adaptor.typedefs]

1 To enable old function adaptors to manipulate function objects that take one or two arguments, many of the function objects in this International Standard correspondingly provide typedef-names

argument_type and result_type for function objects that take one argument and first_argument_type, second_argument_type, and result_type for function objects that take two arguments.

2 The following member names are defined in addition to names specified in Clause [function.objects]:
namespace std {
  template<class T> struct owner_less<shared_ptr<T>> {
    using result_type          = bool;
    using first_argument_type  = shared_ptr<T>;
    using second_argument_type = shared_ptr<T>;
  };

  template<class T> struct owner_less<weak_ptr<T>> {
    using result_type          = bool;
    using first_argument_type  = weak_ptr<T>;
    using second_argument_type = weak_ptr<T>;
  };

  template <class T> class reference_wrapper {
  public :
    using result_type          = see below; // not always defined
    using argument_type        = see below; // not always defined
    using first_argument_type  = see below; // not always defined
    using second_argument_type = see below; // not always defined
  };

  template <class T> struct plus {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = T;
  };

  template <class T> struct minus {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = T;
  };

  template <class T> struct multiplies {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = T;
  };

  template <class T> struct divides {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = T;
  };

  template <class T> struct modulus {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = T;
  };

  template <class T> struct negate {
    using argument_type = T;
    using result_type   = T;
  };

  template <class T> struct equal_to {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = bool;
  };

  template <class T> struct not_equal_to {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = bool;
  };

  template <class T> struct greater {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = bool;
  };

  template <class T> struct less {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = bool;
  };

  template <class T> struct greater_equal {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = bool;
  };

  template <class T> struct less_equal {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = bool;
  };

  template <class T> struct logical_and {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = bool;
  };

  template <class T> struct logical_or {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = bool;
  };

  template <class T> struct logical_not {
    using argument_type = T;
    using result_type   = bool;
  };

  template <class T> struct bit_and {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = T;
  };

  template <class T> struct bit_or {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = T;
  };

  template <class T> struct bit_xor {
    using first_argument_type  = T;
    using second_argument_type = T;
    using result_type          = T;
  };

  template <class T> struct bit_not {
    using argument_type = T;
    using result_type   = T;
  };

  template<class R, class T1>
  class function<R(T1)> {
  public:
    using argument_type = T1;
  };

  template<class R, class T1, class T2>
  class function<R(T1, T2)> {
  public:
    using first_argument_type  = T1;
    using second_argument_type = T2;
  };
}
3 reference_wrapper<T> has a weak result type. If T is a function type, result_type shall be a synonym for the return type of T.
4 The template specialization reference_wrapper<T> shall define a nested type named argument_type as a synonym for T1 only if the type T is any of the following:
(4.1)
  • a function type or a pointer to function type taking one argument of type T1

(4.2)
  • a pointer to member function R T0​::​f() cv (where cv represents the member function's cv-qualifiers); the type T1 is cv T0*

(4.3)
  • a class type where the qualified-id T​::​argument_type is valid and denotes a type ([temp.deduct]); the type T1 is T​::​argument_type.

5 The template instantiation reference_wrapper<T> shall define two nested types named first_argument_type and second_argument_type as synonyms for T1 and T2, respectively, only if the type T is any of the following:
(5.1)
  • a function type or a pointer to function type taking two arguments of types T1 and T2

(5.2)
  • a pointer to member function R T0​::​f(T2) cv (where cv represents the member function's cv-qualifiers); the type T1 is cv T0*

(5.3)
  • a class type where the qualified-ids T​::​first_argument_type and T​::​second_argument_type are both valid and both denote types ([temp.deduct]); the type T1 is T​::​first_argument_type and the type T2 is T​::​second_argument_type.

6 All enabled specializations hash<Key> of hash ([unord.hash]) provide two nested types, result_type and argument_type, which shall be synonyms for size_t and Key, respectively.
7 The forwarding call wrapper g returned by a call to bind(f, bound_args...) ([func.bind.bind]) shall have a weak result type.
8 The forwarding call wrapper g returned by a call to bind<R>(f, bound_args...) ([func.bind.bind]) shall have a nested type result_type defined as a synonym for R.
9 The simple call wrapper returned from a call to mem_fn(pm) shall have a nested type result_type that is a synonym for the return type of pm when pm is a pointer to member function.
10 The simple call wrapper returned from a call to mem_fn(pm) shall define two nested types named argument_type and result_type as synonyms for cv T* and Ret, respectively, when pm is a pointer to member function with cv-qualifier cv and taking no arguments, where Ret is pm's return type.
11 The simple call wrapper returned from a call to mem_fn(pm) shall define three nested types named first_argument_type, second_argument_type, and result_type as synonyms for cv T*, T1, and Ret, respectively, when pm is a pointer to member function with cv-qualifier cv and taking one argument of type T1, where Ret is pm's return type.
12 The following member names are defined in addition to names specified in Clause [containers]:
namespace std {
  template <class Key, class T, class Compare, class Allocator>
  class map<Key, T, Compare, Allocator>::value_compare {
  public:
    using result_type          = bool;
    using first_argument_type  = value_type;
    using second_argument_type = value_type;
  };

  template <class Key, class T, class Compare, class Allocator>
  class multimap<Key, T, Compare, Allocator>::value_compare {
  public:
    using result_type          = bool;
    using first_argument_type  = value_type;
    using second_argument_type = value_type;
  };
}

D.8.3 Negators [depr.negators]

1 The header <functional> has the following additions:
namespace std {
  template <class Predicate> class unary_negate;
  template <class Predicate>
    constexpr unary_negate<Predicate> not1(const Predicate&);
  template <class Predicate> class binary_negate;
  template <class Predicate>
    constexpr binary_negate<Predicate> not2(const Predicate&);
}
2 Negators not1 and not2 take a unary and a binary predicate, respectively, and return their logical negations ([expr.unary.op]).
template <class Predicate>
class unary_negate {
public:
  constexpr explicit unary_negate(const Predicate& pred);
  constexpr bool operator()(const typename Predicate::argument_type& x) const;
  using argument_type = typename Predicate::argument_type;
  using result_type   = bool;
};

constexpr bool operator()(const typename Predicate::argument_type& x) const;

3 Returns: !pred(x).

template <class Predicate> constexpr unary_negate<Predicate> not1(const Predicate& pred);

4 Returns: unary_negate<Predicate>(pred).
template <class Predicate>
class binary_negate {
public:
  constexpr explicit binary_negate(const Predicate& pred);
  constexpr bool operator()(const typename Predicate::first_argument_type& x,
                            const typename Predicate::second_argument_type& y) const;
  using first_argument_type  = typename Predicate::first_argument_type;
  using second_argument_type = typename Predicate::second_argument_type;
  using result_type          = bool;

};

constexpr bool operator()(const typename Predicate::first_argument_type& x, const typename Predicate::second_argument_type& y) const;

5 Returns: !pred(x,y).

template <class Predicate> constexpr binary_negate<Predicate> not2(const Predicate& pred);

6 Returns: binary_negate<Predicate>(pred).

D.9 The default allocator [depr.default.allocator]

1 The following members and explicit class template specialization are defined in addition to those specified in [default.allocator]:
namespace std {
  // specialize for void:
  template <> class allocator<void> {
  public:
    using value_type    = void;
    using pointer       = void*;
    using const_pointer = const void*;
    // reference-to-void members are impossible.

    template <class U> struct rebind { using other = allocator<U>; };
  };

  template <class T> class allocator {
   public:
    using size_type       = size_t;
    using difference_type = ptrdiff_t;
    using pointer         = T*;
    using const_pointer   = const T*;
    using reference       = T
    using const_reference = const T
    template <class U> struct rebind { using other = allocator<U>; };

    T* address(T& x) const noexcept;
    const T* address(const T& x) const noexcept;

    T* allocate(size_t n, const void* hint);

    template<class U, class... Args>
      void construct(U* p, Args&... args);
    template <class U>
      void destroy(U* p);

    size_t max_size() const noexcept;
  };
}

T* address(T& x) const noexcept; const T* address(const T& x) const noexcept;

2 Returns: addressof(x).

T* allocate(size_t n, const void* hint);

3 Returns: A pointer to the initial element of an array of storage of size n

* sizeof(T), aligned appropriately for objects of type T. It is implementation-defined whether over-aligned types are supported ([basic.align]).

4 Remarks: The storage is obtained by calling ​::​operator new(std​::​size_t) ([new.delete]), but it is unspecified when or how often this function is called.
5 Throws:

bad_alloc if the storage cannot be obtained.

template <class U, class... Args> void construct(U* p, Args&&... args);

6 Effects: As if by: ​::​new((void *)p) U(std​::​forward<Args>(args)...);

template <class U> void destroy(U* p);

7 Effects: As if by p->~U().

size_t max_size() const noexcept;

8 Returns: The largest value N for which the call allocate(N, 0) might succeed.

D.10 Raw storage iterator [depr.storage.iterator]

1 The header <memory> has the following addition:
namespace std {
  template <class OutputIterator, class T>
  class raw_storage_iterator {
  public:
    using iterator_category = output_iterator_tag;
    using value_type        = void;
    using difference_type   = void;
    using pointer           = void;
    using reference         = void;

    explicit raw_storage_iterator(OutputIterator x);

    raw_storage_iterator& operator*();
    raw_storage_iterator& operator=(const T& element);
    raw_storage_iterator& operator=(T&& element);
    raw_storage_iterator& operator++();
    raw_storage_iterator  operator++(int);
    OutputIterator base() const;
  };
}
2 raw_storage_iterator is provided to enable algorithms to store their results into uninitialized memory. The template parameter OutputIterator is required to have its operator* return an object for which operator& is defined and returns a pointer to T, and is also required to satisfy the requirements of an output iterator.

explicit raw_storage_iterator(OutputIterator x);

3 Effects: Initializes the iterator to point to the same value to which x points.

raw_storage_iterator& operator*();

4 Returns:

*this

raw_storage_iterator& operator=(const T& element);

5 Requires:

T shall be CopyConstructible.

6 Effects: Constructs a value from element at the location to which the iterator points.
7 Returns: A reference to the iterator.

raw_storage_iterator& operator=(T&& element);

8 Requires:

T shall be MoveConstructible.

9 Effects: Constructs a value from std​::​move(element) at the location to which the iterator points.
10 Returns: A reference to the iterator.

raw_storage_iterator& operator++();

11 Effects: Pre-increment: advances the iterator and returns a reference to the updated iterator.

raw_storage_iterator operator++(int);

12 Effects: Post-increment: advances the iterator and returns the old value of the iterator.

OutputIterator base() const;

13 Returns: An iterator of type OutputIterator that points to the same value as *this points to.

D.11 Temporary buffers [depr.temporary.buffer]

1 The header <memory> has the following additions:
namespace std {
  template <class T>
    pair<T*, ptrdiff_t> get_temporary_buffer(ptrdiff_t n) noexcept;
  template <class T>
    void return_temporary_buffer(T* p);
}

template <class T> pair<T*, ptrdiff_t> get_temporary_buffer(ptrdiff_t n) noexcept;

2 Effects: Obtains a pointer to uninitialized, contiguous storage for N adjacent objects of type T, for some non-negative number N. It is implementation-defined whether over-aligned types are supported ([basic.align]).
3 Remarks: Calling get_temporary_buffer with a positive number n is a non-binding request to return storage for n objects of type T. In this case, an implementation is permitted to return instead storage for a non-negative number N of such objects, where N != n (including N == 0). NoteThe request is non-binding to allow latitude for implementation-specific optimizations of its memory management.
4 Returns: If n <= 0 or if no storage could be obtained, returns a pair P such that P.first is a null pointer value and P.second == 0; otherwise returns a pair P such that P.first refers to the address of the uninitialized storage and P.second refers to its capacity N (in the units of sizeof(T)).

template <class T> void return_temporary_buffer(T* p);

5 Effects: Deallocates the storage referenced by p.
6 Requires:

p shall be a pointer value returned by an earlier call to get_temporary_buffer that has not been invalidated by an intervening call to return_temporary_buffer(T*).

7 Throws: Nothing.

D.12 Deprecated type traits [depr.meta.types]

1 The header <type_traits> has the following addition:
namespace std {
  template <class T> struct is_literal_type;

  template <class T> constexpr bool is_literal_type_v = is_literal_type<T>::value;

  template <class> struct result_of; // not defined
  template <class Fn, class... ArgTypes> struct result_of<Fn(ArgTypes...)>;

  template <class T> using result_of_t = typename result_of<T>::type;
}
2 Requires: For is_literal_type, remove_all_extents_t<T> shall be a complete type or cv void. For result_of<Fn(ArgTypes...)>, Fn and all types in the parameter pack ArgTypes shall be complete types, cv void, or arrays of unknown bound.
3 is_literal_type<T> is a UnaryTypeTrait ([meta.rqmts]) with a base characteristic of true_type if T is a literal type, and false_type otherwise. The partial specialization result_of<Fn(ArgTypes...)> is a TransformationTrait whose member typedef type is defined if and only if invoke_result<Fn, ArgTypes...>​::​type is defined. If type is defined, it names the same type as invoke_result_t<Fn, ArgTypes...>.
4 The behavior of a program that adds specializations for is_literal_type or is_literal_type_v is undefined.

D.13 Deprecated iterator primitives [depr.iterator.primitives]

D.13.1 Basic iterator [depr.iterator.basic]

1 The header <iterator> has the following addition:
namespace std {
  template<class Category, class T, class Distance = ptrdiff_t,
    class Pointer = T*, class Reference = T&>
  struct iterator {
    using iterator_category = Category;
    using value_type        = T;
    using difference_type   = Distance;
    using pointer           = Pointer;
    using reference         = Reference;
  };
}
2 The iterator template may be used as a base class to ease the definition of required types for new iterators.
3 NoteIf the new iterator type is a class template, then these aliases will not be visible from within the iterator class's template definition, but only to callers of that class.
4
ExampleIf a C++ program wants to define a bidirectional iterator for some data structure containing double and such that it works on a large memory model of the implementation, it can do so with:
class MyIterator :
  public iterator<bidirectional_iterator_tag, double, long, T*, T&> {
  // code implementing ++, etc.
};

D.14 Deprecated shared_ptr observers [depr.util.smartptr.shared.obs]

1 The following member is defined in addition to those members specified in [util.smartptr.shared]:
namespace std {
  template<class T> class shared_ptr {
  public:
    bool unique() const noexcept;
  };
}

bool unique() const noexcept;

2 Returns: use_count() == 1.

D.15 Deprecated standard code conversion facets [depr.locale.stdcvt]

1 The header <codecvt> provides code conversion facets for various character encodings.

D.15.1 Header <codecvt> synopsis [depr.codecvt.syn]

namespace std {
  enum codecvt_mode {
    consume_header = 4,
    generate_header = 2,
    little_endian = 1
  };

  template <class Elem, unsigned long Maxcode = 0x10ffff, codecvt_mode Mode = (codecvt_mode)0>
    class codecvt_utf8 : public codecvt<Elem, char, mbstate_t> {
    public:
      explicit codecvt_utf8(size_t refs = 0);
      ~codecvt_utf8();
    };

  template <class Elem, unsigned long Maxcode = 0x10ffff, codecvt_mode Mode = (codecvt_mode)0>
    class codecvt_utf16 : public codecvt<Elem, char, mbstate_t> {
    public:
      explicit codecvt_utf16(size_t refs = 0);
      ~codecvt_utf16();
    };

  template <class Elem, unsigned long Maxcode = 0x10ffff, codecvt_mode Mode = (codecvt_mode)0>
    class codecvt_utf8_utf16 : public codecvt<Elem, char, mbstate_t> {
    public:
      explicit codecvt_utf8_utf16(size_t refs = 0);
      ~codecvt_utf8_utf16();
    };
}

D.15.2 Requirements [depr.locale.stdcvt.req]

1 For each of the three code conversion facets codecvt_utf8, codecvt_utf16, and codecvt_utf8_utf16:
(1.1)
  • Elem is the wide-character type, such as wchar_t, char16_t, or char32_t.

(1.2)
  • Maxcode is the largest wide-character code that the facet will read or write without reporting a conversion error.

(1.3)
  • If (Mode & consume_header), the facet shall consume an initial header sequence, if present, when reading a multibyte sequence to determine the endianness of the subsequent multibyte sequence to be read.

(1.4)
  • If (Mode & generate_header), the facet shall generate an initial header sequence when writing a multibyte sequence to advertise the endianness of the subsequent multibyte sequence to be written.

(1.5)
  • If (Mode & little_endian), the facet shall generate a multibyte sequence in little-endian order, as opposed to the default big-endian order.

2 For the facet codecvt_utf8:
(2.1)
  • The facet shall convert between UTF-8 multibyte sequences and UCS2 or UCS4 (depending on the size of Elem) within the program.

(2.2)
  • Endianness shall not affect how multibyte sequences are read or written.

(2.3)
  • The multibyte sequences may be written as either a text or a binary file.

3 For the facet codecvt_utf16:
(3.1)
  • The facet shall convert between UTF-16 multibyte sequences and UCS2 or UCS4 (depending on the size of Elem) within the program.

(3.2)
  • Multibyte sequences shall be read or written according to the Mode flag, as set out above.

(3.3)
  • The multibyte sequences may be written only as a binary file. Attempting to write to a text file produces undefined behavior.

4 For the facet codecvt_utf8_utf16:
(4.1)
  • The facet shall convert between UTF-8 multibyte sequences and UTF-16 (one or two 16-bit codes) within the program.

(4.2)
  • Endianness shall not affect how multibyte sequences are read or written.

(4.3)
  • The multibyte sequences may be written as either a text or a binary file.

    See also: ISO/IEC 10646-1:1993.

D.16 Deprecated convenience conversion interfaces [depr.conversions]

1 The header <locale> has the following additions:
namespace std {
  template <class Codecvt, class Elem = wchar_t,
            class Wide_alloc = allocator<Elem>,
            class Byte_alloc = allocator<char>>
    class wstring_convert;

  template <class Codecvt, class Elem = wchar_t,
            class Tr = char_traits<Elem>>
    class wbuffer_convert;
}

D.16.1 Class template wstring_convert [depr.conversions.string]

1 Class template wstring_convert performs conversions between a wide string and a byte string. It lets you specify a code conversion facet (like class template codecvt) to perform the conversions, without affecting any streams or locales.
ExampleIf you want to use the code conversion facet codecvt_utf8 to output to cout a UTF-8 multibyte sequence corresponding to a wide string, but you don't want to alter the locale for cout, you can write something like:
wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
std::string mbstring = myconv.to_bytes(L"Hello\n");
std::cout << mbstring;
namespace std {
  template <class Codecvt, class Elem = wchar_t,
            class Wide_alloc = allocator<Elem>,
            class Byte_alloc = allocator<char>>
    class wstring_convert {
    public:
      using byte_string = basic_string<char, char_traits<char>, Byte_alloc>;
      using wide_string = basic_string<Elem, char_traits<Elem>, Wide_alloc>;
      using state_type  = typename Codecvt::state_type;
      using int_type    = typename wide_string::traits_type::int_type;

      explicit wstring_convert(Codecvt* pcvt = new Codecvt);
      wstring_convert(Codecvt* pcvt, state_type state);
      explicit wstring_convert(const byte_string& byte_err,
                               const wide_string& wide_err = wide_string());
      ~wstring_convert();

      wstring_convert(const wstring_convert&) = delete;
      wstring_convert& operator=(const wstring_convert&) = delete;

      wide_string from_bytes(char byte);
      wide_string from_bytes(const char* ptr);
      wide_string from_bytes(const byte_string& str);
      wide_string from_bytes(const char* first, const char* last);

      byte_string to_bytes(Elem wchar);
      byte_string to_bytes(const Elem* wptr);
      byte_string to_bytes(const wide_string& wstr);
      byte_string to_bytes(const Elem* first, const Elem* last);

      size_t converted() const noexcept;
      state_type state() const;

    private:
      byte_string byte_err_string;  // exposition only
      wide_string wide_err_string;  // exposition only
      Codecvt* cvtptr;              // exposition only
      state_type cvtstate;          // exposition only
      size_t cvtcount;              // exposition only
    };
}
2 The class template describes an object that controls conversions between wide string objects of class basic_string<Elem, char_traits<Elem>, Wide_alloc> and byte string objects of class basic_string<char, char_traits<char>, Byte_alloc>. The class template defines the types wide_string and byte_string as synonyms for these two types. Conversion between a sequence of Elem values (stored in a wide_string object) and multibyte sequences (stored in a byte_string object) is performed by an object of class Codecvt, which meets the requirements of the standard code-conversion facet codecvt<Elem, char, mbstate_t>.
3 An object of this class template stores:
(3.1)
  • byte_err_string — a byte string to display on errors

(3.2)
  • wide_err_string — a wide string to display on errors

(3.3)
  • cvtptr — a pointer to the allocated conversion object (which is freed when the wstring_convert object is destroyed)

(3.4)
  • cvtstate — a conversion state object

(3.5)
  • cvtcount — a conversion count

    using byte_string = basic_string<char, char_traits<char>, Byte_alloc>;

4 The type shall be a synonym for basic_string<char, char_traits<char>, Byte_alloc>.

size_t converted() const noexcept;

5 Returns: cvtcount.

wide_string from_bytes(char byte); wide_string from_bytes(const char* ptr); wide_string from_bytes(const byte_string& str); wide_string from_bytes(const char* first, const char* last);

6 Effects: The first member function shall convert the single-element sequence byte to a wide string. The second member function shall convert the null-terminated sequence beginning at ptr to a wide string. The third member function shall convert the sequence stored in str to a wide string. The fourth member function shall convert the sequence defined by the range [first, last) to a wide string.
7 In all cases:
(7.1)
  • If the cvtstate object was not constructed with an explicit value, it shall be set to its default value (the initial conversion state) before the conversion begins. Otherwise it shall be left unchanged.

(7.2)
  • The number of input elements successfully converted shall be stored in cvtcount.

8 Returns: If no conversion error occurs, the member function shall return the converted wide string. Otherwise, if the object was constructed with a wide-error string, the member function shall return the wide-error string. Otherwise, the member function throws an object of class range_error.

using int_type = typename wide_string::traits_type::int_type;

9 The type shall be a synonym for wide_string​::​traits_type​::​int_type.

state_type state() const;

10 returns cvtstate.

using state_type = typename Codecvt::state_type;

11 The type shall be a synonym for Codecvt​::​state_type.

byte_string to_bytes(Elem wchar); byte_string to_bytes(const Elem* wptr); byte_string to_bytes(const wide_string& wstr); byte_string to_bytes(const Elem* first, const Elem* last);

12 Effects: The first member function shall convert the single-element sequence wchar to a byte string. The second member function shall convert the null-terminated sequence beginning at wptr to a byte string. The third member function shall convert the sequence stored in wstr to a byte string. The fourth member function shall convert the sequence defined by the range [first, last) to a byte string.
13 In all cases:
(13.1)
  • If the cvtstate object was not constructed with an explicit value, it shall be set to its default value (the initial conversion state) before the conversion begins. Otherwise it shall be left unchanged.

(13.2)
  • The number of input elements successfully converted shall be stored in cvtcount.

14 Returns: If no conversion error occurs, the member function shall return the converted byte string. Otherwise, if the object was constructed with a byte-error string, the member function shall return the byte-error string. Otherwise, the member function shall throw an object of class range_error.

using wide_string = basic_string<Elem, char_traits<Elem>, Wide_alloc>;

15 The type shall be a synonym for basic_string<Elem, char_traits<Elem>, Wide_alloc>.

explicit wstring_convert(Codecvt* pcvt = new Codecvt); wstring_convert(Codecvt* pcvt, state_type state); explicit wstring_convert(const byte_string& byte_err, const wide_string& wide_err = wide_string());

16 Requires: For the first and second constructors, pcvt != nullptr.
17 Effects: The first constructor shall store pcvt in cvtptr and default values in cvtstate, byte_err_string, and wide_err_string. The second constructor shall store pcvt in cvtptr, state in cvtstate, and default values in byte_err_string and wide_err_string; moreover the stored state shall be retained between calls to from_bytes and to_bytes. The third constructor shall store new Codecvt in cvtptr, state_type() in cvtstate, byte_err in byte_err_string, and wide_err in wide_err_string.

~wstring_convert();

18 Effects: The destructor shall delete cvtptr.

D.16.2 Class template wbuffer_convert [depr.conversions.buffer]

1 Class template wbuffer_convert looks like a wide stream buffer, but performs all its I/O through an underlying byte stream buffer that you specify when you construct it. Like class template wstring_convert, it lets you specify a code conversion facet to perform the conversions, without affecting any streams or locales.
namespace std {
  template <class Codecvt, class Elem = wchar_t, class Tr = char_traits<Elem>>
    class wbuffer_convert : public basic_streambuf<Elem, Tr> {
    public:
      using state_type = typename Codecvt::state_type;

      explicit wbuffer_convert(streambuf* bytebuf = 0,
                               Codecvt* pcvt = new Codecvt,
                               state_type state = state_type());

      ~wbuffer_convert();

      wbuffer_convert(const wbuffer_convert&) = delete;
      wbuffer_convert& operator=(const wbuffer_convert&) = delete;

      streambuf* rdbuf() const;
      streambuf* rdbuf(streambuf* bytebuf);

      state_type state() const;

    private:
      streambuf* bufptr;            // exposition only
      Codecvt* cvtptr;              // exposition only
      state_type cvtstate;          // exposition only
  };
}
2 The class template describes a stream buffer that controls the transmission of elements of type Elem, whose character traits are described by the class Tr, to and from a byte stream buffer of type streambuf. Conversion between a sequence of Elem values and multibyte sequences is performed by an object of class Codecvt, which shall meet the requirements of the standard code-conversion facet codecvt<Elem, char, mbstate_t>.
3 An object of this class template stores:
(3.1)
  • bufptr — a pointer to its underlying byte stream buffer

(3.2)
  • cvtptr — a pointer to the allocated conversion object (which is freed when the wbuffer_convert object is destroyed)

(3.3)
  • cvtstate — a conversion state object

    state_type state() const;

4 Returns: cvtstate.

streambuf* rdbuf() const;

5 Returns: bufptr.

streambuf* rdbuf(streambuf* bytebuf);

6 Effects: Stores bytebuf in bufptr.
7 Returns: The previous value of bufptr.

using state_type = typename Codecvt::state_type;

8 The type shall be a synonym for Codecvt​::​state_type.

explicit wbuffer_convert( streambuf* bytebuf = 0, Codecvt* pcvt = new Codecvt, state_type state = state_type());

9 Requires:

pcvt != nullptr.

10 Effects: The constructor constructs a stream buffer object, initializes bufptr to bytebuf, initializes cvtptr to pcvt, and initializes cvtstate to state.

~wbuffer_convert();

11 Effects: The destructor shall delete cvtptr.

  1. The function signature strlen(const char*) is declared in <cstring>. The macro INT_MAX is defined in <climits>.
  2. An implementation should consider alsize in making this decision.
  3. The function signature strlen(const char*) is declared in <cstring>.


[edit]

Source: https://timsong-cpp.github.io/cppwp/n4868/depr

1 Scope [intro.scope]
2 Normative references [intro.refs]
3 Terms and definitions [intro.defs]
4 General principles [intro]
5 Lexical conventions [lex]
6 Basics [basic]
7 Expressions [expr]
8 Statements [stmt.stmt]
9 Declarations [dcl.dcl]
10 Modules [module]
11 Classes [class]
12 Overloading [over]
13 Templates [temp]
14 Exception handling [except]
15 Preprocessing directives [cpp]
16 Library introduction [library]
17 Language support library [support]
18 Concepts library [concepts]
19 Diagnostics library [diagnostics]
20 General utilities library [utilities]
21 Strings library [strings]
22 Containers library [containers]
23 Iterators library [iterators]
24 Ranges library [ranges]
25 Algorithms library [algorithms]
26 Numerics library [numerics]
27 Time library [time]
28 Localization library [localization]
29 Input/output library [input.output]
30 Regular expressions library [re]
31 Atomic operations library [atomics]
32 Thread support library [thread]
Annex A (informative) Grammar summary [gram]
Annex B (normative) Implementation quantities [implimits]
Annex C (informative) Compatibility [diff]
Annex D (normative) Compatibility features [depr]
D.1 General [depr.general]
D.2 Arithmetic conversion on enumerations [depr.arith.conv.enum]
D.3 Implicit capture of *this by reference [depr.capture.this]
D.4 Comma operator in subscript expressions [depr.comma.subscript]
D.5 Array comparisons [depr.array.comp]
D.6 Deprecated volatile types [depr.volatile.type]
D.7 Redeclaration of static constexpr data members [depr.static.constexpr]
D.8 Non-local use of TU-local entities [depr.local]
D.9 Implicit declaration of copy functions [depr.impldec]
D.10 C headers [depr.c.headers]
D.11 Requires paragraph [depr.res.on.required]
D.12 Relational operators [depr.relops]
D.13 char* streams [depr.str.strstreams]
D.14 Deprecated type traits [depr.meta.types]
D.15 Tuple [depr.tuple]
D.16 Variant [depr.variant]
D.17 Deprecated iterator class template [depr.iterator]
D.18 Deprecated move_­iterator access [depr.move.iter.elem]
D.19 Deprecated shared_­ptr atomic access [depr.util.smartptr.shared.atomic]
D.20 Deprecated basic_­string capacity [depr.string.capacity]
D.21 Deprecated standard code conversion facets [depr.locale.stdcvt]
D.22 Deprecated convenience conversion interfaces [depr.conversions]
D.23 Deprecated locale category facets [depr.locale.category]
D.24 Deprecated filesystem path factory functions [depr.fs.path.factory]
D.25 Deprecated atomic operations [depr.atomics]
Index [generalindex]
Index of grammar productions [grammarindex]
Index of library headers [headerindex]
Index of library names [libraryindex]
Index of library concepts [conceptindex]
Index of implementation-defined behavior [impldefindex]

Annex D (normative) Compatibility features [depr]

D.1 General [depr.general]

1 This Annex describes features of the C++ Standard that are specified for compatibility with existing implementations.
2 These are deprecated features, where deprecated is defined as: Normative for the current revision of C++, but having been identified as a candidate for removal from future revisions. An implementation may declare library names and entities described in this Clause with the deprecated attribute.

D.2 Arithmetic conversion on enumerations [depr.arith.conv.enum]

1 The ability to apply the usual arithmetic conversions ([expr.arith.conv]) on operands where one is of enumeration type and the other is of a different enumeration type or a floating-point type is deprecated.

NoteThree-way comparisons ([expr.spaceship]) between such operands are ill-formed.

Example
enum E1 { e };
enum E2 { f };
bool b = e <= 3.7;              // deprecated
int k = f - e;                  // deprecated
auto cmp = e <=> f;             // error

D.3 Implicit capture of *this by reference [depr.capture.this]

1 For compatibility with prior revisions of C++, a lambda-expression with capture-default

= ([expr.prim.lambda.capture]) may implicitly capture *this by reference.

Example
struct X {
  int x;
  void foo(int n) {
    auto f = [=]() { x = n; };          // deprecated: x means this->x, not a copy thereof
    auto g = [=, this]() { x = n; };    // recommended replacement
  }
};

D.4 Comma operator in subscript expressions [depr.comma.subscript]

1 A comma expression ([expr.comma]) appearing as the expr-or-braced-init-list of a subscripting expression ([expr.sub]) is deprecated.

NoteA parenthesized comma expression is not deprecated.

Example
void f(int *a, int b, int c) {
    a[b,c];                     // deprecated
    a[(b,c)];                   // OK
}

D.5 Array comparisons [depr.array.comp]

1 Equality and relational comparisons ([expr.eq], [expr.rel]) between two operands of array type are deprecated.

NoteThree-way comparisons ([expr.spaceship]) between such operands are ill-formed.

Example
int arr1[5];
int arr2[5];
bool same = arr1 == arr2;       // deprecated, same as &arr1[0] == &arr2[0],
                                // does not compare array contents
auto cmp = arr1 <=> arr2;       // error

D.6 Deprecated volatile types [depr.volatile.type]

1 Postfix ++ and -- expressions ([expr.post.incr]) and prefix ++ and -- expressions ([expr.pre.incr]) of volatile-qualified arithmetic and pointer types are deprecated.
Example
volatile int velociraptor;
++velociraptor;                     // deprecated
2 Certain assignments where the left operand is a volatile-qualified non-class type are deprecated; see [expr.ass].
Example
int neck, tail;
volatile int brachiosaur;
brachiosaur = neck;                 // OK
tail = brachiosaur;                 // OK
tail = brachiosaur = neck;          // deprecated
brachiosaur += neck;                // deprecated
brachiosaur = brachiosaur + neck;   // OK
3 A function type ([dcl.fct]) with a parameter with volatile-qualified type or with a volatile-qualified return type is deprecated.
Example
volatile struct amber jurassic();                               // deprecated
void trex(volatile short left_arm, volatile short right_arm);   // deprecated
void fly(volatile struct pterosaur* pteranodon);                // OK
4 A structured binding ([dcl.struct.bind]) of a volatile-qualified type is deprecated.
Example
struct linhenykus { short forelimb; };
void park(linhenykus alvarezsauroid) {
  volatile auto [what_is_this] = alvarezsauroid;                // deprecated
  // ...
}

D.7 Redeclaration of static constexpr data members [depr.static.constexpr]

1 For compatibility with prior revisions of C++, a constexpr static data member may be redundantly redeclared outside the class with no initializer. This usage is deprecated.
Example
struct A {
  static constexpr int n = 5;   // definition (declaration in C++ 2014)
};

constexpr int A::n;             // redundant declaration (definition in C++ 2014)

D.8 Non-local use of TU-local entities [depr.local]

1 A declaration of a non-TU-local entity that is an exposure ([basic.link]) is deprecated.

NoteSuch a declaration in an importable module unit is ill-formed.

Example
namespace {
  struct A {
    void f() {}
  };
}
A h();                          // deprecated: not internal linkage
inline void g() {A().f();}      // deprecated: inline and not internal linkage

D.9 Implicit declaration of copy functions [depr.impldec]

1 The implicit definition of a copy constructor as defaulted is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor. The implicit definition of a copy assignment operator as defaulted is deprecated if the class has a user-declared copy constructor or a user-declared destructor. In a future revision of C++, these implicit definitions could become deleted ([dcl.fct.def.delete]).

D.10 C headers [depr.c.headers]

D.10.1 General [depr.c.headers.general]

1 For compatibility with the C standard library, the C++ standard library provides the C headers shown in Table 147.
Table 147: C headers [tab:depr.c.headers]
<assert.h> <inttypes.h> <signal.h> <stdio.h> <wchar.h>
<complex.h> <iso646.h> <stdalign.h> <stdlib.h> <wctype.h>
<ctype.h> <limits.h> <stdarg.h> <string.h>
<errno.h> <locale.h> <stdbool.h> <tgmath.h>
<fenv.h> <math.h> <stddef.h> <time.h>
<float.h> <setjmp.h> <stdint.h> <uchar.h>

D.10.2 Header <complex.h> synopsis [depr.complex.h.syn]

#include <complex>
1 The header <complex.h> behaves as if it simply includes the header <complex>.
2 NoteNames introduced by <complex> in namespace std are not placed into the global namespace scope by <complex.h>.

D.10.3 Header <iso646.h> synopsis [depr.iso646.h.syn]

1 The C++ header <iso646.h> is empty.

Noteand, and_eq, bitand, bitor, compl, not_eq, not, or, or_eq, xor, and xor_eq are keywords in C++ ([lex.key]).

D.10.4 Header <stdalign.h> synopsis [depr.stdalign.h.syn]

#define __alignas_is_defined 1
1 The contents of the C++ header <stdalign.h> are the same as the C standard library header <stdalign.h>, with the following changes: The header <stdalign.h> does not define a macro named alignas.

See also: ISO C 7.15

D.10.5 Header <stdbool.h> synopsis [depr.stdbool.h.syn]

#define __bool_true_false_are_defined 1
1 The contents of the C++ header <stdbool.h> are the same as the C standard library header <stdbool.h>, with the following changes: The header <stdbool.h> does not define macros named bool, true, or false.

See also: ISO C 7.18

D.10.6 Header <tgmath.h> synopsis [depr.tgmath.h.syn]

#include <cmath>
#include <complex>
1 The header <tgmath.h> behaves as if it simply includes the headers <cmath> and <complex>.
2 NoteThe overloads provided in C by type-generic macros are already provided in <complex> and <cmath> by “sufficient” additional overloads.
3 NoteNames introduced by <cmath> or <complex> in namespace std are not placed into the global namespace scope by <tgmath.h>.

D.10.7 Other C headers [depr.c.headers.other]

1 Every C header other than <complex.h>, <iso646.h>, <stdalign.h>,
<stdbool.h>, and <tgmath.h>, each of which has a name of the form <name.h>, behaves as if each name placed in the standard library namespace by the corresponding <cname> header is placed within the global namespace scope, except for the functions described in [sf.cmath], the declaration of std​::​byte ([cstddef.syn]), and the functions and function templates described in [support.types.byteops]. It is unspecified whether these names are first declared or defined within namespace scope ([basic.scope.namespace]) of the namespace std and are then injected into the global namespace scope by explicit using-declarations ([namespace.udecl]).
2
ExampleThe header <cstdlib> assuredly provides its declarations and definitions within the namespace std. It may also provide these names within the global namespace. The header <stdlib.h> assuredly provides the same declarations and definitions within the global namespace, much as in the C Standard. It may also provide these names within the namespace std.

D.11 Requires paragraph [depr.res.on.required]

1 In addition to the elements specified in [structure.specifications], descriptions of function semantics may also contain a Requires: element to denote the preconditions for calling a function.
2 Violation of any preconditions specified in a function's Requires: element results in undefined behavior unless the function's Throws: element specifies throwing an exception when the precondition is violated.

D.12 Relational operators [depr.relops]

1 The header <utility> has the following additions:
namespace std::rel_ops {
  template<class T> bool operator!=(const T&, const T&);
  template<class T> bool operator> (const T&, const T&);
  template<class T> bool operator<=(const T&, const T&);
  template<class T> bool operator>=(const T&, const T&);
}
2 To avoid redundant definitions of operator!= out of operator== and operators >, <=, and >= out of operator<, the library provides the following:
🔗template<class T> bool operator!=(const T& x, const T& y);
3 Requires: Type T is Cpp17EqualityComparable (Table 25).
4 Returns: !(x == y).
🔗template<class T> bool operator>(const T& x, const T& y);
5 Requires: Type T is Cpp17LessThanComparable (Table 26).
6 Returns: y < x.
🔗template<class T> bool operator<=(const T& x, const T& y);
7 Requires: Type T is Cpp17LessThanComparable (Table 26).
8 Returns: !(y < x).
🔗template<class T> bool operator>=(const T& x, const T& y);
9 Requires: Type T is Cpp17LessThanComparable (Table 26).
10 Returns: !(x < y).

D.13 char* streams [depr.str.strstreams]

D.13.1 Header <strstream> synopsis [depr.strstream.syn]

1 The header <strstream> defines types that associate stream buffers with character array objects and assist reading and writing such objects.
namespace std {
  class strstreambuf;
  class istrstream;
  class ostrstream;
  class strstream;
}

D.13.2 Class strstreambuf [depr.strstreambuf]

D.13.2.1 General [depr.strstreambuf.general]
namespace std {
  class strstreambuf : public basic_streambuf<char> {
  public:
    strstreambuf() : strstreambuf(0) {}
    explicit strstreambuf(streamsize alsize_arg);
    strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
    strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr);
    strstreambuf(const char* gnext_arg, streamsize n);

    strstreambuf(signed char* gnext_arg, streamsize n,
                 signed char* pbeg_arg = nullptr);
    strstreambuf(const signed char* gnext_arg, streamsize n);
    strstreambuf(unsigned char* gnext_arg, streamsize n,
                 unsigned char* pbeg_arg = nullptr);
    strstreambuf(const unsigned char* gnext_arg, streamsize n);

    virtual ~strstreambuf();

    void  freeze(bool freezefl = true);
    char* str();
    int   pcount();

  protected:
    int_type overflow (int_type c = EOF) override;
    int_type pbackfail(int_type c = EOF) override;
    int_type underflow() override;
    pos_type seekoff(off_type off, ios_base::seekdir way,
                     ios_base::openmode which = ios_base::in | ios_base::out) override;
    pos_type seekpos(pos_type sp,
                     ios_base::openmode which = ios_base::in | ios_base::out) override;
    streambuf* setbuf(char* s, streamsize n) override;

  private:
    using strstate = T1;                // exposition only
    static const strstate allocated;    // exposition only
    static const strstate constant;     // exposition only
    static const strstate dynamic;      // exposition only
    static const strstate frozen;       // exposition only
    strstate strmode;                   // exposition only
    streamsize alsize;                  // exposition only
    void* (*palloc)(size_t);            // exposition only
    void (*pfree)(void*);               // exposition only
  };
}
1 The class strstreambuf associates the input sequence, and possibly the output sequence, with an object of some character array type, whose elements store arbitrary values. The array object has several attributes.
2
Note-
3
Note-
4 Each object of class strstreambuf has a seekable area, delimited by the pointers seeklow and seekhigh. If gnext is a null pointer, the seekable area is undefined. Otherwise, seeklow equals gbeg and seekhigh is either pend, if pend is not a null pointer, or gend.
D.13.2.2 strstreambuf constructors [depr.strstreambuf.cons]
🔗explicit strstreambuf(streamsize alsize_arg);
1 Effects: Initializes the base class with streambuf(). The postconditions of this function are indicated in Table 148.
Table 148: strstreambuf(streamsize) effects [tab:depr.strstreambuf.cons.sz]
Element Value
strmode dynamic
alsize alsize_arg
palloc a null pointer
pfree a null pointer
🔗strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
2 Effects: Initializes the base class with streambuf(). The postconditions of this function are indicated in Table 149.
Table 149: strstreambuf(void* (*)(size_t), void (*)(void*)) effects [tab:depr.strstreambuf.cons.alloc]
Element Value
strmode dynamic
alsize an unspecified value
palloc palloc_arg
pfree pfree_arg
🔗strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr); strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = nullptr); strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = nullptr);
3 Effects: Initializes the base class with streambuf(). The postconditions of this function are indicated in Table 150.
Table 150: strstreambuf(charT*, streamsize, charT*) effects [tab:depr.strstreambuf.cons.ptr]
Element Value
strmode 0
alsize an unspecified value
palloc a null pointer
pfree a null pointer
4 gnext_arg shall point to the first element of an array object whose number of elements N is determined as follows:
(4.1)
  • If n > 0, N is n.

(4.2)
  • If n == 0, N is std​::​strlen(gnext_arg).

(4.3)
5 If pbeg_arg is a null pointer, the function executes:
setg(gnext_arg, gnext_arg, gnext_arg + N);
6 Otherwise, the function executes:
setg(gnext_arg, gnext_arg, pbeg_arg);
setp(pbeg_arg,  pbeg_arg + N);
🔗strstreambuf(const char* gnext_arg, streamsize n); strstreambuf(const signed char* gnext_arg, streamsize n); strstreambuf(const unsigned char* gnext_arg, streamsize n);
7 Effects: Behaves the same as strstreambuf((char*)gnext_arg,n), except that the constructor also sets constant in strmode.
🔗virtual ~strstreambuf();
8 Effects: Destroys an object of class strstreambuf. The function frees the dynamically allocated array object only if (strmode & allocated) != 0 and (strmode & frozen) == 0. ([depr.strstreambuf.virtuals] describes how a dynamically allocated array object is freed.)
D.13.2.3 Member functions [depr.strstreambuf.members]
🔗void freeze(bool freezefl = true);
1 Effects: If strmode & dynamic is nonzero, alters the freeze status of the dynamic array object as follows:
(1.1)
  • If freezefl is true, the function sets frozen in strmode.

(1.2)
  • Otherwise, it clears frozen in strmode.

    🔗char* str();
2 Effects: Calls freeze(), then returns the beginning pointer for the input sequence, gbeg.
3 Remarks: The return value can be a null pointer.
🔗int pcount() const;
4 Effects: If the next pointer for the output sequence, pnext, is a null pointer, returns zero. Otherwise, returns the current effective length of the array object as the next pointer minus the beginning pointer for the output sequence, pnext - pbeg.
D.13.2.4 strstreambuf overridden virtual functions [depr.strstreambuf.virtuals]
🔗int_type overflow(int_type c = EOF) override;
1 Effects: Appends the character designated by c to the output sequence, if possible, in one of two ways:
(1.1)
  • If c != EOF and if either the output sequence has a write position available or the function makes a write position available (as described below), assigns c to *pnext++.

    Returns (unsigned char)c.

(1.2)
  • If c == EOF, there is no character to append.

    Returns a value other than EOF.

2 Returns EOF to indicate failure.
3 Remarks: The function can alter the number of write positions available as a result of any call.
4 To make a write position available, the function reallocates (or initially allocates) an array object with a sufficient number of elements n to hold the current array object (if any), plus at least one additional write position. How many additional write positions are made available is otherwise unspecified. If palloc is not a null pointer, the function calls (*palloc)(n) to allocate the new dynamic array object. Otherwise, it evaluates the expression new charT[n]. In either case, if the allocation fails, the function returns EOF. Otherwise, it sets allocated in strmode.
5 To free a previously existing dynamic array object whose first element address is p: If pfree is not a null pointer, the function calls (*pfree)(p). Otherwise, it evaluates the expression delete[]p.
6 If (strmode & dynamic) == 0, or if (strmode & frozen) != 0, the function cannot extend the array (reallocate it with greater length) to make a write position available.
7 Recommended practice: An implementation should consider alsize in making the decision how many additional write positions to make available.
🔗int_type pbackfail(int_type c = EOF) override;
8 Puts back the character designated by c to the input sequence, if possible, in one of three ways:
(8.1)
  • If c != EOF, if the input sequence has a putback position available, and if (char)c == gnext[-1], assigns gnext - 1 to gnext.

    Returns c.

(8.2)
  • If c != EOF, if the input sequence has a putback position available, and if strmode & constant is zero, assigns c to *--gnext.

    Returns c.

(8.3)
  • If c == EOF and if the input sequence has a putback position available, assigns gnext - 1 to gnext.

    Returns a value other than EOF.

9 Returns EOF to indicate failure.
10 Remarks: If the function can succeed in more than one of these ways, it is unspecified which way is chosen. The function can alter the number of putback positions available as a result of any call.
🔗int_type underflow() override;
11 Effects: Reads a character from the input sequence, if possible, without moving the stream position past it, as follows:
(11.1)
  • If the input sequence has a read position available, the function signals success by returning (unsigned char)​*gnext.

(11.2)
  • Otherwise, if the current write next pointer pnext is not a null pointer and is greater than the current read end pointer gend, makes a read position available by assigning to gend a value greater than gnext and no greater than pnext.

    Returns (unsigned char)*gnext.

12 Returns EOF to indicate failure.
13 Remarks: The function can alter the number of read positions available as a result of any call.
🔗pos_type seekoff(off_type off, seekdir way, openmode which = in | out) override;
14 Effects: Alters the stream position within one of the controlled sequences, if possible, as indicated in Table 151.
Table 151: seekoff positioning [tab:depr.strstreambuf.seekoff.pos]
Conditions Result
(which & ios​::​in) != 0 positions the input sequence
(which & ios​::​out) != 0 positions the output sequence
(which & (ios​::​in | ios​::​out)) ==
(ios​::​in | ios​::​out) and either
way == ios​::​beg or way == ios​::​end
positions both the input and the output sequences
Otherwise the positioning operation fails.
15 For a sequence to be positioned, if its next pointer is a null pointer, the positioning operation fails. Otherwise, the function determines newoff as indicated in Table 152.
Table 152: newoff values [tab:depr.strstreambuf.seekoff.newoff]
Condition newoff Value
way == ios​::​beg 0
way == ios​::​cur the next pointer minus the beginning pointer (xnext - xbeg).
way == ios​::​end seekhigh minus the beginning pointer (seekhigh - xbeg).
16 If (newoff + off) < (seeklow - xbeg) or (seekhigh - xbeg) < (newoff + off), the positioning operation fails. Otherwise, the function assigns xbeg + newoff + off to the next pointer xnext.
17 Returns: pos_type(newoff), constructed from the resultant offset newoff (of type off_type), that stores the resultant stream position, if possible. If the positioning operation fails, or if the constructed object cannot represent the resultant stream position, the return value is pos_type(off_type(-1)).
🔗pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out) override;
18 Effects: Alters the stream position within one of the controlled sequences, if possible, to correspond to the stream position stored in sp (as described below).
(18.1)
  • If (which & ios​::​in) != 0, positions the input sequence.

(18.2)
  • If (which & ios​::​out) != 0, positions the output sequence.

(18.3)
  • If the function positions neither sequence, the positioning operation fails.

19 For a sequence to be positioned, if its next pointer is a null pointer, the positioning operation fails. Otherwise, the function determines newoff from sp.offset():
(19.1)
  • If newoff is an invalid stream position, has a negative value, or has a value greater than (seekhigh - seeklow), the positioning operation fails

(19.2)
  • Otherwise, the function adds newoff to the beginning pointer xbeg and stores the result in the next pointer xnext.

20 Returns: pos_type(newoff), constructed from the resultant offset newoff (of type off_type), that stores the resultant stream position, if possible. If the positioning operation fails, or if the constructed object cannot represent the resultant stream position, the return value is pos_type(off_type(-1)).
🔗streambuf<char>* setbuf(char* s, streamsize n) override;
21 Effects: Behavior is implementation-defined, except that setbuf(0, 0) has no effect.

D.13.3 Class istrstream [depr.istrstream]

D.13.3.1 General [depr.istrstream.general]
namespace std {
  class istrstream : public basic_istream<char> {
  public:
    explicit istrstream(const char* s);
    explicit istrstream(char* s);
    istrstream(const char* s, streamsize n);
    istrstream(char* s, streamsize n);
    virtual ~istrstream();

    strstreambuf* rdbuf() const;
    char* str();
  private:
    strstreambuf sb;            // exposition only
  };
}
1 The class istrstream supports the reading of objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.13.3.2 istrstream constructors [depr.istrstream.cons]
🔗explicit istrstream(const char* s); explicit istrstream(char* s);
1 Effects: Initializes the base class with istream(&sb) and sb with strstreambuf(s, 0). s shall designate the first element of an ntbs.
🔗istrstream(const char* s, streamsize n); istrstream(char* s, streamsize n);
2 Effects: Initializes the base class with istream(&sb) and sb with strstreambuf(s, n). s shall designate the first element of an array whose length is n elements, and n shall be greater than zero.
D.13.3.3 Member functions [depr.istrstream.members]
🔗strstreambuf* rdbuf() const;
1 Returns: const_cast<strstreambuf*>(&sb).
🔗char* str();
2 Returns: rdbuf()->str().

D.13.4 Class ostrstream [depr.ostrstream]

D.13.4.1 General [depr.ostrstream.general]
namespace std {
  class ostrstream : public basic_ostream<char> {
  public:
    ostrstream();
    ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
    virtual ~ostrstream();

    strstreambuf* rdbuf() const;
    void freeze(bool freezefl = true);
    char* str();
    int pcount() const;
  private:
    strstreambuf sb;            // exposition only
  };
}
1 The class ostrstream supports the writing of objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.13.4.2 ostrstream constructors [depr.ostrstream.cons]
🔗ostrstream();
1 Effects: Initializes the base class with ostream(&sb) and sb with strstreambuf().
🔗ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
2 Effects: Initializes the base class with ostream(&sb), and sb with one of two constructors:
(2.1)
  • If (mode & app) == 0, then s shall designate the first element of an array of n elements.

    The constructor is strstreambuf(s, n, s).

(2.2)
  • If (mode & app) != 0, then s shall designate the first element of an array of n elements that contains an ntbs whose first element is designated by s. The constructor is strstreambuf(s, n, s + std​::​strlen(s)).[cpp20 2]

D.13.4.3 Member functions [depr.ostrstream.members]
🔗strstreambuf* rdbuf() const;
1 Returns: (strstreambuf*)&sb.
🔗void freeze(bool freezefl = true);
2 Effects: Calls rdbuf()->freeze(freezefl).
🔗char* str();
3 Returns: rdbuf()->str().
🔗int pcount() const;
4 Returns: rdbuf()->pcount().

D.13.5 Class strstream [depr.strstream]

D.13.5.1 General [depr.strstream.general]
namespace std {
  class strstream
    : public basic_iostream<char> {
  public:
    // types
    using char_type = char;
    using int_type  = char_traits<char>::int_type;
    using pos_type  = char_traits<char>::pos_type;
    using off_type  = char_traits<char>::off_type;

    // constructors/destructor
    strstream();
    strstream(char* s, int n,
              ios_base::openmode mode = ios_base::in|ios_base::out);
    virtual ~strstream();

    // members
    strstreambuf* rdbuf() const;
    void freeze(bool freezefl = true);
    int pcount() const;
    char* str();

  private:
    strstreambuf sb;            // exposition only
  };
}
1 The class strstream supports reading and writing from objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.13.5.2 strstream constructors [depr.strstream.cons]
🔗strstream();
1 Effects: Initializes the base class with iostream(&sb).
🔗strstream(char* s, int n, ios_base::openmode mode = ios_base::in|ios_base::out);
2 Effects: Initializes the base class with iostream(&sb), and sb with one of the two constructors:
(2.1)
  • If (mode & app) == 0, then s shall designate the first element of an array of n elements. The constructor is strstreambuf(s,n,s).

(2.2)
  • If (mode & app) != 0, then s shall designate the first element of an array of n elements that contains an ntbs whose first element is designated by s. The constructor is strstreambuf(s,n,s + std​::​strlen(s)).

D.13.5.3 strstream destructor [depr.strstream.dest]
🔗virtual ~strstream();
1 Effects: Destroys an object of class strstream.
D.13.5.4 strstream operations [depr.strstream.oper]
🔗strstreambuf* rdbuf() const;
1 Returns: const_cast<strstreambuf*>(&sb).
🔗void freeze(bool freezefl = true);
2 Effects: Calls rdbuf()->freeze(freezefl).
🔗char* str();
3 Returns: rdbuf()->str().
🔗int pcount() const;
4 Returns: rdbuf()->pcount().

D.14 Deprecated type traits [depr.meta.types]

1 The header <type_traits> has the following addition:
namespace std {
  template<class T> struct is_pod;
  template<class T> inline constexpr bool is_pod_v = is_pod<T>::value;
}
2 The behavior of a program that adds specializations for any of the templates defined in this subclause is undefined, unless explicitly permitted by the specification of the corresponding template.

🔗template<class T> struct is_pod;

3 Requires: remove_all_extents_t<T> shall be a complete type or cv void.
4 is_pod<T> is a Cpp17UnaryTypeTrait ([meta.rqmts]) with a base characteristic of true_type if T is a POD type, and false_type otherwise. A POD class is a class that is both a trivial class and a standard-layout class, and has no non-static data members of type non-POD class (or array thereof). A POD type is a scalar type, a POD class, an array of such a type, or a cv-qualified version of one of these types.
5 NoteIt is unspecified whether a closure type ([expr.prim.lambda.closure]) is a POD type.

D.15 Tuple [depr.tuple]

1 The header <tuple> has the following additions:
namespace std {
  template<class T> class tuple_size<volatile T>;
  template<class T> class tuple_size<const volatile T>;

  template<size_t I, class T> class tuple_element<I, volatile T>;
  template<size_t I, class T> class tuple_element<I, const volatile T>;
}

🔗template<class T> class tuple_size<volatile T>; template<class T> class tuple_size<const volatile T>;

2 Let TS denote tuple_size<T> of the cv-unqualified type T. If the expression TS​::​value is well-formed when treated as an unevaluated operand, then specializations of each of the two templates meet the Cpp17TransformationTrait requirements with a base characteristic of integral_constant<size_t, TS​::​value>. Otherwise, they have no member value.
3 Access checking is performed as if in a context unrelated to TS and T. Only the validity of the immediate context of the expression is considered.
4 In addition to being available via inclusion of the <tuple> header, the two templates are available when any of the headers <array>, <ranges>, or <utility> are included.

🔗template<size_t I, class T> class tuple_element<I, volatile T>; template<size_t I, class T> class tuple_element<I, const volatile T>;

5 Let TE denote tuple_element_t<I, T> of the cv-unqualified type T. Then specializations of each of the two templates meet the Cpp17TransformationTrait requirements with a member typedef type that names the following type:
(5.1)
  • for the first specialization, add_volatile_t<TE>, and

(5.2)
  • for the second specialization, add_cv_t<TE>.

6 In addition to being available via inclusion of the <tuple> header, the two templates are available when any of the headers <array>, <ranges>, or <utility> are included.

D.16 Variant [depr.variant]

1 The header <variant> has the following additions:
namespace std {
  template<class T> struct variant_size<volatile T>;
  template<class T> struct variant_size<const volatile T>;

  template<size_t I, class T> struct variant_alternative<I, volatile T>;
  template<size_t I, class T> struct variant_alternative<I, const volatile T>;
}

🔗template<class T> class variant_size<volatile T>; template<class T> class variant_size<const volatile T>;

2 Let VS denote variant_size<T> of the cv-unqualified type T. Then specializations of each of the two templates meet the Cpp17UnaryTypeTrait requirements with a base characteristic of integral_constant<size_t, VS​::​value>.

🔗template<size_t I, class T> class variant_alternative<I, volatile T>; template<size_t I, class T> class variant_alternative<I, const volatile T>;

3 Let VA denote variant_alternative<I, T> of the cv-unqualified type T. Then specializations of each of the two templates meet the Cpp17TransformationTrait requirements with a member typedef type that names the following type:
(3.1)
  • for the first specialization, add_volatile_t<VA​::​type>, and

(3.2)
  • for the second specialization, add_cv_t<VA​::​type>.

D.17 Deprecated iterator class template [depr.iterator]

1 The header <iterator> has the following addition:
namespace std {
  template<class Category, class T, class Distance = ptrdiff_t,
           class Pointer = T*, class Reference = T&>
  struct iterator {
    using iterator_category = Category;
    using value_type        = T;
    using difference_type   = Distance;
    using pointer           = Pointer;
    using reference         = Reference;
  };
}
2 The iterator template may be used as a base class to ease the definition of required types for new iterators.
3 NoteIf the new iterator type is a class template, then these aliases will not be visible from within the iterator class's template definition, but only to callers of that class.
4
ExampleIf a C++ program wants to define a bidirectional iterator for some data structure containing double and such that it works on a large memory model of the implementation, it can do so with:
class MyIterator :
  public iterator<bidirectional_iterator_tag, double, long, T*, T&> {
  // code implementing ++, etc.
};

D.18 Deprecated move_iterator access [depr.move.iter.elem]

1 The following member is declared in addition to those members specified in [move.iter.elem]:
namespace std {
  template<class Iterator>
  class move_iterator {
  public:
    constexpr pointer operator->() const;
  };
}
🔗constexpr pointer operator->() const;
2 Returns: current.

D.19 Deprecated shared_ptr atomic access [depr.util.smartptr.shared.atomic]

1 The header <memory> has the following additions:
namespace std {
  template<class T>
    bool atomic_is_lock_free(const shared_ptr<T>* p);

  template<class T>
    shared_ptr<T> atomic_load(const shared_ptr<T>* p);
  template<class T>
    shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo);

  template<class T>
    void atomic_store(shared_ptr<T>* p, shared_ptr<T> r);
  template<class T>
    void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);

  template<class T>
    shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r);
  template<class T>
    shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);

  template<class T>
    bool atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
  template<class T>
    bool atomic_compare_exchange_strong(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
  template<class T>
    bool atomic_compare_exchange_weak_explicit(
      shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
      memory_order success, memory_order failure);
  template<class T>
    bool atomic_compare_exchange_strong_explicit(
      shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
      memory_order success, memory_order failure);
}
2 Concurrent access to a shared_ptr object from multiple threads does not introduce a data race if the access is done exclusively via the functions in this subclause and the instance is passed as their first argument.
3 The meaning of the arguments of type memory_order is explained in [atomics.order].
🔗template<class T> bool atomic_is_lock_free(const shared_ptr<T>* p);
4 Requires: p shall not be null.
5 Returns: true if atomic access to *p is lock-free, false otherwise.
6 Throws: Nothing.
🔗template<class T> shared_ptr<T> atomic_load(const shared_ptr<T>* p);
7 Requires: p shall not be null.
8 Returns: atomic_load_explicit(p, memory_order​::​seq_cst).
9 Throws: Nothing.
🔗template<class T> shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo);
10 Requires: p shall not be null.
11 Requires: mo shall not be memory_order​::​release or memory_order​::​acq_rel.
12 Returns: *p.
13 Throws: Nothing.
🔗template<class T> void atomic_store(shared_ptr<T>* p, shared_ptr<T> r);
14 Requires: p shall not be null.
15 Effects: As if by atomic_store_explicit(p, r, memory_order​::​seq_cst).
16 Throws: Nothing.
🔗template<class T> void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
17 Requires: p shall not be null.
18 Requires: mo shall not be memory_order​::​acquire or memory_order​::​acq_rel.
19 Effects: As if by p->swap(r).
20 Throws: Nothing.
🔗template<class T> shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r);
21 Requires: p shall not be null.
22 Returns: atomic_exchange_explicit(p, r, memory_order​::​seq_cst).
23 Throws: Nothing.
🔗template<class T> shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
24 Requires: p shall not be null.
25 Effects: As if by p->swap(r).
26 Returns: The previous value of *p.
27 Throws: Nothing.
🔗template<class T> bool atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
28 Requires: p shall not be null and v shall not be null.
29 Returns:
atomic_compare_exchange_weak_explicit(p, v, w, memory_order::seq_cst, memory_order::seq_cst)
30 Throws: Nothing.
🔗template<class T> bool atomic_compare_exchange_strong(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
31 Returns:
atomic_compare_exchange_strong_explicit(p, v, w, memory_order::seq_cst,
                                        memory_order::seq_cst)
🔗template<class T>

bool atomic_compare_exchange_weak_explicit( shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w, memory_order success, memory_order failure); template<class T>

bool atomic_compare_exchange_strong_explicit( shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w, memory_order success, memory_order failure);
32 Requires: p shall not be null and v shall not be null. The failure argument shall not be memory_order​::​release nor memory_order​::​acq_rel.
33 Effects: If *p is equivalent to *v, assigns w to *p and has synchronization semantics corresponding to the value of success, otherwise assigns *p to *v and has synchronization semantics corresponding to the value of failure.
34 Returns: true if *p was equivalent to *v, false otherwise.
35 Throws: Nothing.
36 Remarks: Two shared_ptr objects are equivalent if they store the same pointer value and share ownership. The weak form may fail spuriously. See [atomics.types.operations].

D.20 Deprecated basic_string capacity [depr.string.capacity]

1 The following member is declared in addition to those members specified in [string.capacity]:
namespace std {
  template<class charT, class traits = char_traits<charT>,
           class Allocator = allocator<charT>>
  class basic_string {
  public:
    void reserve();
  };
}
🔗void reserve();
2 Effects: After this call, capacity() has an unspecified value greater than or equal to size().

NoteThis is a non-binding shrink to fit request.

D.21 Deprecated standard code conversion facets [depr.locale.stdcvt]

D.21.1 General [depr.locale.stdcvt.general]

1 The header <codecvt> provides code conversion facets for various character encodings.

D.21.2 Header <codecvt> synopsis [depr.codecvt.syn]

namespace std {
  enum codecvt_mode {
    consume_header = 4,
    generate_header = 2,
    little_endian = 1
  };

  template<class Elem, unsigned long Maxcode = 0x10ffff, codecvt_mode Mode = (codecvt_mode)0>
    class codecvt_utf8 : public codecvt<Elem, char, mbstate_t> {
    public:
      explicit codecvt_utf8(size_t refs = 0);
      ~codecvt_utf8();
    };

  template<class Elem, unsigned long Maxcode = 0x10ffff, codecvt_mode Mode = (codecvt_mode)0>
    class codecvt_utf16 : public codecvt<Elem, char, mbstate_t> {
    public:
      explicit codecvt_utf16(size_t refs = 0);
      ~codecvt_utf16();
    };

  template<class Elem, unsigned long Maxcode = 0x10ffff, codecvt_mode Mode = (codecvt_mode)0>
    class codecvt_utf8_utf16 : public codecvt<Elem, char, mbstate_t> {
    public:
      explicit codecvt_utf8_utf16(size_t refs = 0);
      ~codecvt_utf8_utf16();
    };
}

D.21.3 Requirements [depr.locale.stdcvt.req]

1 For each of the three code conversion facets codecvt_utf8, codecvt_utf16, and codecvt_utf8_utf16:
(1.1)
  • Elem is the wide-character type, such as wchar_t, char16_t, or char32_t.

(1.2)
  • Maxcode is the largest wide-character code that the facet will read or write without reporting a conversion error.

(1.3)
  • If (Mode & consume_header), the facet shall consume an initial header sequence, if present, when reading a multibyte sequence to determine the endianness of the subsequent multibyte sequence to be read.

(1.4)
  • If (Mode & generate_header), the facet shall generate an initial header sequence when writing a multibyte sequence to advertise the endianness of the subsequent multibyte sequence to be written.

(1.5)
  • If (Mode & little_endian), the facet shall generate a multibyte sequence in little-endian order, as opposed to the default big-endian order.

2 For the facet codecvt_utf8:
(2.1)
  • The facet shall convert between UTF-8 multibyte sequences and UCS-2 or UTF-32 (depending on the size of Elem) within the program.

(2.2)
  • Endianness shall not affect how multibyte sequences are read or written.

(2.3)
  • The multibyte sequences may be written as either a text or a binary file.

3 For the facet codecvt_utf16:
(3.1)
  • The facet shall convert between UTF-16 multibyte sequences and UCS-2 or UTF-32 (depending on the size of Elem) within the program.

(3.2)
  • Multibyte sequences shall be read or written according to the Mode flag, as set out above.

(3.3)
  • The multibyte sequences may be written only as a binary file. Attempting to write to a text file produces undefined behavior.

4 For the facet codecvt_utf8_utf16:
(4.1)
  • The facet shall convert between UTF-8 multibyte sequences and UTF-16 (one or two 16-bit codes) within the program.

(4.2)
  • Endianness shall not affect how multibyte sequences are read or written.

(4.3)
  • The multibyte sequences may be written as either a text or a binary file.

5 The encoding forms UTF-8, UTF-16, and UTF-32 are specified in ISO/IEC 10646. The encoding form UCS-2 is specified in ISO/IEC 10646:2003.[cpp20 3]

D.22 Deprecated convenience conversion interfaces [depr.conversions]

D.22.1 General [depr.conversions.general]

1 The header <locale> has the following additions:
namespace std {
  template<class Codecvt, class Elem = wchar_t,
           class WideAlloc = allocator<Elem>,
           class ByteAlloc = allocator<char>>
    class wstring_convert;

  template<class Codecvt, class Elem = wchar_t,
           class Tr = char_traits<Elem>>
    class wbuffer_convert;
}

D.22.2 Class template wstring_convert [depr.conversions.string]

1 Class template wstring_convert performs conversions between a wide string and a byte string. It lets you specify a code conversion facet (like class template codecvt) to perform the conversions, without affecting any streams or locales.
ExampleIf you want to use the code conversion facet codecvt_utf8 to output to cout a UTF-8 multibyte sequence corresponding to a wide string, but you don't want to alter the locale for cout, you can write something like:
wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
std::string mbstring = myconv.to_bytes(L"Hello\n");
std::cout << mbstring;
namespace std {
  template<class Codecvt, class Elem = wchar_t,
           class WideAlloc = allocator<Elem>,
           class ByteAlloc = allocator<char>>
    class wstring_convert {
    public:
      using byte_string = basic_string<char, char_traits<char>, ByteAlloc>;
      using wide_string = basic_string<Elem, char_traits<Elem>, WideAlloc>;
      using state_type  = typename Codecvt::state_type;
      using int_type    = typename wide_string::traits_type::int_type;

      wstring_convert() : wstring_convert(new Codecvt) {}
      explicit wstring_convert(Codecvt* pcvt);
      wstring_convert(Codecvt* pcvt, state_type state);
      explicit wstring_convert(const byte_string& byte_err,
                               const wide_string& wide_err = wide_string());
      ~wstring_convert();

      wstring_convert(const wstring_convert&) = delete;
      wstring_convert& operator=(const wstring_convert&) = delete;

      wide_string from_bytes(char byte);
      wide_string from_bytes(const char* ptr);
      wide_string from_bytes(const byte_string& str);
      wide_string from_bytes(const char* first, const char* last);

      byte_string to_bytes(Elem wchar);
      byte_string to_bytes(const Elem* wptr);
      byte_string to_bytes(const wide_string& wstr);
      byte_string to_bytes(const Elem* first, const Elem* last);

      size_t converted() const noexcept;
      state_type state() const;

    private:
      byte_string byte_err_string;  // exposition only
      wide_string wide_err_string;  // exposition only
      Codecvt* cvtptr;              // exposition only
      state_type cvtstate;          // exposition only
      size_t cvtcount;              // exposition only
    };
}
2 The class template describes an object that controls conversions between wide string objects of class basic_string<Elem, char_traits<Elem>, WideAlloc> and byte string objects of class basic_string<char, char_traits<char>, ByteAlloc>. The class template defines the types wide_string and byte_string as synonyms for these two types. Conversion between a sequence of Elem values (stored in a wide_string object) and multibyte sequences (stored in a byte_string object) is performed by an object of class Codecvt, which meets the requirements of the standard code-conversion facet codecvt<Elem, char, mbstate_t>.
3 An object of this class template stores:
(3.1)
  • byte_err_string — a byte string to display on errors

(3.2)
  • wide_err_string — a wide string to display on errors

(3.3)
  • cvtptr — a pointer to the allocated conversion object (which is freed when the wstring_convert object is destroyed)

(3.4)
  • cvtstate — a conversion state object

(3.5)
  • cvtcount — a conversion count

    🔗using byte_string = basic_string<char, char_traits<char>, ByteAlloc>;
4 The type shall be a synonym for basic_string<char, char_traits<char>, ByteAlloc>.
🔗size_t converted() const noexcept;
5 Returns: cvtcount.
🔗wide_string from_bytes(char byte); wide_string from_bytes(const char* ptr); wide_string from_bytes(const byte_string& str); wide_string from_bytes(const char* first, const char* last);
6 Effects: The first member function shall convert the single-element sequence byte to a wide string. The second member function shall convert the null-terminated sequence beginning at ptr to a wide string. The third member function shall convert the sequence stored in str to a wide string. The fourth member function shall convert the sequence defined by the range [first, last) to a wide string.
7 In all cases:
(7.1)
  • If the cvtstate object was not constructed with an explicit value, it shall be set to its default value (the initial conversion state) before the conversion begins. Otherwise it shall be left unchanged.

(7.2)
  • The number of input elements successfully converted shall be stored in cvtcount.

8 Returns: If no conversion error occurs, the member function shall return the converted wide string. Otherwise, if the object was constructed with a wide-error string, the member function shall return the wide-error string. Otherwise, the member function throws an object of class range_error.
🔗using int_type = typename wide_string::traits_type::int_type;
9 The type shall be a synonym for wide_string​::​traits_type​::​int_type.
🔗state_type state() const;
10 Returns: cvtstate.
🔗using state_type = typename Codecvt::state_type;
11 The type shall be a synonym for Codecvt​::​state_type.
🔗byte_string to_bytes(Elem wchar); byte_string to_bytes(const Elem* wptr); byte_string to_bytes(const wide_string& wstr); byte_string to_bytes(const Elem* first, const Elem* last);
12 Effects: The first member function shall convert the single-element sequence wchar to a byte string. The second member function shall convert the null-terminated sequence beginning at wptr to a byte string. The third member function shall convert the sequence stored in wstr to a byte string. The fourth member function shall convert the sequence defined by the range [first, last) to a byte string.
13 In all cases:
(13.1)
  • If the cvtstate object was not constructed with an explicit value, it shall be set to its default value (the initial conversion state) before the conversion begins. Otherwise it shall be left unchanged.

(13.2)
  • The number of input elements successfully converted shall be stored in cvtcount.

14 Returns: If no conversion error occurs, the member function shall return the converted byte string. Otherwise, if the object was constructed with a byte-error string, the member function shall return the byte-error string. Otherwise, the member function shall throw an object of class range_error.
🔗using wide_string = basic_string<Elem, char_traits<Elem>, WideAlloc>;
15 The type shall be a synonym for basic_string<Elem, char_traits<Elem>, WideAlloc>.
🔗explicit wstring_convert(Codecvt* pcvt); wstring_convert(Codecvt* pcvt, state_type state); explicit wstring_convert(const byte_string& byte_err, const wide_string& wide_err = wide_string());
16 Requires: For the first and second constructors, pcvt != nullptr.
17 Effects: The first constructor shall store pcvt in cvtptr and default values in cvtstate, byte_err_string, and wide_err_string. The second constructor shall store pcvt in cvtptr, state in cvtstate, and default values in byte_err_string and wide_err_string; moreover the stored state shall be retained between calls to from_bytes and to_bytes. The third constructor shall store new Codecvt in cvtptr, state_type() in cvtstate, byte_err in byte_err_string, and wide_err in wide_err_string.
🔗~wstring_convert();
18 Effects: The destructor shall delete cvtptr.

D.22.3 Class template wbuffer_convert [depr.conversions.buffer]

1 Class template wbuffer_convert looks like a wide stream buffer, but performs all its I/O through an underlying byte stream buffer that you specify when you construct it. Like class template wstring_convert, it lets you specify a code conversion facet to perform the conversions, without affecting any streams or locales.
namespace std {
  template<class Codecvt, class Elem = wchar_t, class Tr = char_traits<Elem>>
    class wbuffer_convert : public basic_streambuf<Elem, Tr> {
    public:
      using state_type = typename Codecvt::state_type;

      wbuffer_convert() : wbuffer_convert(nullptr) {}
      explicit wbuffer_convert(streambuf* bytebuf,
                               Codecvt* pcvt = new Codecvt,
                               state_type state = state_type());

      ~wbuffer_convert();

      wbuffer_convert(const wbuffer_convert&) = delete;
      wbuffer_convert& operator=(const wbuffer_convert&) = delete;

      streambuf* rdbuf() const;
      streambuf* rdbuf(streambuf* bytebuf);

      state_type state() const;

    private:
      streambuf* bufptr;            // exposition only
      Codecvt* cvtptr;              // exposition only
      state_type cvtstate;          // exposition only
  };
}
2 The class template describes a stream buffer that controls the transmission of elements of type Elem, whose character traits are described by the class Tr, to and from a byte stream buffer of type streambuf. Conversion between a sequence of Elem values and multibyte sequences is performed by an object of class Codecvt, which shall meet the requirements of the standard code-conversion facet codecvt<Elem, char, mbstate_t>.
3 An object of this class template stores:
(3.1)
  • bufptr — a pointer to its underlying byte stream buffer

(3.2)
  • cvtptr — a pointer to the allocated conversion object (which is freed when the wbuffer_convert object is destroyed)

(3.3)
  • cvtstate — a conversion state object

    🔗state_type state() const;
4 Returns: cvtstate.
🔗streambuf* rdbuf() const;
5 Returns: bufptr.
🔗streambuf* rdbuf(streambuf* bytebuf);
6 Effects: Stores bytebuf in bufptr.
7 Returns: The previous value of bufptr.
🔗using state_type = typename Codecvt::state_type;
8 The type shall be a synonym for Codecvt​::​state_type.
🔗explicit wbuffer_convert( streambuf* bytebuf, Codecvt* pcvt = new Codecvt, state_type state = state_type());
9 Requires: pcvt != nullptr.
10 Effects: The constructor constructs a stream buffer object, initializes bufptr to bytebuf, initializes cvtptr to pcvt, and initializes cvtstate to state.
🔗~wbuffer_convert();
11 Effects: The destructor shall delete cvtptr.

D.23 Deprecated locale category facets [depr.locale.category]

1 The ctype locale category includes the following facets as if they were specified in table Table 102 of [locale.category].
codecvt<char16_t, char, mbstate_t>
codecvt<char32_t, char, mbstate_t>
2 The ctype locale category includes the following facets as if they were specified in table Table 103 of [locale.category].
codecvt_byname<char16_t, char, mbstate_t>
codecvt_byname<char32_t, char, mbstate_t>
3 The following class template specializations are required in addition to those specified in [locale.codecvt]. The specialization codecvt<char16_t, char, mbstate_t> converts between the UTF-16 and UTF-8 encoding forms, and the specialization codecvt<char32_t, char, mbstate_t> converts between the UTF-32 and UTF-8 encoding forms.

D.24 Deprecated filesystem path factory functions [depr.fs.path.factory]

🔗template<class Source> path u8path(const Source& source); template<class InputIterator> path u8path(InputIterator first, InputIterator last);
1 Requires: The source and [first, last) sequences are UTF-8 encoded. The value type of Source and InputIterator is char or char8_t. Source meets the requirements specified in [fs.path.req].
2 Returns:
(2.1)
  • If value_type is char and the current native narrow encoding ([fs.path.type.cvt]) is UTF-8, return path(source) or path(first, last); otherwise,

(2.2)
  • if value_type is wchar_t and the native wide encoding is UTF-16, or if value_type is char16_t or char32_t, convert source or [first, last) to a temporary, tmp, of type string_type and return path(tmp); otherwise,

(2.3)
  • convert source or [first, last) to a temporary, tmp, of type u32string and return path(tmp).

3 Remarks: Argument format conversion ([fs.path.fmt.cvt]) applies to the arguments for these functions. How Unicode encoding conversions are performed is unspecified.
4
ExampleA string is to be read from a database that is encoded in UTF-8, and used to create a directory using the native encoding for filenames:
namespace fs = std::filesystem;
std::string utf8_string = read_utf8_data();
fs::create_directory(fs::u8path(utf8_string));

For POSIX-based operating systems with the native narrow encoding set to UTF-8, no encoding or type conversion occurs.

For POSIX-based operating systems with the native narrow encoding not set to UTF-8, a conversion to UTF-32 occurs, followed by a conversion to the current native narrow encoding. Some Unicode characters may have no native character set representation.

For Windows-based operating systems a conversion from UTF-8 to UTF-16 occurs.

NoteThe example above is representative of a historical use of filesystem​::​u8path. To indicate a UTF-8 encoding, passing a std​::​u8string to path's constructor is preferred as it is consistent with path's handling of other encodings.

D.25 Deprecated atomic operations [depr.atomics]

D.25.1 General [depr.atomics.general]

1 The header <atomic> has the following additions.
namespace std {
  template<class T>
    void atomic_init(volatile atomic<T>*, typename atomic<T>::value_type) noexcept;
  template<class T>
    void atomic_init(atomic<T>*, typename atomic<T>::value_type) noexcept;

  #define ATOMIC_VAR_INIT(value) see below

  #define ATOMIC_FLAG_INIT see below
}

D.25.2 Volatile access [depr.atomics.volatile]

1 If an atomic specialization has one of the following overloads, then that overload participates in overload resolution even if atomic<T>​::​is_always_lock_free is false:
void store(T desired, memory_order order = memory_order::seq_cst) volatile noexcept;
T operator=(T desired) volatile noexcept;
T load(memory_order order = memory_order::seq_cst) const volatile noexcept;
operator T() const volatile noexcept;
T exchange(T desired, memory_order order = memory_order::seq_cst) volatile noexcept;
bool compare_exchange_weak(T& expected, T desired,
                           memory_order success, memory_order failure) volatile noexcept;
bool compare_exchange_strong(T& expected, T desired,
                             memory_order success, memory_order failure) volatile noexcept;
bool compare_exchange_weak(T& expected, T desired,
                           memory_order order = memory_order::seq_cst) volatile noexcept;
bool compare_exchange_strong(T& expected, T desired,
                             memory_order order = memory_order::seq_cst) volatile noexcept;
T fetch_key(T operand, memory_order order = memory_order::seq_cst) volatile noexcept;
T operator op=(T operand) volatile noexcept;
T* fetch_key(ptrdiff_t operand, memory_order order = memory_order::seq_cst) volatile noexcept;

D.25.3 Non-member functions [depr.atomics.nonmembers]

🔗template<class T>

void atomic_init(volatile atomic<T>* object, typename atomic<T>::value_type desired) noexcept; template<class T>

void atomic_init(atomic<T>* object, typename atomic<T>::value_type desired) noexcept;
1 Effects: Equivalent to: atomic_store_explicit(object, desired, memory_order​::​relaxed);

D.25.4 Operations on atomic types [depr.atomics.types.operations]

🔗#define ATOMIC_VAR_INIT(value) see below
1 The macro expands to a token sequence suitable for constant initialization of an atomic variable of static storage duration of a type that is initialization-compatible with value.

NoteThis operation might need to initialize locks. Concurrent access to the variable being initialized, even via an atomic operation, constitutes a data race.

Example
atomic<int> v = ATOMIC_VAR_INIT(5);

D.25.5 Flag type and operations [depr.atomics.flag]

🔗#define ATOMIC_FLAG_INIT see below
1 Remarks: The macro ATOMIC_FLAG_INIT is defined in such a way that it can be used to initialize an object of type atomic_flag to the clear state. The macro can be used in the form:
atomic_flag guard = ATOMIC_FLAG_INIT;
It is unspecified whether the macro can be used in other initialization contexts. For a complete static-duration object, that initialization shall be static.

  1. The function signature strlen(const char*) is declared in <cstring>. The macro INT_MAX is defined in <climits>. 
  2. The function signature strlen(const char*) is declared in <cstring>. 
  3. Cancelled and replaced by ISO/IEC 10646:2017. 


[edit]

Source: https://timsong-cpp.github.io/cppwp/n4950/depr

1 Scope [intro.scope]
2 Normative references [intro.refs]
3 Terms and definitions [intro.defs]
4 General principles [intro]
5 Lexical conventions [lex]
6 Basics [basic]
7 Expressions [expr]
8 Statements [stmt.stmt]
9 Declarations [dcl.dcl]
10 Modules [module]
11 Classes [class]
12 Overloading [over]
13 Templates [temp]
14 Exception handling [except]
15 Preprocessing directives [cpp]
16 Library introduction [library]
17 Language support library [support]
18 Concepts library [concepts]
19 Diagnostics library [diagnostics]
20 Memory management library [mem]
21 Metaprogramming library [meta]
22 General utilities library [utilities]
23 Strings library [strings]
24 Containers library [containers]
25 Iterators library [iterators]
26 Ranges library [ranges]
27 Algorithms library [algorithms]
28 Numerics library [numerics]
29 Time library [time]
30 Localization library [localization]
31 Input/output library [input.output]
32 Regular expressions library [re]
33 Concurrency support library [thread]
Annex A (informative) Grammar summary [gram]
Annex B (normative) Implementation quantities [implimits]
Annex C (informative) Compatibility [diff]
Annex D (normative) Compatibility features [depr]
D.1 General [depr.general]
D.2 Arithmetic conversion on enumerations [depr.arith.conv.enum]
D.3 Implicit capture of *this by reference [depr.capture.this]
D.4 Array comparisons [depr.array.comp]
D.5 Deprecated volatile types [depr.volatile.type]
D.6 Redeclaration of static constexpr data members [depr.static.constexpr]
D.7 Non-local use of TU-local entities [depr.local]
D.8 Implicit declaration of copy functions [depr.impldec]
D.9 Literal operator function declarations using an identifier [depr.lit]
D.10 template keyword before qualified names [depr.template.template]
D.11 Requires paragraph [depr.res.on.required]
D.12 has_denorm members in numeric_limits [depr.numeric.limits.has.denorm]
D.13 Deprecated C macros [depr.c.macros]
D.14 Relational operators [depr.relops]
D.15 char* streams [depr.str.strstreams]
D.16 Deprecated error numbers [depr.cerrno]
D.17 The default allocator [depr.default.allocator]
D.18 Deprecated polymorphic_allocator member function [depr.mem.poly.allocator.mem]
D.19 Deprecated type traits [depr.meta.types]
D.20 Tuple [depr.tuple]
D.21 Variant [depr.variant]
D.22 Deprecated iterator class template [depr.iterator]
D.23 Deprecated move_iterator access [depr.move.iter.elem]
D.24 Deprecated shared_ptr atomic access [depr.util.smartptr.shared.atomic]
D.25 Deprecated basic_string capacity [depr.string.capacity]
D.26 Deprecated standard code conversion facets [depr.locale.stdcvt]
D.27 Deprecated convenience conversion interfaces [depr.conversions]
D.28 Deprecated locale category facets [depr.locale.category]
D.29 Deprecated filesystem path factory functions [depr.fs.path.factory]
D.30 Deprecated atomic operations [depr.atomics]
Annex E (informative) Conformance with UAX #31 [uaxid]
Bibliography [bibliography]
Index [generalindex]
Index of grammar productions [grammarindex]
Index of library headers [headerindex]
Index of library names [libraryindex]
Index of library concepts [conceptindex]
Index of implementation-defined behavior [impldefindex]

Annex D (normative) Compatibility features [depr]

D.1 General [depr.general]

1 This Annex describes features of the C++ Standard that are specified for compatibility with existing implementations.
2 These are deprecated features, where deprecated is defined as: Normative for the current revision of C++, but having been identified as a candidate for removal from future revisions. An implementation may declare library names and entities described in this Clause with the deprecated attribute.

D.2 Arithmetic conversion on enumerations [depr.arith.conv.enum]

1 The ability to apply the usual arithmetic conversions ([expr.arith.conv]) on operands where one is of enumeration type and the other is of a different enumeration type or a floating-point type is deprecated.

NoteThree-way comparisons ([expr.spaceship]) between such operands are ill-formed.

Example
enum E1 { e };
enum E2 { f };
bool b = e <= 3.7;              // deprecated
int k = f - e;                  // deprecated
auto cmp = e <=> f;             // error

D.3 Implicit capture of *this by reference [depr.capture.this]

1 For compatibility with prior revisions of C++, a lambda-expression with capture-default

= ([expr.prim.lambda.capture]) may implicitly capture *this by reference.

Example
struct X {
  int x;
  void foo(int n) {
    auto f = [=]() { x = n; };          // deprecated: x means this->x, not a copy thereof
    auto g = [=, this]() { x = n; };    // recommended replacement
  }
};

D.4 Array comparisons [depr.array.comp]

1 Equality and relational comparisons ([expr.eq], [expr.rel]) between two operands of array type are deprecated.

NoteThree-way comparisons ([expr.spaceship]) between such operands are ill-formed.

Example
int arr1[5];
int arr2[5];
bool same = arr1 == arr2;       // deprecated, same as &arr1[0] == &arr2[0],
                                // does not compare array contents
auto cmp = arr1 <=> arr2;       // error

D.5 Deprecated volatile types [depr.volatile.type]

1 Postfix ++ and -- expressions ([expr.post.incr]) and prefix ++ and -- expressions ([expr.pre.incr]) of volatile-qualified arithmetic and pointer types are deprecated.
Example
volatile int velociraptor;
++velociraptor;                     // deprecated
2 Certain assignments where the left operand is a volatile-qualified non-class type are deprecated; see [expr.ass].
Example
int neck, tail;
volatile int brachiosaur;
brachiosaur = neck;                 // OK
tail = brachiosaur;                 // OK
tail = brachiosaur = neck;          // deprecated
brachiosaur += neck;                // OK
3 A function type ([dcl.fct]) with a parameter with volatile-qualified type or with a volatile-qualified return type is deprecated.
Example
volatile struct amber jurassic();                               // deprecated
void trex(volatile short left_arm, volatile short right_arm);   // deprecated
void fly(volatile struct pterosaur* pteranodon);                // OK
4 A structured binding ([dcl.struct.bind]) of a volatile-qualified type is deprecated.
Example
struct linhenykus { short forelimb; };
void park(linhenykus alvarezsauroid) {
  volatile auto [what_is_this] = alvarezsauroid;                // deprecated
  // ...
}

D.6 Redeclaration of static constexpr data members [depr.static.constexpr]

1 For compatibility with prior revisions of C++, a constexpr static data member may be redundantly redeclared outside the class with no initializer. This usage is deprecated.
Example
struct A {
  static constexpr int n = 5;   // definition (declaration in C++ 2014)
};

constexpr int A::n;             // redundant declaration (definition in C++ 2014)

D.7 Non-local use of TU-local entities [depr.local]

1 A declaration of a non-TU-local entity that is an exposure ([basic.link]) is deprecated.

NoteSuch a declaration in an importable module unit is ill-formed.

Example
namespace {
  struct A {
    void f() {}
  };
}
A h();                          // deprecated: not internal linkage
inline void g() {A().f();}      // deprecated: inline and not internal linkage

D.8 Implicit declaration of copy functions [depr.impldec]

1 The implicit definition of a copy constructor as defaulted is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor. The implicit definition of a copy assignment operator as defaulted is deprecated if the class has a user-declared copy constructor or a user-declared destructor. It is possible that future versions of C++ will specify that these implicit definitions are deleted ([dcl.fct.def.delete]).

D.9 Literal operator function declarations using an identifier [depr.lit]

1 A literal-operator-id ([over.literal]) of the form
operator string-literal identifier
is deprecated.

D.10 template keyword before qualified names [depr.template.template]

1 The use of the keyword template before the qualified name of a class or alias template without a template argument list is deprecated ([temp.names]).

D.11 Requires paragraph [depr.res.on.required]

1 In addition to the elements specified in [structure.specifications], descriptions of function semantics may also contain a Requires: element to denote the preconditions for calling a function.
2 Violation of any preconditions specified in a function's Requires: element results in undefined behavior unless the function's Throws: element specifies throwing an exception when the precondition is violated.

D.12 has_denorm members in numeric_limits [depr.numeric.limits.has.denorm]

1 The following type is defined in addition to those specified in <limits>: 🔗
namespace std {
  enum float_denorm_style {
    denorm_indeterminate = -1,
    denorm_absent = 0,
    denorm_present = 1
  };
}
2 The following members are defined in addition to those specified in [numeric.limits.general]:
static constexpr float_denorm_style has_denorm = denorm_absent;
static constexpr bool has_denorm_loss = false;
3 The values of has_denorm and has_denorm_loss of specializations of numeric_limits are unspecified.
4 The following members of the specialization numeric_limits<bool> are defined in addition to those specified in [numeric.special]: 🔗
static constexpr float_denorm_style has_denorm = denorm_absent;
static constexpr bool has_denorm_loss = false;

D.13 Deprecated C macros [depr.c.macros]

1 The header <stdalign.h> has the following macro: 🔗
#define __alignas_is_defined 1
2 The header <stdbool.h> has the following macro: 🔗
#define __bool_true_false_are_defined 1

D.14 Relational operators [depr.relops]

1 The header <utility> has the following additions:
namespace std::rel_ops {
  template<class T> bool operator!=(const T&, const T&);
  template<class T> bool operator> (const T&, const T&);
  template<class T> bool operator<=(const T&, const T&);
  template<class T> bool operator>=(const T&, const T&);
}
2 To avoid redundant definitions of operator!= out of operator== and operators >, <=, and >= out of operator<, the library provides the following:
🔗template<class T> bool operator!=(const T& x, const T& y);
3 Requires: Type T is Cpp17EqualityComparable (Table 28).
4 Returns: !(x == y).
🔗template<class T> bool operator>(const T& x, const T& y);
5 Requires: Type T is Cpp17LessThanComparable (Table 29).
6 Returns: y < x.
🔗template<class T> bool operator<=(const T& x, const T& y);
7 Requires: Type T is Cpp17LessThanComparable (Table 29).
8 Returns: !(y < x).
🔗template<class T> bool operator>=(const T& x, const T& y);
9 Requires: Type T is Cpp17LessThanComparable (Table 29).
10 Returns: !(x < y).

D.15 char* streams [depr.str.strstreams]

D.15.1 Header <strstream> synopsis [depr.strstream.syn]

1 The header <strstream> defines types that associate stream buffers with character array objects and assist reading and writing such objects.
namespace std {
  class strstreambuf;
  class istrstream;
  class ostrstream;
  class strstream;
}

D.15.2 Class strstreambuf [depr.strstreambuf]

D.15.2.1 General [depr.strstreambuf.general]
🔗
namespace std {
  class strstreambuf : public basic_streambuf<char> {
  public:
    strstreambuf() : strstreambuf(0) {}
    explicit strstreambuf(streamsize alsize_arg);
    strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
    strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr);
    strstreambuf(const char* gnext_arg, streamsize n);

    strstreambuf(signed char* gnext_arg, streamsize n,
                 signed char* pbeg_arg = nullptr);
    strstreambuf(const signed char* gnext_arg, streamsize n);
    strstreambuf(unsigned char* gnext_arg, streamsize n,
                 unsigned char* pbeg_arg = nullptr);
    strstreambuf(const unsigned char* gnext_arg, streamsize n);

    virtual ~strstreambuf();

    void  freeze(bool freezefl = true);
    char* str();
    int   pcount();

  protected:
    int_type overflow (int_type c = EOF) override;
    int_type pbackfail(int_type c = EOF) override;
    int_type underflow() override;
    pos_type seekoff(off_type off, ios_base::seekdir way,
                     ios_base::openmode which = ios_base::in | ios_base::out) override;
    pos_type seekpos(pos_type sp,
                     ios_base::openmode which = ios_base::in | ios_base::out) override;
    streambuf* setbuf(char* s, streamsize n) override;

  private:
    using strstate = T1;                // exposition only
    static const strstate allocated;    // exposition only
    static const strstate constant;     // exposition only
    static const strstate dynamic;      // exposition only
    static const strstate frozen;       // exposition only
    strstate strmode;                   // exposition only
    streamsize alsize;                  // exposition only
    void* (*palloc)(size_t);            // exposition only
    void (*pfree)(void*);               // exposition only
  };
}
1 The class strstreambuf associates the input sequence, and possibly the output sequence, with an object of some character array type, whose elements store arbitrary values. The array object has several attributes.
2
Note-
3
Note-
4 Each object of class strstreambuf has a seekable area, delimited by the pointers seeklow and seekhigh. If gnext is a null pointer, the seekable area is undefined. Otherwise, seeklow equals gbeg and seekhigh is either pend, if pend is not a null pointer, or gend.
D.15.2.2 strstreambuf constructors [depr.strstreambuf.cons]
🔗explicit strstreambuf(streamsize alsize_arg);
1 Effects: Initializes the base class with streambuf(). The postconditions of this function are indicated in Table 147.
Table 147: strstreambuf(streamsize) effects [tab:depr.strstreambuf.cons.sz]
Element Value
strmode dynamic
alsize alsize_arg
palloc a null pointer
pfree a null pointer
🔗strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
2 Effects: Initializes the base class with streambuf(). The postconditions of this function are indicated in Table 148.
Table 148: strstreambuf(void* (*)(size_t), void (*)(void*)) effects [tab:depr.strstreambuf.cons.alloc]
Element Value
strmode dynamic
alsize an unspecified value
palloc palloc_arg
pfree pfree_arg
🔗strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr); strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = nullptr); strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = nullptr);
3 Effects: Initializes the base class with streambuf(). The postconditions of this function are indicated in Table 149.
Table 149: strstreambuf(charT*, streamsize, charT*) effects [tab:depr.strstreambuf.cons.ptr]
Element Value
strmode 0
alsize an unspecified value
palloc a null pointer
pfree a null pointer
4 gnext_arg shall point to the first element of an array object whose number of elements N is determined as follows:
(4.1)
  • If n > 0, N is n.

(4.2)
  • If n == 0, N is std​::​strlen(gnext_arg).

(4.3)
5 If pbeg_arg is a null pointer, the function executes:
setg(gnext_arg, gnext_arg, gnext_arg + N);
6 Otherwise, the function executes:
setg(gnext_arg, gnext_arg, pbeg_arg);
setp(pbeg_arg,  pbeg_arg + N);
🔗strstreambuf(const char* gnext_arg, streamsize n); strstreambuf(const signed char* gnext_arg, streamsize n); strstreambuf(const unsigned char* gnext_arg, streamsize n);
7 Effects: Behaves the same as strstreambuf((char*)gnext_arg,n), except that the constructor also sets constant in strmode.
🔗virtual ~strstreambuf();
8 Effects: Destroys an object of class strstreambuf. The function frees the dynamically allocated array object only if (strmode & allocated) != 0 and (strmode & frozen) == 0. ([depr.strstreambuf.virtuals] describes how a dynamically allocated array object is freed.)
D.15.2.3 Member functions [depr.strstreambuf.members]
🔗void freeze(bool freezefl = true);
1 Effects: If strmode & dynamic is nonzero, alters the freeze status of the dynamic array object as follows:
(1.1)
  • If freezefl is true, the function sets frozen in strmode.

(1.2)
  • Otherwise, it clears frozen in strmode.

    🔗char* str();
2 Effects: Calls freeze(), then returns the beginning pointer for the input sequence, gbeg.
3 Remarks: The return value can be a null pointer.
🔗int pcount() const;
4 Effects: If the next pointer for the output sequence, pnext, is a null pointer, returns zero. Otherwise, returns the current effective length of the array object as the next pointer minus the beginning pointer for the output sequence, pnext - pbeg.
D.15.2.4 strstreambuf overridden virtual functions [depr.strstreambuf.virtuals]
🔗int_type overflow(int_type c = EOF) override;
1 Effects: Appends the character designated by c to the output sequence, if possible, in one of two ways:
(1.1)
  • If c != EOF and if either the output sequence has a write position available or the function makes a write position available (as described below), assigns c to *pnext++.

    Returns (unsigned char)c.

(1.2)
  • If c == EOF, there is no character to append.

    Returns a value other than EOF.

2 Returns EOF to indicate failure.
3 Remarks: The function can alter the number of write positions available as a result of any call.
4 To make a write position available, the function reallocates (or initially allocates) an array object with a sufficient number of elements n to hold the current array object (if any), plus at least one additional write position. How many additional write positions are made available is otherwise unspecified. If palloc is not a null pointer, the function calls (*palloc)(n) to allocate the new dynamic array object. Otherwise, it evaluates the expression new charT[n]. In either case, if the allocation fails, the function returns EOF. Otherwise, it sets allocated in strmode.
5 To free a previously existing dynamic array object whose first element address is p: If pfree is not a null pointer, the function calls (*pfree)(p). Otherwise, it evaluates the expression delete[]p.
6 If (strmode & dynamic) == 0, or if (strmode & frozen) != 0, the function cannot extend the array (reallocate it with greater length) to make a write position available.
7 Recommended practice: An implementation should consider alsize in making the decision how many additional write positions to make available.
🔗int_type pbackfail(int_type c = EOF) override;
8 Puts back the character designated by c to the input sequence, if possible, in one of three ways:
(8.1)
  • If c != EOF, if the input sequence has a putback position available, and if (char)c == gnext[-1], assigns gnext - 1 to gnext.

    Returns c.

(8.2)
  • If c != EOF, if the input sequence has a putback position available, and if strmode & constant is zero, assigns c to *--gnext.

    Returns c.

(8.3)
  • If c == EOF and if the input sequence has a putback position available, assigns gnext - 1 to gnext.

    Returns a value other than EOF.

9 Returns EOF to indicate failure.
10 Remarks: If the function can succeed in more than one of these ways, it is unspecified which way is chosen. The function can alter the number of putback positions available as a result of any call.
🔗int_type underflow() override;
11 Effects: Reads a character from the input sequence, if possible, without moving the stream position past it, as follows:
(11.1)
  • If the input sequence has a read position available, the function signals success by returning (unsigned char)​*gnext.

(11.2)
  • Otherwise, if the current write next pointer pnext is not a null pointer and is greater than the current read end pointer gend, makes a read position available by assigning to gend a value greater than gnext and no greater than pnext.

    Returns (unsigned char)*gnext.

12 Returns EOF to indicate failure.
13 Remarks: The function can alter the number of read positions available as a result of any call.
🔗pos_type seekoff(off_type off, seekdir way, openmode which = in | out) override;
14 Effects: Alters the stream position within one of the controlled sequences, if possible, as indicated in Table 150.
Table 150: seekoff positioning [tab:depr.strstreambuf.seekoff.pos]
Conditions Result
(which & ios​::​in) != 0 positions the input sequence
(which & ios​::​out) != 0 positions the output sequence
(which & (ios​::​in | ios​::​out)) ==
(ios​::​in | ios​::​out) and either
way == ios​::​beg or way == ios​::​end
positions both the input and the output sequences
Otherwise the positioning operation fails.
15 For a sequence to be positioned, if its next pointer is a null pointer, the positioning operation fails. Otherwise, the function determines newoff as indicated in Table 151.
Table 151: newoff values [tab:depr.strstreambuf.seekoff.newoff]
Condition newoff Value
way == ios​::​beg 0
way == ios​::​cur the next pointer minus the beginning pointer (xnext - xbeg).
way == ios​::​end seekhigh minus the beginning pointer (seekhigh - xbeg).
16 If (newoff + off) < (seeklow - xbeg) or (seekhigh - xbeg) < (newoff + off), the positioning operation fails. Otherwise, the function assigns xbeg + newoff + off to the next pointer xnext.
17 Returns: pos_type(newoff), constructed from the resultant offset newoff (of type off_type), that stores the resultant stream position, if possible. If the positioning operation fails, or if the constructed object cannot represent the resultant stream position, the return value is pos_type(off_type(-1)).
🔗pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out) override;
18 Effects: Alters the stream position within one of the controlled sequences, if possible, to correspond to the stream position stored in sp (as described below).
(18.1)
  • If (which & ios​::​in) != 0, positions the input sequence.

(18.2)
  • If (which & ios​::​out) != 0, positions the output sequence.

(18.3)
  • If the function positions neither sequence, the positioning operation fails.

19 For a sequence to be positioned, if its next pointer is a null pointer, the positioning operation fails. Otherwise, the function determines newoff from sp.offset():
(19.1)
  • If newoff is an invalid stream position, has a negative value, or has a value greater than (seekhigh - seeklow), the positioning operation fails

(19.2)
  • Otherwise, the function adds newoff to the beginning pointer xbeg and stores the result in the next pointer xnext.

20 Returns: pos_type(newoff), constructed from the resultant offset newoff (of type off_type), that stores the resultant stream position, if possible. If the positioning operation fails, or if the constructed object cannot represent the resultant stream position, the return value is pos_type(off_type(-1)).
🔗streambuf<char>* setbuf(char* s, streamsize n) override;
21 Effects: Behavior is implementation-defined, except that setbuf(0, 0) has no effect.

D.15.3 Class istrstream [depr.istrstream]

D.15.3.1 General [depr.istrstream.general]
🔗
namespace std {
  class istrstream : public basic_istream<char> {
  public:
    explicit istrstream(const char* s);
    explicit istrstream(char* s);
    istrstream(const char* s, streamsize n);
    istrstream(char* s, streamsize n);
    virtual ~istrstream();

    strstreambuf* rdbuf() const;
    char* str();
  private:
    strstreambuf sb;            // exposition only
  };
}
1 The class istrstream supports the reading of objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.15.3.2 istrstream constructors [depr.istrstream.cons]
🔗explicit istrstream(const char* s); explicit istrstream(char* s);
1 Effects: Initializes the base class with istream(&sb) and sb with strstreambuf(s, 0). s shall designate the first element of an ntbs.
🔗istrstream(const char* s, streamsize n); istrstream(char* s, streamsize n);
2 Effects: Initializes the base class with istream(&sb) and sb with strstreambuf(s, n). s shall designate the first element of an array whose length is n elements, and n shall be greater than zero.
D.15.3.3 Member functions [depr.istrstream.members]
🔗strstreambuf* rdbuf() const;
1 Returns: const_cast<strstreambuf*>(&sb).
🔗char* str();
2 Returns: rdbuf()->str().

D.15.4 Class ostrstream [depr.ostrstream]

D.15.4.1 General [depr.ostrstream.general]
🔗
namespace std {
  class ostrstream : public basic_ostream<char> {
  public:
    ostrstream();
    ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
    virtual ~ostrstream();

    strstreambuf* rdbuf() const;
    void freeze(bool freezefl = true);
    char* str();
    int pcount() const;
  private:
    strstreambuf sb;            // exposition only
  };
}
1 The class ostrstream supports the writing of objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.15.4.2 ostrstream constructors [depr.ostrstream.cons]
🔗ostrstream();
1 Effects: Initializes the base class with ostream(&sb) and sb with strstreambuf().
🔗ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
2 Effects: Initializes the base class with ostream(&sb), and sb with one of two constructors:
(2.1)
  • If (mode & app) == 0, then s shall designate the first element of an array of n elements.

    The constructor is strstreambuf(s, n, s).

(2.2)
  • If (mode & app) != 0, then s shall designate the first element of an array of n elements that contains an ntbs whose first element is designated by s. The constructor is strstreambuf(s, n, s + std​::​strlen(s)).[cpp23 2]

D.15.4.3 Member functions [depr.ostrstream.members]
🔗strstreambuf* rdbuf() const;
1 Returns: (strstreambuf*)&sb.
🔗void freeze(bool freezefl = true);
2 Effects: Calls rdbuf()->freeze(freezefl).
🔗char* str();
3 Returns: rdbuf()->str().
🔗int pcount() const;
4 Returns: rdbuf()->pcount().

D.15.5 Class strstream [depr.strstream]

D.15.5.1 General [depr.strstream.general]
🔗
namespace std {
  class strstream
    : public basic_iostream<char> {
  public:
    // types
    using char_type = char;
    using int_type  = char_traits<char>::int_type;
    using pos_type  = char_traits<char>::pos_type;
    using off_type  = char_traits<char>::off_type;

    // constructors/destructor
    strstream();
    strstream(char* s, int n,
              ios_base::openmode mode = ios_base::in|ios_base::out);
    virtual ~strstream();

    // members
    strstreambuf* rdbuf() const;
    void freeze(bool freezefl = true);
    int pcount() const;
    char* str();

  private:
    strstreambuf sb;            // exposition only
  };
}
1 The class strstream supports reading and writing from objects of class strstreambuf. It supplies a strstreambuf object to control the associated array object. For the sake of exposition, the maintained data is presented here as:
(1.1)
  • sb, the strstreambuf object.

D.15.5.2 strstream constructors [depr.strstream.cons]
🔗strstream();
1 Effects: Initializes the base class with iostream(&sb).
🔗strstream(char* s, int n, ios_base::openmode mode = ios_base::in|ios_base::out);
2 Effects: Initializes the base class with iostream(&sb), and sb with one of the two constructors:
(2.1)
  • If (mode & app) == 0, then s shall designate the first element of an array of n elements. The constructor is strstreambuf(s,n,s).

(2.2)
  • If (mode & app) != 0, then s shall designate the first element of an array of n elements that contains an ntbs whose first element is designated by s. The constructor is strstreambuf(s,n,s + std​::​strlen(s)).

D.15.5.3 strstream destructor [depr.strstream.dest]
🔗virtual ~strstream();
1 Effects: Destroys an object of class strstream.
D.15.5.4 strstream operations [depr.strstream.oper]
🔗strstreambuf* rdbuf() const;
1 Returns: const_cast<strstreambuf*>(&sb).
🔗void freeze(bool freezefl = true);
2 Effects: Calls rdbuf()->freeze(freezefl).
🔗char* str();
3 Returns: rdbuf()->str().
🔗int pcount() const;
4 Returns: rdbuf()->pcount().

D.16 Deprecated error numbers [depr.cerrno]

1 The following macros are defined in addition to those specified in [cerrno.syn]: 🔗
#define ENODATA see below
#define ENOSR see below
#define ENOSTR see below
#define ETIME see below
2 The meaning of these macros is defined by the POSIX standard.
3 The following enum errc enumerators are defined in addition to those specified in [system.error.syn]:
no_message_available,               // ENODATA
no_stream_resources,                // ENOSR
not_a_stream,                       // ENOSTR
stream_timeout,                     // ETIME
4 The value of each enum errc enumerator above is the same as the value of the <cerrno> macro shown in the above synopsis.

D.17 The default allocator [depr.default.allocator]

1 The following member is defined in addition to those specified in [default.allocator]: 🔗
namespace std {
  template<class T> class allocator {
  public:
    using is_always_equal = true_type;
  };
}

D.18 Deprecated polymorphic_allocator member function [depr.mem.poly.allocator.mem]

1 The following member is declared in addition to those members specified in [mem.poly.allocator.mem]:
namespace std::pmr {
  template<class Tp = byte>
  class polymorphic_allocator {
  public:
    template <class T>
      void destroy(T* p);
  };
}
🔗template<class T> void destroy(T* p);
2 Effects: As if by p->~T().

D.19 Deprecated type traits [depr.meta.types]

1 The header <type_traits> has the following addition:
namespace std {
  template<class T> struct is_pod;
  template<class T> constexpr bool is_pod_v = is_pod<T>::value;
  template<size_t Len, size_t Align = default-alignment> // see below
    struct aligned_storage;
  template<size_t Len, size_t Align = default-alignment> // see below
    using aligned_storage_t = typename aligned_storage<Len, Align>::type;
  template<size_t Len, class... Types>
    struct aligned_union;
  template<size_t Len, class... Types>
    using aligned_union_t = typename aligned_union<Len, Types...>::type;
}
2 The behavior of a program that adds specializations for any of the templates defined in this subclause is undefined, unless explicitly permitted by the specification of the corresponding template.
🔗template<class T> struct is_pod;
3 Requires: remove_all_extents_t<T> shall be a complete type or cv void.
4 is_pod<T> is a Cpp17UnaryTypeTrait ([meta.rqmts]) with a base characteristic of true_type if T is a POD type, and false_type otherwise. A POD class is a class that is both a trivial class and a standard-layout class, and has no non-static data members of type non-POD class (or array thereof). A POD type is a scalar type, a POD class, an array of such a type, or a cv-qualified version of one of these types.
5 NoteIt is unspecified whether a closure type ([expr.prim.lambda.closure]) is a POD type.
🔗template<size_t Len, size_t Align = default-alignment> struct aligned_storage;
6 The value of default-alignment is the most stringent alignment requirement for any object type whose size is no greater than Len ([basic.types]).
7 Mandates: Len is not zero. Align is equal to alignof(T) for some type T or to default-alignment.
8 The member typedef type denotes a trivial standard-layout type suitable for use as uninitialized storage for any object whose size is at most Len and whose alignment is a divisor of Align.
9 NoteUses of aligned_storage<Len, Align>​::​type can be replaced by an array std​::​byte[Len] declared with alignas(Align).
10
NoteA typical implementation would define aligned_storage as:
template<size_t Len, size_t Alignment>
struct aligned_storage {
  typedef struct {
    alignas(Alignment) unsigned char __data[Len];
  } type;
};
🔗template<size_t Len, class... Types> struct aligned_union;
11 Mandates: At least one type is provided. Each type in the template parameter pack Types is a complete object type.
12 The member typedef type denotes a trivial standard-layout type suitable for use as uninitialized storage for any object whose type is listed in Types; its size shall be at least Len. The static member alignment_value is an integral constant of type size_t whose value is the strictest alignment of all types listed in Types.

D.20 Tuple [depr.tuple]

1 The header <tuple> has the following additions:
namespace std {
  template<class T> struct tuple_size<volatile T>;
  template<class T> struct tuple_size<const volatile T>;

  template<size_t I, class T> struct tuple_element<I, volatile T>;
  template<size_t I, class T> struct tuple_element<I, const volatile T>;
}

🔗template<class T> struct tuple_size<volatile T>; template<class T> struct tuple_size<const volatile T>;

2 Let TS denote tuple_size<T> of the cv-unqualified type T. If the expression TS​::​value is well-formed when treated as an unevaluated operand, then specializations of each of the two templates meet the Cpp17TransformationTrait requirements with a base characteristic of integral_constant<size_t, TS​::​value>. Otherwise, they have no member value.
3 Access checking is performed as if in a context unrelated to TS and T. Only the validity of the immediate context of the expression is considered.
4 In addition to being available via inclusion of the <tuple> header, the two templates are available when any of the headers <array>, <ranges>, or <utility> are included.

🔗template<size_t I, class T> struct tuple_element<I, volatile T>; template<size_t I, class T> struct tuple_element<I, const volatile T>;

5 Let TE denote tuple_element_t<I, T> of the cv-unqualified type T. Then specializations of each of the two templates meet the Cpp17TransformationTrait requirements with a member typedef type that names the following type:
(5.1)
  • for the first specialization, add_volatile_t<TE>, and

(5.2)
  • for the second specialization, add_cv_t<TE>.

6 In addition to being available via inclusion of the <tuple> header, the two templates are available when any of the headers <array>, <ranges>, or <utility> are included.

D.21 Variant [depr.variant]

1 The header <variant> has the following additions:
namespace std {
  template<class T> struct variant_size<volatile T>;
  template<class T> struct variant_size<const volatile T>;

  template<size_t I, class T> struct variant_alternative<I, volatile T>;
  template<size_t I, class T> struct variant_alternative<I, const volatile T>;
}

🔗template<class T> struct variant_size<volatile T>; template<class T> struct variant_size<const volatile T>;

2 Let VS denote variant_size<T> of the cv-unqualified type T. Then specializations of each of the two templates meet the Cpp17UnaryTypeTrait requirements with a base characteristic of integral_constant<size_t, VS​::​value>.

🔗template<size_t I, class T> struct variant_alternative<I, volatile T>; template<size_t I, class T> struct variant_alternative<I, const volatile T>;

3 Let VA denote variant_alternative<I, T> of the cv-unqualified type T. Then specializations of each of the two templates meet the Cpp17TransformationTrait requirements with a member typedef type that names the following type:
(3.1)
  • for the first specialization, add_volatile_t<VA​::​type>, and

(3.2)
  • for the second specialization, add_cv_t<VA​::​type>.

D.22 Deprecated iterator class template [depr.iterator]

1 The header <iterator> has the following addition: 🔗
namespace std {
  template<class Category, class T, class Distance = ptrdiff_t,
           class Pointer = T*, class Reference = T&>
  struct iterator {
    using iterator_category = Category;
    using value_type        = T;
    using difference_type   = Distance;
    using pointer           = Pointer;
    using reference         = Reference;
  };
}
2 The iterator template may be used as a base class to ease the definition of required types for new iterators.
3 NoteIf the new iterator type is a class template, then these aliases will not be visible from within the iterator class's template definition, but only to callers of that class.
4
Example If a C++ program wants to define a bidirectional iterator for some data structure containing double and such that it works on a large memory model of the implementation, it can do so with:
class MyIterator :
  public iterator<bidirectional_iterator_tag, double, long, T*, T&> {
  // code implementing ++, etc.
};

D.23 Deprecated move_iterator access [depr.move.iter.elem]

1 The following member is declared in addition to those members specified in [move.iter.elem]:
namespace std {
  template<class Iterator>
  class move_iterator {
  public:
    constexpr pointer operator->() const;
  };
}
🔗constexpr pointer operator->() const;
2 Returns: current.

D.24 Deprecated shared_ptr atomic access [depr.util.smartptr.shared.atomic]

1 The header <memory> has the following additions: 🔗
namespace std {
  template<class T>
    bool atomic_is_lock_free(const shared_ptr<T>* p);

  template<class T>
    shared_ptr<T> atomic_load(const shared_ptr<T>* p);
  template<class T>
    shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo);

  template<class T>
    void atomic_store(shared_ptr<T>* p, shared_ptr<T> r);
  template<class T>
    void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);

  template<class T>
    shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r);
  template<class T>
    shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);

  template<class T>
    bool atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
  template<class T>
    bool atomic_compare_exchange_strong(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
  template<class T>
    bool atomic_compare_exchange_weak_explicit(
      shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
      memory_order success, memory_order failure);
  template<class T>
    bool atomic_compare_exchange_strong_explicit(
      shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
      memory_order success, memory_order failure);
}
2 Concurrent access to a shared_ptr object from multiple threads does not introduce a data race if the access is done exclusively via the functions in this subclause and the instance is passed as their first argument.
3 The meaning of the arguments of type memory_order is explained in [atomics.order].
🔗template<class T> bool atomic_is_lock_free(const shared_ptr<T>* p);
4 Requires: p shall not be null.
5 Returns: true if atomic access to *p is lock-free, false otherwise.
6 Throws: Nothing.
🔗template<class T> shared_ptr<T> atomic_load(const shared_ptr<T>* p);
7 Requires: p shall not be null.
8 Returns: atomic_load_explicit(p, memory_order​::​seq_cst).
9 Throws: Nothing.
🔗template<class T> shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo);
10 Requires: p shall not be null.
11 Requires: mo shall not be memory_order​::​release or memory_order​::​acq_rel.
12 Returns: *p.
13 Throws: Nothing.
🔗template<class T> void atomic_store(shared_ptr<T>* p, shared_ptr<T> r);
14 Requires: p shall not be null.
15 Effects: As if by atomic_store_explicit(p, r, memory_order​::​seq_cst).
16 Throws: Nothing.
🔗template<class T> void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
17 Requires: p shall not be null.
18 Requires: mo shall not be memory_order​::​acquire or memory_order​::​acq_rel.
19 Effects: As if by p->swap(r).
20 Throws: Nothing.
🔗template<class T> shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r);
21 Requires: p shall not be null.
22 Returns: atomic_exchange_explicit(p, r, memory_order​::​seq_cst).
23 Throws: Nothing.
🔗template<class T> shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
24 Requires: p shall not be null.
25 Effects: As if by p->swap(r).
26 Returns: The previous value of *p.
27 Throws: Nothing.
🔗template<class T> bool atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
28 Requires: p shall not be null and v shall not be null.
29 Returns:
atomic_compare_exchange_weak_explicit(p, v, w, memory_order::seq_cst, memory_order::seq_cst)
30 Throws: Nothing.
🔗template<class T> bool atomic_compare_exchange_strong(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
31 Returns:
atomic_compare_exchange_strong_explicit(p, v, w, memory_order::seq_cst,
                                        memory_order::seq_cst)
🔗template<class T>

bool atomic_compare_exchange_weak_explicit( shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w, memory_order success, memory_order failure); template<class T>

bool atomic_compare_exchange_strong_explicit( shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w, memory_order success, memory_order failure);
32 Requires: p shall not be null and v shall not be null. The failure argument shall not be memory_order​::​release nor memory_order​::​acq_rel.
33 Effects: If *p is equivalent to *v, assigns w to *p and has synchronization semantics corresponding to the value of success, otherwise assigns *p to *v and has synchronization semantics corresponding to the value of failure.
34 Returns: true if *p was equivalent to *v, false otherwise.
35 Throws: Nothing.
36 Remarks: Two shared_ptr objects are equivalent if they store the same pointer value and share ownership. The weak form may fail spuriously. See [atomics.types.operations].

D.25 Deprecated basic_string capacity [depr.string.capacity]

1 The following member is declared in addition to those members specified in [string.capacity]: 🔗
namespace std {
  template<class charT, class traits = char_traits<charT>,
           class Allocator = allocator<charT>>
  class basic_string {
  public:
    void reserve();
  };
}
🔗void reserve();
2 Effects: After this call, capacity() has an unspecified value greater than or equal to size().

NoteThis is a non-binding shrink to fit request.

D.26 Deprecated standard code conversion facets [depr.locale.stdcvt]

D.26.1 General [depr.locale.stdcvt.general]

1 The header <codecvt> provides code conversion facets for various character encodings.

D.26.2 Header <codecvt> synopsis [depr.codecvt.syn]

🔗
namespace std {
  enum codecvt_mode {
    consume_header = 4,
    generate_header = 2,
    little_endian = 1
  };

  template<class Elem, unsigned long Maxcode = 0x10ffff, codecvt_mode Mode = (codecvt_mode)0>
    class codecvt_utf8 : public codecvt<Elem, char, mbstate_t> {
    public:
      explicit codecvt_utf8(size_t refs = 0);
      ~codecvt_utf8();
    };

  template<class Elem, unsigned long Maxcode = 0x10ffff, codecvt_mode Mode = (codecvt_mode)0>
    class codecvt_utf16 : public codecvt<Elem, char, mbstate_t> {
    public:
      explicit codecvt_utf16(size_t refs = 0);
      ~codecvt_utf16();
    };

  template<class Elem, unsigned long Maxcode = 0x10ffff, codecvt_mode Mode = (codecvt_mode)0>
    class codecvt_utf8_utf16 : public codecvt<Elem, char, mbstate_t> {
    public:
      explicit codecvt_utf8_utf16(size_t refs = 0);
      ~codecvt_utf8_utf16();
    };
}

D.26.3 Requirements [depr.locale.stdcvt.req]

1 For each of the three code conversion facets codecvt_utf8, codecvt_utf16, and codecvt_utf8_utf16:
(1.1)
  • Elem is the wide-character type, such as wchar_t, char16_t, or char32_t.

(1.2)
  • Maxcode is the largest wide-character code that the facet will read or write without reporting a conversion error.

(1.3)
  • If (Mode & consume_header), the facet shall consume an initial header sequence, if present, when reading a multibyte sequence to determine the endianness of the subsequent multibyte sequence to be read.

(1.4)
  • If (Mode & generate_header), the facet shall generate an initial header sequence when writing a multibyte sequence to advertise the endianness of the subsequent multibyte sequence to be written.

(1.5)
  • If (Mode & little_endian), the facet shall generate a multibyte sequence in little-endian order, as opposed to the default big-endian order.

(1.6)
  • UCS-2 is the same encoding as UTF-16, except that it encodes scalar values in the range U+0000–U+ffff (Basic Multilingual Plane) only.

2 For the facet codecvt_utf8:
(2.1)
  • The facet shall convert between UTF-8 multibyte sequences and UCS-2 or UTF-32 (depending on the size of Elem).

(2.2)
  • Endianness shall not affect how multibyte sequences are read or written.

(2.3)
  • The multibyte sequences may be written as either a text or a binary file.

3 For the facet codecvt_utf16:
(3.1)
  • The facet shall convert between UTF-16 multibyte sequences and UCS-2 or UTF-32 (depending on the size of Elem).

(3.2)
  • Multibyte sequences shall be read or written according to the Mode flag, as set out above.

(3.3)
  • The multibyte sequences may be written only as a binary file. Attempting to write to a text file produces undefined behavior.

4 For the facet codecvt_utf8_utf16:
(4.1)
  • The facet shall convert between UTF-8 multibyte sequences and UTF-16 (one or two 16-bit codes) within the program.

(4.2)
  • Endianness shall not affect how multibyte sequences are read or written.

(4.3)
  • The multibyte sequences may be written as either a text or a binary file.

D.27 Deprecated convenience conversion interfaces [depr.conversions]

D.27.1 General [depr.conversions.general]

1 The header <locale> has the following additions:
namespace std {
  template<class Codecvt, class Elem = wchar_t,
           class WideAlloc = allocator<Elem>,
           class ByteAlloc = allocator<char>>
    class wstring_convert;

  template<class Codecvt, class Elem = wchar_t,
           class Tr = char_traits<Elem>>
    class wbuffer_convert;
}

D.27.2 Class template wstring_convert [depr.conversions.string]

1 Class template wstring_convert performs conversions between a wide string and a byte string. It lets you specify a code conversion facet (like class template codecvt) to perform the conversions, without affecting any streams or locales.
Example If you want to use the code conversion facet codecvt_utf8 to output to cout a UTF-8 multibyte sequence corresponding to a wide string, but you don't want to alter the locale for cout, you can write something like:
wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
std::string mbstring = myconv.to_bytes(L"Hello\n");
std::cout << mbstring;
🔗
namespace std {
  template<class Codecvt, class Elem = wchar_t,
           class WideAlloc = allocator<Elem>,
           class ByteAlloc = allocator<char>>
    class wstring_convert {
    public:
      using byte_string = basic_string<char, char_traits<char>, ByteAlloc>;
      using wide_string = basic_string<Elem, char_traits<Elem>, WideAlloc>;
      using state_type  = typename Codecvt::state_type;
      using int_type    = typename wide_string::traits_type::int_type;

      wstring_convert() : wstring_convert(new Codecvt) {}
      explicit wstring_convert(Codecvt* pcvt);
      wstring_convert(Codecvt* pcvt, state_type state);
      explicit wstring_convert(const byte_string& byte_err,
                               const wide_string& wide_err = wide_string());
      ~wstring_convert();

      wstring_convert(const wstring_convert&) = delete;
      wstring_convert& operator=(const wstring_convert&) = delete;

      wide_string from_bytes(char byte);
      wide_string from_bytes(const char* ptr);
      wide_string from_bytes(const byte_string& str);
      wide_string from_bytes(const char* first, const char* last);

      byte_string to_bytes(Elem wchar);
      byte_string to_bytes(const Elem* wptr);
      byte_string to_bytes(const wide_string& wstr);
      byte_string to_bytes(const Elem* first, const Elem* last);

      size_t converted() const noexcept;
      state_type state() const;

    private:
      byte_string byte_err_string;  // exposition only
      wide_string wide_err_string;  // exposition only
      Codecvt* cvtptr;              // exposition only
      state_type cvtstate;          // exposition only
      size_t cvtcount;              // exposition only
    };
}
2 The class template describes an object that controls conversions between wide string objects of class basic_string<Elem, char_traits<Elem>, WideAlloc> and byte string objects of class basic_string<char, char_traits<char>, ByteAlloc>. The class template defines the types wide_string and byte_string as synonyms for these two types. Conversion between a sequence of Elem values (stored in a wide_string object) and multibyte sequences (stored in a byte_string object) is performed by an object of class Codecvt, which meets the requirements of the standard code-conversion facet codecvt<Elem, char, mbstate_t>.
3 An object of this class template stores:
(3.1)
  • byte_err_string — a byte string to display on errors

(3.2)
  • wide_err_string — a wide string to display on errors

(3.3)
  • cvtptr — a pointer to the allocated conversion object (which is freed when the wstring_convert object is destroyed)

(3.4)
  • cvtstate — a conversion state object

(3.5)
  • cvtcount — a conversion count

    🔗size_t converted() const noexcept;
4 Returns: cvtcount.
🔗wide_string from_bytes(char byte); wide_string from_bytes(const char* ptr); wide_string from_bytes(const byte_string& str); wide_string from_bytes(const char* first, const char* last);
5 Effects: The first member function shall convert the single-element sequence byte to a wide string. The second member function shall convert the null-terminated sequence beginning at ptr to a wide string. The third member function shall convert the sequence stored in str to a wide string. The fourth member function shall convert the sequence defined by the range [first, last) to a wide string.
6 In all cases:
(6.1)
  • If the cvtstate object was not constructed with an explicit value, it shall be set to its default value (the initial conversion state) before the conversion begins. Otherwise it shall be left unchanged.

(6.2)
  • The number of input elements successfully converted shall be stored in cvtcount.

7 Returns: If no conversion error occurs, the member function shall return the converted wide string. Otherwise, if the object was constructed with a wide-error string, the member function shall return the wide-error string. Otherwise, the member function throws an object of class range_error.
🔗state_type state() const;
8 Returns: cvtstate.
🔗byte_string to_bytes(Elem wchar); byte_string to_bytes(const Elem* wptr); byte_string to_bytes(const wide_string& wstr); byte_string to_bytes(const Elem* first, const Elem* last);
9 Effects: The first member function shall convert the single-element sequence wchar to a byte string. The second member function shall convert the null-terminated sequence beginning at wptr to a byte string. The third member function shall convert the sequence stored in wstr to a byte string. The fourth member function shall convert the sequence defined by the range [first, last) to a byte string.
10 In all cases:
(10.1)
  • If the cvtstate object was not constructed with an explicit value, it shall be set to its default value (the initial conversion state) before the conversion begins. Otherwise it shall be left unchanged.

(10.2)
  • The number of input elements successfully converted shall be stored in cvtcount.

11 Returns: If no conversion error occurs, the member function shall return the converted byte string. Otherwise, if the object was constructed with a byte-error string, the member function shall return the byte-error string. Otherwise, the member function shall throw an object of class range_error.
🔗explicit wstring_convert(Codecvt* pcvt); wstring_convert(Codecvt* pcvt, state_type state); explicit wstring_convert(const byte_string& byte_err, const wide_string& wide_err = wide_string());
12 Requires: For the first and second constructors, pcvt != nullptr.
13 Effects: The first constructor shall store pcvt in cvtptr and default values in cvtstate, byte_err_string, and wide_err_string. The second constructor shall store pcvt in cvtptr, state in cvtstate, and default values in byte_err_string and wide_err_string; moreover the stored state shall be retained between calls to from_bytes and to_bytes. The third constructor shall store new Codecvt in cvtptr, state_type() in cvtstate, byte_err in byte_err_string, and wide_err in wide_err_string.
🔗~wstring_convert();
14 Effects: The destructor shall delete cvtptr.

D.27.3 Class template wbuffer_convert [depr.conversions.buffer]

1 Class template wbuffer_convert looks like a wide stream buffer, but performs all its I/O through an underlying byte stream buffer that you specify when you construct it. Like class template wstring_convert, it lets you specify a code conversion facet to perform the conversions, without affecting any streams or locales. 🔗
namespace std {
  template<class Codecvt, class Elem = wchar_t, class Tr = char_traits<Elem>>
    class wbuffer_convert : public basic_streambuf<Elem, Tr> {
    public:
      using state_type = typename Codecvt::state_type;

      wbuffer_convert() : wbuffer_convert(nullptr) {}
      explicit wbuffer_convert(streambuf* bytebuf,
                               Codecvt* pcvt = new Codecvt,
                               state_type state = state_type());

      ~wbuffer_convert();

      wbuffer_convert(const wbuffer_convert&) = delete;
      wbuffer_convert& operator=(const wbuffer_convert&) = delete;

      streambuf* rdbuf() const;
      streambuf* rdbuf(streambuf* bytebuf);

      state_type state() const;

    private:
      streambuf* bufptr;            // exposition only
      Codecvt* cvtptr;              // exposition only
      state_type cvtstate;          // exposition only
  };
}
2 The class template describes a stream buffer that controls the transmission of elements of type Elem, whose character traits are described by the class Tr, to and from a byte stream buffer of type streambuf. Conversion between a sequence of Elem values and multibyte sequences is performed by an object of class Codecvt, which shall meet the requirements of the standard code-conversion facet codecvt<Elem, char, mbstate_t>.
3 An object of this class template stores:
(3.1)
  • bufptr — a pointer to its underlying byte stream buffer

(3.2)
  • cvtptr — a pointer to the allocated conversion object (which is freed when the wbuffer_convert object is destroyed)

(3.3)
  • cvtstate — a conversion state object

    🔗state_type state() const;
4 Returns: cvtstate.
🔗streambuf* rdbuf() const;
5 Returns: bufptr.
🔗streambuf* rdbuf(streambuf* bytebuf);
6 Effects: Stores bytebuf in bufptr.
7 Returns: The previous value of bufptr.
🔗explicit wbuffer_convert( streambuf* bytebuf, Codecvt* pcvt = new Codecvt, state_type state = state_type());
8 Requires: pcvt != nullptr.
9 Effects: The constructor constructs a stream buffer object, initializes bufptr to bytebuf, initializes cvtptr to pcvt, and initializes cvtstate to state.
🔗~wbuffer_convert();
10 Effects: The destructor shall delete cvtptr.

D.28 Deprecated locale category facets [depr.locale.category]

1 The ctype locale category includes the following facets as if they were specified in table Table 104 of [locale.category].
codecvt<char16_t, char, mbstate_t>
codecvt<char32_t, char, mbstate_t>
2 The ctype locale category includes the following facets as if they were specified in table Table 105 of [locale.category].
codecvt_byname<char16_t, char, mbstate_t>
codecvt_byname<char32_t, char, mbstate_t>
3 The following class template specializations are required in addition to those specified in [locale.codecvt]. The specialization codecvt<char16_t, char, mbstate_t> converts between the UTF-16 and UTF-8 encoding forms, and the specialization codecvt<char32_t, char, mbstate_t> converts between the UTF-32 and UTF-8 encoding forms.

D.29 Deprecated filesystem path factory functions [depr.fs.path.factory]

🔗template<class Source> path u8path(const Source& source); template<class InputIterator> path u8path(InputIterator first, InputIterator last);
1 Requires: The source and [first, last) sequences are UTF-8 encoded. The value type of Source and InputIterator is char or char8_t. Source meets the requirements specified in [fs.path.req].
2 Returns:
(2.1)
  • If value_type is char and the current native narrow encoding ([fs.path.type.cvt]) is UTF-8, return path(source) or path(first, last); otherwise,

(2.2)
  • if value_type is wchar_t and the native wide encoding is UTF-16, or if value_type is char16_t or char32_t, convert source or [first, last) to a temporary, tmp, of type string_type and return path(tmp); otherwise,

(2.3)
  • convert source or [first, last) to a temporary, tmp, of type u32string and return path(tmp).

3 Remarks: Argument format conversion ([fs.path.fmt.cvt]) applies to the arguments for these functions. How Unicode encoding conversions are performed is unspecified.
4
Example A string is to be read from a database that is encoded in UTF-8, and used to create a directory using the native encoding for filenames:
namespace fs = std::filesystem;
std::string utf8_string = read_utf8_data();
fs::create_directory(fs::u8path(utf8_string));

For POSIX-based operating systems with the native narrow encoding set to UTF-8, no encoding or type conversion occurs.

For POSIX-based operating systems with the native narrow encoding not set to UTF-8, a conversion to UTF-32 occurs, followed by a conversion to the current native narrow encoding. Some Unicode characters may have no native character set representation.

For Windows-based operating systems a conversion from UTF-8 to UTF-16 occurs.

NoteThe example above is representative of a historical use of filesystem​::​u8path. To indicate a UTF-8 encoding, passing a std​::​u8string to path's constructor is preferred as it is consistent with path's handling of other encodings.

D.30 Deprecated atomic operations [depr.atomics]

D.30.1 General [depr.atomics.general]

1 The header <atomic> has the following additions.
namespace std {
  template<class T>
    void atomic_init(volatile atomic<T>*, typename atomic<T>::value_type) noexcept;
  template<class T>
    void atomic_init(atomic<T>*, typename atomic<T>::value_type) noexcept;

  #define ATOMIC_VAR_INIT(value) see below
}

D.30.2 Volatile access [depr.atomics.volatile]

1 If an atomic ([atomics.types.generic]) specialization has one of the following overloads, then that overload participates in overload resolution even if atomic<T>​::​is_always_lock_free is false:
void store(T desired, memory_order order = memory_order::seq_cst) volatile noexcept;
T operator=(T desired) volatile noexcept;
T load(memory_order order = memory_order::seq_cst) const volatile noexcept;
operator T() const volatile noexcept;
T exchange(T desired, memory_order order = memory_order::seq_cst) volatile noexcept;
bool compare_exchange_weak(T& expected, T desired,
                           memory_order success, memory_order failure) volatile noexcept;
bool compare_exchange_strong(T& expected, T desired,
                             memory_order success, memory_order failure) volatile noexcept;
bool compare_exchange_weak(T& expected, T desired,
                           memory_order order = memory_order::seq_cst) volatile noexcept;
bool compare_exchange_strong(T& expected, T desired,
                             memory_order order = memory_order::seq_cst) volatile noexcept;
T fetch_key(T operand, memory_order order = memory_order::seq_cst) volatile noexcept;
T operator op=(T operand) volatile noexcept;
T* fetch_key(ptrdiff_t operand, memory_order order = memory_order::seq_cst) volatile noexcept;

D.30.3 Non-member functions [depr.atomics.nonmembers]

🔗template<class T>

void atomic_init(volatile atomic<T>* object, typename atomic<T>::value_type desired) noexcept; template<class T>

void atomic_init(atomic<T>* object, typename atomic<T>::value_type desired) noexcept;
1 Effects: Equivalent to: atomic_store_explicit(object, desired, memory_order​::​relaxed);

D.30.4 Operations on atomic types [depr.atomics.types.operations]

🔗#define ATOMIC_VAR_INIT(value) see below
1 The macro expands to a token sequence suitable for constant initialization of an atomic variable of static storage duration of a type that is initialization-compatible with value.

NoteThis operation possibly needs to initialize locks. Concurrent access to the variable being initialized, even via an atomic operation, constitutes a data race.

Example
atomic<int> v = ATOMIC_VAR_INIT(5);

  1. The function signature strlen(const char*) is declared in <cstring>. The macro INT_MAX is defined in <climits>.
  2. The function signature strlen(const char*) is declared in <cstring>.