Skip to main content
Commonmark migration
Source Link

Table 101 — Optional sequence container operations

 

Expression: a.emplace_back(args)

 

Return type: void

 

Operational semantics:
Appends an object of type T constructed with std::forward<Args>(args)....

Requires: T shall be EmplaceConstructible into X from args. For vector, T shall also be MoveInsertable into X.

§ 23.2.1.13

 

— T is EmplaceConstructible into X from args, for zero or more arguments args, means that the following expression is well-formed:

 

allocator_traits<A>::construct(m, p, args);

Table 101 — Optional sequence container operations

 

Expression: a.emplace_back(args)

 

Return type: void

 

Operational semantics:
Appends an object of type T constructed with std::forward<Args>(args)....

Requires: T shall be EmplaceConstructible into X from args. For vector, T shall also be MoveInsertable into X.

§ 23.2.1.13

 

— T is EmplaceConstructible into X from args, for zero or more arguments args, means that the following expression is well-formed:

 

allocator_traits<A>::construct(m, p, args);

Table 101 — Optional sequence container operations

Expression: a.emplace_back(args)

Return type: void

Operational semantics:
Appends an object of type T constructed with std::forward<Args>(args)....

Requires: T shall be EmplaceConstructible into X from args. For vector, T shall also be MoveInsertable into X.

§ 23.2.1.13

— T is EmplaceConstructible into X from args, for zero or more arguments args, means that the following expression is well-formed:

allocator_traits<A>::construct(m, p, args);

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot
added 5 characters in body
Source Link
Mark Garcia
  • 17.6k
  • 4
  • 58
  • 95

v.emplace_back(41,42); does not work because of some rules in the standard (emphasissome emphasis mine):

U(std::forward<Args>(args)...) (take note of the use of direct initializationdirect initialization) will find a constructor of U which accepts the forwarded arguments. However, in your case, my_pair is an aggregate type, which can only be initialized with braced-initialization syntax (aggregate initialization).

v.emplace_back(41,42); does not work because of some rules in the standard (emphasis mine):

U(std::forward<Args>(args)...) (take note of the use of direct initialization) will find a constructor of U which accepts the forwarded arguments. However, in your case, my_pair is an aggregate type, which can only be initialized with braced-initialization syntax (aggregate initialization).

v.emplace_back(41,42); does not work because of some rules in the standard (some emphasis mine):

U(std::forward<Args>(args)...) (take note of the use of direct initialization) will find a constructor of U which accepts the forwarded arguments. However, in your case, my_pair is an aggregate type, which can only be initialized with braced-initialization syntax (aggregate initialization).

added 443 characters in body
Source Link
Mark Garcia
  • 17.6k
  • 4
  • 58
  • 95
Loading
Source Link
Mark Garcia
  • 17.6k
  • 4
  • 58
  • 95
Loading